Skip to main content

DispatchKindConversion

Trait DispatchKindConversion 

pub trait DispatchKindConversion<B>
where B: Backend,
{ // Required methods fn try_into_backend( tensor: DispatchTensor, ) -> Result<BackendTensor<B>, String>; fn from_backend(tensor: BackendTensor<B>) -> DispatchTensor; }
Expand description

Trait to execute runtime routing conversions between the dynamic dispatch layer and specific backends.

Required Methods§

fn try_into_backend(tensor: DispatchTensor) -> Result<BackendTensor<B>, String>

Attempts to extract a backend-specific BackendTensor wrapper from a generic, dynamically-routed DispatchTensor.

§Errors

Returns an error if the dynamic routing state does not match the requested backend B.

fn from_backend(tensor: BackendTensor<B>) -> DispatchTensor

Encapsulates a backend-specific tensor variant back into a globally routing DispatchTensor.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

§

impl DispatchKindConversion<Flex> for DispatchTensor

Available on crate feature flex only.
§

impl<C> DispatchKindConversion<Autodiff<Flex, C>> for DispatchTensor
where C: CheckpointStrategy + IntoGradientCheckpointingStrategy,

Available on crate features autodiff and flex only.