Compare two tensors or non-tensor numbers for their closeness. Add msg=blah to add an additional comment to when assert fails. For default values of `rtol` and `atol` which are dtype dependent, see the table at https://docs.pytorch.org/docs/stable/testing.html#torch.testing.assert_clo
(actual, expected, **kwargs)
| 135 | |
| 136 | |
| 137 | def torch_assert_close(actual, expected, **kwargs) -> None: |
| 138 | """ |
| 139 | Compare two tensors or non-tensor numbers for their closeness. |
| 140 | |
| 141 | Add msg=blah to add an additional comment to when assert fails. |
| 142 | |
| 143 | For default values of `rtol` and `atol` which are dtype dependent, see the table at https://docs.pytorch.org/docs/stable/testing.html#torch.testing.assert_close |
| 144 | For example for bf16 it is `rtol=1.6e-2` and `atol=1e-5`. |
| 145 | |
| 146 | The check doesn't assert when `|a - b| <= (atol + rtol * |b|)` |
| 147 | """ |
| 148 | torch.testing.assert_close(actual, expected, **kwargs) |
| 149 | |
| 150 | |
| 151 | def torch_assert_dicts_of_tensors_equal(actual, expected, **kwargs): |
no outgoing calls