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
I observed a loss of precision using ReverseDiff with respect to ForwardDiff on the following simple example:
ReverseDiff
ForwardDiff
julia> testprecision() type precision eps(T) = 1.7272337110188889250772703725600799142232e-77 ForwardDiff error = 0.0000000000000000000000000000000000000000e+00 ReverseDiff error = 8.6560832651618551196119417711416155844212e-19
Is it expected? Thanks!
using Statistics, LinearAlgebra using ForwardDiff, ReverseDiff, Printf setprecision(2 ^ 8) function testprecision(n::Int64 = 1_000, T::DataType = BigFloat) x = rand(T, n) f(x) = mean(x .^ 3) gf = ForwardDiff.gradient(f, x) gr = ReverseDiff.gradient(f, x) gth = 3 * x .^ 2 / n @printf "type precision eps(T) = %4.40e \n\n" eps(T) @printf "ForwardDiff error = %4.40e \n" norm(gf - gth) @printf "ReverseDiff error = %4.40e \n" norm(gr - gth) nothing end
The text was updated successfully, but these errors were encountered:
~
No branches or pull requests
I observed a loss of precision using
ReverseDiff
with respect toForwardDiff
on the following simple example:Is it expected?
Thanks!
The text was updated successfully, but these errors were encountered: