I’m not sure if this might be the reason, since the difference is quite large, but using float numbers the order of the operations can yield small perturbations in the results:
a = torch.randn(10, 10, 10)
a_sum = a.sum()
a_sum_sep = a.sum(0).sum(0).sum(0)[0]
err = a_sum - a_sum_sep
print(err)