Skip to main content

WeightComponentPayload

Struct WeightComponentPayload 

Source
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>

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>

Source

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.

Source

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.

Source

pub fn component_id(&self) -> &WeightId

Source

pub fn external_name(&self) -> &str

Source

pub fn source_file(&self) -> &str

Source

pub fn external_names(&self) -> &[String]

Source

pub fn source_files(&self) -> &[String]

Source

pub fn dimensions(&self) -> &[u64]

Source

pub const fn element_type(&self) -> ElementType

Source

pub fn bytes(&self) -> &[u8]

Source

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V