concision_transformer/codec/mod.rs
1/*
2 Appellation: codec <module>
3 Contrib: FL03 <jo3mccain@icloud.com>
4*/
5//! # Codec
6//!
7//! The `codec` module implements the [Decoder] and [Encoder] layers of the [Transformer](crate::Transformer) model.
8//! Each layer has two sublayers, namely:
9//! - multi-head, self-attention layer
10//! - fully-connected, piecewise feed-forward network.
11//!
12pub use self::{decoder::Decoder, encoder::Encoder, model::*};
13
14pub(crate) mod model;
15
16pub mod decoder;
17pub mod encoder;
18
19#[cfg(test)]
20mod tests {
21 use super::*;
22
23 #[test]
24 fn test_codec_builder() {
25 let ctx = Context::new()
26 .with_src("src".to_string())
27 .with_tgt("tgt".to_string());
28 let codec = Codec::new().ctx(ctx).build();
29 assert_eq!(codec.context().src, "src");
30 assert_eq!(codec.context().tgt, "tgt");
31 }
32}