ConstantPad3d¶
- class torch.nn.ConstantPad3d(padding, value)[source][source]¶
使用常數值來填充輸入張量的邊界。
對於 N 維度的填充,請使用
torch.nn.functional.pad()
。- 形狀
輸入: or 。
輸出: 或 ,其中
輸出寬度 = 輸入寬度 + 左邊填充 + 右邊填充
範例
>>> m = nn.ConstantPad3d(3, 3.5) >>> input = torch.randn(16, 3, 10, 20, 30) >>> output = m(input) >>> # using different paddings for different sides >>> m = nn.ConstantPad3d((3, 3, 6, 6, 0, 1), 3.5) >>> output = m(input)