Word-level Attention layer for text processing. More...


Public Member Functions | |
| __init__ (self, hidden_dim) | |
| Constructor for WordAttention class. | |
| forward (self, gru_output) | |
| Forward pass through the word attention layer. | |
Public Attributes | |
| attention | |
| context_vector | |
Word-level Attention layer for text processing.
This class implements a word-level attention mechanism that computes attention weights for each word in a sequence and produces a context vector.
Word-level Attention layer.
| eaml.WordAttention.__init__ | ( | self, | |
| hidden_dim | |||
| ) |
Constructor for WordAttention class.
| hidden_dim | Dimension of the hidden state |
| eaml.WordAttention.forward | ( | self, | |
| gru_output | |||
| ) |
Forward pass through the word attention layer.
| gru_output | Output from the GRU layer of shape (batch_size, seq_len, hidden_dim) |
| eaml.WordAttention.attention |
| eaml.WordAttention.context_vector |