-
-
Notifications
You must be signed in to change notification settings - Fork 39
Closed
Description
It'd be great to add support for ReverseDiff. ForwardDiff is great, and even FiniteDiff works fine. But with ReverseDiff I get an error:
using ComponentArrays
using ForwardDiff
using ReverseDiff
using FiniteDiff
using Parameters: @unpack
ca = ComponentArray(x = [1, 2], θ = [1.0, 100.0], deg = 2)
function F(ca)
@unpack x, θ, deg = ca
(θ[1] - x[1])^deg + θ[2] * (x[2] - x[1]^deg)^deg
end
gradsF = ForwardDiff.gradient(ca -> F(ca), ca).x
gradsFD = FiniteDiff.finite_difference_gradient(ca -> F(ca), ca).x
gradsR = ReverseDiff.gradient(ca -> F(ca), ca).x
# ERROR: type TrackedArray has no field x
Metadata
Metadata
Assignees
Labels
No labels