#[non_exhaustive]#[repr(u16)]pub enum ReduceToOp {
Sum = 0,
Max = 2,
Min = 3,
Prod = 4,
}Expand description
Broadcast-reverse reduction op discriminant — ReduceToPlan.
The autograd primitive that undoes a forward BroadcastTo: for
each output cell, reduce every input cell that broadcasts TO it.
Distinct from ReduceKind because the reduction collapses an
arbitrary set of axes in one launch (every dim where
output_shape[d] == 1 while input_shape[d] != 1) rather than a
single reduce_axis, so dispatch goes through its own plan shape
(ReduceToPlan<T, N> in baracuda-kernels).
Discriminants mirror ReduceKind’s values for the same logical
op so KernelSku::op tags consistently across the reduction
family (hence the gap at 1 — there is no broadcast-reverse Mean).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Sum = 0
Sum over the broadcast set. Identity on an empty reduce set
(any reduced input_shape[d] == 0): 0.
Max = 2
Maximum over the broadcast set. Identity on an empty reduce
set: -FLT_MAX / -DBL_MAX per the kernel’s AccMax policy —
the most-negative finite value for f32 / f64 outputs. For
f16 / bf16 the f32 identity overflows the storage dtype on the
final narrowing store and lands as -inf.
Min = 3
Minimum over the broadcast set. Identity on an empty reduce
set: +FLT_MAX / +DBL_MAX per the kernel’s AccMin policy —
the most-positive finite value for f32 / f64 outputs; +inf
for f16 / bf16 (same narrowing overflow as Self::Max).
Prod = 4
Product over the broadcast set. Identity on an empty reduce
set: 1.
Trait Implementations§
Source§impl Clone for ReduceToOp
impl Clone for ReduceToOp
Source§fn clone(&self) -> ReduceToOp
fn clone(&self) -> ReduceToOp
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ReduceToOp
Source§impl Debug for ReduceToOp
impl Debug for ReduceToOp
impl Eq for ReduceToOp
Source§impl Hash for ReduceToOp
impl Hash for ReduceToOp
Source§impl PartialEq for ReduceToOp
impl PartialEq for ReduceToOp
Source§fn eq(&self, other: &ReduceToOp) -> bool
fn eq(&self, other: &ReduceToOp) -> bool
self and other values to be equal, and is used by ==.