当前位置:主页 > 软件编程 > Python代码 >

pytorch permute维度转换方法

时间:2021-05-29 07:43:21 | 栏目:Python代码 | 点击:

permute

prediction = input.view(bs, self.num_anchors,
  self.bbox_attrs, in_h, in_w).permute(0, 1, 3, 4, 2).contiguous()

转置:

import torch

x = torch.linspace(1, 9, steps=9).view(3, 3)

b=x.permute(1,0)
print(b)
print(b.permute(1,0))

您可能感兴趣的文章:

相关文章