Table of Contents
Shortcuts

# MaxUnpool3d

class torch.nn.MaxUnpool3d(kernel_size, stride=None, padding=0)

  Computes a partial inverse of `MaxPool3d`.

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

  Note

  This operation may behave nondeterministically when the input indices has repeat values. See https://github.com/pytorch/pytorch/issues/80827 and Reproducibility for more information.

  Note

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

  Parameters:

    - kernel_size (int or tuple) – Size of the max pooling window.

    - stride (int or tuple) – Stride of the max pooling window. It is set to `kernel_size` by default.

    - padding (int or tuple) – Padding that was added to the input

  Inputs:

    - input: the input Tensor to invert

    - indices: the indices given out by `MaxPool3d`

    - output_size (optional): the targeted output size

  Shape:

    - Input: (N,C,D i n,H i n,W i n)(N, C, D_{in}, H_{in}, W_{in})(N,C,D in​,H in​,W in​) or (C,D i n,H i n,W i n)(C, D_{in}, H_{in}, W_{in})(C,D in​,H in​,W in​).

    - Output: (N,C,D o u t,H o u t,W o u t)(N, C, D_{out}, H_{out}, W_{out})(N,C,D o u t​,H o u t​,W o u t​) or (C,D o u t,H o u t,W o u t)(C, D_{out}, H_{out}, W_{out})(C,D o u t​,H o u t​,W o u t​), where

      D o u t=(D i n−1)×stride[0]−2×padding[0]+kernel_size[0]D_{out} = (D_{in} - 1) \times \text{stride[0]} - 2 \times \text{padding[0]} + \text{kernel\_size[0]} D o u t​=(D in​−1)×stride[0]−2×padding[0]+kernel_size[0]
      H o u t=(H i n−1)×stride[1]−2×padding[1]+kernel_size[1]H_{out} = (H_{in} - 1) \times \text{stride[1]} - 2 \times \text{padding[1]} + \text{kernel\_size[1]} H o u t​=(H in​−1)×stride[1]−2×padding[1]+kernel_size[1]
      W o u t=(W i n−1)×stride[2]−2×padding[2]+kernel_size[2]W_{out} = (W_{in} - 1) \times \text{stride[2]} - 2 \times \text{padding[2]} + \text{kernel\_size[2]} W o u t​=(W in​−1)×stride[2]−2×padding[2]+kernel_size[2]

      or as given by `output_size` in the call operator

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

## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.