16#ifndef ROOT_INTERNAL_ML_RBATCHLOADER
17#define ROOT_INTERNAL_ML_RBATCHLOADER
26#include <condition_variable>
46 std::condition_variable &
fCV;
72 std::condition_variable &
sharedCV,
const std::vector<std::size_t> &
vecSizes = {},
108 std::lock_guard<std::mutex> lock(
fLock);
123 std::lock_guard<std::mutex> lock(
fLock);
150 std::unique_lock<std::mutex> lock(
fLock);
183 std::vector<std::unique_ptr<RFlat2DMatrix>>
batches;
186 for (std::size_t i = 0; i <
numBatches; i++) {
211 batches.emplace_back(std::move(copy));
235 batches.emplace_back(std::move(copy));
249 batches.emplace_back(std::move(copy));
257 std::lock_guard<std::mutex> lock(
fLock);
270 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.
Building and loading the batches from loaded chunks in RChunkLoader.
RFlat2DMatrix GetBatch()
Loading the batch from the queue.
std::size_t fNumFullBatches
std::size_t GetNumEntries()
std::size_t GetNumBatches()
std::unique_ptr< RFlat2DMatrix > fSecondaryLeftoverBatch
std::queue< std::unique_ptr< RFlat2DMatrix > > fBatchQueue
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.
std::size_t GetNumRemainderRows()
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
std::size_t GetNumBatchQueue()
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.