-
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 rrule for Diagonal * AbstractVector #108
Conversation
We explictly don't conjugate inside rules. |
rng, N = MersenneTwister(123456), 3 | ||
rrule_test(*, randn(rng, N), | ||
(Diagonal(randn(rng, N)), Diagonal(randn(rng, N))), | ||
(randn(rng, N), randn(rng, N))) |
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.
For consistancy with the rest of the code, the intentation style is:
rrule_test(
*, randn(rng, N),
(Diagonal(randn(rng, N)), Diagonal(randn(rng, N))),
(randn(rng, N), randn(rng, N)),
)
i.e. always start and end a multiline call with a line that has no arguments on it,
and always ident by 4, rather than indenting to line-up with the brace
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.
actually it would be with one argument per line
rrule_test(
*,
randn(rng, N),
(Diagonal(randn(rng, N)), Diagonal(randn(rng, N))),
(randn(rng, N), randn(rng, N)),
)
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, but I feel like this is one of the cases where the clear relationship between
*, randn(rng, N),
as inputs to the function makes it worth putting them on one-line.
I'ld be happy with either
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.
Good to know that ChainRules.jl is using a sane code style!
Co-Authored-By: Lyndon White <[email protected]>
OK. I think I reflected the comments in the new version. Travis is happy with it. |
Thanks |
ref #52 (comment)
Reading #103 and other source code, I suppose we are only defining
rrule
s forReal
element types at the moment so didn't putadjoint
in the definition. (By the way, if that's the case, I think it makes sense to mention it in #103.)