Backend

Trait Backend 

Source
pub trait Backend {
    // Required methods
    fn from_buf<D: Scalar, Mapping: M>(data: Vec<Opt<D>>) -> Tensor<D, Mapping>;
    fn to_buf<D: Scalar, Mapping: M>(tensor: &Tensor<D, Mapping>) -> Vec<Opt<D>>;
    fn to_hbm<D: Scalar, Element: M, Chip: M, Element2: M>(
        host: &HostTensor<D, Element>,
        address: Address,
    ) -> impl Future<Output = HbmTensor<D, Chip, Element2>>;
    fn to_host<D: Scalar, Chip: M, Element: M, Element2: M>(
        hbm: &HbmTensor<D, Chip, Element>,
    ) -> impl Future<Output = HostTensor<D, Element2>>;
}
Expand description

Backend for tensor operations.

Cpu: interprets operations via mapping expressions (default). Npu: dispatches to device via PCIe DMA.

Required Methods§

Source

fn from_buf<D: Scalar, Mapping: M>(data: Vec<Opt<D>>) -> Tensor<D, Mapping>

Create a tensor from a flat buffer.

Source

fn to_buf<D: Scalar, Mapping: M>(tensor: &Tensor<D, Mapping>) -> Vec<Opt<D>>

Serialize a tensor to a flat buffer.

Source

fn to_hbm<D: Scalar, Element: M, Chip: M, Element2: M>( host: &HostTensor<D, Element>, address: Address, ) -> impl Future<Output = HbmTensor<D, Chip, Element2>>

Transfer host tensor to HBM.

Source

fn to_host<D: Scalar, Chip: M, Element: M, Element2: M>( hbm: &HbmTensor<D, Chip, Element>, ) -> impl Future<Output = HostTensor<D, Element2>>

Transfer HBM tensor to host.

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§