espnet2.spk.loss.softmax.Softmax
Less than 1 minute
espnet2.spk.loss.softmax.Softmax
class espnet2.spk.loss.softmax.Softmax(nout: int, nclasses: int)
Bases: AbsLoss
Softmax loss
- Parameters:
- nout – Dimension of input features (embedding size)
- nclasses – Number of output classes
Initializes internal Module state, shared by both nn.Module and ScriptModule.
forward(input: Tensor, label: Tensor | None = None) → Tuple[Tensor | None, Tensor | None, Tensor]
Forward pass of Softmax loss.
- Parameters:
- input – Input embeddings, shape (batch_size, embedding_dim)
- label – Ground truth labels, shape (batch_size,)
- Returns: Cross-entropy loss accuracy: Classification accuracy preds: Predicted class indices
- Return type: loss