Skip to main content

InterventionAction

Enum InterventionAction 

Source
pub enum InterventionAction {
    Zero {
        dtype: InterventionDtype,
    },
    Scale {
        dtype: InterventionDtype,
        factor: f32,
    },
    Mask {
        dtype: InterventionDtype,
        shape: Vec<u64>,
        keep: Vec<bool>,
    },
    Replace {
        tensor: InterventionTensor,
    },
    Add {
        tensor: InterventionTensor,
    },
    MaskLogits {
        dtype: InterventionDtype,
        token_ids: Vec<u32>,
    },
    ExcludeExperts {
        expert_ids: Vec<u32>,
    },
    ZeroExpertContribution {
        expert_ids: Vec<u32>,
    },
    BiasRoutingScores {
        stage: RoutingScoreStage,
        expert_ids: Vec<u32>,
        biases: Vec<f32>,
    },
    ForceExperts {
        shape: [u64; 2],
        expert_ids: Vec<u32>,
    },
}
Expand description

One typed mutation. No variant contains native handles or executable code.

Variants§

§

Zero

Zero selected elements; retains dtype and shape.

Fields

§dtype: InterventionDtype

Required runtime storage dtype.

§

Scale

Native multiplication; the finite scalar must be representable in the dtype.

Fields

§dtype: InterventionDtype

Required runtime storage dtype.

§factor: f32

Finite scalar, with native dtype rounding.

§

Mask

False entries become zero; shape must exactly equal the selected region.

Fields

§dtype: InterventionDtype

Required runtime storage dtype.

§shape: Vec<u64>

Complete selected extents.

§keep: Vec<bool>

Row-major keep bits.

§

Replace

Whole-value replacement or patching according to the explicit axis slices.

Fields

§tensor: InterventionTensor

Complete exact-dtype selected values.

§

Add

Elementwise addition; supports typed logit bias without a second sampler.

Fields

§tensor: InterventionTensor

Complete exact-dtype selected values.

§

MaskLogits

Negative-infinity mask at final logits; selection must retain full vocabulary.

Fields

§dtype: InterventionDtype

Required runtime storage dtype.

§token_ids: Vec<u32>

Unique canonical vocabulary IDs.

§

ExcludeExperts

Eligibility exclusion before the architecture’s existing selection algorithm. Gathered scores retain ordinary normalization and scaling semantics.

Fields

§expert_ids: Vec<u32>

Unique global routed-expert IDs.

§

ZeroExpertContribution

Suppress selected contributions without reselection or renormalization. Remaining coefficients retain their original magnitude. Expert computation is not promised to be avoided. Shared experts remain unchanged.

Fields

§expert_ids: Vec<u32>

Unique global routed-expert IDs.

§

BiasRoutingScores

Per-expert bias replicated explicitly over the selected token rows.

Fields

§stage: RoutingScoreStage

Precise scoring boundary.

§expert_ids: Vec<u32>

Unique global routed-expert IDs.

§biases: Vec<f32>

One finite additive bias per listed expert.

§

ForceExperts

Replace selected IDs before dispatch. Scores/weights are gathered from the architecture’s router, preserving its normalization, scaling and learned multipliers. There is no caller coefficient override.

Fields

§shape: [u64; 2]

Exact [selected_token_rows, top_k] extents.

§expert_ids: Vec<u32>

Complete row-major global routed-expert IDs.

Implementations§

Source§

impl InterventionAction

Source

pub fn validate_activation_region( &self, dtype: InterventionDtype, shape: &[u64], ) -> Result<(), CaptureError>

Revalidates complete host parameters against an exact native selected region.

Source

pub fn kind(&self) -> InterventionKind

Exact operation category.

Source

pub fn dtype(&self) -> Option<InterventionDtype>

Exact activation dtype, absent for architecture-owned routing arithmetic.

Trait Implementations§

Source§

impl Clone for InterventionAction

Source§

fn clone(&self) -> InterventionAction

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InterventionAction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for InterventionAction

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for InterventionAction

Source§

fn eq(&self, other: &InterventionAction) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for InterventionAction

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for InterventionAction

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.