小编Rub*_*ben的帖子

如何在Pytorch中将1-d IntTensor转换为int

我得到了一维IntTensor,但我想将其转换为整数。我通过这种方法尝试:

print(dictionary[IntTensor.int()])
Run Code Online (Sandbox Code Playgroud)

但出现错误:

KeyError: Variable containing:
 423
[torch.IntTensor of size 1]
Run Code Online (Sandbox Code Playgroud)

谢谢〜

pytorch tensor

7
推荐指数
2
解决办法
1万
查看次数

标签 统计

pytorch ×1

tensor ×1