Rate this Page

Class MaxPool2dImpl#

Inheritance Relationships#

Base Type#

Class Documentation#

class MaxPool2dImpl : public torch::nn::MaxPoolImpl<2, MaxPool2dImpl>#

Applies maxpool over a 2-D input.

See https://pytorch.org/docs/main/nn.html#torch.nn.MaxPool2d to learn about the exact behavior of this module.

See the documentation for torch::nn::MaxPool2dOptions class to learn what constructor arguments are supported for this module.

Example:

MaxPool2d model(MaxPool2dOptions({3, 2}).stride({2, 2}));

Public Functions

Tensor forward(const Tensor &input)#
std::tuple<Tensor, Tensor> forward_with_indices(const Tensor &input)#

Returns the outputs and the indices of the max values.

Useful for torch::nn::MaxUnpool2d later.