Title: Pooling Layers — PyTorch main documentation
Description: Pooling layers in PyTorch C++ — MaxPool, AvgPool, AdaptiveMaxPool, AdaptiveAvgPool, and LPPool.
Keywords:
Domain: docs.pytorch.org
{
"@context": "https://schema.org",
"@type": "Article",
"name": "Pooling Layers",
"headline": "Pooling Layers",
"description": "Pooling layers in PyTorch C++ \u2014 MaxPool, AvgPool, AdaptiveMaxPool, AdaptiveAvgPool, and LPPool.",
"url": "/api/nn/pooling.html",
"articleBody": "Pooling Layers# Pooling layers reduce spatial dimensions by aggregating values in local regions, providing translation invariance and reducing computational cost in deeper layers. MaxPool: Takes the maximum value in each pooling window (preserves strong features) AvgPool: Takes the average value in each pooling window (smoother downsampling) AdaptivePool: Automatically calculates kernel size to produce a target output size FractionalMaxPool: Randomized pooling with fractional output size MaxUnpool: Computes the partial inverse of MaxPool using stored indices LPPool: Power-average pooling (generalization of avg/max pooling) MaxPool1d / MaxPool2d / MaxPool3d# class MaxPool1d : public torch::nn::ModuleHolder\u003cMaxPool1dImpl\u003e# A ModuleHolder subclass for MaxPool1dImpl. See the documentation for MaxPool1dImpl class to learn what methods it provides, and examples of how to use MaxPool1d with torch::nn::MaxPool1dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = MaxPool1dImpl# class MaxPool1dImpl : public torch::nn::MaxPoolImpl\u003c1, MaxPool1dImpl\u003e# Applies maxpool over a 1-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.MaxPool1d to learn about the exact behavior of this module. See the documentation for torch::nn::MaxPool1dOptions class to learn what constructor arguments are supported for this module. Example: MaxPool1d model(MaxPool1dOptions(3).stride(2)); Public Functions Tensor forward(const Tensor \u0026input)# std::tuple\u003cTensor, Tensor\u003e forward_with_indices(const Tensor \u0026input)# Returns the outputs and the indices of the max values. Useful for torch::nn::MaxUnpool1d later. class MaxPool2d : public torch::nn::ModuleHolder\u003cMaxPool2dImpl\u003e# A ModuleHolder subclass for MaxPool2dImpl. See the documentation for MaxPool2dImpl class to learn what methods it provides, and examples of how to use MaxPool2d with torch::nn::MaxPool2dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = MaxPool2dImpl# class MaxPool2dImpl : public torch::nn::MaxPoolImpl\u003c2, MaxPool2dImpl\u003e# 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 \u0026input)# std::tuple\u003cTensor, Tensor\u003e forward_with_indices(const Tensor \u0026input)# Returns the outputs and the indices of the max values. Useful for torch::nn::MaxUnpool2d later. class MaxPool3d : public torch::nn::ModuleHolder\u003cMaxPool3dImpl\u003e# A ModuleHolder subclass for MaxPool3dImpl. See the documentation for MaxPool3dImpl class to learn what methods it provides, and examples of how to use MaxPool3d with torch::nn::MaxPool3dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = MaxPool3dImpl# class MaxPool3dImpl : public torch::nn::MaxPoolImpl\u003c3, MaxPool3dImpl\u003e# Applies maxpool over a 3-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.MaxPool3d to learn about the exact behavior of this module. See the documentation for torch::nn::MaxPool3dOptions class to learn what constructor arguments are supported for this module. Example: MaxPool3d model(MaxPool3dOptions(3).stride(2)); Public Functions Tensor forward(const Tensor \u0026input)# std::tuple\u003cTensor, Tensor\u003e forward_with_indices(const Tensor \u0026input)# Returns the outputs and the indices of the max values. Useful for torch::nn::MaxUnpool3d later. Example: auto pool = torch::nn::MaxPool2d( torch::nn::MaxPool2dOptions(2).stride(2)); AvgPool1d / AvgPool2d / AvgPool3d# class AvgPool1d : public torch::nn::ModuleHolder\u003cAvgPool1dImpl\u003e# A ModuleHolder subclass for AvgPool1dImpl. See the documentation for AvgPool1dImpl class to learn what methods it provides, and examples of how to use AvgPool1d with torch::nn::AvgPool1dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = AvgPool1dImpl# class AvgPool1dImpl : public torch::nn::AvgPoolImpl\u003c1, AvgPool1dImpl\u003e# Applies avgpool over a 1-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.AvgPool1d to learn about the exact behavior of this module. See the documentation for torch::nn::AvgPool1dOptions class to learn what constructor arguments are supported for this module. Example: AvgPool1d model(AvgPool1dOptions(3).stride(2)); Public Functions Tensor forward(const Tensor \u0026input)# class AvgPool2d : public torch::nn::ModuleHolder\u003cAvgPool2dImpl\u003e# A ModuleHolder subclass for AvgPool2dImpl. See the documentation for AvgPool2dImpl class to learn what methods it provides, and examples of how to use AvgPool2d with torch::nn::AvgPool2dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = AvgPool2dImpl# class AvgPool2dImpl : public torch::nn::AvgPoolImpl\u003c2, AvgPool2dImpl\u003e# Applies avgpool over a 2-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.AvgPool2d to learn about the exact behavior of this module. See the documentation for torch::nn::AvgPool2dOptions class to learn what constructor arguments are supported for this module. Example: AvgPool2d model(AvgPool2dOptions({3, 2}).stride({2, 2})); Public Functions Tensor forward(const Tensor \u0026input)# class AvgPool3d : public torch::nn::ModuleHolder\u003cAvgPool3dImpl\u003e# A ModuleHolder subclass for AvgPool3dImpl. See the documentation for AvgPool3dImpl class to learn what methods it provides, and examples of how to use AvgPool3d with torch::nn::AvgPool3dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = AvgPool3dImpl# class AvgPool3dImpl : public torch::nn::AvgPoolImpl\u003c3, AvgPool3dImpl\u003e# Applies avgpool over a 3-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.AvgPool3d to learn about the exact behavior of this module. See the documentation for torch::nn::AvgPool3dOptions class to learn what constructor arguments are supported for this module. Example: AvgPool3d model(AvgPool3dOptions(5).stride(2)); Public Functions Tensor forward(const Tensor \u0026input)# AdaptiveAvgPool1d / AdaptiveAvgPool2d / AdaptiveAvgPool3d# class AdaptiveAvgPool1d : public torch::nn::ModuleHolder\u003cAdaptiveAvgPool1dImpl\u003e# A ModuleHolder subclass for AdaptiveAvgPool1dImpl. See the documentation for AdaptiveAvgPool1dImpl class to learn what methods it provides, and examples of how to use AdaptiveAvgPool1d with torch::nn::AdaptiveAvgPool1dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = AdaptiveAvgPool1dImpl# class AdaptiveAvgPool1dImpl : public torch::nn::AdaptiveAvgPoolImpl\u003c1, ExpandingArray\u003c1\u003e, AdaptiveAvgPool1dImpl\u003e# Applies adaptive avgpool over a 1-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.AdaptiveAvgPool1d to learn about the exact behavior of this module. See the documentation for torch::nn::AdaptiveAvgPool1dOptions class to learn what constructor arguments are supported for this module. Example: AdaptiveAvgPool1d model(AdaptiveAvgPool1dOptions(5)); Public Functions Tensor forward(const Tensor \u0026input)# class AdaptiveAvgPool2d : public torch::nn::ModuleHolder\u003cAdaptiveAvgPool2dImpl\u003e# A ModuleHolder subclass for AdaptiveAvgPool2dImpl. See the documentation for AdaptiveAvgPool2dImpl class to learn what methods it provides, and examples of how to use AdaptiveAvgPool2d with torch::nn::AdaptiveAvgPool2dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = AdaptiveAvgPool2dImpl# class AdaptiveAvgPool2dImpl : public torch::nn::AdaptiveAvgPoolImpl\u003c2, ExpandingArrayWithOptionalElem\u003c2\u003e, AdaptiveAvgPool2dImpl\u003e# Applies adaptive avgpool over a 2-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.AdaptiveAvgPool2d to learn about the exact behavior of this module. See the documentation for torch::nn::AdaptiveAvgPool2dOptions class to learn what constructor arguments are supported for this module. Example: AdaptiveAvgPool2d model(AdaptiveAvgPool2dOptions({3, 2})); Public Functions Tensor forward(const Tensor \u0026input)# class AdaptiveAvgPool3d : public torch::nn::ModuleHolder\u003cAdaptiveAvgPool3dImpl\u003e# A ModuleHolder subclass for AdaptiveAvgPool3dImpl. See the documentation for AdaptiveAvgPool3dImpl class to learn what methods it provides, and examples of how to use AdaptiveAvgPool3d with torch::nn::AdaptiveAvgPool3dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = AdaptiveAvgPool3dImpl# class AdaptiveAvgPool3dImpl : public torch::nn::AdaptiveAvgPoolImpl\u003c3, ExpandingArrayWithOptionalElem\u003c3\u003e, AdaptiveAvgPool3dImpl\u003e# Applies adaptive avgpool over a 3-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.AdaptiveAvgPool3d to learn about the exact behavior of this module. See the documentation for torch::nn::AdaptiveAvgPool3dOptions class to learn what constructor arguments are supported for this module. Example: AdaptiveAvgPool3d model(AdaptiveAvgPool3dOptions(3)); Public Functions Tensor forward(const Tensor \u0026input)# Example: // Output will always be 7x7 regardless of input size auto adaptive_pool = torch::nn::AdaptiveAvgPool2d( torch::nn::AdaptiveAvgPool2dOptions({7, 7})); AdaptiveMaxPool1d / AdaptiveMaxPool2d / AdaptiveMaxPool3d# class AdaptiveMaxPool1d : public torch::nn::ModuleHolder\u003cAdaptiveMaxPool1dImpl\u003e# A ModuleHolder subclass for AdaptiveMaxPool1dImpl. See the documentation for AdaptiveMaxPool1dImpl class to learn what methods it provides, and examples of how to use AdaptiveMaxPool1d with torch::nn::AdaptiveMaxPool1dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = AdaptiveMaxPool1dImpl# class AdaptiveMaxPool1dImpl : public torch::nn::AdaptiveMaxPoolImpl\u003c1, ExpandingArray\u003c1\u003e, AdaptiveMaxPool1dImpl\u003e# Applies adaptive maxpool over a 1-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.AdaptiveMaxPool1d to learn about the exact behavior of this module. See the documentation for torch::nn::AdaptiveMaxPool1dOptions class to learn what constructor arguments are supported for this module. Example: AdaptiveMaxPool1d model(AdaptiveMaxPool1dOptions(3)); Public Functions Tensor forward(const Tensor \u0026input)# std::tuple\u003cTensor, Tensor\u003e forward_with_indices(const Tensor \u0026input)# Returns the indices along with the outputs. Useful to pass to nn.MaxUnpool1d. class AdaptiveMaxPool2d : public torch::nn::ModuleHolder\u003cAdaptiveMaxPool2dImpl\u003e# A ModuleHolder subclass for AdaptiveMaxPool2dImpl. See the documentation for AdaptiveMaxPool2dImpl class to learn what methods it provides, and examples of how to use AdaptiveMaxPool2d with torch::nn::AdaptiveMaxPool2dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = AdaptiveMaxPool2dImpl# class AdaptiveMaxPool2dImpl : public torch::nn::AdaptiveMaxPoolImpl\u003c2, ExpandingArrayWithOptionalElem\u003c2\u003e, AdaptiveMaxPool2dImpl\u003e# Applies adaptive maxpool over a 2-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.AdaptiveMaxPool2d to learn about the exact behavior of this module. See the documentation for torch::nn::AdaptiveMaxPool2dOptions class to learn what constructor arguments are supported for this module. Example: AdaptiveMaxPool2d model(AdaptiveMaxPool2dOptions({3, 2})); Public Functions Tensor forward(const Tensor \u0026input)# std::tuple\u003cTensor, Tensor\u003e forward_with_indices(const Tensor \u0026input)# Returns the indices along with the outputs. Useful to pass to nn.MaxUnpool2d. class AdaptiveMaxPool3d : public torch::nn::ModuleHolder\u003cAdaptiveMaxPool3dImpl\u003e# A ModuleHolder subclass for AdaptiveMaxPool3dImpl. See the documentation for AdaptiveMaxPool3dImpl class to learn what methods it provides, and examples of how to use AdaptiveMaxPool3d with torch::nn::AdaptiveMaxPool3dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = AdaptiveMaxPool3dImpl# class AdaptiveMaxPool3dImpl : public torch::nn::AdaptiveMaxPoolImpl\u003c3, ExpandingArrayWithOptionalElem\u003c3\u003e, AdaptiveMaxPool3dImpl\u003e# Applies adaptive maxpool over a 3-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.AdaptiveMaxPool3d to learn about the exact behavior of this module. See the documentation for torch::nn::AdaptiveMaxPool3dOptions class to learn what constructor arguments are supported for this module. Example: AdaptiveMaxPool3d model(AdaptiveMaxPool3dOptions(3)); Public Functions Tensor forward(const Tensor \u0026input)# std::tuple\u003cTensor, Tensor\u003e forward_with_indices(const Tensor \u0026input)# Returns the indices along with the outputs. Useful to pass to nn.MaxUnpool3d. FractionalMaxPool2d / FractionalMaxPool3d# class FractionalMaxPool2d : public torch::nn::ModuleHolder\u003cFractionalMaxPool2dImpl\u003e# A ModuleHolder subclass for FractionalMaxPool2dImpl. See the documentation for FractionalMaxPool2dImpl class to learn what methods it provides, and examples of how to use FractionalMaxPool2d with torch::nn::FractionalMaxPool2dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = FractionalMaxPool2dImpl# class FractionalMaxPool2dImpl : public torch::nn::Cloneable\u003cFractionalMaxPool2dImpl\u003e# Applies fractional maxpool over a 2-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.FractionalMaxPool2d to learn about the exact behavior of this module. See the documentation for torch::nn::FractionalMaxPool2dOptions class to learn what constructor arguments are supported for this module. Example: FractionalMaxPool2d model(FractionalMaxPool2dOptions(5).output_size(1)); Public Functions inline FractionalMaxPool2dImpl(ExpandingArray\u003c2\u003e kernel_size)# explicit FractionalMaxPool2dImpl(FractionalMaxPool2dOptions options_)# virtual void reset() override# reset() must perform initialization of all members with reference semantics, most importantly parameters, buffers and submodules. virtual void pretty_print(std::ostream \u0026stream) const override# Pretty prints the FractionalMaxPool2d module into the given stream. Tensor forward(const Tensor \u0026input)# std::tuple\u003cTensor, Tensor\u003e forward_with_indices(const Tensor \u0026input)# Returns the outputs and the indices of the max values. Useful for torch::nn::MaxUnpool2d later. Public Members FractionalMaxPool2dOptions options# The options with which this Module was constructed. Tensor _random_samples# class FractionalMaxPool3d : public torch::nn::ModuleHolder\u003cFractionalMaxPool3dImpl\u003e# A ModuleHolder subclass for FractionalMaxPool3dImpl. See the documentation for FractionalMaxPool3dImpl class to learn what methods it provides, and examples of how to use FractionalMaxPool3d with torch::nn::FractionalMaxPool3dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = FractionalMaxPool3dImpl# class FractionalMaxPool3dImpl : public torch::nn::Cloneable\u003cFractionalMaxPool3dImpl\u003e# Applies fractional maxpool over a 3-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.FractionalMaxPool3d to learn about the exact behavior of this module. See the documentation for torch::nn::FractionalMaxPool3dOptions class to learn what constructor arguments are supported for this module. Example: FractionalMaxPool3d model(FractionalMaxPool3dOptions(5).output_size(1)); Public Functions inline FractionalMaxPool3dImpl(ExpandingArray\u003c3\u003e kernel_size)# explicit FractionalMaxPool3dImpl(FractionalMaxPool3dOptions options_)# virtual void reset() override# reset() must perform initialization of all members with reference semantics, most importantly parameters, buffers and submodules. virtual void pretty_print(std::ostream \u0026stream) const override# Pretty prints the FractionalMaxPool3d module into the given stream. Tensor forward(const Tensor \u0026input)# std::tuple\u003cTensor, Tensor\u003e forward_with_indices(const Tensor \u0026input)# Returns the outputs and the indices of the max values. Useful for torch::nn::MaxUnpool3d later. Public Members FractionalMaxPool3dOptions options# The options with which this Module was constructed. Tensor _random_samples# MaxUnpool1d / MaxUnpool2d / MaxUnpool3d# Computes a partial inverse of MaxPool, using the indices of the maximum values computed during pooling to place values back into unpooled positions. class MaxUnpool1d : public torch::nn::ModuleHolder\u003cMaxUnpool1dImpl\u003e# A ModuleHolder subclass for MaxUnpool1dImpl. See the documentation for MaxUnpool1dImpl class to learn what methods it provides, and examples of how to use MaxUnpool1d with torch::nn::MaxUnpool1dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = MaxUnpool1dImpl# class MaxUnpool1dImpl : public torch::nn::MaxUnpoolImpl\u003c1, MaxUnpool1dImpl\u003e# Applies maxunpool over a 1-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.MaxUnpool1d to learn about the exact behavior of this module. See the documentation for torch::nn::MaxUnpool1dOptions class to learn what constructor arguments are supported for this module. Example: MaxUnpool1d model(MaxUnpool1dOptions(3).stride(2).padding(1)); Public Functions Tensor forward(const Tensor \u0026input, const Tensor \u0026indices, const std::optional\u003cstd::vector\u003cint64_t\u003e\u003e \u0026output_size = std::nullopt)# Friends friend struct torch::nn::AnyModuleHolder class MaxUnpool2d : public torch::nn::ModuleHolder\u003cMaxUnpool2dImpl\u003e# A ModuleHolder subclass for MaxUnpool2dImpl. See the documentation for MaxUnpool2dImpl class to learn what methods it provides, and examples of how to use MaxUnpool2d with torch::nn::MaxUnpool2dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = MaxUnpool2dImpl# class MaxUnpool2dImpl : public torch::nn::MaxUnpoolImpl\u003c2, MaxUnpool2dImpl\u003e# Applies maxunpool over a 2-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.MaxUnpool2d to learn about the exact behavior of this module. See the documentation for torch::nn::MaxUnpool2dOptions class to learn what constructor arguments are supported for this module. Example: MaxUnpool2d model(MaxUnpool2dOptions(3).stride(2).padding(1)); Public Functions Tensor forward(const Tensor \u0026input, const Tensor \u0026indices, const std::optional\u003cstd::vector\u003cint64_t\u003e\u003e \u0026output_size = std::nullopt)# Friends friend struct torch::nn::AnyModuleHolder class MaxUnpool3d : public torch::nn::ModuleHolder\u003cMaxUnpool3dImpl\u003e# A ModuleHolder subclass for MaxUnpool3dImpl. See the documentation for MaxUnpool3dImpl class to learn what methods it provides, and examples of how to use MaxUnpool3d with torch::nn::MaxUnpool3dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = MaxUnpool3dImpl# class MaxUnpool3dImpl : public torch::nn::MaxUnpoolImpl\u003c3, MaxUnpool3dImpl\u003e# Applies maxunpool over a 3-D input. See https://pytorch.org/docs/main/nn.html#torch.nn.MaxUnpool3d to learn about the exact behavior of this module. See the documentation for torch::nn::MaxUnpool3dOptions class to learn what constructor arguments are supported for this module. Example: MaxUnpool3d model(MaxUnpool3dOptions(3).stride(2).padding(1)); Public Functions Tensor forward(const Tensor \u0026input, const Tensor \u0026indices, const std::optional\u003cstd::vector\u003cint64_t\u003e\u003e \u0026output_size = std::nullopt)# Friends friend struct torch::nn::AnyModuleHolder Example: auto pool = torch::nn::MaxPool2d( torch::nn::MaxPool2dOptions(2).stride(2).return_indices(true)); auto unpool = torch::nn::MaxUnpool2d( torch::nn::MaxUnpoolOptions\u003c2\u003e(2).stride(2)); auto [output, indices] = pool-\u003eforward_with_indices(input); auto reconstructed = unpool-\u003eforward(output, indices); LPPool1d / LPPool2d / LPPool3d# class LPPool1d : public torch::nn::ModuleHolder\u003cLPPool1dImpl\u003e# A ModuleHolder subclass for LPPool1dImpl. See the documentation for LPPool1dImpl class to learn what methods it provides, and examples of how to use LPPool1d with torch::nn::LPPool1dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = LPPool1dImpl# class LPPool1dImpl : public torch::nn::LPPoolImpl\u003c1, LPPool1dImpl\u003e# Applies the LPPool1d function element-wise. See https://pytorch.org/docs/main/nn.html#torch.nn.LPPool1d to learn about the exact behavior of this module. See the documentation for torch::nn::LPPool1dOptions class to learn what constructor arguments are supported for this module. Example: LPPool1d model(LPPool1dOptions(1, 2).stride(5).ceil_mode(true)); Public Functions Tensor forward(const Tensor \u0026input)# class LPPool2d : public torch::nn::ModuleHolder\u003cLPPool2dImpl\u003e# A ModuleHolder subclass for LPPool2dImpl. See the documentation for LPPool2dImpl class to learn what methods it provides, and examples of how to use LPPool2d with torch::nn::LPPool2dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = LPPool2dImpl# class LPPool2dImpl : public torch::nn::LPPoolImpl\u003c2, LPPool2dImpl\u003e# Applies the LPPool2d function element-wise. See https://pytorch.org/docs/main/nn.html#torch.nn.LPPool2d to learn about the exact behavior of this module. See the documentation for torch::nn::LPPool2dOptions class to learn what constructor arguments are supported for this module. Example: LPPool2d model(LPPool2dOptions(1, std::vector\u003cint64_t\u003e({3, 4})).stride({5, 6}).ceil_mode(true)); Public Functions Tensor forward(const Tensor \u0026input)# class LPPool3d : public torch::nn::ModuleHolder\u003cLPPool3dImpl\u003e# A ModuleHolder subclass for LPPool3dImpl. See the documentation for LPPool3dImpl class to learn what methods it provides, and examples of how to use LPPool3d with torch::nn::LPPool3dOptions. See the documentation for ModuleHolder to learn about PyTorch\u2019s module storage semantics. Public Types using Impl = LPPool3dImpl# class LPPool3dImpl : public torch::nn::LPPoolImpl\u003c3, LPPool3dImpl\u003e# Applies the LPPool3d function element-wise. See https://pytorch.org/docs/main/nn.html#torch.nn.LPPool3d to learn about the exact behavior of this module. See the documentation for torch::nn::LPPool3dOptions class to learn what constructor arguments are supported for this module. Example: LPPool3d model(LPPool3dOptions(1, std::vector\u003cint64_t\u003e({3, 4, 5})).stride( {5, 6, 7}).ceil_mode(true)); Public Functions Tensor forward(const Tensor \u0026input)#",
"author": {
"@type": "Organization",
"name": "PyTorch Contributors",
"url": "https://pytorch.org"
},
"image": "https://pytorch.org/docs/stable/_static/img/pytorch_seo.png",
"mainEntityOfPage": {
"@type": "WebPage",
"@id": "/api/nn/pooling.html"
},
"datePublished": "2023-01-01T00:00:00Z",
"dateModified": "2023-01-01T00:00:00Z"
}
| docsearch:language | en |
| llm:site-type | documentation |
| llm:framework | PyTorch |
| llm:description | Pooling layers in PyTorch C++ — MaxPool, AvgPool, AdaptiveMaxPool, AdaptiveAvgPool, and LPPool. |
| llm:navigation-file | https://pytorch.org/docs/stable/llms.txt |
| llm:sitemap | https://pytorch.org/docs/stable/sitemap.xml |
| llm:version | main |
| llm:project | PyTorch |
| llm:page-type | documentation |
| og:image | https://docs.pytorch.org/docs/stable/_static/img/pytorch_seo.png |
| None | 3 |
Links:
Viewport: width=device-width, initial-scale=1