Indeed, ctc loss will ignore stuff beyond the target_lengths. However, your lengths seemed to be such that you include blanks before that, maybe the lengths are off?
There is a bug in GPU CTC when you have target length zero, so if you need that after you’ve fixed your inputs, maybe the CPU version is better at the moment.
Best regards
Thomas