JuliaDiff / JuliaDiff/ChainRulesCore.jl
How to @opt_out of rules for methods in packages that don't use CRC
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 267
- Forks
- 66
- PR merge metrics
- No merged PRs in 30d
Description
Problem Statement
PDMats.jl doesn't utilise CRC, however, it has a decent chunk of code that needs to be opted out of. For example, this diag rule probably isn't what you want in order to differentiate this method of diag. Rather you should just differentiate through the method.
We're starting to use PDMats.jl in the JuliaGPs ecosystem and I realised that I have no idea how to opt out of stuff when we inevitably hit something we need to opt out of without convincing the maintainers of PDMats.jl to use CRC, and to write a load of additional code opting out.
An example of this kind of problem came up in Zygote recently: https://github.com/FluxML/Zygote.jl/issues/1106
Question
Do we have any options other than
- convincing PDMats maintainers to care about CRC, or
- putting opt-out code in the JuliaGPs ecosystem?
To my mind, neither of the above options are good. 2 is quite clearly bad (type piracy), and 1 also feels bad because we would just be adding the CRC dep in order to opt out of stuff (if they had written code which wasn't trivially differentiable, it would be a different matter).
edit: typo
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked diag rule in src/rulesets/LinearAlgebra/structured.jl and the referenced method in PDMats.jl's src/scalmat.jl, then compare the related Zygote issue. Determine whether ChainRulesCore already supports a non-pirating opt-out for external methods; done would be a decided, documented approach or a clearly scoped API proposal.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100