ChainRules.jl icon indicating copy to clipboard operation
ChainRules.jl copied to clipboard

Add rule for `mean(f, x; dims)`

Open nickrobinson251 opened this issue 6 years ago • 3 comments

We have rules for mean, except for mean(f, x; dims) which is new as of Julia v1.3

nickrobinson251 avatar Aug 16 '19 18:08 nickrobinson251

The implementation could look a bit like sum(f, xs):

https://github.com/JuliaDiff/ChainRules.jl/blob/ce78d3d3e8aaf6303e1aa7085fdbdfc2d36d1b64/src/rulesets/Base/mapreduce.jl#L69-L94

mzgubic avatar Dec 01 '21 17:12 mzgubic

Ideally it would probably share code, have a function which for mean gets scale=1/size(...) or something.

Xref #529 which is trying to re-work that rule.

mcabbott avatar Dec 01 '21 17:12 mcabbott

reopened as i had to revert the fix

oxinabox avatar May 17 '22 22:05 oxinabox