Forward Sum Loss
Bases: Module
Computes the forward sum loss for sequence-to-sequence models with attention.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
blank_logprob |
float
|
The log probability of the blank symbol. Default: -1. |
-1
|
Attributes:
| Name | Type | Description |
|---|---|---|
log_softmax |
LogSoftmax
|
The log softmax function. |
ctc_loss |
CTCLoss
|
The CTC loss function. |
blank_logprob |
float
|
The log probability of the blank symbol. |
Methods:
| Name | Description |
|---|---|
forward |
Computes the forward sum loss for sequence-to-sequence models with attention. |
Source code in training/loss/forward_sum_loss.py
forward(attn_logprob, in_lens, out_lens)
Computes the forward sum loss for sequence-to-sequence models with attention.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
attn_logprob |
Tensor
|
The attention log probabilities of shape (batch_size, max_out_len, max_in_len). |
required |
in_lens |
Tensor
|
The input lengths of shape (batch_size,). |
required |
out_lens |
Tensor
|
The output lengths of shape (batch_size,). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The forward sum loss. |