Applies a 2D max pooling over an input signal composed of several input planes.
对输入的多通道信号执行二维最大池化操作。
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:
If `padding` is non-zero, then the input is implicitly zero-padded on both sides for `padding` number of points. `dilation` controls the spacing between the kernel points. It is harder to describe, but this [link](https://github.com/vdumoulin/conv_arithmetic/blob/master/README.md) has a nice visualization of what `dilation` does.
***kernel_size** – the size of the window to take a max over
***stride** – the stride of the window. Default value is `kernel_size`
***padding** – implicit zero padding to be added on both sides
***dilation** – a parameter that controls the stride of elements in the window
***return_indices** – if `True`, will return the max indices along with the outputs. Useful for [`torch.nn.MaxUnpool2d`](#torch.nn.MaxUnpool2d"torch.nn.MaxUnpool2d") later
***ceil_mode** – when True, will use `ceil` instead of `floor` to compute the output shape
Applies a 3D max pooling over an input signal composed of several input planes. This is not a test
对输入的多通道信号执行三维最大池化操作。
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:
If `padding` is non-zero, then the input is implicitly zero-padded on both sides for `padding` number of points. `dilation` controls the spacing between the kernel points. It is harder to describe, but this [link](https://github.com/vdumoulin/conv_arithmetic/blob/master/README.md) has a nice visualization of what `dilation` does.
The parameters `kernel_size`, `stride`, `padding`, `dilation` can either be:
> * 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
***kernel_size** – the size of the window to take a max over
***stride** – the stride of the window. Default value is `kernel_size`
***padding** – implicit zero padding to be added on all three sides
***dilation** – a parameter that controls the stride of elements in the window
***return_indices** – if `True`, will return the max indices along with the outputs. Useful for [`torch.nn.MaxUnpool3d`](#torch.nn.MaxUnpool3d"torch.nn.MaxUnpool3d") later
***ceil_mode** – when True, will use `ceil` instead of `floor` to compute the output shape
Computes a partial inverse of [`MaxPool1d`](#torch.nn.MaxPool1d"torch.nn.MaxPool1d").
[`MaxPool1d`](#torch.nn.MaxPool1d"torch.nn.MaxPool1d") is not fully invertible, since the non-maximal values are lost.
[`MaxUnpool1d`](#torch.nn.MaxUnpool1d"torch.nn.MaxUnpool1d") takes in as input the output of [`MaxPool1d`](#torch.nn.MaxPool1d"torch.nn.MaxPool1d") including the indices of the maximal values and computes a partial inverse in which all non-maximal values are set to zero.
[`MaxPool1d`](#torch.nn.MaxPool1d"torch.nn.MaxPool1d") 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