Skip to content
fn

max_axis_f32

void max_axis_f32(const float * in, float * out, int outer, int reduce_dim, int inner)

Reduces a single axis by elementwise maximum into a packed (outer, inner) output.

The kernel always uses the generic axis_reduce template — Accelerate does not expose a stride-aware vDSP equivalent for max with the same semantics, so vectorisation is left to the compiler. Initial accumulator is -inf which means an empty reduce dimension yields -inf per cell.

Math

out[o,i]=max⁡rin[o,r,i].\text{out}[o, i] = \max_{r} \text{in}[o, r, i].

Parameters

inconst float*
Source buffer of shape (outer, reduce_dim, inner).
outfloat*
Destination buffer of shape (outer, inner).
outer, reduce_dim, innerstd::size_t
Layout extents; see sum_axis_f32.

Notes

NaN propagation follows the C++ a > b semantics: a NaN on either side of the comparison loses, so a NaN element will not necessarily survive the reduction. Downstream code that requires NaN-poisoning must guard explicitly.