JuliaDiff / JuliaDiff/ChainRules.jl
Chainrule for CUDA reduction
Open
Nobody has claimed this yet.
good first issue
missing rule
- Dominant language
- Julia
- Stars
- 475
- Forks
- 98
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'd like to suggest including a rule for GPU reductions.
using Zygote
function my_loss(v)
# This works:
# l = sum(v)
# This does not work:
l = reduce(+, v)
return l
end
v = cu([1., 2.])
Zygote.gradient(my_loss, v)
See also: https://github.com/FluxML/Zygote.jl/issues/730#issuecomment-1221146525
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 running the Julia reproduction in the issue with Zygote and the CUDA array, confirming that sum works while reduce(+, v) does not. Read the existing reduction rules in ChainRules.jl and compare their behavior with this case. Done means the supplied gradient call works for the GPU reduction and has coverage for the demonstrated example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100