fn
max_pool2d_forward_f32
void max_pool2d_forward_f32(const float * x, float * y, int * argmax, int B, int C, int H, int W, int KH, int KW, int OH, int OW, int stride_h, int stride_w, int pad_h, int pad_w)Single-precision 2-D max-pool forward over an NCHW input.
For every output cell the kernel scans the corresponding KH × KW
window and writes both the maximum into y and the flat H*W index
of the winning input position into argmax. Pad positions contribute
-inf (an all-pad window yields the first pad slot as the argmax).
Shape
, analogously for .
Parameters
xconst float*Input tensor of shape
(B, C, H, W).yfloat*Output tensor of shape
(B, C, OH, OW).argmaxint32_t*Per-output winning input position, encoded as
h*W + w within the 2-D spatial slice; shape (B, C, OH, OW).B, C, H, WintLayout extents of
x.KH, KWintWindow height and width.
OH, OWintOutput spatial extents.
stride_h, stride_wintWindow stride along H and W.
pad_h, pad_wintSymmetric zero-pad on each spatial axis.