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` is a thin wrapper around `torch.testing.assert_close`, designed to replace usages of `self.assertTrue(torch.allclose(...))`. Using has several advantages over `torch.allclose`: * Checks that shapes are equal, not just values * More configurability and better defaults, such as higher tolerances for single precision, if we choose to use them in the future. for the time being, I've set up this wrapper so that numerical checks remain exactly the same as they used to be. * More informative test output, showing what was put in and why the test failed: 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) ``` Reviewed By: Balandat Differential Revision: D42402142 fbshipit-source-id: 8d29fde720b24a1c6c9f22797585db5962d01d7b
- Loading branch information