Skip to content
fn

avg_pool2d_backward_f32

void avg_pool2d_backward_f32(const float * g, float * dx, 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, bool count_include_pad)

Single-precision 2-D average-pool backward — broadcasts each upstream gradient back over its source window with the fixed 1/(KH*KW) weight.

dx is accumulated and must be zeroed by the caller because overlapping windows write to overlapping input slots.

Parameters

gconst float*
Upstream gradient of shape (B, C, OH, OW).
dxfloat*
Output gradient of shape (B, C, H, W); accumulated.
B, C, H, W, KH, KW, OH, OW, stride_h, stride_w, pad_h, pad_wint
Layout and window parameters matching the forward call.