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

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

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

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ __init__()

eaml.WordAttention.__init__ (   self,
  hidden_dim 
)

Constructor for WordAttention class.

Parameters
hidden_dimDimension of the hidden state

Member Function Documentation

◆ forward()

eaml.WordAttention.forward (   self,
  gru_output 
)

Forward pass through the word attention layer.

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

Member Data Documentation

◆ attention

eaml.WordAttention.attention

◆ context_vector

eaml.WordAttention.context_vector

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