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

Appropriate location for Zygote rrule_via_ad example

Open willtebbutt opened this issue 4 years ago • 5 comments

Maybe it would make sense to provide a working example of testing Zygote using CRTU? Just working through an example, and having to dig around in Zygote internals. Should Zygote be providing this?

willtebbutt avatar Aug 23 '21 09:08 willtebbutt

Oh, wait, Zygote already has an example of this implemented here. I got the impression from the docs that we'd have to implement it ourselves. Would be good to highlight that this should just work, even if this is a bit of a circular dependency.

willtebbutt avatar Aug 23 '21 09:08 willtebbutt

There's this sentence in the docs: "For some AD systems (e.g. Zygote) rrule_via_ad already exists"

But indeed we might do well do have a "rollout status" for where this is implemented and where it is not.

mzgubic avatar Aug 23 '21 09:08 mzgubic

Ahh I see. My bad for not reading the docs more thoroughly. Would a working example that users can copy + paste involving Zygote make sense to add? Something like

config = Zygote.ZygoteConfig()
f(x, y) = x * y + 3x + 2y
test_rrule(config, f, 2.3, 6.1; rrule_f=rrule_via_ad)

just so that it's really explicit. For example, I don't believe (again, I could just be missing some docs) that it's obvious that Zygote.ZygoteConfig() is the thing that users need if using Zygote.

willtebbutt avatar Aug 25 '21 17:08 willtebbutt

yes please, this is really needed.

PS: ZygoteConfig -> ZygoteRuleConfig in the example

CarloLucibello avatar Sep 18 '21 06:09 CarloLucibello

Give this it's own page in the docs?

How to Test an AD system using this. And put a subheading Zygote

oxinabox avatar Sep 24 '21 14:09 oxinabox