How to add attributes to subgraphs #4696
Unanswered
zhinanchezhoubo
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Any def my_transform(data):
data.node_label = torch.tensor(1)
return data
dataset = TUDataset(..., transform=my_transform)
print(dataset[0].node_label) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
for example, I want to add properties to each subgraph,
But the following error is reported:
KeyError: 'node_label'
During handling of the above exception, another exception occurred:
AttributeError Traceback (most recent call last)
/usr/local/lib/python3.7/dist-packages/torch_geometric/data/storage.py in getattr(self, key)
62 except KeyError:
63 raise AttributeError(
---> 64 f"'{self.class.name}' object has no attribute '{key}'")
65
66 def setattr(self, key: str, value: Any):
AttributeError: 'GlobalStorage' object has no attribute 'node_label'
Beta Was this translation helpful? Give feedback.
All reactions