#[non_exhaustive]#[repr(u16)]pub enum RandomKind {
Uniform = 0,
Normal = 1,
Bernoulli = 2,
Multinomial = 3,
}Expand description
Random / sampling op discriminant.
Stored as u16 in crate::KernelSku::op when
category == OpCategory::Random. Phase 4.5 wires:
Self::Uniform(f32, f64) —y ~ U(low, high)via cuRAND.Self::Normal(f32, f64) —y ~ N(mean, std)via cuRAND.Self::Bernoulli(Bool output) —y = (rand < p) ? 1 : 0via cuRAND uniform + custom threshold kernel.
Multinomial / Randint / exponential / gamma / quasi-random are reserved discriminants for future milestones.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Uniform = 0
y[i] ~ U(low, high) — uniform on the half-open interval. Plan
descriptor param1 = low, param2 = high.
Normal = 1
y[i] ~ N(mean, std) — Gaussian. Plan descriptor
param1 = mean, param2 = stddev.
Bernoulli = 2
y[i] = 1 if uniform < p else 0, Bool output. Plan descriptor
param1 = p. param2 ignored.
Multinomial = 3
y[b] = sample one cell from row probs[b, :] using inverse-CDF
sampling. Phase 46 wires the FlashInfer sort-free Top-K /
Top-P / Min-P / combined Top-K + Top-P samplers under this
discriminant via the TopKTopPSamplingPlan in baracuda-kernels.
Trait Implementations§
Source§impl Clone for RandomKind
impl Clone for RandomKind
Source§fn clone(&self) -> RandomKind
fn clone(&self) -> RandomKind
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for RandomKind
Source§impl Debug for RandomKind
impl Debug for RandomKind
impl Eq for RandomKind
Source§impl Hash for RandomKind
impl Hash for RandomKind
Source§impl PartialEq for RandomKind
impl PartialEq for RandomKind
Source§fn eq(&self, other: &RandomKind) -> bool
fn eq(&self, other: &RandomKind) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for RandomKind
Auto Trait Implementations§
impl Freeze for RandomKind
impl RefUnwindSafe for RandomKind
impl Send for RandomKind
impl Sync for RandomKind
impl Unpin for RandomKind
impl UnsafeUnpin for RandomKind
impl UnwindSafe for RandomKind
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
Mutably borrows from an owned value. Read more