Struct dfdx::nn::modules::TransformerDecoder
source · pub struct TransformerDecoder<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize, E: Dtype, D: DeviceStorage>(pub Repeated<TransformerDecoderBlock<MODEL_DIM, NUM_HEADS, FF_DIM, E, D>, NUM_LAYERS>);
Expand description
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.
Tuple Fields§
§0: Repeated<TransformerDecoderBlock<MODEL_DIM, NUM_HEADS, FF_DIM, E, D>, NUM_LAYERS>
Trait Implementations§
source§impl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize, E: Clone + Dtype, D: Clone + DeviceStorage> Clone for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS, E, D>
impl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize, E: Clone + Dtype, D: Clone + DeviceStorage> Clone for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS, E, D>
source§fn clone(
&self
) -> TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS, E, D>
fn clone( &self ) -> TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS, E, D>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize, E: Debug + Dtype, D: Debug + DeviceStorage> Debug for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS, E, D>
impl<const MODEL_DIM: usize, const NUM_HEADS: usize, const FF_DIM: usize, const NUM_LAYERS: usize, E: Debug + Dtype, D: Debug + DeviceStorage> Debug for TransformerDecoder<MODEL_DIM, NUM_HEADS, FF_DIM, NUM_LAYERS, E, D>
source§impl<const M: usize, const H: usize, const F: usize, const L: usize, E, D, Tgt, Mem: Clone> Module<(Tgt, Mem)> for TransformerDecoder<M, H, F, L, E, D>where
E: Dtype,
D: Device<E>,
TransformerDecoderBlock<M, H, F, E, D>: Module<(Tgt, Mem), Output = Tgt, Error = D::Err>,
impl<const M: usize, const H: usize, const F: usize, const L: usize, E, D, Tgt, Mem: Clone> Module<(Tgt, Mem)> for TransformerDecoder<M, H, F, L, E, D>where E: Dtype, D: Device<E>, TransformerDecoderBlock<M, H, F, E, D>: Module<(Tgt, Mem), Output = Tgt, Error = D::Err>,
source§impl<const M: usize, const H: usize, const F: usize, const L: usize, E, D: Device<E>> TensorCollection<E, D> for TransformerDecoder<M, H, F, L, E, D>where
E: Dtype + Float + SampleUniform,
impl<const M: usize, const H: usize, const F: usize, const L: usize, E, D: Device<E>> TensorCollection<E, D> for TransformerDecoder<M, H, F, L, E, D>where E: Dtype + Float + SampleUniform,
§type To<E2: Dtype, D2: Device<E2>> = TransformerDecoder<M, H, F, L, E2, D2>
type To<E2: Dtype, D2: Device<E2>> = TransformerDecoder<M, H, F, L, E2, D2>
Type alias that specifies the how a module’s type changes when using a different dtype and/or
device.
source§fn iter_tensors<V: ModuleVisitor<Self, E, D>>(
visitor: &mut V
) -> Result<Option<Self::To<V::E2, V::D2>>, V::Err>
fn iter_tensors<V: ModuleVisitor<Self, E, D>>( visitor: &mut V ) -> Result<Option<Self::To<V::E2, V::D2>>, V::Err>
Specifies how to iterate through tensors or modules containted within this module, and how
to contruct this module given values for its fields. Returns
Err(_)
to indicate an error,
Ok(None)
to indicate that there is no error and a module has not been built, and
Ok(Some(_))
contains Self::Output<E2, D2>
source§fn module<F1, F2, Field>(
name: &str,
get_ref: F1,
get_mut: F2
) -> ModuleField<'_, F1, F2, Self, Field>where
F1: FnMut(&Self) -> &Field,
F2: FnMut(&mut Self) -> &mut Field,
Field: TensorCollection<E, D>,
fn module<F1, F2, Field>( name: &str, get_ref: F1, get_mut: F2 ) -> ModuleField<'_, F1, F2, Self, Field>where F1: FnMut(&Self) -> &Field, F2: FnMut(&mut Self) -> &mut Field, Field: TensorCollection<E, D>,
Creates a ModuleFields that represents a field that may contain one or more tensors. Read more
source§fn tensor<F1, F2, S>(
name: &str,
get_ref: F1,
get_mut: F2,
options: TensorOptions<S, E, D>
) -> TensorField<'_, F1, F2, Self, S, E, D>where
F1: FnMut(&Self) -> &Tensor<S, E, D>,
F2: FnMut(&mut Self) -> &mut Tensor<S, E, D>,
S: Shape,
fn tensor<F1, F2, S>( name: &str, get_ref: F1, get_mut: F2, options: TensorOptions<S, E, D> ) -> TensorField<'_, F1, F2, Self, S, E, D>where F1: FnMut(&Self) -> &Tensor<S, E, D>, F2: FnMut(&mut Self) -> &mut Tensor<S, E, D>, S: Shape,
Creates a ModuleFields that represents a tensor field. Read more