pytorch permute维度转换方法

yipeiwu_com6年前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))

以上这篇pytorch permute维度转换方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持【听图阁-专注于Python设计】。

相关文章

Python使用pip安装报错:is not a supported wheel on this platform的解决方法

Python使用pip安装报错:is not a supported wheel on this platform的解决方法

本文讲述了Python使用pip安装报错:is not a supported wheel on this platform的解决方法。分享给大家供大家参考,具体如下: 可能的原因1:安...

python类继承与子类实例初始化用法分析

本文实例讲述了python类继承与子类实例初始化用法。分享给大家供大家参考。具体分析如下: [ 先贴参考书籍原文(中文英文对照)] __init__方法介绍: If a base cla...

在django中自定义字段Field详解

Django的Field类中方法有: to_python() # 把数据库数据转成python数据 from_db_value() # 把数据库数据转成python数据 get_pre_...

Python使用面向对象方式创建线程实现12306售票系统

目前python 提供了几种多线程实现方式 thread,threading,multithreading ,其中thread模块比较底层,而threading模块是对thread做了一...

Pandas实现DataFrame按行求百分数(比例数)

简述 Motivation 一般来说,每个部分的内容数量是较为容易获取的,但比例(百分数)这样的数据是二次数据,这样的操作很常见 比例的信息相比于纯粹的数字更体现的整体体系的内部变化迁移...