Add more `Duplicated` methods for Enzyme.jl support (#2471)
* add more Duplicated methods
* update macro to zero, show
* make informative errors if you use Duplicated without loading Enzyme
* note on macro
* fix some tests
* add an Enzyme docs page
* tweaks & tests
* typos
* news, docs
* let Flux own the function update! to avoid piracy
* Revert "let Flux own the function update! to avoid piracy"
This reverts commit ca5a20f24bcd60560f4961da3646b8f44852fb31.
* demand Optimisers PR
* fixup
* force depwarns
* allow aux in withgradient
* disallow Active
* disallow trivial Duplicated
* don't use ReverseWithPrimal in gradient
* tweak
* giant post-rebase fixup after everything was moved around... all earlier commits are a mess now, probably
* clean up more rebase mess
* fix docs
* try out Ref for withgradient
* don't own `_make_zero!`
* add explicit errors for 2nd order
* more rebase problems
Co-authored-by: Carlo Lucibello <carlo.lucibello@gmail.com>
* teach Flux.state about Duplicated
* another explicit error for Zygote mistake
* ahem
* don't use Enzyme's make_zero!, fix some bugs
* maybe this works?
* see if CI likes these
* turns out train! does have tests
* enzyme tests
* fix tests?
* minor comments
---------
Co-authored-by: Carlo Lucibello <carlo.lucibello@gmail.com>