Skip to main content

HostTensorStorage

Trait HostTensorStorage 

Source
pub trait HostTensorStorage:
    Any
    + Debug
    + Send
    + Sync {
    // Required methods
    fn dtype(&self) -> DataType;
    fn allocation_bytes(&self) -> &[u8] ;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Runtime-owned, host-accessible storage retained without a runtime dependency.

Backend crates use this boundary to keep an allocator or runtime value alive while exposing its stable CPU allocation. Implementations must keep the returned allocation address and length unchanged for their entire lifetime.

Required Methods§

Source

fn dtype(&self) -> DataType

Returns the exact tensor element type stored by this allocation.

Source

fn allocation_bytes(&self) -> &[u8]

Returns the complete host-accessible allocation.

Source

fn as_any(&self) -> &dyn Any

Supports backend-specific zero-copy reuse through checked downcasting.

Implementors§