![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
pytorch基础
biubiu713
前人种树,后人乘凉
展开
-
max, argmax, maximum傻傻分不清楚
pytorch中,max, argmax, maximum的区别原创 2023-05-25 16:02:54 · 174 阅读 · 0 评论 -
torch.squeeze()
不指定维度时,删除所有大小为1的维度。原创 2023-04-27 20:48:33 · 116 阅读 · 1 评论 -
torch.where()与torch.nonzero()
根据条件condition取值,condition为True,取input,为False时,取other。等价于torch.nonzero(condition: Tensor, as_tuple=True)返回input中非零值的坐标。原创 2023-04-27 20:22:13 · 274 阅读 · 0 评论 -
torch.topk()与tensor.topk()
等价于torck.topk(tensor, k, dim=None, largest=True)返回tensor指定维度的前k个元素值及坐标。原创 2023-04-27 18:26:12 · 197 阅读 · 1 评论 -
torch.split()与tensor.split()
等价于torch.split(tensor, int/list, dim)将tensor切分为块,每个块都是原始tensor的一个视图。原创 2023-04-27 17:53:42 · 360 阅读 · 1 评论 -
torch.expand()与torch.expand_as()
【代码】torch.expand()与torch.expand_as()原创 2023-04-27 17:39:28 · 192 阅读 · 1 评论 -
torch.cat()与torch.stack()
torch.cat()是在tensor的原维度进行操作,而torch.stack()操作会改变tensor的维度,增加一个维度。从示例中可以看出,t1, t2, t3 的维度为3,连接后得到的t4, t5的维度也为3,形状为[2, 7, 5]。t4在第1维增加一个维度,原来的第1维变成第2维,t5在最后增加一个维度。作用:在新的维度上连接tensor序列。原创 2023-04-24 17:35:54 · 191 阅读 · 1 评论