当前位置:网站首页>【Pytorch】nn.PixelShuffle
【Pytorch】nn.PixelShuffle
2022-08-11 06:28:00 【二进制人工智能】
torch.nn.PixelShuffle(upscale_factor)
PixelShuffle是一种上采样方法,它将形状 ( ∗ , C × r 2 , H , W ) (∗, C\times r^2, H, W) (∗,C×r2,H,W)的张量重新排列转换为形状为 ( ∗ , C , H × r , W × r ) (∗, C, H\times r, W\times r) (∗,C,H×r,W×r)的张量:

图片来源:[1]
其中 r r r是upscale_factor因子。
输入输出尺寸:

例子: ( 1 , 8 , 2 , 2 ) → ( 1 , 2 , 4 , 4 ) (1, 8, 2, 2)\rightarrow (1,2,4,4) (1,8,2,2)→(1,2,4,4)
import torch
import torch.nn as nn
ps = nn.PixelShuffle(2)
input = torch.arange(0, 8 * 2 * 2).view(1, 8, 2, 2)
output = ps(input)
print('input:\n',input)
print('output:\n',output)


[1] Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network https://openaccess.thecvf.com/content_cvpr_2016/papers/Shi_Real-Time_Single_Image_CVPR_2016_paper.pdf
边栏推荐
猜你喜欢
随机推荐
联想集团:2022/23财年第一季度业绩
从 dpdk-20.11 移植 intel E810 百 G 网卡 pmd 驱动到 dpdk-16.04 中
Daily sql - judgment + aggregation
Implement general-purpose, high-performance sorting and quicksort optimizations
docker安装mysql5.7(仅供测试使用)
Spatial Pyramid Pooling -Spatial Pyramid Pooling (including source code)
Unity程序员如何提升自己的能力
【软件测试】(北京)字节跳动科技有限公司终面HR面试题
SQL滑动窗口
抖音API接口
MySQL使用GROUP BY 分组查询时,SELECT 查询字段包含非分组字段
技术分享 | 实战演练接口自动化如何处理 Form 请求?
How to choose professional, safe and high-performance remote control software
淘宝API常用接口与获取方式
1688 product interface
你是如何做好Unity项目性能优化的
Production and optimization of Unity game leaderboards
ssh服务攻防与加固
每日sql -查询至少有5名下属的经理和选举
ROS 服务通信理论模型








