Building and loading the batches from loaded chunks in RChunkLoader.
In this class the chunks that are loaded into memory (see RChunkLoader) are split into batches used in the ML training which are loaded into a queue. This is done for both the training and validation chunks separately.
Definition at line 38 of file RBatchLoader.hxx.
Public Member Functions | |
| 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) | |
| void | Activate () |
| Activate the batchloader. This means that batches can be created and loaded. | |
| std::unique_ptr< RFlat2DMatrix > | CreateBatch (RFlat2DMatrix &chunkTensor, std::size_t idxs) |
| Return a batch of data as a unique pointer. | |
| void | CreateBatches (RFlat2DMatrix &chunkTensor, bool isLastBatch) |
| Creating the batches from a chunk and add them to the queue. | |
| void | DeActivate () |
| DeActivate the batchloader. | |
| RFlat2DMatrix | GetBatch () |
| Loading the batch from the queue. | |
| std::size_t | GetNumBatches () |
| std::size_t | GetNumBatchQueue () |
| std::size_t | GetNumEntries () |
| std::size_t | GetNumRemainderRows () |
| bool | isProducerDone () |
| void | MarkProducerDone () |
| Signal that the producer has finished pushing all batches for this epoch. | |
| void | Reset () |
| Reset the batchloader state. | |
Private Attributes | |
| std::queue< std::unique_ptr< RFlat2DMatrix > > | fBatchQueue |
| std::size_t | fBatchSize |
| std::vector< std::string > | fCols |
| std::unique_ptr< RFlat2DMatrix > | fCurrentBatch |
| std::condition_variable & | fCV |
| bool | fDropRemainder |
| bool | fIsActive = false |
| std::size_t | fLeftoverBatchSize |
| std::mutex & | fLock |
| std::size_t | fNumBatches |
| std::size_t | fNumColumns |
| std::size_t | fNumEntries |
| std::size_t | fNumFullBatches |
| std::unique_ptr< RFlat2DMatrix > | fPrimaryLeftoverBatch |
| bool | fProducerDone = true |
| std::unique_ptr< RFlat2DMatrix > | fSecondaryLeftoverBatch |
| std::size_t | fSumVecSizes |
| std::vector< std::size_t > | fVecSizes |
#include <ROOT/ML/RBatchLoader.hxx>
| ROOT::Experimental::Internal::ML::RBatchLoader::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 ) |
Definition at line 10 of file RBatchLoader.cxx.
| void ROOT::Experimental::Internal::ML::RBatchLoader::Activate | ( | ) |
Activate the batchloader. This means that batches can be created and loaded.
Definition at line 44 of file RBatchLoader.cxx.
| std::unique_ptr< RFlat2DMatrix > ROOT::Experimental::Internal::ML::RBatchLoader::CreateBatch | ( | RFlat2DMatrix & | chunkTensor, |
| std::size_t | idxs ) |
Return a batch of data as a unique pointer.
After the batch has been processed, it should be destroyed.
| [in] | chunkTensor | Tensor with the data from the chunk |
| [in] | idxs | Index of batch in the chunk |
Definition at line 101 of file RBatchLoader.cxx.
| void ROOT::Experimental::Internal::ML::RBatchLoader::CreateBatches | ( | RFlat2DMatrix & | chunkTensor, |
| bool | isLastBatch ) |
Creating the batches from a chunk and add them to the queue.
| [in] | chunkTensor | Tensor with the data from the chunk |
| [in] | isLastBatch | Check if the batch in the chunk is the last one |
Definition at line 139 of file RBatchLoader.cxx.
| void ROOT::Experimental::Internal::ML::RBatchLoader::DeActivate | ( | ) |
DeActivate the batchloader.
This means that no more batches are created. Batches can still be returned if they are already loaded.
Definition at line 59 of file RBatchLoader.cxx.
| RFlat2DMatrix ROOT::Experimental::Internal::ML::RBatchLoader::GetBatch | ( | ) |
|
inline |
Definition at line 83 of file RBatchLoader.hxx.
|
inline |
Definition at line 86 of file RBatchLoader.hxx.
|
inline |
Definition at line 84 of file RBatchLoader.hxx.
|
inline |
Definition at line 85 of file RBatchLoader.hxx.
|
inline |
Definition at line 82 of file RBatchLoader.hxx.
| void ROOT::Experimental::Internal::ML::RBatchLoader::MarkProducerDone | ( | ) |
Signal that the producer has finished pushing all batches for this epoch.
Definition at line 90 of file RBatchLoader.cxx.
| void ROOT::Experimental::Internal::ML::RBatchLoader::Reset | ( | ) |
Reset the batchloader state.
Definition at line 72 of file RBatchLoader.cxx.
|
private |
Definition at line 59 of file RBatchLoader.hxx.
|
private |
Definition at line 40 of file RBatchLoader.hxx.
|
private |
Definition at line 42 of file RBatchLoader.hxx.
|
private |
Definition at line 62 of file RBatchLoader.hxx.
|
private |
Definition at line 44 of file RBatchLoader.hxx.
|
private |
Definition at line 49 of file RBatchLoader.hxx.
Definition at line 55 of file RBatchLoader.hxx.
|
private |
Definition at line 53 of file RBatchLoader.hxx.
|
private |
Definition at line 43 of file RBatchLoader.hxx.
|
private |
Definition at line 52 of file RBatchLoader.hxx.
|
private |
Definition at line 47 of file RBatchLoader.hxx.
|
private |
Definition at line 48 of file RBatchLoader.hxx.
|
private |
Definition at line 51 of file RBatchLoader.hxx.
|
private |
Definition at line 65 of file RBatchLoader.hxx.
Definition at line 56 of file RBatchLoader.hxx.
|
private |
Definition at line 66 of file RBatchLoader.hxx.
|
private |
Definition at line 46 of file RBatchLoader.hxx.
|
private |
Definition at line 45 of file RBatchLoader.hxx.