Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError #19

Open
fatemehghanadi opened this issue Oct 24, 2023 · 2 comments
Open

IndexError #19

fatemehghanadi opened this issue Oct 24, 2023 · 2 comments

Comments

@fatemehghanadi
Copy link

fatemehghanadi commented Oct 24, 2023

Hello. when i run this code on cuda environment this error happend. would you please help me fixing it?
python -m examples.example_main --dataset_name ABIDE --pooling concat --gcn_mp_type edge_node_concate --hidden_dim 256


(base) C:\Users\Tandi\Downloads\BrainGB>python -m examples.example_main --dataset_name ABIDE --pooling concat --gcn_mp_type edge_node_concate --hidden_dim 256
Processing...
Done!
seed for seed_everything(): 767955
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Tandi\Downloads\BrainGB\examples\example_main.py", line 149, in <module>
    main(parser.parse_args())
  File "C:\Users\Tandi\Downloads\BrainGB\examples\example_main.py", line 69, in main
    train_set, test_set = dataset[train_index], dataset[test_index]
                          ~~~~~~~^^^^^^^^^^^^^
  File "C:\Users\Tandi\anaconda3\Lib\site-packages\torch_geometric\data\dataset.py", line 268, in __getitem__
    return self.index_select(idx)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\Tandi\anaconda3\Lib\site-packages\torch_geometric\data\dataset.py", line 306, in index_select
    raise IndexError(
IndexError: Only slices (':'), list, tuples, torch.tensor and np.ndarray of dtype long or bool are valid indices (got 'ndarray')
@fatemehghanadi fatemehghanadi changed the title Runtime Error AttributeError Oct 25, 2023
@fatemehghanadi fatemehghanadi changed the title AttributeError IndexError Oct 28, 2023
@GiDunPar
Copy link

In ndarray, you need to change it to int64. You can modify the data type yourself. I hope it will be helpful to you.

@Gemaxis
Copy link

Gemaxis commented Jun 11, 2024

One simple way: train_set, test_set = dataset[train_index.tolist()], dataset[test_index.tolist()]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants