Thank you for your feedback, @ptrblck !

I’ve changed targets to
targets  = targets.reshape(seq_len, input_size).long()
So now Outputs is torch.Size([226, 1, 128]) while targets is torch.Size([226, 128]) if I understood your answer in 1. correctly. However, I keep getting the second errors abour invalid indices. I’m not sure how to fix this?