BackendStorage

Trait BackendStorage 

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

Re-export core types. 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§

fn dtype(&self) -> DType

The data type of the elements in this storage.

fn len(&self) -> usize

Total number of elements that fit in this storage.

Provided Methods§

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§