Hi everyone. I am studying about CTC from this wonderful article Sequence Modeling with CTC , and I’d like to ask something regarding PyTorch’s way of computing CTC loss.

In the article it says that to compute the loss, a typical way would be to sum the probability of all valid alignments. However, this might become too costly, as the valid alignments may be too many.

It then goes on to explain an alternative, less costly way to compute the loss, which approximates the above-mentioned calculation.

Reading PyTorch’s documentation, I think that it computes the loss using the first way, that is summing over *all* possible alignments. Is my understanding correct, and if yes, is there a way to use the second approach described in the article, which uses a dynamic programming algorithm?

Any help will be greatly appreciated, thanks