MCPcopy
hub / github.com/tinygrad/tinygrad / gradcheck

Function gradcheck

extra/gradcheck.py:48–51  ·  view source on GitHub ↗
(func, input, eps = 1e-3, atol = 1e-3, rtol = 1e-3)

Source from the content-addressed store, hash-verified

46 return NJ
47
48def gradcheck(func, input, eps = 1e-3, atol = 1e-3, rtol = 1e-3):
49 NJ = numerical_jacobian(func, input, eps)
50 J = jacobian(func, input)
51 return np.allclose(J, NJ, atol = atol, rtol = rtol)

Callers 1

test_gradcheckMethod · 0.90

Calls 3

numerical_jacobianFunction · 0.85
jacobianFunction · 0.85
allcloseMethod · 0.80

Tested by 1

test_gradcheckMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…