pub struct WeightBinding { /* private fields */ }Expand description
One named checkpoint selection within an atomic resident unit.
Implementations§
Source§impl WeightBinding
impl WeightBinding
Sourcepub fn new(
name: impl Into<String>,
checkpoint_key: impl Into<String>,
selection: TensorSelection,
expected_bytes: u64,
) -> Result<Self, ResidencyDeclarationError>
pub fn new( name: impl Into<String>, checkpoint_key: impl Into<String>, selection: TensorSelection, expected_bytes: u64, ) -> Result<Self, ResidencyDeclarationError>
Creates a direct binding with a stable local name and selected size.
Sourcepub fn from_recipe(
name: impl Into<String>,
recipe: DerivedWeightRecipe,
expected_bytes: u64,
) -> Result<Self, ResidencyDeclarationError>
pub fn from_recipe( name: impl Into<String>, recipe: DerivedWeightRecipe, expected_bytes: u64, ) -> Result<Self, ResidencyDeclarationError>
Creates a binding backed by a composable derived-weight recipe.
Sourcepub fn alias(
name: impl Into<String>,
owner: impl Into<String>,
expected_bytes: u64,
) -> Result<Self, ResidencyDeclarationError>
pub fn alias( name: impl Into<String>, owner: impl Into<String>, expected_bytes: u64, ) -> Result<Self, ResidencyDeclarationError>
Creates one logical destination that shares an already materialized owner binding in the same atomic unit.
Sourcepub fn alias_of(&self) -> Option<&str>
pub fn alias_of(&self) -> Option<&str>
Returns the logical owner when this binding is an alias.
Sourcepub const fn is_alias(&self) -> bool
pub const fn is_alias(&self) -> bool
Returns whether this binding reuses another logical binding’s native materialization.
Sourcepub fn with_name(
self,
name: impl Into<String>,
) -> Result<Self, ResidencyDeclarationError>
pub fn with_name( self, name: impl Into<String>, ) -> Result<Self, ResidencyDeclarationError>
Replaces the stable name used to address this value inside its resident unit.
Sourcepub fn logical_target(&self) -> Option<&str>
pub fn logical_target(&self) -> Option<&str>
Returns the architecture-logical parameter destination.
Sourcepub fn with_logical_target(
self,
target: impl Into<String>,
) -> Result<Self, ResidencyDeclarationError>
pub fn with_logical_target( self, target: impl Into<String>, ) -> Result<Self, ResidencyDeclarationError>
Attaches the architecture-logical parameter destination.
Sourcepub fn with_quantization_companions(
self,
scales_binding: impl Into<String>,
biases_binding: Option<String>,
) -> Result<Self, ResidencyDeclarationError>
pub fn with_quantization_companions( self, scales_binding: impl Into<String>, biases_binding: Option<String>, ) -> Result<Self, ResidencyDeclarationError>
Declares exact local companion names produced by load-time quantization.
Sourcepub const fn quantization_companions(
&self,
) -> Option<&QuantizationCompanionBindings>
pub const fn quantization_companions( &self, ) -> Option<&QuantizationCompanionBindings>
Returns exact local scale and affine-bias bindings for load-time quantization.
Sourcepub fn checkpoint_key(&self) -> &str
pub fn checkpoint_key(&self) -> &str
Returns the first physical checkpoint source.
Sourcepub fn selection(&self) -> &TensorSelection
pub fn selection(&self) -> &TensorSelection
Returns the direct checkpoint selection.
Sourcepub const fn recipe(&self) -> Option<&DerivedWeightRecipe>
pub const fn recipe(&self) -> Option<&DerivedWeightRecipe>
Returns the derived recipe when this is not a direct binding.
Sourcepub fn source_recipe(&self) -> DerivedWeightRecipe
pub fn source_recipe(&self) -> DerivedWeightRecipe
Returns the complete source recipe represented by this binding.
Sourcepub fn checkpoint_keys(&self) -> Vec<&str>
pub fn checkpoint_keys(&self) -> Vec<&str>
Returns every checkpoint key consumed by this binding.
Sourcepub const fn expected_bytes(&self) -> u64
pub const fn expected_bytes(&self) -> u64
Returns the exact logical materialized byte length.
Sourcepub fn with_source_recipe(
self,
recipe: DerivedWeightRecipe,
expected_bytes: u64,
) -> Result<Self, ResidencyDeclarationError>
pub fn with_source_recipe( self, recipe: DerivedWeightRecipe, expected_bytes: u64, ) -> Result<Self, ResidencyDeclarationError>
Replaces the physical source with an equivalent validated recipe.
Sourcepub fn select_bounded_output<C: RecipeCatalog + ?Sized>(
self,
catalog: &C,
selection: TensorSelection,
) -> Result<Self, WeightBindingSelectionError>
pub fn select_bounded_output<C: RecipeCatalog + ?Sized>( self, catalog: &C, selection: TensorSelection, ) -> Result<Self, WeightBindingSelectionError>
Rewrites one logical output selection into bounded physical sources.
Trait Implementations§
Source§impl Clone for WeightBinding
impl Clone for WeightBinding
Source§fn clone(&self) -> WeightBinding
fn clone(&self) -> WeightBinding
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more