Skip to main content

TensorStorage

Trait TensorStorage 

Source
pub trait TensorStorage:
    Clone
    + Send
    + Sync
    + Debug {
    // Required methods
    fn dtype(&self) -> DType;
    fn device(&self) -> Device;
    fn nbytes(&self) -> usize;
    fn is_contiguous(&self) -> bool;
    fn alignment(&self) -> usize;
}
Expand description

Tensor 存储后端 trait

Required Methods§

Source

fn dtype(&self) -> DType

获取数据类型

Source

fn device(&self) -> Device

获取设备类型

Source

fn nbytes(&self) -> usize

获取字节大小

Source

fn is_contiguous(&self) -> bool

检查是否连续存储

Source

fn alignment(&self) -> usize

获取对齐字节数

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§

Source§

impl TensorStorage for UnifiedStorage

Source§

impl TensorStorage for NdArrayStorage

Available on crate feature tensor only.