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

Partial implementation of Zygote AD with symbolic indexing #479

Merged
merged 8 commits into from
Aug 12, 2023

Conversation

contradict
Copy link
Contributor

Symbolic indexing of state and observed variables. Time index must be specified for observed symbols.

This is a rebase and fixup of https://github.com/lamorton/scimlbase.jl/tree/zygote_rules

Symbolic indexing of state and observed variables. Time index must be
specified or observed.
Copy link

@ai-maintainer ai-maintainer bot left a comment

Choose a reason for hiding this comment

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

AI-Maintainer Review for PR - Partial implementation of Zygote AD with symbolic indexing

Title and Description 👍

The Title and Description are clear and focused
The title and description of the pull request are clear and focused. They effectively communicate the purpose of the changes, which is to implement symbolic indexing of state and observed variables in the context of Zygote AD. However, it would be beneficial to include more specific details about the implementation and motivation behind it.

Scope of Changes 👍

The changes are narrowly focused
The changes in this pull request are narrowly focused on implementing symbolic indexing of state and observed variables in the context of Zygote AD. There is no indication that the author is trying to resolve multiple issues simultaneously.

Testing ⚠️

Testing details are missing
The description does not mention how the author tested the changes. It would be helpful to have information about the testing approach, such as specific test cases or scenarios that were used to verify the correctness and functionality of the implemented symbolic indexing.

Documentation ⚠️

Docstrings are missing for new functions
The following newly added functions, classes, or methods do not have docstrings:
  • ZygoteExt.getindex(VA::ODESolution, i::Int, j::Int)
  • ZygoteExt.getindex(VA::ODESolution, sym, j::Int)
  • ChainRulesCore.rrule(config::ChainRulesCore.RuleConfig, ::typeof(getindex), VA::ODESolution, sym, j::Integer)
  • ChainRulesCore.rrule(::typeof(getindex), VA::ODESolution, sym)
  • ZygoteExt.getindex(VA::ODESolution, i::Int)
  • ZygoteExt.getindex(VA::ODESolution, sym)

These functions, classes, or methods should have docstrings added to describe their behavior, arguments, and return values.

Suggested Changes

  • Please add docstrings to the new functions, classes, or methods to describe their behavior, arguments, and return values.
  • Please provide information about how the changes were tested. This could include specific test cases or scenarios that were used to verify the correctness and functionality of the implemented symbolic indexing.

Reviewed with AI Maintainer

@codecov
Copy link

codecov bot commented Aug 11, 2023

Codecov Report

Merging #479 (d5d5e37) into master (cce1ce0) will increase coverage by 3.08%.
The diff coverage is 30.00%.

@@            Coverage Diff             @@
##           master     #479      +/-   ##
==========================================
+ Coverage   53.73%   56.82%   +3.08%     
==========================================
  Files          47       50       +3     
  Lines        3584     3657      +73     
==========================================
+ Hits         1926     2078     +152     
+ Misses       1658     1579      -79     
Files Changed Coverage Δ
src/SciMLBase.jl 71.42% <ø> (ø)
src/solutions/chainrules.jl 0.00% <0.00%> (ø)
src/solutions/zygote.jl 46.15% <46.15%> (ø)
ext/ZygoteExt.jl 50.00% <50.00%> (ø)

... and 9 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

ext/ZygoteExt.jl Outdated
Comment on lines 16 to 42
Δ′ = ODESolution{
T,
N,
typeof(du),
Nothing,
Nothing,
typeof(VA.t),
typeof(VA.k),
typeof(dprob),
typeof(VA.alg),
typeof(VA.interp),
typeof(VA.destats),
typeof(VA.alg_choice),
}(du,
nothing,
nothing,
VA.t,
VA.k,
dprob,
VA.alg,
VA.interp,
VA.dense,
0,
VA.destats,
VA.alg_choice,
VA.retcode)
(Δ′, nothing, nothing)
Copy link
Member

Choose a reason for hiding this comment

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

This is the wrong formatting.

Copy link
Member

Choose a reason for hiding this comment

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

It won't revert this if you run the formatter, so put it all to one line and then reformat with the right format.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed, maybe fixed?

@ChrisRackauckas
Copy link
Member

Alright cool this looks good to go if tests pass. I hope we can get sol[sym] working ASAP afterwards since that's probably the most commonly used call, but at least there's a workaround for now.

@contradict
Copy link
Contributor Author

Oh, it fails on 1.6 since package extensions don't exist yet. Should I skip the tests on 1.6 or is there a workaround to get the extensions to load?

@ChrisRackauckas
Copy link
Member

Just skip v1.6. We're getting close to dropping it (please LTS come soon).

@ChrisRackauckas ChrisRackauckas merged commit 4d926fc into SciML:master Aug 12, 2023
51 of 61 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.

3 participants