syntaxdot_transformers/
error.rs

1use tch::TchError;
2use thiserror::Error;
3
4/// Transformer errors.
5#[derive(Debug, Error)]
6#[non_exhaustive]
7pub enum TransformerError {
8    /// The hidden size is not a multiple of the number of attention heads.
9    #[error("hidden size ({hidden_size:?}) is not a multiple of attention heads ({num_attention_heads:?})")]
10    IncorrectHiddenSize {
11        /// The hidden size.
12        hidden_size: i64,
13
14        /// The number of attention heads.
15        num_attention_heads: i64,
16    },
17
18    /// Torch error.
19    #[error(transparent)]
20    Tch(#[from] TchError),
21
22    /// The activation function is unknown.
23    #[error("unknown activation function: {activation:?}")]
24    UnknownActivationFunction { activation: String },
25}