Problem with batchsize on edge_index #5974
-
Hi, i am working with GNN on images and have found a strange bug with edge_index. I can't store all dataset in memory, and because of it, I am working with Dataset class:
And i have next model initilization:
My train loop:
My GNN graph is static and i always have 896 nodes. And with batch size equal to 1 I have correct edge-index:
Now I have next problem, as soon as I set batch_size != 1 my code is crushed due to edge_index: RuntimeError: INDICES element is out of DATA bounds, id=1087 axis_dim=896 I found the problem after some debugging. For some reason, batch size increases edge_index values. For example, with batch_size equal to 2:
Because of it i can't work with batch size > 1. Can you please tell me where I went wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
This is intended. You should reshape your features to |
Beta Was this translation helpful? Give feedback.
This is intended. You should reshape your features to
x.view(batch_size * num_nodes, -1)
.