Open renatobellotti opened 2 years ago
rrule(reduce, +, x; kw...)
can just call rrule(sum, x; kw...)
right?
Isn't the reduction implemented on the GPU? I don't know the details, but reducing on the GPU and then copying the result is certainly more efficient than copying the entire vector and reducing on the CPU.
Sure. The rrule
for sum just calls sum
again on what it's given, for the forward pass, and thus uses the same GPU code as without AD. (And the reverse pass is written using broadcasting, which also works on the GPU.)
Nice!
Hi,
I'd like to suggest including a rule for GPU reductions.
See also: https://github.com/FluxML/Zygote.jl/issues/730#issuecomment-1221146525