Pytorch的item()方法
时间:2020-12-10 23:23:33
收藏:0
阅读:120
pytorch中.item()方法 是得到一个元素张量里面的元素值
1 import torch 2 torch.arange(3)
1 tensor([0, 1, 2])
1 torch.arange(3)[0].item()
0
注:返回元素0.
原文:https://www.cnblogs.com/vvzhang/p/14117472.html
评论(0)