pub trait DispatchKindConversion<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§
Sourcefn try_into_backend(tensor: DispatchTensor) -> Result<BackendTensor<B>, String>
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.
Sourcefn from_backend(tensor: BackendTensor<B>) -> DispatchTensor
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
default_backend or crate feature flex only.