[BC breaking] Remove assert_allclose (#164560)
`torch.testing.assert_allclose` was deprecated in favour of `torch.testing.assert_close`. This PR thus replaces usage of `torch.testing.assert_close` with `torch.testing.assert_allclose` and removes `torch.testing.assert_allclose`. Thus the PR breaks backward compatibility. Because `torch.testing.assert_allclose` is actually a wrapper of `torch.testing.assert_close`, the `kwargs` of the two functions overlaps largely as well as some of their default values, so it is relatively easy to move to the new way. One notable default value change is that `torch.testing.assert_allclose` uses `check_dtype=False` while `dtype` check is enabled by default in `torch.testing.assert_close`. Another change is that `eq_nan=True` in `torch.testing.assert_allclose` and it is `False` in `torch.testing.assert_close` For example, before the PR we have ``` torch.testing.assert_allclose(a, b) ``` After the PR it should be changed to ``` torch.testing.assert_close(a, b, check_dtype=False) ``` or simply to ``` torch.testing.assert_close(a, b) ``` to also check `dtype`. Pull Request resolved: https://github.com/pytorch/pytorch/pull/164560 Approved by: https://github.com/janeyx99, https://github.com/mlazos
Y
Yuanyuan Chen committed
eac53545ce48b33d5aad93e8b027f93160a50c05
Parent: c240daa
Committed by PyTorch MergeBot <pytorchmergebot@users.noreply.github.com>
on 8/24/2026, 7:56:58 AM