Skip to content

Commit

Permalink
Add rrule for efficient copy constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
lkdvos committed Sep 29, 2023
1 parent 1fe4955 commit 3139ae7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ext/TensorKitChainRulesCoreExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ function ChainRulesCore.rrule(::typeof(convert), T::Type{<:Array}, t::AbstractTe
return A, convert_pullback
end

function ChainRulesCore.rrule(::typeof(Base.copy), t::AbstractTensorMap)
copy_pullback(Δt) = NoTangent(), Δt
return copy(t), copy_pullback
end

# Base Linear Algebra
# -------------------

Expand Down

0 comments on commit 3139ae7

Please sign in to comment.