You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following example tries to differentiate through eigvals! with both real and complex input arguments. Both fail, but with different errors. ChainRules has rules that should cover both cases
using LinearAlgebra, ForwardDiff, ForwardDiffChainRules, ChainRules
functiontest_ev(x)
X =copy(reshape(x, 4, 4))
X2 = LinearAlgebra.eigvals!(X)
sum(X2)
end@ForwardDiff_frule LinearAlgebra.eigvals!(x1::AbstractMatrix{<:ForwardDiff.Dual}; kwargs...)
xr =randn(16)
ForwardDiff.gradient(test_ev, xr)
functiontest_ev_complex(x)
X =copy(reshape(x, 4, 4))
X = X + im*X
X2 = LinearAlgebra.eigvals!(X)
sum(X2)
end@ForwardDiff_frule LinearAlgebra.eigvals!(x1::AbstractMatrix{<:Complex{<:ForwardDiff.Dual}}; kwargs...)
ForwardDiff.gradient(test_ev_complex, xr)
The following example tries to differentiate through
eigvals!
with both real and complex input arguments. Both fail, but with different errors. ChainRules has rules that should cover both casesThe text was updated successfully, but these errors were encountered: