I have a loss value that becomes negative. when testing it i notices that if i am doing a scalar multiplication of the vector and then mean i am getting a different results then doing the mean and then multiply, i assume this is due to representation error. since the final mean is small.

But how will it affect the loss ? any ideas how to avoid the issue?