Struct dfdx::nn::TransformerDecoder
source · [−]pub struct TransformerDecoder<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize>(pub Repeated<TransformerDecoderBlock<MODEL_DIM, NUM_HEADS, FF_DIM>, NUM_LAYERS>);
Expand description
Requires Nightly A transformer decoder.
Generics
MODEL_DIM
: The size of query/key/value tensors. Given to MultiHeadAttention.NUM_HEADS
: The number of heads in MultiHeadAttention.FF_DIM
: The size of the hidden layer in the feedforward network in TransformerDecoderBlock.NUM_LAYERS
: The number of TransformerDecoderBlock to use. TODO: Doctests
Tuple Fields
0: Repeated<TransformerDecoderBlock<MODEL_DIM, NUM_HEADS, FF_DIM>, NUM_LAYERS>
Trait Implementations
sourceimpl<const M: usize, const H: usize, const F: usize, const L: usize> CanUpdateWithGradients for TransformerDecoder<M, H, F, L>
impl<const M: usize, const H: usize, const F: usize, const L: usize> CanUpdateWithGradients for TransformerDecoder<M, H, F, L>
sourcefn update<G: GradientProvider>(
&mut self,
grads: &mut G,
unused: &mut UnusedTensors
)
fn update<G: GradientProvider>(
&mut self,
grads: &mut G,
unused: &mut UnusedTensors
)
Updates self given the GradientProvider. When any parameters that
are NOT present in
G
, then this function should
add the tensor’s UniqueId to UnusedTensors. Read moresourceimpl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize> Clone for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
impl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize> Clone for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
sourcefn clone(&self) -> TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
fn clone(&self) -> TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize> Debug for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
impl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize> Debug for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
sourceimpl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize> Default for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
impl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize> Default for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
sourcefn default() -> TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
fn default() -> TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
Returns the “default value” for a type. Read more
sourceimpl<const M: usize, const H: usize, const F: usize, const L: usize> LoadFromNpz for TransformerDecoder<M, H, F, L>
impl<const M: usize, const H: usize, const F: usize, const L: usize> LoadFromNpz for TransformerDecoder<M, H, F, L>
sourceimpl<const M: usize, const H: usize, const F: usize, const L: usize, Tgt, Mem> Module<(Tgt, Mem)> for TransformerDecoder<M, H, F, L>where
Mem: Tensor<NoTape = Mem> + Clone,
TransformerDecoderBlock<M, H, F>: Module<(Tgt, Mem), Output = Tgt>,
impl<const M: usize, const H: usize, const F: usize, const L: usize, Tgt, Mem> Module<(Tgt, Mem)> for TransformerDecoder<M, H, F, L>where
Mem: Tensor<NoTape = Mem> + Clone,
TransformerDecoderBlock<M, H, F>: Module<(Tgt, Mem), Output = Tgt>,
type Output = Tgt
type Output = Tgt
The type that this unit produces given
Input
.sourcefn forward(&self, (x, mem): (Tgt, Mem)) -> Self::Output
fn forward(&self, (x, mem): (Tgt, Mem)) -> Self::Output
sourceimpl<const M: usize, const H: usize, const F: usize, const L: usize, T> ModuleMut<T> for TransformerDecoder<M, H, F, L>where
Self: Module<T>,
impl<const M: usize, const H: usize, const F: usize, const L: usize, T> ModuleMut<T> for TransformerDecoder<M, H, F, L>where
Self: Module<T>,
type Output = <TransformerDecoder<M, H, F, L> as Module<T>>::Output
type Output = <TransformerDecoder<M, H, F, L> as Module<T>>::Output
The type that this unit produces given
Input
.sourcefn forward_mut(&mut self, t: T) -> Self::Output
fn forward_mut(&mut self, t: T) -> Self::Output
sourceimpl<const M: usize, const H: usize, const F: usize, const L: usize> ResetParams for TransformerDecoder<M, H, F, L>
impl<const M: usize, const H: usize, const F: usize, const L: usize> ResetParams for TransformerDecoder<M, H, F, L>
Auto Trait Implementations
impl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize> RefUnwindSafe for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
impl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize> Send for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
impl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize> Sync for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
impl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize> Unpin for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
impl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize> UnwindSafe for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more