pub struct KvTensorShapeV1 {
pub schema_version: String,
pub role: KvRole,
pub attention_kind: KvAttentionKind,
pub batch: u32,
pub layers: u32,
pub kv_heads: u32,
pub query_heads: u32,
pub tokens: u32,
pub head_dim: u32,
pub dtype: KvDType,
pub rope_state: KvRopeState,
}Expand description
Logical KV tensor shape.
Fields§
§schema_version: StringStable schema marker.
role: KvRoleKey or value role.
attention_kind: KvAttentionKindAttention head sharing geometry.
batch: u32Batch count.
layers: u32Layer count.
kv_heads: u32KV head count.
query_heads: u32Query head count.
tokens: u32Token count.
head_dim: u32Per-head channel dimension.
dtype: KvDTypeSource dtype.
rope_state: KvRopeStateKey RoPE state or not-applicable for values.
Implementations§
Source§impl KvTensorShapeV1
impl KvTensorShapeV1
Sourcepub fn new(
role: KvRole,
attention_kind: KvAttentionKind,
batch: u32,
layers: u32,
kv_heads: u32,
query_heads: u32,
tokens: u32,
head_dim: u32,
dtype: KvDType,
rope_state: KvRopeState,
) -> Self
pub fn new( role: KvRole, attention_kind: KvAttentionKind, batch: u32, layers: u32, kv_heads: u32, query_heads: u32, tokens: u32, head_dim: u32, dtype: KvDType, rope_state: KvRopeState, ) -> Self
Create a shape with the v1 schema marker.
Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate shape invariants that are independent of compression profile.
Sourcepub fn validate_block_dim(&self, block_dim: u32) -> Result<()>
pub fn validate_block_dim(&self, block_dim: u32) -> Result<()>
Validate that the head dimension can be directly compressed by a FibQuant block.
Sourcepub fn vector_count(&self) -> Result<usize>
pub fn vector_count(&self) -> Result<usize>
Number of [batch, layer, kv_head, token] vectors.
Sourcepub fn element_count(&self) -> Result<usize>
pub fn element_count(&self) -> Result<usize>
Number of f32 scalar values in canonical contiguous form.
Trait Implementations§
Source§impl Clone for KvTensorShapeV1
impl Clone for KvTensorShapeV1
Source§fn clone(&self) -> KvTensorShapeV1
fn clone(&self) -> KvTensorShapeV1
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 moreSource§impl Debug for KvTensorShapeV1
impl Debug for KvTensorShapeV1
Source§impl<'de> Deserialize<'de> for KvTensorShapeV1
impl<'de> Deserialize<'de> for KvTensorShapeV1
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 KvTensorShapeV1
impl PartialEq for KvTensorShapeV1
Source§fn eq(&self, other: &KvTensorShapeV1) -> bool
fn eq(&self, other: &KvTensorShapeV1) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for KvTensorShapeV1
impl Serialize for KvTensorShapeV1
impl Eq for KvTensorShapeV1
impl StructuralPartialEq for KvTensorShapeV1
Auto Trait Implementations§
impl Freeze for KvTensorShapeV1
impl RefUnwindSafe for KvTensorShapeV1
impl Send for KvTensorShapeV1
impl Sync for KvTensorShapeV1
impl Unpin for KvTensorShapeV1
impl UnsafeUnpin for KvTensorShapeV1
impl UnwindSafe for KvTensorShapeV1
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.