MCPcopy Create free account
hub / github.com/deepspeedai/DeepSpeed / torch_assert_equal

Function torch_assert_equal

tests/unit/util.py:127–132  ·  view source on GitHub ↗

Compare two tensors or non-tensor numbers for their equality. Add msg=blah to add an additional comment to when assert fails.

(actual, expected, **kwargs)

Source from the content-addressed store, hash-verified

125
126
127def torch_assert_equal(actual, expected, **kwargs) -> None:
128 """
129 Compare two tensors or non-tensor numbers for their equality.
130 Add msg=blah to add an additional comment to when assert fails.
131 """
132 torch.testing.assert_close(actual, expected, rtol=0.0, atol=0.0, **kwargs)
133
134
135def torch_assert_close(actual, expected, **kwargs) -> None:

Callers 5

testMethod · 0.90
test_ulysses_sp_hfMethod · 0.90
test_disable_in_evalMethod · 0.90
test_tiled_mlpMethod · 0.90

Calls 1

assert_closeMethod · 0.80

Tested by 5

testMethod · 0.72
test_ulysses_sp_hfMethod · 0.72
test_disable_in_evalMethod · 0.72
test_tiled_mlpMethod · 0.72