Skip to main content

Dflash2Head

Struct Dflash2Head 

Source
pub struct Dflash2Head {
    pub attn_conv: Vec<Dflash2Conv>,
    pub mlp_conv: Vec<Dflash2Conv>,
    pub hidden_proj: GpuTensor,
    pub pred_codebook: Vec<u8>,
    pub succ_codebook: Vec<u8>,
    pub rank: usize,
    pub top_k: usize,
    pub conv_k: usize,
    pub group_size: usize,
    pub vocab: usize,
}

Fields§

§attn_conv: Vec<Dflash2Conv>§mlp_conv: Vec<Dflash2Conv>§hidden_proj: GpuTensor

candidate_selector.hidden_projection.weight [rank, hidden].

§pred_codebook: Vec<u8>

Codebooks [V, rank] raw bf16, HOST-resident: the walk gathers ~1+16 rows per draft slot (~70KB/round) — host math beside the round’s existing chain dtoh, no device residency for 2x127MB tables. Checkpoint quirk: stored WITHOUT the .weight suffix (reference from_pretrained installs a key_mapping).

§succ_codebook: Vec<u8>§rank: usize§top_k: usize§conv_k: usize§group_size: usize§vocab: usize

Implementations§

Source§

impl Dflash2Head

Source

pub fn walk_greedy( &self, unary: &[f32], cand: &[u32], hproj: &[f32], anchor: u32, nd: usize, ) -> Vec<u32>

Greedy selector walk over this head’s codebooks — see dflash2_walk_greedy.

Source

pub fn walk_sampled( &self, unary: &[f32], cand: &[u32], hproj: &[f32], anchor: u32, nd: usize, temp: f32, uniforms: &mut dyn FnMut() -> f32, ) -> (Vec<u32>, Vec<f32>, Vec<f32>)

Sampled (T>0) selector walk — see dflash2_walk_sampled.

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<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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.