ner.nn.models.ffnn module#

class ner.nn.models.ffnn.FFNN(embedding_dim: int, hidden_dim: int, output_dim: int, num_layers: int = 1)#

Bases: Module

A multi-layer feed-forward neural network that applies a linear transformation, followed by a ReLU nonlinearity, at each layer.

Parameters:
embedding_dimint

Number of dimensions of an input embedding.

hidden_dimint

Number of dimensions for the hidden layer(s).

output_dimint

Number of dimensions for the output layer.

num_layersint

Number of hidden layers to initialize.

forward(embeddings: Tensor) Tensor#

Computes a forward pass through each of the network layers using the given input embeddings.

Parameters:
embeddingstorch.Tensor

Input tensor of embeddings of shape (batch_size, max_length, embedding_dim).

Returns:
torch.Tensor

Output tensor resulting from forward pass of shape (batch_size, max_length, output_dim).