Skip to content
fn

max_pool1d_forward_f32

void max_pool1d_forward_f32(const float * x, float * y, int * argmax, int B, int C, int L, int KL, int OL, int stride_l, int pad_l)

Single-precision 1-D max-pool forward over an NCL-laid-out input.

For each output element the kernel scans the corresponding KL-wide window and records both the maximum value into y and the flat position within the L dimension of the input row into argmax. Out-of-bounds (pad) positions contribute -inf and so never win unless the whole window is padding (in which case the first pad slot wins).

Shape

OL=⌊(L+2⋅pad_l−KL)/stride_l⌋+1\text{OL} = \lfloor (L + 2 \cdot \text{pad\_l} - \text{KL}) / \text{stride\_l}\rfloor + 1.

See Also

max_pool1d_backward_f32 : Reverse pass that consumes argmax.

Parameters

xconst float*
Input tensor of shape (B, C, L).
yfloat*
Output tensor of shape (B, C, OL).
argmaxint32_t*
Companion buffer of shape (B, C, OL) holding the winning L-axis index of each output element; consumed by the backward kernel.
B, C, Lint
Batch, channel, and spatial extents of x.
KLint
Pool window length.
OLint
Spatial extent of y; caller computes it as (L + 2*pad_l - KL) / stride_l + 1.
stride_l, pad_lint
Window stride and symmetric zero-pad on the L axis.