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
NaNMath.pow
NaNMath.log
I would expect this:
using ForwardDiff using NaNMath function new_pow(x) NaNMath.pow(x[1],x[2]) end ForwardDiff.gradient(new_pow, [-1.0, 1.0])
to return a NaN I think?
NaN
The issue is right here,
for f in (:(Base.:^), :(NaNMath.pow)) @eval begin @define_binary_dual_op( $f, begin vx, vy = value(x), value(y) expv = ($f)(vx, vy) powval = vy * ($f)(vx, vy - 1) if isconstant(y) logval = one(expv) elseif iszero(vx) && vy > 0 logval = zero(vx) else logval = expv * log(vx) end new_partials = _mul_partials(partials(x), partials(y), powval, logval) return Dual{Txy}(expv, new_partials) end,
in logval = expv*log(vx) , I think NaNMath.log should be used if f is NaNMath.pow.
logval = expv*log(vx)
f
The text was updated successfully, but these errors were encountered:
Makes sense to me.
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
I would expect this:
to return a
NaN
I think?The issue is right here,
in
logval = expv*log(vx)
, I thinkNaNMath.log
should be used iff
isNaNMath.pow
.The text was updated successfully, but these errors were encountered: