Rate this Page

ConstantPad3d#

classtorch.nn.modules.padding.ConstantPad3d(padding,value)[source]#

Pads the input tensor boundaries with a constant value.

ForN-dimensional padding, usetorch.nn.functional.pad().

Parameters:

padding (int,tuple) – the size of the padding. If isint, uses the samepadding in all boundaries. If a 6-tuple, uses(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})

Shape:

Examples:

>>>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)