-
-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
write >>
as infix notation for OptimiserChain
#139
base: master
Are you sure you want to change the base?
Conversation
What about using |
That's possible. But |
(r2::AbstractRule)(r1::AbstractRule) = OptimiserChain(r1, r2) would only break piratical (and unlikely) similar definitions. |
Since chaining rules is so close to |
One problem with We could literally use |
I personally don't think asking users to write the order of rules "backwards" is a big deal, but that might just be me. Suggesting |
The only other vararg infix operator is |
Yes, finding a good operator is the higher priority. |
I still think |
We discussed this during the call. In general, all the options outlined here don't seem worth it. There is very little value-add, and we are either breaking/bending existing semantics or unnecessarily using up an infix operator (the latter being poor form given that Julia is not permissive about these). There are already workable solutions for users: use the new Here's some additional context for the current naming: #9 (comment) (which also goes into stuff discussed here like function composition being a bit confusing). One option we settled on is to have an un-exported verb: |
Building in two distinct names to allow someone to write The nice thing about infix syntax like
I am very dubious that one case of Pair(AbstractRule, AbstractRule) exists in the wild. Nevertheless we just missed a golden opportunity to roll this into the 0.3 change.
I do think this is quite confusing. (In fact I remain a little confused why AdamW seems to be backwards, but that's another topic.)
This objection is to defining a currently undefined operator, like It does not apply to abusing other built-in infix operators. We could use say |
That's #46 (comment) and FluxML/Flux.jl#1612. PyTorch inexplicably chooses to do their own thing, and despite reading pytorch/pytorch#21250 (comment) multiple times I still don't understand why. |
=>
for OptimiserChain
>>
as infix notation for OptimiserChain
This lets you chain optimisation rules like
setup(ClipGrad(1.0) => WeightDecay() => Descent(0.1), model)
. It's just notation & printing, there is no functional change toOptimiserChain
.Edit: now uses
>>
instead of=>
.