-
Notifications
You must be signed in to change notification settings - Fork 95
Add missing generic repeat method #466
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
78b13b0 to
1cd6bb3
Compare
Codecov Report
@@ Coverage Diff @@
## master #466 +/- ##
==========================================
- Coverage 98.12% 98.12% -0.01%
==========================================
Files 22 22
Lines 2350 2348 -2
==========================================
- Hits 2306 2304 -2
Misses 44 44
Continue to review full report at Codecov.
|
Meaning what? In #460 (comment) I was trying to say that it seems a bit of an open question what should be returned for zero-arrays. They shouldn't error, but should they always be mapped to scalars, or always restored, or is a random mix OK? |
cb4bad2 to
dad6dcb
Compare
So the issue I was encountering was in TestUtils and the use of I suppose that my stating that it is doing the correct thing is a bit presumptive. What the 'right' choice of the zero-array idiom is idk. Julia itself seems to have changed the behaviour between versions, i.e. in 1.0 So yeah, I'm not certain on what behaviour is wanted. FWIW, I'd expect it to propagate: consistently treat a zero-vector as a vector, and a scalar as a scalar. But idk. |
I'm torn actually. This has the plus side of being easy to state. And sometimes, a zero-array might be a sensible one-number container when you need something mutable and don't want On the minus side, it's a much heavier object than Ref or Float64. And it's a pain to preserve in all rules, since e.g. |
dad6dcb to
a0c5207
Compare
|
Coming back to this MR. I've now added in Project for xs and wrapped the calculation of x̄ into a thunk and rebased onto master. Responding to your comment (if it's still applies!) Regarding the consistency - behaviour of zero-arrays, Ref and so on and the nuisance inconsistencies in terms of whether it's treated as a vector or a real this seems a broader question than related to However, there may be cases where these inconstencies interfere with the internals of CVC (such as |
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.
LGTM bar a few minor comments. Are you and @mcabbott happy with the Fill outcome?
Co-authored-by: Miha Zgubic <[email protected]>
daf52c4 to
5fdd9eb
Compare
Follow up from #460
Adds in the missing
function rrule(::typeof(repeat), xs::AbstractArray, counts::Integer...)method.Uses the code provided by @mcabbott in the gist here
Some comments:
There were some type infererence issues in running in 1.0 IDK how important this is is (a bunch of stuff is marked to only check inference in later versions), but to avoid regressing on the tests already implemented I've added some type hinting in the closure. It's a bit gross so there may be a better way to do it.EDIT: Now removed and just relaxing the 1.0 tests for typing.Bumps finite differences soFD has been bumped, but actually no longer needed now that rand_tangent is in CRTUrand_tangent{Array{T, 0}}is now doing the correct thing and hence enables those tests. There are some differences in the behaviour of the forward pass of repeat between 1.0 and 1.6 (the CI versions) so there is a bit of version checking.