-
Notifications
You must be signed in to change notification settings - Fork 92
Closed
Description
Stating the obvious, but we had a nightly failure https://github.com/JuliaDiff/ChainRules.jl/runs/4390009367?check_suite_focus=true
which is probably related to changes in LinearAlgebra coming with julia 1.7
I can reproduce the error locally when running the tests, but not when copy-pasting the code necessary to run the tests into the REPL for some reason. I.e. the following should error:
using ChainRules
using ChainRulesCore
using Test
using LinearAlgebra
using FiniteDifferences
using ChainRulesTestUtils
using ChainRulesTestUtils: rand_tangent, _fdm
# generate random matrices of type TA in the domain of f
function rand_matfun_input(f, TA, T, uplo, n, hermout)
U = Matrix(qr(randn(T, n, n)).Q)
if hermout # f(A) will also be a TA
λ = if f in (acos, asin, atanh)
2 .* rand(real(T), n) .- 1
elseif f in (log, sqrt)
abs.(randn(real(T), n))
elseif f === acosh
1 .+ abs.(randn(real(T), n))
else
randn(real(T), n)
end
else
λ = randn(real(T), n)
λ = if f === atanh
2 .* rand(real(T), n) .- 1
else
randn(real(T), n)
end
end
return TA(U * Diagonal(λ) * U', uplo)
end
f = atanh
TA = Symmetric
T = Float64
TC = Complex{real(T)}
n = 10
λ, U = eigen(rand_matfun_input(f, TA, T, :U, n, true))
m = div(n, 2)
λ[1:m] .= λ[m+1:2m] .+ cbrt(eps(eltype(λ))) / 100
A = TA(U * Diagonal(λ) * U')
ΔA = TA(randn(T, n, n))
_, ∂Y = frule((ZeroTangent(), ΔA), f, A)
@test parent(∂Y) ≈ jvp(_fdm, x -> Matrix{TC}(parent(f(TA(x)))), (A.data, ΔA.data))
λ[1:m] .= λ[m+1:2m]
A2 = TA(U * Diagonal(λ) * U')
ΔA2 = TA(randn(T, n, n))
_, ∂Y2 = frule((ZeroTangent(), ΔA2), f, A2)
@test parent(∂Y2) ≈ jvp(_fdm, x -> Matrix{TC}(parent(f(TA(x)))), (A2.data, ΔA2.data))
Metadata
Metadata
Assignees
Labels
No labels