Pytorch的permute函数,将tensor的维度换位

举例:

>>> x = torch.randn(2, 3, 5) 
>>> x.size() 
torch.Size([2, 3, 5]) 
>>> x.permute(2, 0, 1).size() 
torch.Size([5, 2, 3])

 

 

https://zhuanlan.zhihu.com/p/76583143

posted @ 2022-03-29 11:19  Tomorrow1126  阅读(79)  评论(0编辑  收藏  举报