Derivatives of a production function

Zygote will not work for you the way it’s implemented now as you are mutating L1. ForwardDiff.jl should work well though

ForwardDiff.gradient(L2 -> F(L2, A; kwargs...), L2)

Note that defining L1 like this

 L1 = similar(L2, 2)

will be required then

2 Likes