Hacker News new | ask | show | jobs
by dbieber 3150 days ago
^I get that error with just `tangent.grad(np.sin)`.

So, it's not a nested differentiation problem, so much as a problem with "ufuncs". If you wrap np.sin in your own function then it takes the gradient just fine.

def sin(x): return np.sin(x)

negative_sin = tangent.grad(tangent.grad(sin))

1 comments

Ah, good point, thanks!