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

Fix adjoints for ODESolution indexing #494

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/Downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ jobs:
- {user: SciML, repo: StochasticDelayDiffEq.jl, group: All}
- {user: SciML, repo: SimpleNonlinearSolve.jl, group: All}
- {user: SciML, repo: SimpleDiffEq.jl, group: All}
- {user: SciML, repo: SciMLSensitivity.jl, group: Core1}
- {user: SciML, repo: SciMLSensitivity.jl, group: Core2}
- {user: SciML, repo: SciMLSensitivity.jl, group: Core3}
- {user: SciML, repo: SciMLSensitivity.jl, group: Core4}
- {user: SciML, repo: SciMLSensitivity.jl, group: Core5}

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ ConstructionBase = "187b0558-2788-49d3-abe0-74a17ed4e7c9"
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
EnumX = "4e289a0a-7415-4d19-859d-a7e5c4648b56"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
FunctionWrappersWrappers = "77dc65aa-8811-40c2-897b-53d922fa7daf"
IteratorInterfaceExtensions = "82899510-4779-5014-852e-03e436cf321d"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
1 change: 1 addition & 0 deletions src/SciMLBase.jl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import TruncatedStacktraces
import ADTypes: AbstractADType
import ChainRulesCore
import ZygoteRules: @adjoint
import FillArrays

using Reexport
using SciMLOperators
Expand Down
2 changes: 1 addition & 1 deletion src/solutions/zygote.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@adjoint function getindex(VA::ODESolution, i::Int)
function ODESolution_getindex_pullback(Δ)
Δ′ = [[i == k ? Δ[j] : zero(x[1]) for k in 1:length(x)]
Δ′ = [(i == j ? Δ : FillArrays.Fill(zero(eltype(x)), size(x)))

Check warning on line 3 in src/solutions/zygote.jl

View check run for this annotation

Codecov / codecov/patch

src/solutions/zygote.jl#L3

Added line #L3 was not covered by tests
for (x, j) in zip(VA.u, 1:length(VA))]
(Δ′, nothing)
end
Expand Down
Loading