-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add rules for specialized norm functions and normalize #226
Conversation
This PR is now ready for review. A few notes:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving subject to the things that you note above being resolved as I don't want to hold you back, and deciding whether to release a new minor version (if we decide to do that, then we should probably -DEV briefly, and bundle it in with #311 to avoid making multiple breaking releases.
I've made some style suggestions to make the type unions more readable.
We should discuss whether or not it's a breaking change though. Before, would you have expected things to break if someone passed in a type outside of the new constraints?
Co-authored-by: willtebbutt <wt0881@my.bristol.ac.uk>
Not necessarily. The rule should have worked for any array type whose differential could be represented by scaling the array via broadcast. So it would have worked for |
Hmmm interesting. So it probably fixes some potential bugs, but might remove some functionality. @nickrobinson251 any thoughts on the correct course of action here? |
@nickrobinson251 what are your thoughts on the version number here? |
Codecov Report
@@ Coverage Diff @@
## master #226 +/- ##
==========================================
- Coverage 97.15% 96.87% -0.29%
==========================================
Files 16 17 +1
Lines 880 993 +113
==========================================
+ Hits 855 962 +107
- Misses 25 31 +6
Continue to review full report at Codecov.
|
Okay, this PR should be 100% complete, just pending input on choice of version number. |
I'd say this is a bug fix 👍 |
Agreed, bug-fixes are never considered breaking. Also it's much easier to deal with something incorrectly called non-breaking (revert, tag a patch, unrevert tag a breaking). |
Great! Thanks to you both! |
This PR adds
(edit: it only adds thefrule
sfrule
for the scalar function andnorm
withoutp
) andrrule
s of the various generic norm functions (and friends) in LinearAlgebra:norm
norm2
norm1
normInf
normMinusInf
normp
normalize
normalize!
(frule
only)The
frule
s are patterned after the primal functions and work on iterators. Therrule
s are restrict toAbstractArray
primal inputs because I don't see how to generically writerrule
s for iterators. This PR replaces the currentrrule
fornorm
to dispatch to the other rules. The rules use the subgradient convention throughout.I'm still working on the test suite.This PR will fix #204 and FluxML/Zygote.jl#663.