当前位置: 首页 > news >正文

用织梦做的网站好还是cms电商网络推广怎么做

用织梦做的网站好还是cms,电商网络推广怎么做,深圳网站建设深圳网络,六盘水网站建设文章目录 torch.nn.PixelShuffle直观解释官方文档 torch.nn.PixelUnshuffle直观解释官方文档 torch.nn.PixelShuffle 直观解释 PixelShuffle是一种上采样方法,它将形状为 ( ∗ , C r 2 , H , W ) (∗, C\times r^2, H, W) (∗,Cr2,H,W)的张量重新排列转换为形状为…

文章目录

  • torch.nn.PixelShuffle
    • 直观解释
    • 官方文档
  • torch.nn.PixelUnshuffle
    • 直观解释
    • 官方文档

torch.nn.PixelShuffle

直观解释

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,8,2,3),PixelShuffle的 缩放因子是r=2

import torch
ps=torch.nn.PixelShuffle(2)
input=torch.arange(0,48).view(1,8,2,3)
print(input)
output=ps(input)
print(output)
print(output.shape)

如下图可以看到,PixelShuffle是把输入通道按照缩放因子r^2进行划分成8/(2^2)=2 组。
也就是输入的第一组(前4个通道)中的元素,每次间隔r=2 交错排列,合并成输出的第一个通道维度。
输入的第二组(后4个通道)中的元素,每次间隔r=2交错排列,合并成输出通道的第二个维度。
输入的大小为(batchsize,in_channel,in_height,in_width)=(1,8,2,3)
输出的大小为(batchsize,out_channel,out_height,out_width)(1,2,4,6)

各个维度的变化规律如下:
batchsize 不变;
out_channel=in_channel/(r^2)
out_height=in_height*r
out_width=in_width*r
在这里插入图片描述

官方文档

CLASS
torch.nn.PixelShuffle(upscale_factor)
  • 功能: 把大小为 ( ∗ , 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) , 其中 r r r 是 upscale factor 。

    这个操作对于实现步长为 1 r \frac {1}{r} r1efficient sub-pixel convolution有用。

  • 参数

    • upscale_factor(int) : 增加空间分辨率的因子
  • 形状

    • 输入: ( ∗ , C i n , H i n , W i n ) (*,C_{in},H_{in},W_{in}) (,Cin,Hin,Win) ,其中 ∗ * 是 0 或者batch大小

    • 输出: ( ∗ , C o u t , H o u t , W o u t ) (*,C_{out},H_{out},W_{out}) (,Cout,Hout,Wout) , 其中

      C out  = C in  ÷ u p s c a l e _ f a c t o r 2 H out  = H in  × u p s c a l e _ f a c t o r W out  = W in  × u p s c a l e _ f a c t o r C_{\text {out }}=C_{\text {in }} \div upscale\_factor ^2 \\ H_{\text {out }}=H_{\text {in }} \times upscale\_factor \\ W_{\text {out }}=W_{\text {in }} \times upscale\_factor Cout =Cin ÷upscale_factor2Hout =Hin ×upscale_factorWout =Win ×upscale_factor

  • 例子

>>> pixel_shuffle = nn.PixelShuffle(3)
>>> input = torch.randn(1, 9, 4, 4)
>>> output = pixel_shuffle(input)
>>> print(output.size())
torch.Size([1, 1, 12, 12])

torch.nn.PixelUnshuffle

直观解释

PixelUnshuffle就是PixelShuffle的逆操作。

import torch
pus=torch.nn.PixelUnshuffle(2)
input_restore=pus(putput)
print(input_restore)
print(input_restore.shape)
print(input_restore==input) # input_restore和input一样

官方文档

CLASS
torch.nn.PixelUnshuffle(downscale_factor)
  • 功能: 是PixelShuffle的逆操作,把大小为 ( ∗ , C , H × r , W × r ) (*,C,H\times r,W\times r) (,C,H×r,W×r)的张量重组成大小为 ( ∗ , C × r , H , W ) (*,C\times r,H,W) (,C×r,H,W)的张量。其中 r r r 是downscale factor。

  • 参数:

    • downscale_factor (int) : 降低空间分辨率的因子。
  • 形状:

    • 输入: ( ∗ , C i n , H i n , W i n ) (*,C_{in},H_{in},W_{in}) (,Cin,Hin,Win), 其中 ∗ * 是 0 或者batch大小

    • 输出: ( ∗ , C o u t , H o u t , W o u t ) (*,C_{out},H_{out},W_{out}) (,Cout,Hout,Wout), 其中

      C out  = C in  × downscale  _ factor  2 H out  = H in  ÷ downscale  _ factor  W out  = W in  ÷ downscale  _ factor  \begin{aligned}& C_{\text {out }}=C_{\text {in }} \times \text { downscale } \_ \text {factor }{ }^2 \\& H_{\text {out }}=H_{\text {in }} \div \text { downscale } \_ \text {factor } \\& W_{\text {out }}=W_{\text {in }} \div \text { downscale } \_ \text {factor }\end{aligned} Cout =Cin × downscale _factor 2Hout =Hin ÷ downscale _factor Wout =Win ÷ downscale _factor 

  • 例子

>>> pixel_unshuffle = nn.PixelUnshuffle(3)
>>> input = torch.randn(1, 1, 12, 12)
>>> output = pixel_unshuffle(input)
>>> print(output.size())
torch.Size([1, 9, 4, 4])
http://www.dt0577.cn/news/21590.html

相关文章:

  • 安顺网站建设私人网站服务器
  • 小程序怎么做微网站链接百度灰色词优化排名
  • 撤销网站备案表填写后免费线上培训平台
  • 网站建设完工报告搜狗推广登录入口
  • 阿里云虚拟主机做多个网站阿里巴巴seo排名优化
  • 怎么在百度搜索到我的网站百度关键词排名靠前
  • 网站租空间多少钱企业网站建设方案策划
  • 厦门做网站最好的公司有哪些学校网站建设
  • 外资企业可以在中国境内做网站吗武汉网络推广有限公司
  • 外贸soho 怎么做网站谷歌seo推广
  • 用python自动写wordpress谷歌seo优化中文章
  • 制作公众号网站开发今日足球比赛预测推荐分析
  • 迁安网站建设深圳网站seo外包公司哪家好
  • wordpress后台左侧菜单显示seo是什么的简称
  • 做网站为什么一定要留住用户网站空间租用
  • 网站实现搜索功能营业推广促销方式有哪些
  • 终端平台网站建设百度重庆营销中心
  • 用vs2010做网站教程百度一下你就知道移动首页
  • 网站的页面风格是什么山西网络营销外包
  • 昆明云南微网站搭建哪家好友情链接导航
  • 网站怎么做才能赚钱网址导航哪个好
  • 站长工具大全网站建设公司业务
  • 专业做数据的网站有哪些方面做一个微信小程序需要多少钱
  • 天津党员档案建设网站站长统计app最新版本2023
  • 做新房网站怎么弄南宁百度seo优化
  • 中国建设银行网站登陆互联网广告代理商
  • 个人网站推广方案网络推广公司官网
  • 怎么自己开发app软件seo优化器
  • 新乡市做网站直销系统网站自己开平台怎么弄啊
  • java做的网站怎么调试南京网页搜索排名提升