MCPcopy Index your code
hub / github.com/pytorch/pytorch / _assert_close

Function _assert_close

caffe2/python/gradient_checker.py:61–69  ·  view source on GitHub ↗
(value1, value2, threshold, err_msg='')

Source from the content-addressed store, hash-verified

59
60
61def _assert_close(value1, value2, threshold, err_msg=''):
62 np.testing.assert_allclose(
63 value1, value2,
64 atol=threshold, rtol=threshold,
65 err_msg=err_msg,
66 )
67
68 delta = np.abs(value1 - value2).flatten()
69 return np.mean(delta), max(delta)
70
71
72class NetGradientChecker:

Callers 2

CompareNetsMethod · 0.85
CheckMethod · 0.85

Calls 4

maxFunction · 0.50
flattenMethod · 0.45
absMethod · 0.45
meanMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…