Created
October 22, 2018 11:43
-
-
Save jrevels/c71a96345c59b5c96ff75850ce4f1e1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ReverseDiff, ForwardDiff | |
x, v = rand(3), rand(3) | |
tp = ReverseDiff.InstructionTape() | |
tx = ReverseDiff.track(x, tp) | |
ty = cumprod(tx) | |
ReverseDiff.increment_deriv!(ty, v) | |
ReverseDiff.reverse_pass!(tp) | |
isapprox(ReverseDiff.deriv(tx)', (v' * ForwardDiff.jacobian(cumprod, x))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment