ReflectionPad3d¶
- class torch.nn.ReflectionPad3d(padding)[原始碼][原始碼]¶
使用輸入邊界的反射來填充輸入張量。
對於 N 維填充,使用
torch.nn.functional.pad()
。- 形狀 (Shape)
輸入 (Input): or .
輸出: 或 ,其中
輸出高度 = 輸入高度 + 上邊距 + 下邊距
輸出寬度 = 輸入寬度 + 左邊距 + 右邊距
範例
>>> 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.]]]]])