#[non_exhaustive]#[repr(u16)]pub enum TernaryKind {
Clamp = 0,
Fma = 1,
Addcmul = 2,
Addcdiv = 3,
Where = 4,
}Expand description
Ternary elementwise op discriminant.
Stored as u16 in crate::KernelSku::op when
category == OpCategory::TernaryElementwise. Same-dtype-input,
same-dtype-output ops only — Self::Where (which takes a bool
cond + two value tensors) is reserved here but won’t be wired via
the same-dtype TernaryPlan<T, N>; it gets its own plan shape in
a future session.
Today only Self::Clamp on f32 is wired — the Phase 3 ternary
trailblazer SKU. The remaining ops + non-f32 dtypes follow in
fanout sessions.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Clamp = 0
y = min(max(x, lo), hi) — clamp x to [lo, hi]. Trailblazer.
Fma = 1
y = a * b + c — fused multiply-add. PyTorch torch.addcmul(c, a, b)
with value = 1.
Addcmul = 2
y = self + value * t1 * t2 — PyTorch addcmul. Reserved for
a future parameterized-ternary path (the scalar value is a
runtime parameter, not a tensor operand).
Addcdiv = 3
y = self + value * t1 / t2 — PyTorch addcdiv. Same
parameterization story as Addcmul.
Where = 4
y = cond ? a : b — element-select. Heterogeneous-dtype inputs
(cond is bool, a / b match output type) — needs its own plan
shape, won’t be wired via the same-dtype TernaryPlan.
Trait Implementations§
Source§impl Clone for TernaryKind
impl Clone for TernaryKind
Source§fn clone(&self) -> TernaryKind
fn clone(&self) -> TernaryKind
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 TernaryKind
Source§impl Debug for TernaryKind
impl Debug for TernaryKind
impl Eq for TernaryKind
Source§impl Hash for TernaryKind
impl Hash for TernaryKind
Source§impl PartialEq for TernaryKind
impl PartialEq for TernaryKind
Source§fn eq(&self, other: &TernaryKind) -> bool
fn eq(&self, other: &TernaryKind) -> bool
self and other values to be equal, and is used by ==.