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:
- Created a year ago
- Comments:6 (2 by maintainers)
Top 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 >
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 Free
Top 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
I will do it after I finish my current work. 😃
This issue is closed due to lack of activity. Feel free to reopen it if you still have questions.