-
Hi everyone, I'm running into an issue where I have multiple large graphs that I wish to train on. As such, I have decided to use I have a bunch of Data objects in list that I wish to batch, which is symbolically like so: states_graph = [Data(x=[17217, 2], edge_index=[17217, 17217, nnz=19366912]), Data(x=[17217, 2], edge_index=[17217, 17217, nnz=19366912])] The I then create a batch from this list: batch = Batch.from_data_list(states_graph).to(device) # Batch of two graphs However, the resulting batch does not produce a square sparse matrix for the print(batch_state.edge_index)
# Output:
# SparseTensor(row=tensor([ 0, 0, 0, ..., 17215, 17215, 17215], device='cuda:0'),
# col=tensor([ 32, 33, 34, ..., 31166, 31167, 31168], device='cuda:0'),
# size=(17217, 34434), nnz=38733824, density=6.53%) (i.e. look at the If I run inference on this batch I get RuntimeError: The size of tensor a (17217) must match the size of tensor b (34434) at non-singleton dimension 0 However, if my batch size is 1, then inference raises no error, which indicates to me that the batching procedure messes with the SparseTensor's dimension. Is this a bug, or is this expected behavior? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
I fiddled with the Setting manually I will investigate deeper, though I would appreciate some input, if you have any. |
Beta Was this translation helpful? Give feedback.
-
Seems to be a PICNIC (Problem in Chair, Not in Computer) error... The way I created my data object stores the adjacency matrix in the edge_index key. Perhaps it would be a good idea to show how to create such objects in the documentation here? Looking at the reference for the |
Beta Was this translation helpful? Give feedback.
Seems to be a PICNIC (Problem in Chair, Not in Computer) error... The way I created my data object stores the adjacency matrix in the edge_index key.
Perhaps it would be a good idea to show how to create such objects in the documentation here?
Looking at the reference for the
torch_geometric.data.Data
class, it seems like theadj_t
attribute is concealed within the**kwargs
, which makes in a little bit unclear on how to proceed (e.g. I had assumed onlyedge_index
existed as a valid constructor attribute).