GEDDataset num_classes request leads to AttributeError
See original GitHub issue🐛 Bug
When loaded a GEDDataset and querying the num_classes as descriped in the tutorial (dataset.num_classes
) an AttributeError: 'NoneType' object has no attribute 'dim'
-error is thrown.
To Reproduce
Steps to reproduce the behavior:
- Load the IMDBMulti dataset with GEDDataset
- Ask the num_classes.
Code for reproducing error:
from torch_geometric.datasets import GEDDataset
dataset = GEDDataset(root='/datasets/IMDBMulti', name="IMDBMulti")
print(dataset.num_classes)
Expected behavior
I would have expected a return of the number of classes: 3.
Environment
- OS: Ubuntu 18.04 in Docker
- Python version: 3.6.5
- PyTorch version: 1.4.0
- CUDA/cuDNN version: 10.1.243 / 7.6.5.32
- GCC version: 7.5.0
- Any other relevant information: Basis of our Dockerfile is from your provided dockerfile.
Additional context
I noticed that in the examples, the ground truth is saved in the key 'y'
.
data = dataset[0]
data.keys()
would return something like ['edge_index', 'y']
The GEDDataset returns
['edge_index', 'i']
.
Also tested with the ALKANE
dataset, same problem.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
GEDDataset num_classes request leads to AttributeError #1156
When loaded a GEDDataset and querying the num_classes as descriped in the tutorial ( dataset.num_classes ) an AttributeError: 'NoneType' object ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The i refers to the index of the graph in the dataset, so that you can access the GED between two pairs of graphs via dataset.ged[data1.i, data2.i]. I think we should mention this in the documentation.
You can access them via
data.x
.