Skip to content

Commit fafd9e1

Browse files
committed
add rrule for flip
1 parent ed09f13 commit fafd9e1

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ext/TensorKitChainRulesCoreExt/linalg.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,12 @@ function ChainRulesCore.rrule(::typeof(twist), A::AbstractTensorMap, is; inv::Bo
8383
return tA, twist_pullback
8484
end
8585

86+
function ChainRulesCore.rrule(::typeof(flip), A::AbstractTensorMap, is)
87+
tA = flip(A, is)
88+
flip_pullback(ΔA) = NoTangent(), flip(unthunk(ΔA), is), NoTangent()
89+
return tA, flip_pullback
90+
end
91+
8692
function ChainRulesCore.rrule(::typeof(dot), a::AbstractTensorMap, b::AbstractTensorMap)
8793
dot_pullback(Δd) = NoTangent(), @thunk(b * Δd'), @thunk(a * Δd)
8894
return dot(a, b), dot_pullback

0 commit comments

Comments
 (0)