Skip to content

feat: add adjoint for remake_buffer #3042

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

Merged

Conversation

AayushSabharwal
Copy link
Member

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

Add any other context about the problem here.

tunable = selected_tangents(buf′.tunable, tunable_idxs)
discrete = selected_tangents(buf′.discrete, disc_idxs)
constant = selected_tangents(buf′.constant, const_idxs)
nonnumeric = selected_tangents(buf′.nonnumeric, nn_idxs)
Copy link
Member

Choose a reason for hiding this comment

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

is this type stable?

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't checked, though the type-stability of the adjoint will largely depend on the type stability of idxs and vals

Copy link
Member Author

Choose a reason for hiding this comment

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

selected_tangents is type-stable, the pullback is almost type stable with a couple changes if idxs and vals are type-stable. The only source of instability is the one selected_tangents method which uses similar(tangents, Union{T, NoTangent}) (which in fairness is a concretely typed union) and vals′

Copy link
Member Author

Choose a reason for hiding this comment

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

However, if we restrict to the case of idxs only referring to values in the tunables, it's type-stable.

@ChrisRackauckas ChrisRackauckas merged commit 39b6221 into SciML:master Sep 16, 2024
24 of 25 checks passed
@AayushSabharwal AayushSabharwal deleted the as/remake-buffer-adjoint branch September 16, 2024 08:34
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.

2 participants