Trait burn::tensor::backend::BackendBridge

pub trait BackendBridge<Origin>:
    Send
    + Sync
    + Debug
where Origin: Backend,
{ type Target: Backend; // Required methods fn into_target( tensor: <Origin as Backend>::FloatTensorPrimitive, device: Option<<Self::Target as Backend>::Device>, ) -> <Self::Target as Backend>::FloatTensorPrimitive; fn from_target( tensor: <Self::Target as Backend>::FloatTensorPrimitive, device: Option<<Origin as Backend>::Device>, ) -> <Origin as Backend>::FloatTensorPrimitive; }
Expand description

Allows tensors to be transferred between backends efficiently.

Required Associated Types§

type Target: Backend

The target backend

Required Methods§

fn into_target( tensor: <Origin as Backend>::FloatTensorPrimitive, device: Option<<Self::Target as Backend>::Device>, ) -> <Self::Target as Backend>::FloatTensorPrimitive

Transfer the tensor to the target backend.

fn from_target( tensor: <Self::Target as Backend>::FloatTensorPrimitive, device: Option<<Origin as Backend>::Device>, ) -> <Origin as Backend>::FloatTensorPrimitive

Transfer the tensor from the target backend.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl<R, BInput, BTarget> BackendBridge<Fusion<BInput>> for PrecisionBridge<BTarget>
where BInput: FusionBackend<FusionRuntime = R>, BTarget: FusionBackend<FusionRuntime = R>, R: FusionRuntime + 'static,

§

type Target = Fusion<BTarget>

§

fn into_target( tensor: <Fusion<BInput> as Backend>::FloatTensorPrimitive, _device: Option<<<PrecisionBridge<BTarget> as BackendBridge<Fusion<BInput>>>::Target as Backend>::Device>, ) -> <<PrecisionBridge<BTarget> as BackendBridge<Fusion<BInput>>>::Target as Backend>::FloatTensorPrimitive

§

fn from_target( tensor: <<PrecisionBridge<BTarget> as BackendBridge<Fusion<BInput>>>::Target as Backend>::FloatTensorPrimitive, _device: Option<<Fusion<BInput> as Backend>::Device>, ) -> <Fusion<BInput> as Backend>::FloatTensorPrimitive

§

impl<R, FOrigin, IOrigin, FTarget, ITarget> BackendBridge<JitBackend<R, FOrigin, IOrigin>> for PrecisionBridge<R, FTarget, ITarget>
where R: JitRuntime, FOrigin: FloatElement, IOrigin: IntElement, FTarget: FloatElement, ITarget: IntElement,

§

type Target = JitBackend<R, FTarget, ITarget>

§

fn into_target( tensor: <JitBackend<R, FOrigin, IOrigin> as Backend>::FloatTensorPrimitive, device: Option<<<PrecisionBridge<R, FTarget, ITarget> as BackendBridge<JitBackend<R, FOrigin, IOrigin>>>::Target as Backend>::Device>, ) -> <<PrecisionBridge<R, FTarget, ITarget> as BackendBridge<JitBackend<R, FOrigin, IOrigin>>>::Target as Backend>::FloatTensorPrimitive

§

fn from_target( tensor: <<PrecisionBridge<R, FTarget, ITarget> as BackendBridge<JitBackend<R, FOrigin, IOrigin>>>::Target as Backend>::FloatTensorPrimitive, device: Option<<JitBackend<R, FOrigin, IOrigin> as Backend>::Device>, ) -> <JitBackend<R, FOrigin, IOrigin> as Backend>::FloatTensorPrimitive

Implementors§

§

impl<B, C, Bridge> BackendBridge<Autodiff<B, C>> for AutodiffBridge<Bridge>
where B: Backend, C: CheckpointStrategy, Bridge: BackendBridge<B> + 'static,

§

type Target = Autodiff<<Bridge as BackendBridge<B>>::Target, C>

§

impl<TElem, OElem, IntElem> BackendBridge<Candle<OElem, IntElem>> for burn::backend::candle::PrecisionBridge<TElem>
where TElem: FloatCandleElement, OElem: FloatCandleElement, IntElem: IntCandleElement,

§

type Target = Candle<TElem, IntElem>

§

impl<TElem, OElem, QElem> BackendBridge<LibTorch<OElem, QElem>> for burn::backend::libtorch::PrecisionBridge<TElem>
where TElem: TchElement, OElem: TchElement, QElem: QuantElement,

§

type Target = LibTorch<TElem>

§

impl<TElem, OElem, QElem, IntElem> BackendBridge<NdArray<OElem, IntElem, QElem>> for burn::backend::ndarray::PrecisionBridge<TElem>
where TElem: FloatNdArrayElement, OElem: FloatNdArrayElement, QElem: QuantElement, IntElem: IntNdArrayElement,

§

type Target = NdArray<TElem, IntElem, QElem>