![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
函数对比
6116yy
Fighting!
展开
-
permute()和transpose()的区别
torch.permute(* dims )*dims (int…) – The desired ordering of dimensionstorch.transpose(input, dim0, dim1)*input (Tensor) – the input tensor.*dim0 (int) – the first dimension to be transposed*dim1 (int) – the second dimension to be transposed代码(perm.原创 2020-09-16 13:55:33 · 1624 阅读 · 0 评论 -
pytorch 中 item()和tolist()的区别
代码d = torch.randn(1)print(d)print(d.item())e = torch.randn(2,3)print(e)print(e.tolist())print(e[0,0].tolist())print(e[1,0].tolist())print(e[1,2].tolist())输出tensor([-0.9357])-0.9356811046600342tensor([[ 0.8045, 0.5580, -0.1956], [ 1.原创 2020-09-07 13:59:54 · 1752 阅读 · 1 评论