Skip to content
fn

max_pool2d_backward_f32

void max_pool2d_backward_f32(const float * g, const int * argmax, float * dx, int B, int C, int H, int W, int OH, int OW)

Single-precision 2-D max-pool backward — scatters each upstream gradient onto the input slot that won its pool window (per the forward argmax).

dx is accumulated and must be zeroed by the caller; this allows overlapping windows (stride < kernel) to sum contributions correctly.

Parameters

gconst float*
Upstream gradient of shape (B, C, OH, OW).
argmaxconst int32_t*
Per-output winning h*W + w indices from the matching forward call.
dxfloat*
Output gradient of shape (B, C, H, W); accumulated.
B, C, H, W, OH, OWint
Layout extents.