【发布时间】:2021-04-27 17:03:02
【问题描述】:
我是 PyTorch 的新手,所以我对 PyTorch 张量的工作并不多。我感到困惑的是,如果我将张量的 dytpe 声明为torch.long,然后检查它的 dtype 是int64。例如:
In [62]: a = torch.tensor([[0, 1, 1, 2],
[1, 0, 2, 1]], dtype=torch.long)
a.dtype
Out[62]: torch.int64
我可能犯了一些愚蠢的错误。
为什么会这样?
编辑:
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
在我的情况下,a 是 edge_index。
【问题讨论】: