Skip to main content

avgpool2d_forward

Function avgpool2d_forward 

Source
pub fn avgpool2d_forward<T: Triton, D: Num, const KH: i32, const KW: i32, const STRIDE_H: i32, const STRIDE_W: i32, const BLOCK_OW: i32>(
    input_ptr: T::Pointer<D>,
    output_ptr: T::Pointer<D>,
    _B: i32,
    C: i32,
    H: i32,
    W: i32,
    OH: i32,
    OW: i32,
)
where T::I32Tensor: Tensor<i32, 1> + Comparison<i32, BoolTensor = T::BoolTensor>, T::Pointer<D>: AddOffsets<i32, 1, T::I32Tensor, Output = T::Tensor<T::Pointer<D>>>,
Expand description

2-D average-pooling forward pass.

Grid: one flat 1-D pid per (b, c, oh, ow-tile) combination: pid = ((b * C + c) * OH + oh) * num_ow_tiles + ow_tile

Each CTA accumulates a BLOCK_OW-wide strip of output columns via a flat loop over all KH×KW kernel positions (avoids nested scf.for).

Constraints: no padding; OH = (H - KH) / STRIDE_H + 1, OW = (W - KW) / STRIDE_W + 1.