Trait burn::tensor::repr::ReprBackend

pub trait ReprBackend: 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: QuantizedKind<TensorHandle<Self::Handle>>,
        scheme: QuantizationScheme,
    ) -> 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,
    ) -> QuantizedKind<Self::Handle>;
}
Expand description

Backend extension trait that allows an existing backend to use the Burn tensor 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: QuantizedKind<TensorHandle<Self::Handle>>, scheme: QuantizationScheme, ) -> 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, ) -> QuantizedKind<Self::Handle>

Convert a quantized tensor to a handle. A quantized tensor has multiple handles for the tensor itself and the quantization parameters.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl<B> ReprBackend for Fusion<B>
where B: FusionBackend,

§

type Handle = FusionTensor<<B as FusionBackend>::FusionRuntime>

§

fn float_tensor( handle: TensorHandle<<Fusion<B> as ReprBackend>::Handle>, ) -> <Fusion<B> as Backend>::FloatTensorPrimitive

§

fn int_tensor( handle: TensorHandle<<Fusion<B> as ReprBackend>::Handle>, ) -> <Fusion<B> as Backend>::IntTensorPrimitive

§

fn bool_tensor( handle: TensorHandle<<Fusion<B> as ReprBackend>::Handle>, ) -> <Fusion<B> as Backend>::BoolTensorPrimitive

§

fn quantized_tensor( _handles: QuantizedKind<TensorHandle<<Fusion<B> as ReprBackend>::Handle>>, _scheme: QuantizationScheme, ) -> <Fusion<B> as Backend>::QuantizedTensorPrimitive

§

fn float_tensor_handle( tensor: <Fusion<B> as Backend>::FloatTensorPrimitive, ) -> <Fusion<B> as ReprBackend>::Handle

§

fn int_tensor_handle( tensor: <Fusion<B> as Backend>::IntTensorPrimitive, ) -> <Fusion<B> as ReprBackend>::Handle

§

fn bool_tensor_handle( tensor: <Fusion<B> as Backend>::BoolTensorPrimitive, ) -> <Fusion<B> as ReprBackend>::Handle

§

fn quantized_tensor_handle( _tensor: <Fusion<B> as Backend>::QuantizedTensorPrimitive, ) -> QuantizedKind<<Fusion<B> as ReprBackend>::Handle>

Implementors§

§

impl<E, I, Q> ReprBackend for NdArray<E, I, Q>
where E: FloatNdArrayElement, I: IntNdArrayElement, Q: QuantElement,

§

type Handle = HandleKind<NdArray<E, I, Q>>

§

impl<R, F, I> ReprBackend for JitBackend<R, F, I>
where R: JitRuntime, F: FloatElement, I: IntElement,

§

type Handle = JitFusionHandle<R>