We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I'm using autograd to calculate the gradient of an l2 norm operator, the code is as simple as
def f(x): return np.linalg.norm(x,axis=-1)**2 f_dx = grad(f) f_dx(np.array([[0, 0.]]))
However, when I substitute vector 0 to f, it outputs nan
nan
>> \autograd\numpy\linalg.py:100: RuntimeWarning: invalid value encountered in scalar divide return expand(g / ans) * x
When I change the code to something that does not involve using linalg, it produces 0 as usual
def f(x): return np.sum(np.square(x)) f_dx = grad(f) f_dx(np.array([[0, 0]], dtype=float))
array([[0., 0.]])
autograd/autograd/numpy/linalg.py
Line 100 in 9a90bd6
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi, I'm using autograd to calculate the gradient of an l2 norm operator, the code is as simple as
However, when I substitute vector 0 to f, it outputs
nan
When I change the code to something that does not involve using linalg, it produces 0 as usual
autograd/autograd/numpy/linalg.py
Line 100 in 9a90bd6
The text was updated successfully, but these errors were encountered: