IndexError: dimension specified as 0 but tensor has no dimensions

2022-09-02 20:49:11 浏览数 (3)

代码语言:javascript复制
loss = loss.unsqueeze(0) 升维
losses.update(loss.item(), loss.size(0))
IndexError: dimension specified as 0 but tensor has no dimensions
a = torch.tensor([1])
b = torch.tensor(1)

a 和 b 之间是有很大的区别的。

0 人点赞