Tom_ska:

Thanks! But shouldnt a simple unsqueeze(0) solve this?


No, since this would remove the batch dimension and you would end up with the wrong shapes again.
Based on the second error, it seems that predicted_model is a list and not a tensor, so you won’t be able to use log_softmax on it.
Also, note that indexing a tensor as x[0] is only equal to squeeze(0), if the size of the dimension is 1.