MCPcopy
hub / github.com/huggingface/diffusers / torch_all_close

Function torch_all_close

tests/testing_utils.py:127–132  ·  view source on GitHub ↗
(a, b, *args, **kwargs)

Source from the content-addressed store, hash-verified

125
126
127def torch_all_close(a, b, *args, **kwargs):
128 if not is_torch_available():
129 raise ValueError("PyTorch needs to be installed to use this function.")
130 if not torch.allclose(a, b, *args, **kwargs):
131 assert False, f"Max diff is absolute {(a - b).abs().max()}. Diff tensor is {(a - b).abs()}."
132 return True
133
134
135def assert_tensors_close(

Calls 1

is_torch_availableFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…