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

feat: make dense_ad act as the identity on a dense backend #107

Merged
merged 2 commits into from
Mar 6, 2025
Merged

Conversation

gdalle
Copy link
Collaborator

@gdalle gdalle commented Mar 6, 2025

Checklist

  • Appropriate tests were added
  • Any code changes were done in a way that does not break public API
  • All documentation related to code changes were updated
  • The new code follows the
    contributor guidelines, in particular the SciML Style Guide and
    COLPRAC.
  • Any new documentation only uses public API

Additional context

Adds a natural default dense_ad(ad::AbstractADType) = ad to help avoid the following pattern:

if ad isa AutoSparse
    dense_ad(ad)
else
    ad
end

@gdalle gdalle requested a review from oscardssmith March 6, 2025 06:48
@gdalle gdalle merged commit 2b3f360 into main Mar 6, 2025
5 checks passed
@gdalle gdalle deleted the gd/dense_ad branch March 6, 2025 07:01
@oscardssmith
Copy link

thanks!

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