pub struct NgramDims {
pub vocab_size: u64,
pub ratio: u64,
pub neighbor_num: usize,
pub split_num: usize,
pub eos_token_id: u32,
pub hidden_size: usize,
}Expand description
2026-09-25: The n-gram dimensions, read from ModelConfig.
Fields§
§vocab_size: u64§ratio: u64§neighbor_num: usize2026-09-25: Largest n-gram size N.
split_num: usize2026-09-25: Hash splits K per n-gram size.
eos_token_id: u32Implementations§
Source§impl NgramDims
impl NgramDims
pub fn from_config(c: &ModelConfig) -> Option<Self>
pub fn num_tables(&self) -> usize
Sourcepub fn table_dim(&self) -> usize
pub fn table_dim(&self) -> usize
2026-09-25: Per-table embedding dim, hidden_size / num_tables()
(integer division).
Sourcepub fn table_rows(&self, index: usize) -> u64
pub fn table_rows(&self, index: usize) -> u64
2026-09-25: Row count of table index: ratio*vocab + 2*index + 1,
so the K tables of one n-gram size have distinct sizes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NgramDims
impl RefUnwindSafe for NgramDims
impl Send for NgramDims
impl Sync for NgramDims
impl Unpin for NgramDims
impl UnwindSafe for NgramDims
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