5 ms·
^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 yo
by dbieber 9y 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))
- simonbyrne 9y agoAh, good point, thanks!