pub struct StateTensorPolicy {
pub role: StateTensorRole,
pub shape: Vec<StateTensorDimension>,
pub dtype: StateTensorDtype,
pub residency: StateResidencyClass,
pub presence: StateTensorPresence,
}Expand description
Exact semantic role, symbolic shape, and dtype contract for a state tensor.
Fields§
§role: StateTensorRoleMeaning of this tensor within its owner.
shape: Vec<StateTensorDimension>Symbolic shape resolved from batch and prefix geometry.
dtype: StateTensorDtypeAccepted dtype family.
residency: StateResidencyClassAuthoritative live-state residency behavior.
presence: StateTensorPresenceCondition under which persisted caches materialize this tensor.
Implementations§
Source§impl StateTensorPolicy
impl StateTensorPolicy
Sourcepub fn new(
role: StateTensorRole,
shape: Vec<StateTensorDimension>,
dtype: StateTensorDtype,
residency: MutableStateResidency,
) -> Result<Self, CachePolicyError>
pub fn new( role: StateTensorRole, shape: Vec<StateTensorDimension>, dtype: StateTensorDtype, residency: MutableStateResidency, ) -> Result<Self, CachePolicyError>
Constructs and validates a state-tensor policy.
Sourcepub fn new_with_residency(
role: StateTensorRole,
shape: Vec<StateTensorDimension>,
dtype: StateTensorDtype,
residency: StateResidencyClass,
) -> Result<Self, CachePolicyError>
pub fn new_with_residency( role: StateTensorRole, shape: Vec<StateTensorDimension>, dtype: StateTensorDtype, residency: StateResidencyClass, ) -> Result<Self, CachePolicyError>
Constructs state with an explicit pageable or mutable residency class.
Sourcepub const fn when_prefix_remainder_nonzero(self, divisor: NonZeroU32) -> Self
pub const fn when_prefix_remainder_nonzero(self, divisor: NonZeroU32) -> Self
Requires the tensor when the prefix has a non-zero remainder.
Sourcepub const fn when_prefix_at_least(self, divisor: NonZeroU32) -> Self
pub const fn when_prefix_at_least(self, divisor: NonZeroU32) -> Self
Requires the tensor when the prefix contains a complete group.
Sourcepub fn is_required_for(&self, prefix_tokens: usize) -> bool
pub fn is_required_for(&self, prefix_tokens: usize) -> bool
Returns whether the tensor is required for an exact prefix length.
Sourcepub fn residency_class(&self) -> StateResidencyClass
pub fn residency_class(&self) -> StateResidencyClass
Returns the unified residency classification.
Sourcepub fn resolved_shape(
&self,
batch_size: usize,
prefix_tokens: usize,
) -> Result<Vec<i32>, CachePolicyError>
pub fn resolved_shape( &self, batch_size: usize, prefix_tokens: usize, ) -> Result<Vec<i32>, CachePolicyError>
Resolves symbolic dimensions for an exact batch and prefix length.
Sourcepub fn accepts_dtype_name(&self, dtype: &str) -> bool
pub fn accepts_dtype_name(&self, dtype: &str) -> bool
Tests a stable serialized dtype name against this policy.
Trait Implementations§
Source§impl Clone for StateTensorPolicy
impl Clone for StateTensorPolicy
Source§fn clone(&self) -> StateTensorPolicy
fn clone(&self) -> StateTensorPolicy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more