Thanks for the quick response. I fixed the loss function and checked it with torch.autograd.gradcheck(). So the loss function should work fine now. Still the predictions are the same per batch.
I predict 9 floats, which should be in range [-2,2].
Here one Prediction of batchsize 2:
tensor([[ 0.0959, -0.1443,  2.0000,  0.0764, -0.0829,  1.6607, -0.1028, -0.0421, 0.9389],
[ 0.1076, -0.0852,  2.0000,  0.0933, -0.0665,  1.6058, -0.1053, -0.0624,  0.8904]], grad_fn=)
Is there any possibility to implement in the loss function, that the predictions in on batch need to be different?