快捷键

ReflectionPad3d ¬

类 torch.nn.ReflectionPad3d(padding)[来源][来源] ¬

使用输入边界的反射对输入张量进行填充。

对于 N 维填充,使用 torch.nn.functional.pad()

参数:

填充(int,tuple)- 填充的大小。如果为 int,则在所有边界使用相同的填充。如果为 6 元组,则使用( padding_left\text{padding\_left}padding_right\text{padding\_right}padding_top\text{padding\_top}padding_bottom\text{padding\_bottom}padding_front\text{padding\_front}padding_back\text{padding\_back} )。

形状:
  • 输入: (N,C,Din,Hin,Win)(N, C, D_{in}, H_{in}, W_{in})(C,Din,Hin,Win)(C, D_{in}, H_{in}, W_{in})

  • 输出: (N,C,Dout,Hout,Wout)(N, C, D_{out}, H_{out}, W_{out})(C,Dout,Hout,Wout)(C, D_{out}, H_{out}, W_{out}) ,其中

    Dout=Din+padding_front+padding_backD_{out} = D_{in} + \text{padding\_front} + \text{padding\_back}

    Hout=Hin+padding_top+padding_bottomH_{out} = H_{in} + \text{padding\_top} + \text{padding\_bottom}

    Wout=Win+padding_left+padding_rightW_{out} = W_{in} + \text{padding\_left} + \text{padding\_right}

示例:

>>> m = nn.ReflectionPad3d(1)
>>> input = torch.arange(8, dtype=torch.float).reshape(1, 1, 2, 2, 2)
>>> m(input)
tensor([[[[[7., 6., 7., 6.],
           [5., 4., 5., 4.],
           [7., 6., 7., 6.],
           [5., 4., 5., 4.]],
          [[3., 2., 3., 2.],
           [1., 0., 1., 0.],
           [3., 2., 3., 2.],
           [1., 0., 1., 0.]],
          [[7., 6., 7., 6.],
           [5., 4., 5., 4.],
           [7., 6., 7., 6.],
           [5., 4., 5., 4.]],
          [[3., 2., 3., 2.],
           [1., 0., 1., 0.],
           [3., 2., 3., 2.],
           [1., 0., 1., 0.]]]]])

© 版权所有 PyTorch 贡献者。

使用 Sphinx 构建,并使用 Read the Docs 提供的主题。

文档

PyTorch 的全面开发者文档

查看文档

教程

深入了解初学者和高级开发者的教程

查看教程

资源

查找开发资源并获得您的疑问解答

查看资源