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
base: main
Are you sure you want to change the base?
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.
function getobs!(buffer, A::BatchView{TElem, TData, Val{nothing}}, i) where {TElem, TData} | ||
obsindices = _batchindexes(A, i) | ||
return _getbatch!(buffer, A, obsindices) | ||
end | ||
|
||
function _getbatch!(buffer, A::BatchView{TElem, TData, Val{nothing}}, obsindices) where {TElem, TData} | ||
return getobs!(buffer, A.data, obsindices) | ||
end |
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.
function getobs!(buffer, A::BatchView{TElem, TData, Val{nothing}}, i) where {TElem, TData} | |
obsindices = _batchindexes(A, i) | |
return _getbatch!(buffer, A, obsindices) | |
end | |
function _getbatch!(buffer, A::BatchView{TElem, TData, Val{nothing}}, obsindices) where {TElem, TData} | |
return getobs!(buffer, A.data, obsindices) | |
end | |
function getobs!(buffer, A::BatchView{<:Any, <:Any, Val{nothing}}, i) | |
obsindices = _batchindexes(A, i) | |
return _getbatch!(buffer, A, obsindices) | |
end | |
function _getbatch!(buffer, A::BatchView{<:Any, <:Any, Val{nothing}}, obsindices) | |
return getobs!(buffer, A.data, obsindices) | |
end |
I think we can avoid overspecializing here
function _getbatch!(buffer, A::BatchView{TElem, TData, Val{nothing}}, obsindices) where {TElem, TData} | ||
return getobs!(buffer, A.data, obsindices) | ||
end |
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 would've assumed this also works for collate=true|false
, because unlike getobs
/_getbatch
the caller has already figured out the return type by passing in buffer
. Not sure I understand the interface or API contract that well though, so please correct me if not.
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.