Skip to main content

BackendStorage

Trait BackendStorage 

Source
pub trait BackendStorage:
    Clone
    + Send
    + Sync
    + 'static {
    // Required methods
    fn dtype(&self) -> DType;
    fn len(&self) -> usize;

    // Provided method
    fn is_empty(&self) -> bool { ... }
}
Expand description

A storage buffer that holds tensor data on a specific device.

For CPU, this is a Vec<f32> (or enum over dtypes). For CUDA, this is a device memory allocation (CudaSlice).

Required Methods§

Source

fn dtype(&self) -> DType

The data type of the elements in this storage.

Source

fn len(&self) -> usize

Total number of elements that fit in this storage.

Provided Methods§

Source

fn is_empty(&self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§