question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
EdisonLeeeeecommented, Sep 11, 2022

Thank you for making it clear. I get your point now. Previously, data.num_graphs is calculated by batch.max() + 1, which would lead to a wrong result if batch was overridden in the sampler (e.g., passing a Barch object).

Now I think data.num_graphs would return a correct result even passing a Batch object after the fix in PR. I’ve tested the example/shadow.py example with your case, and it works fine – data.num_graphs always equals out.size(0).

0reactions
cvaneacommented, Sep 11, 2022

Thanks very much! I’m closing the Issue then 😃

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found