pub struct TransformerLayerConfig { /* private fields */ }Expand description
Transformer layer configuration.
Implementations§
Source§impl TransformerLayerConfig
impl TransformerLayerConfig
Sourcepub fn attn_residual_layer_norm(
self,
attn_residual_layer_norm: Box<dyn BuildModule>,
) -> Self
pub fn attn_residual_layer_norm( self, attn_residual_layer_norm: Box<dyn BuildModule>, ) -> Self
Attention residual connection layer norm.
Default: Identity
Sourcepub fn attention(self, attention: SelfAttentionConfig) -> Self
pub fn attention(self, attention: SelfAttentionConfig) -> Self
Attention layer configuration.
Default: SelfAttentionConfig::default()
Sourcepub fn feedforward(self, feedforward: PointwiseFeedForwardConfig) -> Self
pub fn feedforward(self, feedforward: PointwiseFeedForwardConfig) -> Self
Feed-forward layer configuration.
Default: PointwiseFeedForwardConfig::default()
Sourcepub fn ffn_residual_layer_norm(
self,
ffn_residual_layer_norm: Box<dyn BuildModule>,
) -> Self
pub fn ffn_residual_layer_norm( self, ffn_residual_layer_norm: Box<dyn BuildModule>, ) -> Self
Feed-forward residual connection layer norm.
Default: Identity
Sourcepub fn parallel_attn_dropout(
self,
parallel_attn_dropout: Box<dyn BuildModule>,
) -> Self
pub fn parallel_attn_dropout( self, parallel_attn_dropout: Box<dyn BuildModule>, ) -> Self
Parallel attention dropout.
Default: Identity
Sourcepub fn use_parallel_attention(self, use_parallel_attention: bool) -> Self
pub fn use_parallel_attention(self, use_parallel_attention: bool) -> Self
Whether to use parallel attention.
Default: false
Trait Implementations§
Source§impl BuildDecoderLayer for TransformerLayerConfig
impl BuildDecoderLayer for TransformerLayerConfig
Source§type Cache = LayerKeyValueCache
type Cache = LayerKeyValueCache
Cache type for the decoder. Read more
Source§fn build_decoder_layer(
&self,
vb: VarBuilder<'_>,
) -> Result<Box<dyn DecoderLayer<Cache = Self::Cache>>, BoxedError>
fn build_decoder_layer( &self, vb: VarBuilder<'_>, ) -> Result<Box<dyn DecoderLayer<Cache = Self::Cache>>, BoxedError>
Build a decoder layer.
Source§impl BuildEncoderLayer for TransformerLayerConfig
impl BuildEncoderLayer for TransformerLayerConfig
Source§fn build_encoder_layer(
&self,
vb: VarBuilder<'_>,
) -> Result<Box<dyn EncoderLayer>, BoxedError>
fn build_encoder_layer( &self, vb: VarBuilder<'_>, ) -> Result<Box<dyn EncoderLayer>, BoxedError>
Build a encoder layer.
Source§impl Debug for TransformerLayerConfig
impl Debug for TransformerLayerConfig
Auto Trait Implementations§
impl Freeze for TransformerLayerConfig
impl !RefUnwindSafe for TransformerLayerConfig
impl !Send for TransformerLayerConfig
impl !Sync for TransformerLayerConfig
impl Unpin for TransformerLayerConfig
impl !UnwindSafe for TransformerLayerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more