benedekrozemberczki / pytorch_geometric_temporal

PyTorch Geometric Temporal: Spatiotemporal Signal Processing with Neural Machine Learning Models (CIKM 2021)
MIT License
2.61k stars 367 forks source link

Unhashable type Data #226

Closed JavaStudentAlex closed 1 year ago

JavaStudentAlex commented 1 year ago

I am using the 0.54 version of the pytorch geometric temporal. In example code file examples/recurrent/a3tgcn2_example.py there is such snippet of code:

from torch_geometric_temporal.dataset import METRLADatasetLoader
loader = METRLADatasetLoader()
dataset = loader.get_dataset(num_timesteps_in=12, num_timesteps_out=12)
print("Dataset type:  ", dataset)
print("Number of samples / sequences: ",  len(set(dataset)))

When I try to run the code I get the error:

TypeError                                 Traceback (most recent call last)
Cell In[22], line 4
      2 dataset = loader.get_dataset(num_timesteps_in=12, num_timesteps_out=12)
      3 print("Dataset type:  ", dataset)
----> 4 print("Number of samples [/](https://file+.vscode-resource.vscode-cdn.net/) sequences: ",  len(set(dataset)))

TypeError: unhashable type: 'Data'

As far as I got we would like to see the number of time snapshots. I would offer to use dataset.snapshot_count instead.