Solved by jdhao in post #9 
              
              
                Finally, I have found the reason for this error. I am using the warp_ctc package to do ocr recognition.  The signature for CTCLoss is: 
CTCLoss(size_average=False, length_average=False)
    # size_average (bool): normalize the loss by the batch size (default: False)
    # length_average (bool): norm…