#[non_exhaustive]pub enum ReduceOp {
Sum,
Product,
StableProduct,
SumSquares,
Max,
Min,
}Expand description
Runtime reduction operation for dtype-erased full reductions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Sum
Product
StableProduct
Reassociated, overflow/underflow-safe product.
Tracks a signed mantissa and an exact integer exponent per lane, so
factors outside the dtype range do not overflow or underflow a partial.
The reduction is reassociated and threaded like Self::Sum.
A zero, subnormal, infinite or NaN input cannot be represented by the
exponent-tracked accumulator; the affected output is then recomputed in
source order, keeping IEEE propagation (0 * inf = NaN, a zero or an
infinity result) identical to the sequential fold. For integers this is
the reassociated wrapping product and for complex dtypes the
source-order product.
SumSquares
Sum of same-dtype rounded squares.
Each input is first multiplied by itself without FMA contraction, then
accumulated under the same association policy as Self::Sum.
Max
NaN-propagating maximum for f32/f64, ordered maximum for
i32/i64.
Any NaN operand makes the result the canonical NaN of the dtype. The
identity written for an empty reduction is -inf for floats and the
dtype minimum for integers. Complex and bool dtypes are rejected.
When the reduced values contain both -0.0 and +0.0, which zero is
returned is unspecified.
Min
NaN-propagating minimum for f32/f64, ordered minimum for
i32/i64.
Any NaN operand makes the result the canonical NaN of the dtype. The
identity written for an empty reduction is +inf for floats and the
dtype maximum for integers. Complex and bool dtypes are rejected.
When the reduced values contain both -0.0 and +0.0, which zero is
returned is unspecified.