#[non_exhaustive]#[repr(u16)]pub enum SoftmaxKind {
Softmax = 0,
LogSoftmax = 1,
GumbelSoftmax = 2,
Sparsemax = 3,
}Expand description
Softmax-family op discriminant — category H from the comprehensive plan.
Stored as u16 in crate::KernelSku::op when
category == OpCategory::Softmax. All variants apply a
length-preserving transform along a single axis (output shape ==
input shape — distinct from reductions, like scans).
Today wired: {Softmax, LogSoftmax} × {f32, f16, bf16, f64} —
FW + BW. GumbelSoftmax (needs RNG state from Phase 4 random) and
Sparsemax (different gradient — projection onto simplex) are
reserved-but-deferred.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Softmax = 0
y[k] = exp(x[k] - max(x)) / Σ_j exp(x[j] - max(x))
— numerically stable softmax.
LogSoftmax = 1
y[k] = x[k] - logsumexp(x) — log-domain softmax, also stable.
Output is the elementwise log of Softmax(x).
GumbelSoftmax = 2
y = (x + Gumbel(0,1)) / τ → softmax — reserved.
Sparsemax = 3
y = ProjSimplex(x) — reserved (different gradient than softmax).
Trait Implementations§
Source§impl Clone for SoftmaxKind
impl Clone for SoftmaxKind
Source§fn clone(&self) -> SoftmaxKind
fn clone(&self) -> SoftmaxKind
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 SoftmaxKind
Source§impl Debug for SoftmaxKind
impl Debug for SoftmaxKind
impl Eq for SoftmaxKind
Source§impl Hash for SoftmaxKind
impl Hash for SoftmaxKind
Source§impl PartialEq for SoftmaxKind
impl PartialEq for SoftmaxKind
Source§fn eq(&self, other: &SoftmaxKind) -> bool
fn eq(&self, other: &SoftmaxKind) -> bool
self and other values to be equal, and is used by ==.