-
Notifications
You must be signed in to change notification settings - Fork 20
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
use buffer in BatchView #157
Conversation
Codecov Report
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. @@ Coverage Diff @@
## main #157 +/- ##
==========================================
+ Coverage 88.46% 88.57% +0.11%
==========================================
Files 13 15 +2
Lines 598 604 +6
==========================================
+ Hits 529 535 +6
Misses 69 69
|
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.
Generally LGTM, though I've pulled in Lorenz to answer the questions posed.
661f09e
to
deb63ef
Compare
# This collate=true specialization doesn't seem to be particularly useful, use collate=nothing instead. | ||
function _getbatch!(buffer, A::BatchView{<:Any, <:Any, Val{true}}, obsindices) | ||
for (i, idx) in enumerate(obsindices) | ||
getobs!(buffer[i], A.data, idx) |
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 don't understand why this isn't
getobs!(buffer[i], A.data, idx) | |
getobs!(buffer, A.data, idx) |
Can you explain how it works to me briefly?
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.
When collate == false
, the minibatch returned is
[getobs(A.data, idx) for idx in obsindexes]
so in this context the buffer has to be used for the single observation. We have to use a different buffer for all observations in the mini-batch though, therefore the mini-batch buffer has to be a vector of single-observation-buffers of the length of the batchsize:
[getobs!(buffer[i], A.data, idx) for (i, idx) in for enumerate(obsindexes)]
closing in favor of #191 |
fix #156
This covers only
BatchView(...; collate=nothing)
, I'm not sure howcollate=true
andcollate=false
should interact with the buffer so I won't address that here.