Skip to main content

BackendIr

Trait BackendIr 

pub trait BackendIr: Backend {
    type Handle: Sync + Send + Clone;

    // Required methods
    fn float_tensor(
        handle: TensorHandle<Self::Handle>,
    ) -> Self::FloatTensorPrimitive;
    fn int_tensor(
        handle: TensorHandle<Self::Handle>,
    ) -> Self::IntTensorPrimitive;
    fn bool_tensor(
        handle: TensorHandle<Self::Handle>,
    ) -> Self::BoolTensorPrimitive;
    fn quantized_tensor(
        handle: TensorHandle<Self::Handle>,
    ) -> Self::QuantizedTensorPrimitive;
    fn float_tensor_handle(tensor: Self::FloatTensorPrimitive) -> Self::Handle;
    fn int_tensor_handle(tensor: Self::IntTensorPrimitive) -> Self::Handle;
    fn bool_tensor_handle(tensor: Self::BoolTensorPrimitive) -> Self::Handle;
    fn quantized_tensor_handle(
        tensor: Self::QuantizedTensorPrimitive,
    ) -> Self::Handle;
}
Expand description

Backend extension trait that allows an existing backend to use the Burn tensor intermediate representation for compilation purpose or other…

Required Associated Types§

type Handle: Sync + Send + Clone

The type that can be used to point to a tensor of any kind.

Required Methods§

fn float_tensor( handle: TensorHandle<Self::Handle>, ) -> Self::FloatTensorPrimitive

Convert a handle to a float tensor.

fn int_tensor(handle: TensorHandle<Self::Handle>) -> Self::IntTensorPrimitive

Convert a handle to an int tensor.

fn bool_tensor(handle: TensorHandle<Self::Handle>) -> Self::BoolTensorPrimitive

Convert a handle to a bool tensor.

fn quantized_tensor( handle: TensorHandle<Self::Handle>, ) -> Self::QuantizedTensorPrimitive

Convert a handle to a quantized tensor.

fn float_tensor_handle(tensor: Self::FloatTensorPrimitive) -> Self::Handle

Convert a float tensor to a handle.

fn int_tensor_handle(tensor: Self::IntTensorPrimitive) -> Self::Handle

Convert an int tensor to a handle.

fn bool_tensor_handle(tensor: Self::BoolTensorPrimitive) -> Self::Handle

Convert a bool tensor to a handle.

fn quantized_tensor_handle( tensor: Self::QuantizedTensorPrimitive, ) -> Self::Handle

Convert a quantized tensor to a handle.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§