Skip to content

[WIP] Add ChainRules differentiation rules for expv#51

Open
sethaxen wants to merge 4 commits into
SciML:masterfrom
sethaxen:chainrules
Open

[WIP] Add ChainRules differentiation rules for expv#51
sethaxen wants to merge 4 commits into
SciML:masterfrom
sethaxen:chainrules

Conversation

@sethaxen
Copy link
Copy Markdown

Following #40, this PR implements forward- and reverse-mode rules for expv, adding compatibility with Zygote and perhaps making ForwardDiff2's differentiation of these rules faster.

This is still marked as a WIP until I figure out sensitivities of the matrix A.

∂b = Thunk() do
# using similar is necessary to ensure type-stability
b̄ = similar(b)
_copyto!(b̄, expv(t', A', Δw; kwargs...))
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

adjoint is currently not part of the required interface for generic A. How should we handle this?

  • Make it a required part of the interface
  • Make it an optional requirement for A (i.,e. "if you want to work with Zygote, you also need to define adjoint")
  • restrict this rrule to A::AbstractMatrix (this may be necessary anyways, as for non-matrix A, its differential type is unknown.).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

"if you want to work with Zygote, you also need to define adjoint"

I think that's entirely reasonable.

@sethaxen sethaxen mentioned this pull request Dec 22, 2020
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