The Connectionist Temporal Classification loss.
nnf_ctc_loss(
log_probs,
targets,
input_lengths,
target_lengths,
blank = 0,
reduction = c("mean", "sum", "none"),
zero_infinity = FALSE
)
(sum(target_lengths))
. Targets cannot be blank.
In the second form, the targets are assumed to be concatenated.
(int, optional) Blank label. Default
(string, optional) – Specifies the reduction to apply to the output: 'none' | 'mean' | 'sum'. 'none': no reduction will be applied, 'mean': the sum of the output will be divided by the number of elements in the output, 'sum': the output will be summed. Default: 'mean'
(bool, optional) Whether to zero infinite losses and the
associated gradients. Default: FALSE
Infinite losses mainly occur when the
inputs are too short to be aligned to the targets.