Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add BotorchTestCase.assertAllClose (#1618)
Summary: Pull Request resolved: #1618 `BotorchTestCase.assertAllClose` will print more informative error messages on failure than `TestCase.assertTrue(torch.allclose(...))`. It uses `torch.testing.assert_close`. Old test output: ```AssertionError: False is not true``` New test output: ``` 1) AssertionError: Scalars are not close! Absolute difference: 1.0000034868717194 (up to 0.0001 allowed) Relative difference: 0.8348668001940709 (up to 1e-05 allowed) ``` This currently replicates the behavior of `torch.allclose` so that tests remain exactly as strict as they used to be, but in the future we might want to use the behavior of `assert_close` instead since it uses higher tolerances for single-precision inputs by default and is more configurable. Differential Revision: D42402142 fbshipit-source-id: 62dc6df5e786a72a758a4d9a08ca92f88ab2c149
- Loading branch information