torch.long and torch.int64
See original GitHub issue🐛 Bug
torch.long and torch.int64 should be equivalent according to the pytorch documentation, however, the following error message shows.
`` ValueError: MessagePassing.propagate
only supports torch.LongTensor
of shape [2, num_messages]
or torch_sparse.SparseTensor
for argument edge_index
.
Expected behavior
I am not sure if I am creating the tensor wrongly or the dtype check did not include torch.int64.
I had tried changing the dtype by using .to(torch.long) but the dtypes stays at torch.int64
Environment
- OS: wsl ubuntu
- Python version: 3.9
- PyTorch version: 1.9
- CUDA/cuDNN version:
- GCC version:
- Any other relevant information:
Additional context
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
PyTorch tensor declared as torch.long becomes torch.int64
From the the documentation we can see that torch.long and torch.int64 are synonymous and both refer to the 64-bit signed integer type.
Read more >torch.Tensor — PyTorch 1.13 documentation
Data types ; 64-bit integer (signed). torch.int64 or torch.long. torch.LongTensor ; Boolean. torch.bool. torch.BoolTensor ; quantized 8-bit integer (unsigned).
Read more >torch.Tensor — PyTorch master documentation
A torch.Tensor is a multi-dimensional matrix containing elements of a single data type. Torch defines eight CPU tensor types and eight GPU tensor...
Read more >How to typecast a float tensor to integer tensor and vice ...
This is achieved by using .type(torch.int64) which will return the integer type values, even if the values are in float or in some...
Read more >torch.Tensor — PyTorch master documentation
torch.int32 or torch.int. torch.IntTensor. torch.cuda.IntTensor. 64-bit integer (signed). torch.int64 or torch.long. torch.LongTensor. torch.cuda.LongTensor.
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
All GNN layers need a valid
edge_index
to propagate information. You can define an emptyedge_index
matrix viaNote that this matrix is still two-dimensional despite having zero elements, i.e it has shape
[2, 0]
.Hi @rusty1s , thanks for the framework! I was trying to learn in a situation when there are no edges and and there are only nodes, so either I pass a empty tensor or pass None for edge index, when I do that I run into the above error, but according to the documentation here, it states that these attributes are not required, could you please help me out here?