Ohhh, I think I was very tired yesterday how I didn’t saw obvious thing here what I did even after reading documentation. I just had to call loss function using log_probs and target_tensor like:
loss = loss_function(log_probs, target_tensor)
Now everything works, sorry for confusion.
Thank you Frank,
Ivan