ShaDowKHopSampler creates incorrect data.batch when using Batch graph
See original GitHub issue🐛 Describe the bug
Hello! Firstly, thank you for this fantastic library.
I am trying to run various scalable GNNs on custom data but I am having an issue with shaDow.
On this line in the shaDow model definition (as per the example):
x = torch.cat([x[root_n_id], global_mean_pool(x, batch)], dim=-1)
This error is thrown:
RuntimeError: Sizes of tensors must match except in dimension 1. Expected size 1024 but got size 1 for tensor number 1 in the list.
Where 1024 is the batch size.
I’ve found this is only a problem when the graph dataset is composed into a disjointed Batch
graph.
To reproduce the problem, run the code from examples/shadow.py
but change the data object into a Batch
object:
from torch_geometric.data import Batch
dataset = Flickr(path)
datas = [dataset[0]]
data = Batch.from_data_list(datas)
Thank you for any help!
Environment
- PyG version: 2.1.0.post1
- PyTorch version: 1.11.0+cu113
- OS: Ubuntu 20.04.2 (WSL) and macOS 11.1
- Python version: 3.7.2
- CUDA/cuDNN version: 11.3
- How you installed PyTorch and PyG (
conda
,pip
, source): pip - Any other relevant information (e.g., version of
torch-scatter
):
Issue Analytics
- State:
- Created a year ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
torch_geometric.loader.shadow - PyTorch Geometric
Given a graph in a :obj:`data` object, the sampler will create shallow, ... optional): The nodes that should be considered for creating mini-batches....
Read more >Batch limit incorrect · Issue #4366 · microsoftgraph ... - GitHub
It is either a problem with the documentation or a bug in the graph api. I would also specify the limits (either 15...
Read more >Known issues with Microsoft Graph
This article describes known issues and limitations with Microsoft Graph and provides workarounds when possible.
Read more >Malformed JSON in Batch when getting Unified Group images
I'm pretty sure this is a bug in Microsoft Graph batch because response data is not correctly formatted JSON. Tried to add progressive...
Read more >v0.8 Release Highlights - Deep Graph Library
In training Neural Networks, minibatch sampling has been used to both ... CUDA UVA allows users to create in-memory data beyond the size...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you for making it clear. I get your point now. Previously,
data.num_graphs
is calculated bybatch.max() + 1
, which would lead to a wrong result ifbatch
was overridden in the sampler (e.g., passing aBarch
object).Now I think
data.num_graphs
would return a correct result even passing aBatch
object after the fix in PR. I’ve tested theexample/shadow.py
example with your case, and it works fine –data.num_graphs
always equalsout.size(0)
.Thanks very much! I’m closing the Issue then 😃