DAPPER (Document Analysis, Processing, and Pattern Extraction Repository)
Statistical Learning Final Project for Document Classification
 
Loading...
Searching...
No Matches
eaml.SentenceAttention Class Reference

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

Inheritance diagram for eaml.SentenceAttention:
Inheritance graph
Collaboration diagram for eaml.SentenceAttention:
Collaboration graph

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

eaml.SentenceAttention.__init__ (   self,
  hidden_dim 
)

Constructor for SentenceAttention class.

Parameters
hidden_dimDimension of the hidden state

Member Function Documentation

◆ forward()

eaml.SentenceAttention.forward (   self,
  gru_output 
)

Forward pass through the sentence attention layer.

Parameters
gru_outputOutput from the GRU layer of shape (batch_size, num_sentences, hidden_dim)
Returns
Tuple of (document vector, attention weights)

Member Data Documentation

◆ attention

eaml.SentenceAttention.attention

◆ context_vector

eaml.SentenceAttention.context_vector

The documentation for this class was generated from the following file: