Skip to content
fn

adaptive_avg_pool2d_op

→TensorImplPtr
int adaptive_avg_pool2d_op(const int & x, int OH, int OW)

Python wrappers

Public Python APIs implemented by this engine symbol.

Two-dimensional adaptive average-pool to a fixed (OH, OW) grid.

The canonical global average pooling head of modern classification backbones (ResNet, EfficientNet, ConvNeXt, ...) uses OH = OW = 1.

Parameters

xTensorImplPtr
Input of shape (B, C, H, W).
OH, OWint
Target output extents. Must satisfy H % OH == 0 and W % OW == 0.

Returns

TensorImplPtr

Output of shape (B, C, OH, OW).

Raises

ShapeMismatch
If x is not 4-D.
not_implemented
If any spatial axis is not evenly divisible by its target.