ToBackend

Trait ToBackend 

Source
pub trait ToBackend<B: Backend>: Sized {
    type OnBackend;

    // Required method
    fn to_backend_device(self, device: &B::Device) -> Self::OnBackend;

    // Provided method
    fn to_backend(self) -> Self::OnBackend { ... }
}
Expand description

trait for switching the backend of a module

Required Associated Types§

Source

type OnBackend

the type on the new backend

Required Methods§

Source

fn to_backend_device(self, device: &B::Device) -> Self::OnBackend

moves the module to the backend with the device

Provided Methods§

Source

fn to_backend(self) -> Self::OnBackend

moves the module to the backend with the device

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<B: Backend, C: Backend, K: BasicOps<B> + BasicOps<C> + TensorKind<B> + TensorKind<C>, const N: usize> ToBackend<C> for Tensor<B, N, K>

Source§

type OnBackend = Tensor<C, N, K>

Source§

fn to_backend_device(self, device: &C::Device) -> Self::OnBackend

Implementors§

Source§

impl<B: Backend, C: Backend> ToBackend<C> for Value<B>

Source§

impl<C: Backend, W: ToBackend<C, OnBackend = W::With<C>> + Wrappable> ToBackend<C> for Wrapped<W>