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

Refactor parameter caching + add Zygote tests #315

Merged
merged 11 commits into from
Jul 28, 2024

Conversation

SouthEndMusic
Copy link
Member

@SouthEndMusic SouthEndMusic commented Jul 27, 2024

Fixes #298
Fixes #301

#289 can be a follow-up. Gradients w.r.t. u for QuadraticSpline are not broken anymore, but they are slow as mentioned in the issue.

The refactor includes:

  • Caching parameters is opt-in, so users need to make the active decision to cache parameters. It is documented that this is not compatible with modifying u and t. We could if desired allow this with a dedicated interface which updates the parameters automatically. When parameters are not cached, they are computed on demand with the same functions.
  • The ReadOnlyArray wrappers are removed, which simplifies the type parameters. I also noticed an inconsistency where I forgot to do it for integral inverse interpolations in the first place
  • Also safetycopy as an option is removed again

Zygote:

  • I added Zygote tests for differentiation w.r.t. the interpolation input and w.r.t. the u of the data points for where that is supported (again).
  • I've added some examples in DataInterpolationsChainRulesCoreExt.jl of how to speed up gradients w.r.t. u with analytical expressions. Speeding up more interpolation types this way could be a follow up

@SouthEndMusic SouthEndMusic marked this pull request as draft July 27, 2024 15:37
@SouthEndMusic
Copy link
Member Author

How can I fix the Zygote compat?

Project.toml Outdated Show resolved Hide resolved
@ChrisRackauckas
Copy link
Member

You can only compat weakdeps or deps. So added as a weakdep if we want the compat.

@SouthEndMusic
Copy link
Member Author

I've added tests for I think everything that was compatible with Zygote before. I've added some examples in DataInterpolationsChainRulesCoreExt.jl of how to speed up gradients w.r.t. u with analytical expressions. Speeding up more interpolation types this way could be a follow up

@SouthEndMusic SouthEndMusic marked this pull request as ready for review July 28, 2024 15:06
@ChrisRackauckas ChrisRackauckas merged commit 4366656 into SciML:master Jul 28, 2024
7 of 10 checks passed
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.

Remove ReadOnlyArray from type parameters Zygote support broke in new release
2 participants