SIGN IN SIGN UP

[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
080093474421f2c563bd83fb1c61bae5af2019d0
Parent: fe4a613
Committed by PyTorch MergeBot <pytorchmergebot@users.noreply.github.com> on 8/25/2026, 1:47:26 AM