Skip to content
fn

max_pool2d_op

→TensorImplPtr
int max_pool2d_op(const int & x, int KH, int KW, int stride_h, int stride_w, int pad_h, int pad_w, bool ceil_mode)

Python wrappers

Public Python APIs implemented by this engine symbol.

Two-dimensional max pooling over a batch of feature maps.

Emits the maximum of each KH×KWKH \times KW sliding window. Provides local translation invariance and is the canonical downsampling primitive in convolutional classification networks.

Parameters

xTensorImplPtr
Input of shape (B, C, H, W).
KH, KWint
Per-axis window size.
stride_h, stride_wint= None
Per-axis stride. 0 is a sentinel meaning "use K". Default: 0.
pad_h, pad_wint= None
Per-axis zero-padding. Default: 0.

Returns

TensorImplPtr

Output of shape (B, C, H_out, W_out) with Hout=⌊(H+2ph−KH)/sh+1⌋H_\text{out} = \lfloor (H + 2 p_h - KH)/s_h + 1 \rfloor and analogously for WoutW_\text{out}.