-
Thank you for the amazing library! I am a student and needed some help in implementing one of my ideas.
Questions:
I really appreciate any help you can provide. |
Beta Was this translation helpful? Give feedback.
Answered by
rusty1s
Apr 22, 2022
Replies: 1 comment 1 reply
-
Instead of saving numerical node features in from itertools import chain
from torch_geometric.data import Data
from torch_geometric.loader import DataLoader
data = Data(sentence=['node1', 'node2', 'node3'], num_nodes=3)
loader = DataLoader([data, data, data], batch_size=3)
batch = next(iter(loader))
print(batch)
print(batch.sentence)
print(list(chain(*batch.sentence)))
You should be able to input that input a BERT/Transformer model to obtain a feature vector per node, while PyG batching stays fully intact. Let me know if this helps you! |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
piyush-J
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Instead of saving numerical node features in
data.x
as a PyTorch Tensor, you should be able to simply assign each node astr
attribute:Yo…