Open GiggleLiu opened 4 years ago
julia> @benchmark myloss(ForwardDiff.Dual(10.0, 1.0))
BenchmarkTools.Trial:
memory estimate: 7.06 KiB
allocs estimate: 4
--------------
minimum time: 2.605 μs (0.00% GC)
median time: 2.790 μs (0.00% GC)
mean time: 3.356 μs (7.09% GC)
maximum time: 190.302 μs (96.25% GC)
--------------
samples: 10000
evals/sample: 9
julia> @benchmark Grad(i_myloss!)(Val(1), 0.0, zeros($n-2), zeros($n-2), zeros($n-2), 10.0)
BenchmarkTools.Trial:
memory estimate: 7.92 KiB
allocs estimate: 6
--------------
minimum time: 7.122 μs (0.00% GC)
median time: 7.266 μs (0.00% GC)
mean time: 8.183 μs (3.35% GC)
maximum time: 339.283 μs (95.11% GC)
--------------
samples: 10000
evals/sample: 6
In the single parameter case, forwarddiff is faster because reversediff traverse the program twice.
In the first example in the README, the linear solver can be faster
When
A
,B
andC
are uniform, we haveThe NiLang version is