Note that in the above example the inference result is not “perfect” because you need to pass log-softmaxed activations into the ctc loss. This means that the ideal case would be an alignment where all targets except the true target have -inf and the true target has 0.