kaira.losses.text.Word2VecLoss

Inheritance diagram for Word2VecLoss
- class kaira.losses.text.Word2VecLoss(embedding_dim, vocab_size, n_negatives=5)[source]
Bases:
BaseLossWord2Vec Loss Module.
This module implements the negative sampling loss used in Word2Vec.
Methods
Initialize the Word2VecLoss module.
Forward pass through the Word2VecLoss module.
- forward(input_idx: Tensor, output_idx: Tensor) Tensor[source]
Forward pass through the Word2VecLoss module.
- Parameters:
input_idx (torch.Tensor) – Input word indices.
output_idx (torch.Tensor) – Output context word indices.
- Returns:
The Word2Vec loss.
- Return type: