Thanks, converting LongTensor to IntTensor works. The model is traning now. However, the training loss varys much and does not decrease. My input to the loss function:

ctc_input.png1378×89 21.4 KB

tag_score_shape is [15,2,64]  (max_seq_len, batch_size, character_probability). It’s generated by passing neural outcome to sigmoid and then softmax. My neural network is structed as resnet_cnn layers + bidirectional lstm + fully connected. It works well for fixed length character recognization using NLLLoss. The traning and evaluation loss:

ctc_loss.png450×734 17.8 KB

They seems to be too large for loss. The evaluation loss curve seems to be declining, but the values are all 256.5 probably due to precision omitted by tensorboard. After some time, eval loss just stays still. The traning loss looks bad too.