13 : fBatchSize(batchSize),
18 fNumEntries(numEntries),
34 std::lock_guard<std::mutex> lock(
fLock);
49 std::lock_guard<std::mutex> lock(
fLock);
62 std::lock_guard<std::mutex> lock(
fLock);
101 std::unique_lock<std::mutex> lock(
fLock);
134 std::vector<std::unique_ptr<RFlat2DMatrix>>
batches;
137 for (std::size_t i = 0; i <
numBatches; i++) {
162 batches.emplace_back(std::move(copy));
186 batches.emplace_back(std::move(copy));
200 batches.emplace_back(std::move(copy));
208 std::lock_guard<std::mutex> lock(
fLock);
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
RFlat2DMatrix GetBatch()
Loading the batch from the queue.
std::size_t fNumFullBatches
std::unique_ptr< RFlat2DMatrix > fSecondaryLeftoverBatch
std::queue< std::unique_ptr< RFlat2DMatrix > > fBatchQueue
void RecalculateBatchCounts(std::size_t numEntries)
Recalculate batch counts from the given number of entries.
void Reset()
Reset the batchloader state.
std::size_t fLeftoverBatchSize
void Activate()
Activate the batchloader. This means that batches can be created and loaded.
void MarkProducerDone()
Signal that the producer has finished pushing all batches for this epoch.
void CreateBatches(RFlat2DMatrix &chunkTensor, bool isLastBatch)
Creating the batches from a chunk and add them to the queue.
void DeActivate()
DeActivate the batchloader.
std::unique_ptr< RFlat2DMatrix > fPrimaryLeftoverBatch
std::vector< std::size_t > fVecSizes
std::vector< std::string > fCols
std::unique_ptr< RFlat2DMatrix > fCurrentBatch
RBatchLoader(std::size_t batchSize, const std::vector< std::string > &cols, std::mutex &sharedMutex, std::condition_variable &sharedCV, const std::vector< std::size_t > &vecSizes={}, std::size_t numEntries=0, bool dropRemainder=false)
std::unique_ptr< RFlat2DMatrix > CreateBatch(RFlat2DMatrix &chunkTensor, std::size_t idxs)
Return a batch of data as a unique pointer.
std::condition_variable & fCV
Wrapper around ROOT::RVec<float> representing a 2D matrix.