<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Accelerate",
  "identifier" : "/documentation/Accelerate/BNNSGraph/Builder/Tensor/pooling(_:kernelSize:strides:padding:ceilingMode:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Accelerate"
    ],
    "preciseIdentifier" : "s:10Accelerate9BNNSGraphO7BuilderV6TensorV7pooling_10kernelSize7strides7padding11ceilingModeAGy__xGAE15PoolingFunctionO_SaySiGApE18ConvolutionPaddingOAE07CeilingK0OtF"
  },
  "title" : "pooling(_:kernelSize:strides:padding:ceilingMode:)"
}
-->

# pooling(_:kernelSize:strides:padding:ceilingMode:)

Adds a pooling operation to the current graph.

```
func pooling(_ function: BNNSGraph.Builder.PoolingFunction, kernelSize: [Int], strides: [Int], padding: BNNSGraph.Builder.PoolingPadding, ceilingMode: BNNSGraph.Builder.CeilingMode) -> BNNSGraph.Builder.Tensor<T>
```

## Parameters

`function`

An enumeration that specifies the pooling function.

`kernelSize`

The size of the pooling kernel.

`strides`

An array that contains the kernel stride for each spatial dimension.

`padding`

An enumeration that specifies that the operation computes the padding from
the input and output shapes. If you specify `custom`, pass twice the number of spatial dimensions.

`ceilingMode`

An enumeration that specifies how the operation rounds when calculating the output size.

## Discussion

This operation assumes the source tensor is in  `(N, C, spatial dimensions...)` format,
where the number of spatial dimensions is either `1` or `2`

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)