Rate this Page

MaxUnpool3d#

classtorch.nn.modules.pooling.MaxUnpool3d(kernel_size,stride=None,padding=0)[source]#

Computes a partial inverse ofMaxPool3d.

MaxPool3d is not fully invertible, since the non-maximal values are lost.MaxUnpool3d takes in as input the output ofMaxPool3dincluding the indices of the maximal values and computes a partial inversein which all non-maximal values are set to zero.

Note

This operation may behave nondeterministically when the input indices has repeat values.Seepytorch/pytorch#80827 andReproducibility for more information.

Note

MaxPool3d can map several input sizes to the same outputsizes. Hence, the inversion process can get ambiguous.To accommodate this, you can provide the needed output sizeas an additional argumentoutput_size in the forward call.See the Inputs section below.

Parameters
  • kernel_size (int ortuple) – Size of the max pooling window.

  • stride (int ortuple) – Stride of the max pooling window.It is set tokernel_size by default.

  • padding (int ortuple) – Padding that was added to the input

Inputs:
  • input: the input Tensor to invert

  • indices: the indices given out byMaxPool3d

  • output_size (optional): the targeted output size

Shape:

Example:

>>># pool of square window of size=3, stride=2>>>pool=nn.MaxPool3d(3,stride=2,return_indices=True)>>>unpool=nn.MaxUnpool3d(3,stride=2)>>>output,indices=pool(torch.randn(20,16,51,33,15))>>>unpooled_output=unpool(output,indices)>>>unpooled_output.size()torch.Size([20, 16, 51, 33, 15])
forward(input,indices,output_size=None)[source]#

Runs the forward pass.

Return type

Tensor