You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would try using Jax , but the install does not work on my system and Jax has 1.3k open issues, so I think that my install questions would get lost in the noise; see jax-ml/jax#18084
How do I create a scalar value that does not depend on the independent variables ?
The following function works (fails) if you set flag to False (True).
flag = False
import autograd
def my_fun(x) :
Scalar = type( x[0] )
result = x[0] * x[1]
if flag :
result = result + Scalar(0.0)
return result
my_grad = autograd.grad(my_fun)
my_x = autograd.numpy.array( [ 2.0, 3.0 ] )
my_g = my_grad( my_x )
ok = my_g[0] == my_x[1] and my_g[1] == my_x[0]
print( f'ok = {ok}' )
The text was updated successfully, but these errors were encountered:
I would try using Jax , but the install does not work on my system and Jax has 1.3k open issues, so I think that my install questions would get lost in the noise; see
jax-ml/jax#18084
How do I create a scalar value that does not depend on the independent variables ?
The following function works (fails) if you set flag to False (True).
The text was updated successfully, but these errors were encountered: