pytorch permute维度转换

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/jacke121/article/details/83044674

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))

猜你喜欢

转载自blog.csdn.net/jacke121/article/details/83044674
今日推荐