pub struct KvCacheLayoutV1 {
pub schema_version: String,
pub shape_schema_version: String,
pub order: KvLayoutOrder,
pub batch_stride: u64,
pub layer_stride: u64,
pub head_stride: u64,
pub token_stride: u64,
pub dim_stride: u64,
}Expand description
KV cache layout declaration.
Fields§
§schema_version: StringStable schema marker.
shape_schema_version: StringShape schema bound into this layout.
order: KvLayoutOrderPhysical order.
batch_stride: u64Scalar stride for batch.
layer_stride: u64Scalar stride for layer.
head_stride: u64Scalar stride for KV head.
token_stride: u64Scalar stride for token.
dim_stride: u64Scalar stride for head dimension.
Implementations§
Source§impl KvCacheLayoutV1
impl KvCacheLayoutV1
Sourcepub fn canonical(shape: &KvTensorShapeV1) -> Result<Self>
pub fn canonical(shape: &KvTensorShapeV1) -> Result<Self>
Build the canonical contiguous layout for a shape.
Sourcepub fn validate_for_shape(&self, shape: &KvTensorShapeV1) -> Result<()>
pub fn validate_for_shape(&self, shape: &KvTensorShapeV1) -> Result<()>
Validate this layout against a logical shape.
Sourcepub fn digest(&self, shape: &KvTensorShapeV1) -> Result<String>
pub fn digest(&self, shape: &KvTensorShapeV1) -> Result<String>
Stable layout digest.
Trait Implementations§
Source§impl Clone for KvCacheLayoutV1
impl Clone for KvCacheLayoutV1
Source§fn clone(&self) -> KvCacheLayoutV1
fn clone(&self) -> KvCacheLayoutV1
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 KvCacheLayoutV1
impl Debug for KvCacheLayoutV1
Source§impl<'de> Deserialize<'de> for KvCacheLayoutV1
impl<'de> Deserialize<'de> for KvCacheLayoutV1
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 KvCacheLayoutV1
impl PartialEq for KvCacheLayoutV1
Source§fn eq(&self, other: &KvCacheLayoutV1) -> bool
fn eq(&self, other: &KvCacheLayoutV1) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for KvCacheLayoutV1
impl Serialize for KvCacheLayoutV1
impl Eq for KvCacheLayoutV1
impl StructuralPartialEq for KvCacheLayoutV1
Auto Trait Implementations§
impl Freeze for KvCacheLayoutV1
impl RefUnwindSafe for KvCacheLayoutV1
impl Send for KvCacheLayoutV1
impl Sync for KvCacheLayoutV1
impl Unpin for KvCacheLayoutV1
impl UnsafeUnpin for KvCacheLayoutV1
impl UnwindSafe for KvCacheLayoutV1
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.