How large is the difference between y1 and y2?
If it’s approx. 1e-6 or smaller, you might just see the limited floating point precision of FP32 numbers.
To compare these tensors, you could alternatively use torch.allclose and specify the absolute or relative error, if necessary.
I’ve created a manual approach of nn.BatchNorm2d some time ago here 27. Maybe it might help in debugging.