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.

Expect argument "nodes["_N"]" to have data type torch.int32. But got torch.int64.

See original GitHub issue

🐛 Bug

To Reproduce

Steps to reproduce the behavior:

when i use SAGPool(200,ratio=0.8)(g,feats), error occurs.

DGLError: Expect argument “nodes[”_N"]" to have data type torch.int32. But got torch.int64.

And I think bug is in dgl/subgraph.py/node_subgraph().

Line 140:

        nodes = {graph.ntypes[0]: nodes}

I change that:

        nodes=torch.tensor(nodes,dtype=torch.int32)
        nodes = {graph.ntypes[0]: nodes}

and then it work

Expected behavior

Environment

  • DGL Version (e.g., 1.0): 0.82
  • Backend Library & Version (e.g., PyTorch 0.4.1, MXNet/Gluon 1.3): pytorch
  • OS (e.g., Linux): windows
  • How you installed DGL (conda, pip, source): conda
  • Build command you used (if compiling from source):
  • Python version: 3.9
  • CUDA/cuDNN version (if applicable): 11
  • GPU models and configuration (e.g. V100):
  • Any other relevant information:

Additional context

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
wkmywscommented, Jun 16, 2022

I will do it after I finish my current work. 😃

0reactions
github-actions[bot]commented, Jul 24, 2022

This issue is closed due to lack of activity. Feel free to reopen it if you still have questions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Data type and device context throw error since update to DGL ...
DGLError : Expect argument "nodes["user"]" to have data type torch.int64 and device context cpu. But got torch.int64 and cuda:0.
Read more >
Tensor dtype for input batches to pytorch networks
ToTensor() to our dataloaders transformation, ToTensor() sets the datatype of input images X to torch.float32 and labels y to torch.int64. Is there a...
Read more >
DGL使用指南- 机器狗mo - 博客园
import dgl >>> import torch as th >>> # edges 0->1, 0->2, 0->3, ... 3])] # get features of edge 0 and 3...
Read more >
Python API: test/test_jit.py Source File - Caffe2
84 RUN_CUDA_MULTI_GPU = RUN_CUDA and torch.cuda.device_count() > 1 ... 220 raise RuntimeError("Can't get a grad_executor for a non-differentiable graph").
Read more >
RuntimeError: Expected object of scalar type Float but got ...
Likewise, when you get another error for loss = loss_fn(y_pred, ... I hope the issue came because your datatype is torch.float64 .
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