-
Notifications
You must be signed in to change notification settings - Fork 64
Update kwargs fallback rules after RuleConfig rewrite #372
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #372 +/- ##
==========================================
+ Coverage 88.86% 89.46% +0.59%
==========================================
Files 14 14
Lines 485 560 +75
==========================================
+ Hits 431 501 +70
- Misses 54 59 +5
Continue to review full report at Codecov.
|
d64e504 to
dc52994
Compare
mzgubic
left a comment
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.
Probably good if @oxinabox takes a look as well, but i can't see anything wrong so approving
src/rules.jl
Outdated
| See also: [`rrule`](@ref), [`@scalar_rule`](@ref), [`RuleConfig`](@ref) | ||
| """ | ||
| frule(::Any, ::Any, ::Vararg{Any}; kwargs...) = nothing | ||
| frule(::Any, ::Any, ::Vararg{Any}) = nothing |
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.
Is there a reason we don't just do
| frule(::Any, ::Any, ::Vararg{Any}) = nothing | |
| frule(::Vararg{Any}) = nothing |
?
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.
yes, we require at least 2 arguments.
The minimum number of arguments a function can have is zero.
Which has the case frule(Tuple(), f).
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.
Either way is fine. The system doesn't care, but this makes it explicit that at least two arguments are expected, so you get a method error otherwise. I guess by the same reasoning, I should put back the two arguments below.
src/rules.jl
Outdated
| # still has to manually analyze). Manually declare this method with an | ||
| # explicitly empty body to save the compiler that work. | ||
| const frule_kwfunc = Core.kwftype(typeof(frule)).instance | ||
| (::typeof(frule_kwfunc))(::Any, ::typeof(frule), ::Any, ::Vararg{Any}) = nothing |
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 guess either having the two Anys
| (::typeof(frule_kwfunc))(::Any, ::typeof(frule), ::Any, ::Vararg{Any}) = nothing | |
| (::typeof(frule_kwfunc))(::Any, ::typeof(frule), ::Any, ::Any, ::Vararg{Any}) = nothing |
or pack them all into Vararg
| (::typeof(frule_kwfunc))(::Any, ::typeof(frule), ::Any, ::Vararg{Any}) = nothing | |
| (::typeof(frule_kwfunc))(::Any, ::typeof(frule), ::Vararg{Any}) = nothing |
right?
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.
Yeah, let me make it consistent.
dc52994 to
7c40e72
Compare
Fixes #368