Based on your code snippet it seems that you are using nn.Modules in a wrong way.
The proper way is to create an object and pass the input(s) to it to get the result.
However, here:
softmax_pred_S = nn.LogSoftmax(preds_S[0])

you are creating the nn.LogSoftmax module with what seems to be a tensor. This value would be used as the dim argument.
Later you are then passing the dim to the loss calculation:
loss_value = loss(softmax_pred_S.dim,softmax_pred_T)

which is also wrong, since a tensor with log probabilities would be expected, not a dimension value.