Hmmm, that’s odd that your batch dimension gets changed via the function. Are you sure it’s not meant to change a different dimension of your Tensor?
Would you mind explain what that function does?
Ideally, your loss function should take 2 Tensors with the same batch dimension as you’re effectively measuring the difference between 2 probability distributions with your data.