concision_transformer/codec/
encoder.rs

1/*
2    Appellation: encoder <module>
3    Contrib: FL03 <jo3mccain@icloud.com>
4*/
5pub use self::{config::EncoderConfig, layer::EncoderLayer};
6
7pub mod config;
8pub mod layer;
9
10use linear::norm::LayerNorm;
11
12#[derive(Default)]
13pub struct Encoder {
14    config: EncoderConfig,
15    layers: Vec<EncoderLayer>,
16    norm: LayerNorm,
17}
18
19impl Encoder {
20    pub fn new() -> Self {
21        Self {
22            config: EncoderConfig::default(),
23            layers: Vec::new(),
24            norm: LayerNorm::default(),
25        }
26    }
27
28    pub const fn config(&self) -> &EncoderConfig {
29        &self.config
30    }
31
32    pub fn layers(&self) -> &[EncoderLayer] {
33        &self.layers
34    }
35
36    pub fn norm(&self) -> &LayerNorm {
37        &self.norm
38    }
39}