ZeroPad2d

class dragon.vm.torch.nn.ZeroPad2d(padding)[source]

Pad input according to the last 2-dimensions with zeros.

The padded dimension is computed as:

\[\text{Dim}_{out} = \text{Dim}_{in} + pad_l + pad_r \]

Examples:

m = torch.nn.ZeroPad2d(1)
x = torch.randn(1, 2, 2)
y = m(x)  # (1, 2, 2) -> (1, 4, 4)

__init__

ZeroPad2d.__init__(padding)[source]

Create a ZeroPad2d module.

Parameters:
  • padding (Union[int, Sequence[int]]) The 2d padding sizes.