#[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.
Trait Implementations§
impl Copy for ReduceOp
impl Eq for ReduceOp
impl StructuralPartialEq for ReduceOp
Auto Trait Implementations§
impl Freeze for ReduceOp
impl RefUnwindSafe for ReduceOp
impl Send for ReduceOp
impl Sync for ReduceOp
impl Unpin for ReduceOp
impl UnsafeUnpin for ReduceOp
impl UnwindSafe for ReduceOp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more