I was thinking of a trick. If existing CTC gradient (wrt logits if the paper is correct) is of form log_probs.exp() - somequantity, then we can retrieve somequantity (by undoing the subtraction) and use it in NLL loss. Like that it should be possible to sidestep modifying the original CTC. But something is not quite right, my code snippet does not produce the same loss value via NLL.