Zygote.jl
Zygote.jl copied to clipboard
Fix for #717 - grads for dictionaries in closures/struct fields
Commented out ===
check in lib @adjoint
for literal_getproperty
.
This is breaking grads for dicts in closures (and thus, also structs with dictionary fields).
There are a number of small MWEs for this issue:
https://github.com/FluxML/Zygote.jl/issues/717
I have no idea if this breaks other things, because master already has broken tests.
@femtomc could you add a regression test please? Would like to prevent this bug from creeping back in.
Absolutely.
I don’t fully understand this code - but I can transform the MWEs into a small set of tests.
Not sure this is the right thing to do here, we want to shortcut out if something doesn't have a gradient
Well it’s catching things which do have gradients - so the intention is not working as expected.
Is there an example of when the shortcut is applied? That would help me change my fix.
Transformed the MWEs into a test suite.
Bump. @willtebbutt @DhairyaLGandhi
Any pointers for fixing this PR now?
We do need to return the nothing there, so the "fix" would be to let it fall back to the nt_nothing
function and accumulate there.
We do need to return the nothing there, so the "fix" would be to let it fall back to the nt_nothing function and accumulate there.
can you post a scratch of the approach?
I'll try to post a write-up soon
bumpity bump
Yeah, I had written something similar for this and another project here (~https://github.com/Chemellia/ChemistryFeaturization.jl/pull/111~ edit: wrong link), I have to convert that into a cleaned up PR to Zygote since its not complete in its current state. ref https://github.com/FluxML/Zygote.jl/pull/688, #452
Ref. https://github.com/FluxML/Zygote.jl/issues/717#issuecomment-1208927447 for visibility.
closing as outdated. Also, #717 has been closed