CTCLoss predicts blanks after a few batches

The ctc loss value for a case is infinite and then for the all the other examples after that it gives loss as ‘nan’. I realised that at times the input length is less than the target length and that might be a problem so I padded the Input with blank characters.
But the loss is still getting inf value when input length = target length +1.
Is there a limit to the ctc loss that the ratio between the input len and target len should be more than 1.
Thank you for you time.