MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / assert_all_approx_close

Function assert_all_approx_close

tests/test_modules.py:55–60  ·  view source on GitHub ↗
(a, b, atol=1e-8, rtol=1e-5, count=10)

Source from the content-addressed store, hash-verified

53
54
55def assert_all_approx_close(a, b, atol=1e-8, rtol=1e-5, count=10):
56 idx = torch.isclose(a, b, rtol=rtol, atol=atol)
57 sumval = (idx == 0).sum().item()
58 if sumval > count:
59 print(f"Too many values not close: assert {sumval} < {count}")
60 torch.testing.assert_close(a, b, rtol=rtol, atol=atol)
61
62
63@pytest.mark.parametrize("device", get_available_devices())

Callers 1

test_kbit_backpropFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected