fixed trainingLoss computation for full batch