I only have one graph which is have a feature matrix with n-cols and d-rows in one batch so that I don't know how should I set parameter 'batch' in this case?
global_max_pool(x, batch, size=None)
I don't know how to set the 'batch' in this case
Looking forward to your reply,thank you very mach!
x.max(dim=0) or set batch via batch = x.new_zeros(x.size(0), dtype=torch.long)
x.max(dim=0)or setbatchviabatch = x.new_zeros(x.size(0), dtype=torch.long)
Impressive!
Thank you for such a quick respond!
I have anthor question.
In every batch,I have N graphs that means I have a (N * n) * d matrix(every graph have n nodes,but n is different between every graph).I want make the dimension of every graph form n * d become
(n * d) * 1,
final,the matrix of batch(N graphs)'s dimension become N * (n * d).
I want use torch.bincount and torch.split the matrix,but I think the method is too slow.
Do have anthor methods?
Looking forward to your reply,thank you very mach!
That's what torch_geometric.utils.to_dense_batch is doing :)
That's what
torch_geometric.utils.to_dense_batchis doing :)
OK, I'll try it later.
Finall, I want to ask why the parameter 'batch' can set like you told me ? I don't know the reason.
For each node, batch holds the index of the graph the node belongs to. Since you only have a single graph, setting batch to zero assigns all nodes to the same graph (with index 0).
For each node,
batchholds the index of the graph the node belongs to. Since you only have a single graph, settingbatchtozeroassigns all nodes to the same graph (with index0).
I'm flattered that you're reply so quickly.
Thank you and I wish you a happy life