Trait dfdx::nn::BuildOnDevice

source ·
pub trait BuildOnDevice<D: Device<E>, E: Dtype> {
    type Built: BuildModule<D, E>;

    // Provided methods
    fn build_on_device(device: &D) -> Self::Built { ... }
    fn try_build_on_device(device: &D) -> Result<Self::Built, D::Err> { ... }
}
Expand description

Something that can be built on a different device than it is on.

Related to BuildModule

Required Associated Types§

Provided Methods§

source

fn build_on_device(device: &D) -> Self::Built

source

fn try_build_on_device(device: &D) -> Result<Self::Built, D::Err>

Implementations on Foreign Types§

source§

impl<D: Device<E>, E: Dtype, M1: BuildOnDevice<D, E>, M2: BuildOnDevice<D, E>, M3: BuildOnDevice<D, E>, M4: BuildOnDevice<D, E>, M5: BuildOnDevice<D, E>> BuildOnDevice<D, E> for (M1, M2, M3, M4, M5)

§

type Built = (<M1 as BuildOnDevice<D, E>>::Built, <M2 as BuildOnDevice<D, E>>::Built, <M3 as BuildOnDevice<D, E>>::Built, <M4 as BuildOnDevice<D, E>>::Built, <M5 as BuildOnDevice<D, E>>::Built)

source§

impl<D: Device<E>, E: Dtype, M1: BuildOnDevice<D, E>, M2: BuildOnDevice<D, E>, M3: BuildOnDevice<D, E>> BuildOnDevice<D, E> for (M1, M2, M3)

§

type Built = (<M1 as BuildOnDevice<D, E>>::Built, <M2 as BuildOnDevice<D, E>>::Built, <M3 as BuildOnDevice<D, E>>::Built)

source§

impl<D: Device<E>, E: Dtype, M1: BuildOnDevice<D, E>, M2: BuildOnDevice<D, E>, M3: BuildOnDevice<D, E>, M4: BuildOnDevice<D, E>, M5: BuildOnDevice<D, E>, M6: BuildOnDevice<D, E>> BuildOnDevice<D, E> for (M1, M2, M3, M4, M5, M6)

§

type Built = (<M1 as BuildOnDevice<D, E>>::Built, <M2 as BuildOnDevice<D, E>>::Built, <M3 as BuildOnDevice<D, E>>::Built, <M4 as BuildOnDevice<D, E>>::Built, <M5 as BuildOnDevice<D, E>>::Built, <M6 as BuildOnDevice<D, E>>::Built)

source§

impl<D: Device<E>, E: Dtype, M1: BuildOnDevice<D, E>, M2: BuildOnDevice<D, E>, M3: BuildOnDevice<D, E>, M4: BuildOnDevice<D, E>> BuildOnDevice<D, E> for (M1, M2, M3, M4)

§

type Built = (<M1 as BuildOnDevice<D, E>>::Built, <M2 as BuildOnDevice<D, E>>::Built, <M3 as BuildOnDevice<D, E>>::Built, <M4 as BuildOnDevice<D, E>>::Built)

source§

impl<D: Device<E>, E: Dtype, M1: BuildOnDevice<D, E>, M2: BuildOnDevice<D, E>> BuildOnDevice<D, E> for (M1, M2)

§

type Built = (<M1 as BuildOnDevice<D, E>>::Built, <M2 as BuildOnDevice<D, E>>::Built)

Implementors§

source§

impl<D: Device<E>, E: Dtype, F: BuildOnDevice<D, E>> BuildOnDevice<D, E> for Residual<F>

§

type Built = Residual<<F as BuildOnDevice<D, E>>::Built>

source§

impl<D: Device<E>, E: Dtype, F: BuildOnDevice<D, E>, R: BuildOnDevice<D, E>> BuildOnDevice<D, E> for GeneralizedResidual<F, R>

§

type Built = GeneralizedResidual<<F as BuildOnDevice<D, E>>::Built, <R as BuildOnDevice<D, E>>::Built>

source§

impl<D: Device<E>, E: Dtype, T: BuildOnDevice<D, E>, const N: usize> BuildOnDevice<D, E> for Repeated<T, N>

§

type Built = Repeated<<T as BuildOnDevice<D, E>>::Built, N>

source§

impl<T: BuildOnDevice<D, E>, D: Device<E>, E: Dtype> BuildOnDevice<D, E> for AddInto<T>

§

type Built = AddInto<<T as BuildOnDevice<D, E>>::Built>

source§

impl<T: BuildOnDevice<D, E>, D: Device<E>, E: Dtype> BuildOnDevice<D, E> for SplitInto<T>

§

type Built = SplitInto<<T as BuildOnDevice<D, E>>::Built>

source§

impl<T: ZeroSizedModule + BuildModule<D, E>, D: Device<E>, E: Dtype> BuildOnDevice<D, E> for T

§

type Built = T

source§

impl<const C: usize, E: Dtype, D: Device<E>> BuildOnDevice<D, E> for BatchNorm1D<C>where BatchNorm1D<C, E, D>: BuildModule<D, E>,

§

type Built = BatchNorm1D<C, E, D>

source§

impl<const C: usize, E: Dtype, D: Device<E>> BuildOnDevice<D, E> for BatchNorm2D<C>where BatchNorm2D<C, E, D>: BuildModule<D, E>,

§

type Built = BatchNorm2D<C, E, D>

source§

impl<const C: usize, E: Dtype, D: Device<E>> BuildOnDevice<D, E> for Bias2D<C>where Bias2D<C, E, D>: BuildModule<D, E>,

§

type Built = Bias2D<C, E, D>

source§

impl<const I: usize, const O: usize, E: Dtype, D: Device<E>> BuildOnDevice<D, E> for Linear<I, O>where Linear<I, O, E, D>: BuildModule<D, E>,

§

type Built = Linear<I, O, E, D>

source§

impl<const I: usize, const O: usize, E: Dtype, D: Device<E>> BuildOnDevice<D, E> for UnbiasedLinear<I, O>where UnbiasedLinear<I, O, E, D>: BuildModule<D, E>,

§

type Built = UnbiasedLinear<I, O, E, D>

source§

impl<const I: usize, const O: usize, const K: usize, const S: usize, const P: usize, E, D> BuildOnDevice<D, E> for Conv2D<I, O, K, S, P>where E: Dtype, D: Device<E>, Conv2D<I, O, K, S, P, E, D>: BuildModule<D, E>,

§

type Built = Conv2D<I, O, K, S, P, E, D>

source§

impl<const M: usize, E: Dtype, D: Device<E>> BuildOnDevice<D, E> for LayerNorm1D<M>where LayerNorm1D<M, E, D>: BuildModule<D, E>,

§

type Built = LayerNorm1D<M, E, D>

source§

impl<const M: usize, const H: usize, const A: usize, const B: usize, const F: usize, E, D> BuildOnDevice<D, E> for Transformer<M, H, A, B, F>where E: Dtype, D: Device<E>, Transformer<M, H, A, B, F, E, D>: BuildModule<D, E>,

§

type Built = Transformer<M, H, A, B, F, E, D>

source§

impl<const M: usize, const H: usize, const F: usize, E: Dtype, D: Device<E>> BuildOnDevice<D, E> for TransformerEncoderBlock<M, H, F>where TransformerEncoderBlock<M, H, F, E, D>: BuildModule<D, E>,

§

type Built = TransformerEncoderBlock<M, H, F, E, D>

source§

impl<const M: usize, const H: usize, const F: usize, const L: usize, E: Dtype, D: Device<E>> BuildOnDevice<D, E> for TransformerDecoder<M, H, F, L>where TransformerDecoder<M, H, F, L, E, D>: BuildModule<D, E>,

§

type Built = TransformerDecoder<M, H, F, L, E, D>

source§

impl<const M: usize, const H: usize, const F: usize, const L: usize, E: Dtype, D: Device<E>> BuildOnDevice<D, E> for TransformerEncoder<M, H, F, L>where TransformerEncoder<M, H, F, L, E, D>: BuildModule<D, E>,

§

type Built = Repeated<TransformerEncoderBlock<M, H, F, E, D>, L>

source§

impl<const M: usize, const H: usize, const K: usize, const V: usize, E: Dtype, D: Device<E>> BuildOnDevice<D, E> for MultiHeadAttention<M, H, K, V>where MultiHeadAttention<M, H, K, V, E, D>: BuildModule<D, E>,

§

type Built = MultiHeadAttention<M, H, K, V, E, D>

source§

impl<const M: usize, const N: usize, const F: usize, E: Dtype, D: Device<E>> BuildOnDevice<D, E> for TransformerDecoderBlock<M, N, F>where TransformerDecoderBlock<M, N, F, E, D>: BuildModule<D, E>,

§

type Built = TransformerDecoderBlock<M, N, F, E, D>

source§

impl<const V: usize, const M: usize, E: Dtype, D: Device<E>> BuildOnDevice<D, E> for Embedding<V, M>where Embedding<V, M, E, D>: BuildModule<D, E>,

§

type Built = Embedding<V, M, E, D>