ABCCHEM
ABCCHEM

Reputation: 35

PyTorch tensor declared as torch.long becomes torch.int64

I am new to PyTorch so I haven't worked a lot with PyTorch Tensors. Something I am puzzled about is if I declare the dytpe of a tensor as torch.long, and then check the dtype it is int64. For example:

In [62]: a = torch.tensor([[0, 1, 1, 2],
                       [1, 0, 2, 1]], dtype=torch.long)
         a.dtype

Out[62]: torch.int64

I am probably making some silly mistake.

Why is this happening?

Edit:

     89         if isinstance(edge_index, Tensor):
---> 90             assert edge_index.dtype == torch.long
     91             assert edge_index.dim() == 2
     92             assert edge_index.size(0) == 2

In my case a is edge_index.

Upvotes: 2

Views: 8100

Answers (1)

jodag
jodag

Reputation: 22214

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.

Upvotes: 5

Related Questions