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
This makes me however wonder to what extent we can rely on getindex returning a copy. If we ever switch over the TensorKit blocks to return a StridedView instead of a reshape(view(...)), we might run into problem, because getindex producing a view on StridedView objects has been a (possibly misinformed) design principle from early on. Maybe we should be more explicit with copy(view(...)) ?
@Jutho I have switched everything to copy(view(...)), but I think this is more a case of Strided performing piracy on a Base method by altering its semantics than MatrixAlgebraKit not being able to rely on this. It is a good comment though, this would be an annoying thing to debug in the future...
@kshyatt Good point, should be done now :).
Interestingly, my first idea was that this should be caught by the AD testing frameworks, but that just isn't the case because of different requirements: Mooncake actually requires us to zero out these output tangents, so that would never catch this (or be affected by this), and adding this to ChainRulesTestUtils seems like it will be hard to find someone to merge this...
This also brings up the point that if we end up dropping chainrules in the end, it would actually be more efficient to assume we can modify these inputs, but I guess we can keep that for the future 😉
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bumped into this to resolve QuantumKitHub/TensorKit.jl#419.
TLDR: the QR pullback correctly did not modify the input cotangents, using a
getindex, while the LQ pullback uses aview.