concision_transformer/codec/encoder/
layer.rs

1/*
2    Appellation: layer <module>
3    Contrib: FL03 <jo3mccain@icloud.com>
4*/
5use crate::attention::multi::MultiHeadAttention;
6
7#[derive(Default)]
8pub struct EncoderLayer {
9    pub(crate) attention: MultiHeadAttention,
10}
11
12impl EncoderLayer {
13    pub fn new() -> Self {
14        let attention = MultiHeadAttention::default();
15
16        Self { attention }
17    }
18    /// Returns an immutable reference to the multi-head, self-attention layer.
19    pub fn attention(&self) -> &MultiHeadAttention {
20        &self.attention
21    }
22    /// Returns a mutable reference to the multi-head, self-attention layer.
23    pub fn attention_mut(&mut self) -> &mut MultiHeadAttention {
24        &mut self.attention
25    }
26}