Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic Differentiation #82

Merged
merged 26 commits into from
Sep 29, 2023
Merged

Automatic Differentiation #82

merged 26 commits into from
Sep 29, 2023

Conversation

lkdvos
Copy link
Collaborator

@lkdvos lkdvos commented Sep 25, 2023

This PR adds rrules and tests for most linear algebra methods.

Note that the tests for tsvd are disabled when working with Complex, as I have not been able to figure out how to make the lack of uniqueness of U and V work with finite differences and or the ChainRulesTestUtils interface.

return _repartition(p, N₁)
end

TensorKit.block(t::ZeroTangent, c::Sector) = t
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems a bit suspicious? Why is this needed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is mostly to avoid having to manually deal with the ZeroTangent type. For example, a QR decomposition where the final result does not depend on R, would generate a ZeroTangent for dR, which is just an abstract representation that behaves as the zero vector in any (co)vectorspace. As some of the rrules are implemented "blockwise", this would either require manually checking if a tangent is a ZeroTangent, or, which is what I chose to do, rely on the hope that the compiler would recognize that the blockwise operation results in ZeroTangents anyways, and thus automatically takes care of this

@lkdvos lkdvos merged commit 6a0fa69 into master Sep 29, 2023
6 of 9 checks passed
@lkdvos lkdvos deleted the ad branch September 29, 2023 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants