-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Closed
Labels
enhancementNot as big of a feature, but technically not a bug. Should be easy to fixNot as big of a feature, but technically not a bug. Should be easy to fixmodule: testsIssues related to tests (not the torch.testing module)Issues related to tests (not the torch.testing module)triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module
Description
Currently we have many uses of
self.assertEqual(ans.shape, expected.shape)
self.assertTrue(np.allclose(ans.cpu(), expected, rtol=1e-02, atol=1e-03, equal_nan=True))
in our tests. e.g. https://github.com/pytorch/pytorch/blob/master/test/test_torch.py#L11270
torch.allclose
won't work well here as it only accept two tensors.
But this way is hard for backends like XLA to override precisions :P
We want to propose make an API
self.assertAllClose(torch_tensor, np_array, rtol, atol, equal_nan)
to replace it.
@mruberry @gchanan @ezyang Does this sound good?
cc: @JackCaoG
Metadata
Metadata
Assignees
Labels
enhancementNot as big of a feature, but technically not a bug. Should be easy to fixNot as big of a feature, but technically not a bug. Should be easy to fixmodule: testsIssues related to tests (not the torch.testing module)Issues related to tests (not the torch.testing module)triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate moduleThis issue has been looked at a team member, and triaged and prioritized into an appropriate module