MCPcopy Create free account
hub / github.com/FreeformRobotics/OTS / TorchTestCase

Class TorchTestCase

lib/nn/modules/unittest.py:23–29  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21
22
23class TorchTestCase(unittest.TestCase):
24 def assertTensorClose(self, a, b, atol=1e-3, rtol=1e-3):
25 npa, npb = as_numpy(a), as_numpy(b)
26 self.assertTrue(
27 np.allclose(npa, npb, atol=atol),
28 'Tensor close check failed\n{}\n{}\nadiff={}, rdiff={}'.format(a, b, np.abs(npa - npb).max(), np.abs((npa - npb) / np.fmax(npa, 1e-5)).max())
29 )

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected