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'm not sure whether this is a proper fix, but if in the defvjp call of anp.power we change anp.where(y, y - 1, 1.) to anp.where(x, anp.where(y, y - 1, 1.), 1.) then gb(0.) does produce the same result as ga(0.)
I concede that 0 ** -0.5 and ZeroDivisionError in general is a delicate topic. But my fix still seems consistent to me. 🤷♂️
The text was updated successfully, but these errors were encountered:
yairchu
added a commit
to soundradix/autograd
that referenced
this issue
Aug 31, 2022
Consider these two seemingly equivalent functions:
We can see that one of them is differentiated ok, while the other produces warnings and
nan
s at zero:I'm not sure whether this is a proper fix, but if in the
defvjp
call ofanp.power
we changeanp.where(y, y - 1, 1.)
toanp.where(x, anp.where(y, y - 1, 1.), 1.)
thengb(0.)
does produce the same result asga(0.)
I concede that
0 ** -0.5
andZeroDivisionError
in general is a delicate topic. But my fix still seems consistent to me. 🤷♂️The text was updated successfully, but these errors were encountered: