Skip to content

Commit

Permalink
Fix SVD rrule when ΔSis a ZeroTangent
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Oct 17, 2023
1 parent e912eae commit 680faf3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/TensorKitChainRulesCoreExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ function svd_rev(U::AbstractMatrix, S::AbstractMatrix, V::AbstractMatrix, ΔU,
F = _invert_S²(S, tol)
S⁻¹ = pinv(S; atol=tol)

term = Diagonal(diag(ΔS))
term = ΔS isa ZeroTangent ? ΔS : Diagonal(diag(ΔS))

J = F .* (U' * ΔU)
term += (J + J') * S
Expand Down

0 comments on commit 680faf3

Please sign in to comment.