pub struct WeightComponentPayload<'source> { /* private fields */ }Expand description
Validated physical bytes for one model weight component.
Borrowed bytes allow mmap-backed dense weights to avoid a host copy. Owned bytes cover format adapters that must repack before device upload.
Implementations§
Source§impl<'source> WeightComponentPayload<'source>
impl<'source> WeightComponentPayload<'source>
pub fn new( component: &WeightComponentSpec, external_name: impl Into<String>, source_file: impl Into<String>, dimensions: Vec<u64>, element_type: ElementType, bytes: impl Into<Cow<'source, [u8]>>, ) -> Result<Self, VNextError>
Sourcepub fn from_ordered_sources(
component: &WeightComponentSpec,
external_names: Vec<String>,
source_files: Vec<String>,
dimensions: Vec<u64>,
element_type: ElementType,
bytes: impl Into<Cow<'source, [u8]>>,
) -> Result<Self, VNextError>
pub fn from_ordered_sources( component: &WeightComponentSpec, external_names: Vec<String>, source_files: Vec<String>, dimensions: Vec<u64>, element_type: ElementType, bytes: impl Into<Cow<'source, [u8]>>, ) -> Result<Self, VNextError>
Construct a payload materialized from multiple ordered checkpoint tensors. Multi-source order is part of the component schema, so packed projections cannot silently swap their logical partitions.
Sourcepub fn with_retained_host_memory(
self,
retained_host_memory: RetainedHostMemoryRegion,
) -> Result<Self, VNextError>
pub fn with_retained_host_memory( self, retained_host_memory: RetainedHostMemoryRegion, ) -> Result<Self, VNextError>
Attach the stable owner for an otherwise borrowed payload. Pointer and length identity are checked here so a backend cannot accidentally retain a different mmap range than the bytes validated against the schema.
pub fn component_id(&self) -> &WeightId
pub fn external_name(&self) -> &str
pub fn source_file(&self) -> &str
pub fn external_names(&self) -> &[String]
pub fn source_files(&self) -> &[String]
pub fn dimensions(&self) -> &[u64]
pub const fn element_type(&self) -> ElementType
pub fn bytes(&self) -> &[u8] ⓘ
pub fn retained_host_memory(&self) -> Option<&RetainedHostMemoryRegion>
Auto Trait Implementations§
impl<'source> !RefUnwindSafe for WeightComponentPayload<'source>
impl<'source> !UnwindSafe for WeightComponentPayload<'source>
impl<'source> Freeze for WeightComponentPayload<'source>
impl<'source> Send for WeightComponentPayload<'source>
impl<'source> Sync for WeightComponentPayload<'source>
impl<'source> Unpin for WeightComponentPayload<'source>
impl<'source> UnsafeUnpin for WeightComponentPayload<'source>
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