脚本之家,脚本语言编程技术及教程分享平台!
分类导航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服务器之家 - 脚本之家 - Python - pytorch permute维度转换方法

pytorch permute维度转换方法

2021-04-29 00:38ShellCollector Python

今天小编就为大家分享一篇pytorch permute维度转换方法,具有很好的参考价值,希望对大家有所帮助。一起跟随小编过来看看吧

permute

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

转置:

?
1
2
3
4
5
6
7
import torch
 
x = torch.linspace(1, 9, steps=9).view(3, 3)
 
b=x.permute(1,0)
print(b)
print(b.permute(1,0))

以上这篇pytorch permute维度转换方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持服务器之家。

原文链接:https://blog.csdn.net/jacke121/article/details/83044674

延伸 · 阅读

精彩推荐