JuliaDiff / JuliaDiff/ChainRules.jl
Handling rules that construct pullbacks via mutations of copies of their inputs
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 475
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
OK, I admit I can't find a better title for this. But I feel this should be brought up. See previous related issues in #381 #380 #46
@GiggleLiu keeps wanting to make all the return type of pullback to be the same as its input, that's why he was asking how to fix the problem in #381 for all possible cases. However, I don't think this would work with the current thunk mechanism.
I'm thinking there should be a mutability trait to handle this task, and a BangBang version of setindex! (which is setindex!!) so when the rules writer requires the interface, ChainRules can check and error.
Meanwhile, I think part of the problem of using thunk is because current AD compilers like Zygote are not able to do optimization if the compiler is able to do what thunk does, e.g Yota can figure out the gradient accumulation and unused gradient I believe, then it is not necessary to do it lazily.
cc: @oxinabox @sethaxen
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 related issues #381, #380, and #46, then inspect the current pullback and thunk mechanisms. Consider how a mutability trait and a setindex!! interface would fit the rules-writing contract. Done would require an agreed design for handling rules that mutate copies of their inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100