[`MaxPool2d`](#torch.nn.MaxPool2d"torch.nn.MaxPool2d") is not fully invertible, since the non-maximal values are lost.
[`MaxUnpool2d`](#torch.nn.MaxUnpool2d"torch.nn.MaxUnpool2d") takes in as input the output of [`MaxPool2d`](#torch.nn.MaxPool2d"torch.nn.MaxPool2d") including the indices of the maximal values and computes a partial inverse in which all non-maximal values are set to zero.
Note
Note
[`MaxPool2d`](#torch.nn.MaxPool2d"torch.nn.MaxPool2d") 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 and Example below.
***kernel_size** ([_int_](https://docs.python.org/3/library/functions.html#int"(in Python v3.7)")_or_[_tuple_](https://docs.python.org/3/library/stdtypes.html#tuple"(in Python v3.7)")) – Size of the max pooling window.
***stride** ([_int_](https://docs.python.org/3/library/functions.html#int"(in Python v3.7)")_or_[_tuple_](https://docs.python.org/3/library/stdtypes.html#tuple"(in Python v3.7)")) – Stride of the max pooling window. It is set to `kernel_size` by default.
***padding** ([_int_](https://docs.python.org/3/library/functions.html#int"(in Python v3.7)")_or_[_tuple_](https://docs.python.org/3/library/stdtypes.html#tuple"(in Python v3.7)")) – Padding that was added to the input
[`MaxPool3d`](#torch.nn.MaxPool3d"torch.nn.MaxPool3d") is not fully invertible, since the non-maximal values are lost. [`MaxUnpool3d`](#torch.nn.MaxUnpool3d"torch.nn.MaxUnpool3d") takes in as input the output of [`MaxPool3d`](#torch.nn.MaxPool3d"torch.nn.MaxPool3d") including the indices of the maximal values and computes a partial inverse in which all non-maximal values are set to zero.
Note
Note
[`MaxPool3d`](#torch.nn.MaxPool3d"torch.nn.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.
***kernel_size** ([_int_](https://docs.python.org/3/library/functions.html#int"(in Python v3.7)")_or_[_tuple_](https://docs.python.org/3/library/stdtypes.html#tuple"(in Python v3.7)")) – Size of the max pooling window.
***stride** ([_int_](https://docs.python.org/3/library/functions.html#int"(in Python v3.7)")_or_[_tuple_](https://docs.python.org/3/library/stdtypes.html#tuple"(in Python v3.7)")) – Stride of the max pooling window. It is set to `kernel_size` by default.
***padding** ([_int_](https://docs.python.org/3/library/functions.html#int"(in Python v3.7)")_or_[_tuple_](https://docs.python.org/3/library/stdtypes.html#tuple"(in Python v3.7)")) – Padding that was added to the input
Applies a 1D average pooling over an input signal composed of several input planes.
对输入的多通道信号执行一维平均池化操作。
In the simplest case, the output value of the layer with input size ![](img/5816e96aa78b7425cf792435bba8bc29.jpg), output ![](img/d131773750846713475c600aa8cd917a.jpg) and `kernel_size` ![](img/a1c2f8d5b1226e67bdb44b12a6ddf18b.jpg) can be precisely described as:
In the simplest case, the output value of the layer with input size ![](img/23f8772594b27bd387be708fe9c085e1.jpg), output ![](img/a0ef05f779873fc4dcbf020b1ea14754.jpg) and `kernel_size` ![](img/6384e001ad4c0989683deb86f6ffbd2f.jpg) can be precisely described as:
![](img/b7a0e1d0a42a3626724c14d89a10a44f.jpg)
![](img/b7a0e1d0a42a3626724c14d89a10a44f.jpg)
If `padding` is non-zero, then the input is implicitly zero-padded on both sides for `padding` number of points.
`padding` 参数控制了要在输入信号的各维度各边上要补齐0的层数。
The parameters `kernel_size`, `stride`, `padding` can either be:
`kernel_size`, `stride`, `padding`等参数均支持以下类型输入:
> * a single `int` – in which case the same value is used for the height and width dimension
> * 一个单独的 `int` – 此时这个`int`会同时控制池化滑动窗的宽和高这两个维度的大小
> * a `tuple` of two ints – in which case, the first `int` is used for the height dimension, and the second `int` for the width dimension
In the simplest case, the output value of the layer with input size ![](img/f5a45f7b445db562b21cfcb525637aab.jpg), output ![](img/41ca4c8d4c65c979d2d643c6f62ea280.jpg) and `kernel_size` ![](img/f5dcdebf9a81b9d15227749ae7535eb7.jpg) can be precisely described as:
![](img/79acedd31cd18baac8d97ab96a7092e0.jpg)
![](img/79acedd31cd18baac8d97ab96a7092e0.jpg)
If `padding` is non-zero, then the input is implicitly zero-padded on all three sides for `padding` number of points.
`padding` 参数控制了要在输入信号的各维度各边上要补齐0的层数。
The parameters `kernel_size`, `stride` can either be:
`kernel_size`, `stride`, `padding`等参数均支持以下类型输入:
> * a single `int` – in which case the same value is used for the depth, height and width dimension
> * a `tuple` of three ints – in which case, the first `int` is used for the depth dimension, the second `int` for the height dimension and the third `int` for the width dimension