Trait burn_tensor::backend::Backend
source · [−]pub trait Backend: Clone + Sized + Default + Send + Sync + Debug + 'static {
type Device: Copy + Clone + Default + Debug + Send + Sync;
type Elem: Element;
type FullPrecisionElem: Element;
type FullPrecisionBackend: Backend<Elem = Self::FullPrecisionElem, Device = Self::Device>;
type IntegerBackend: Backend<Elem = i64, Device = Self::Device>;
type TensorPrimitive<const D: usize>: TensorOpsUtilities<Self::Elem, D> + TensorOpsMatmul<Self::Elem, D> + TensorOpsTranspose<Self::Elem, D> + TensorOpsMul<Self::Elem, D> + TensorOpsDiv<Self::Elem, D> + TensorOpsNeg<Self::Elem, D> + TensorOpsAdd<Self::Elem, D> + TensorOpsSub<Self::Elem, D> + Zeros<Self::TensorPrimitive<D>> + Ones<Self::TensorPrimitive<D>> + TensorOpsReshape<Self, D> + TensorOpsPrecision<Self, D> + TensorOpsDevice<Self, D> + TensorOpsIndex<Self::Elem, D> + TensorOpsAggregation<Self, D> + TensorOpsExp<Self::Elem, D> + TensorOpsArg<Self, D> + TensorOpsCat<Self::Elem, D> + TensorOpsLog<Self::Elem, D> + TensorOpsMask<Self, D> + TensorOpsMapComparison<Self, D> + ReLU<Self::Elem, D> + Clone + Send + Sync + 'static + Debug;
type BoolTensorPrimitive<const D: usize>: TensorOpsUtilities<bool, D> + Clone + Send + Sync + 'static + Debug;
fn from_data<const D: usize>(
data: Data<Self::Elem, D>,
device: Self::Device
) -> Self::TensorPrimitive<D>;
fn from_data_bool<const D: usize>(
data: Data<bool, D>,
device: Self::Device
) -> Self::BoolTensorPrimitive<D>;
fn random<const D: usize>(
shape: Shape<D>,
distribution: Distribution<Self::Elem>,
device: Self::Device
) -> Self::TensorPrimitive<D>;
fn zeros<const D: usize>(
shape: Shape<D>,
device: Self::Device
) -> Self::TensorPrimitive<D>;
fn ones<const D: usize>(
shape: Shape<D>,
device: Self::Device
) -> Self::TensorPrimitive<D>;
fn ad_enabled() -> bool;
fn name() -> String;
}Required Associated Types
source
type FullPrecisionBackend: Backend<Elem = Self::FullPrecisionElem, Device = Self::Device>
source
type IntegerBackend: Backend<Elem = i64, Device = Self::Device>
source
type TensorPrimitive<const D: usize>: TensorOpsUtilities<Self::Elem, D> + TensorOpsMatmul<Self::Elem, D> + TensorOpsTranspose<Self::Elem, D> + TensorOpsMul<Self::Elem, D> + TensorOpsDiv<Self::Elem, D> + TensorOpsNeg<Self::Elem, D> + TensorOpsAdd<Self::Elem, D> + TensorOpsSub<Self::Elem, D> + Zeros<Self::TensorPrimitive<D>> + Ones<Self::TensorPrimitive<D>> + TensorOpsReshape<Self, D> + TensorOpsPrecision<Self, D> + TensorOpsDevice<Self, D> + TensorOpsIndex<Self::Elem, D> + TensorOpsAggregation<Self, D> + TensorOpsExp<Self::Elem, D> + TensorOpsArg<Self, D> + TensorOpsCat<Self::Elem, D> + TensorOpsLog<Self::Elem, D> + TensorOpsMask<Self, D> + TensorOpsMapComparison<Self, D> + ReLU<Self::Elem, D> + Clone + Send + Sync + 'static + Debug
Required Methods
sourcefn from_data<const D: usize>(
fn from_data<const D: usize>(
data: Data<Self::Elem, D>,
device: Self::Device
) -> Self::TensorPrimitive<D>
sourcefn from_data_bool<const D: usize>(
fn from_data_bool<const D: usize>(
data: Data<bool, D>,
device: Self::Device
) -> Self::BoolTensorPrimitive<D>
sourcefn random<const D: usize>(
fn random<const D: usize>(
shape: Shape<D>,
distribution: Distribution<Self::Elem>,
device: Self::Device
) -> Self::TensorPrimitive<D>
source