JuliaDiff / ChainRulesCore.jl

AD-backend agnostic system defining custom forward and reverse mode rules. This is the light weight core to allow you to define rules for your functions in your packages, without depending on any particular AD system.
Other
258 stars 62 forks source link

BroadcastStyle of Differentials needs to match their primals #94

Open oxinabox opened 4 years ago

oxinabox commented 4 years ago

Particularlyatyers for Composite of subtypes of AbstractArray

For Thunks we need to unthunk at start, by overloading broadcasted

oxinabox commented 4 years ago

Yay, BroadcastStyle is a proper trait - it depends only on type. And since the Composite differential is type-parametric on it’s primal type. Making them broadcast the same is trivial. So Composite{<:AbstactArray} will work as well as a AbstractArray of differentials . This is really pleasing. This directly matters for #85

More generally this issue relates to #92 since operations between single deriviatives and chunked dervatives are broadcasting.

Also #96 is related in that it covers the cases not mentioned in the top of this thread.