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

Data.update() fails with 'TypeError: 'list' object is not callable' #6502

Closed
j-mesnil opened this issue Jan 24, 2023 · 2 comments
Closed

Data.update() fails with 'TypeError: 'list' object is not callable' #6502

j-mesnil opened this issue Jan 24, 2023 · 2 comments
Labels

Comments

@j-mesnil
Copy link

🐛 Describe the bug

The data.Data.update() method fails in the following minimal example.

import torch
from torch_geometric.data import Data

x1 = torch.Tensor([[1.0, 0.0]])
x2 = torch.Tensor([[0.0, 1.0]])
d1 = Data(x=x1)
d2 = Data(x=x2)
d2.update(d1)

The following exception is thrown:

Traceback (most recent call last):
  File "(/path/to/minimal_example.py)", line 8, in <module>
    d2.update(d1)
  File "/usr/lib/python3.8/_collections_abc.py", line 834, in update
    for key in other.keys():
TypeError: 'list' object is not callable

The update method in _collections_abc.py will run

elif hasattr(other, "keys"):
    for key in other.keys():
        self[key] = other[key]

The Data class from PyG has a list of keys keys, so the call to other.keys() fails here.

Environment

  • PyG version: 2.2.0
  • PyTorch version: 1.12.1+cu113
  • OS: Linux
  • Python version: 3.8
  • CUDA/cuDNN version: 11.1
  • How you installed PyTorch and PyG (conda, pip, source): pip
  • Any other relevant information (e.g., version of torch-scatter):
@j-mesnil j-mesnil added the bug label Jan 24, 2023
@rusty1s
Copy link
Member

rusty1s commented Jan 24, 2023

We just recently added support for Data.update(), see #6313. Should be fixed in PyG master and upcoming releases.

@j-mesnil
Copy link
Author

I see, thanks!

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

No branches or pull requests

2 participants