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


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