Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use broadcasting rules from ChainRules #89

Merged
merged 6 commits into from
Sep 17, 2022
Merged

Conversation

mcabbott
Copy link
Member

@mcabbott mcabbott commented Sep 1, 2022

This removes the reverse-mode broadcasting definitions here, in favour of the ones from ChainRules.

To make tests work, it also adjusts a few other rules, to add unthunk, or handle trivial cases, or to ensure zero(x) is only called on arrays of numbers. Not all were required by the tests here, some were for testing some Flux models (and some are in JuliaDiff/ChainRules.jl#673). Test from #82 passes.

All the Most of the second order tests fail. They fail before this PR, too.

Built on top of #88, have not tested whether it would work without that. (rebased)

Closes #53

@codecov-commenter
Copy link

codecov-commenter commented Sep 4, 2022

Codecov Report

Merging #89 (01aed6c) into main (fb1d4ec) will increase coverage by 3.84%.
The diff coverage is 86.66%.

@@            Coverage Diff             @@
##             main      #89      +/-   ##
==========================================
+ Coverage   51.69%   55.54%   +3.84%     
==========================================
  Files          21       21              
  Lines        2124     2157      +33     
==========================================
+ Hits         1098     1198     +100     
+ Misses       1026      959      -67     
Impacted Files Coverage Δ
src/stage1/broadcast.jl 0.00% <ø> (-20.00%) ⬇️
src/extra_rules.jl 47.70% <81.81%> (+12.25%) ⬆️
src/runtime.jl 80.00% <100.00%> (+1.05%) ⬆️
src/stage1/generated.jl 78.28% <100.00%> (+5.55%) ⬆️
src/stage2/interpreter.jl 0.00% <0.00%> (ø)
src/stage2/abstractinterpret.jl 0.00% <0.00%> (ø)
src/stage1/recurse_fwd.jl 94.28% <0.00%> (+0.16%) ⬆️
src/jet.jl 39.66% <0.00%> (+0.50%) ⬆️
src/tangent.jl 34.04% <0.00%> (+1.06%) ⬆️
src/stage1/hacks.jl 6.38% <0.00%> (+4.25%) ⬆️
... and 4 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

src/extra_rules.jl Outdated Show resolved Hide resolved
src/extra_rules.jl Outdated Show resolved Hide resolved
@oscardssmith
Copy link
Member

This mostly looks really good.

test/runtests.jl Outdated Show resolved Hide resolved
@mcabbott mcabbott merged commit 55d2871 into JuliaDiff:main Sep 17, 2022
@mcabbott mcabbott deleted the nocast branch September 17, 2022 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Some errors from broadcasting
3 participants