invenia / Nabla.jl

A operator overloading, tape-based, reverse-mode AD
Other
68 stars 5 forks source link

Multi-output `broadcast` / `map` #26

Open willtebbutt opened 7 years ago

willtebbutt commented 7 years ago

Currently, when broadcast and map are used to apply a function f which accepts multiple inputs to the appropriate number of arrays of data, each input is treated individually as Julia does not appear to have built-in functionality for performing a multiple-output broadcast / map. This strategy will incur an increased number of memops if it is not the case that all of the input and output data can be cached (L2?), specifically, if N is the number of inputs and P the length of the arrays being broadcasted / mapped over, we incur an extra O(PN) memops due to the need to re-cache the output for each input. Furthermore, we incur an extra O(PN) integer arithmetic operations due to the extra for-loops required. Having Julia implement multi-output map and broadcast operations would therefore yield significant computational savings in certain situations.

willtebbutt commented 7 years ago

See this Issue in the Julia repo: https://github.com/JuliaLang/julia/issues/22129