(a, b, rtol=1e-3, atol=1e-3, count=0, throw=True)
| 37 | |
| 38 | |
| 39 | def assert_all_approx_close(a, b, rtol=1e-3, atol=1e-3, count=0, throw=True): |
| 40 | idx = torch.isclose(a, b, rtol=rtol, atol=atol) |
| 41 | sumval = (idx == 0).sum().item() |
| 42 | if sumval > count: |
| 43 | if throw: |
| 44 | print(f"Too many values not close: assert {sumval} < {count}") |
| 45 | torch.testing.assert_close(a, b, rtol=rtol, atol=atol) |
| 46 | |
| 47 | return sumval |
| 48 | |
| 49 | |
| 50 | class FFN(torch.nn.Module): |
no outgoing calls
no test coverage detected