Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TMVA::Experimental::Internal::RBatchLoader Class Reference

Definition at line 33 of file RBatchLoader.hxx.

Public Member Functions

 RBatchLoader (const TMVA::Experimental::RTensor< float > &chunkTensor, const std::size_t batchSize, const std::size_t numColumns, const std::size_t maxBatches)
 
 ~RBatchLoader ()
 
void Activate ()
 Activate the batchloader so it will accept chunks to batch.
 
std::unique_ptr< TMVA::Experimental::RTensor< float > > CreateBatch (const TMVA::Experimental::RTensor< float > &chunkTensor, std::span< const std::size_t > idxs, std::size_t batchSize)
 
std::unique_ptr< TMVA::Experimental::RTensor< float > > CreateFirstBatch (const TMVA::Experimental::RTensor< float > &remainderTensor, std::size_t remainderTensorRow, std::span< const std::size_t > eventIndices)
 
void CreateTrainingBatches (const std::vector< std::size_t > &eventIndices)
 Create training batches from the given chunk of data based on the given event indices Batches are added to the training queue of batches.
 
void CreateValidationBatches (const std::vector< std::size_t > &eventIndices)
 Create validation batches from the given chunk based on the given event indices Batches are added to the vector of validation batches.
 
void DeActivate ()
 DeActivate the batchloader.
 
const TMVA::Experimental::RTensor< float > & GetTrainBatch ()
 Return a batch of data as a unique pointer.
 
const TMVA::Experimental::RTensor< float > & GetValidationBatch ()
 Returns a batch of data for validation The owner of this batch has to be with the RBatchLoader.
 
void LastBatches ()
 
void SaveRemainingData (TMVA::Experimental::RTensor< float > &remainderTensor, const std::size_t remainderTensorRow, const std::vector< std::size_t > eventIndices, const std::size_t start=0)
 save to remaining data when the whole chunk has to be saved
 

Private Attributes

std::condition_variable fBatchCondition
 
std::mutex fBatchLock
 
std::size_t fBatchSize
 
const TMVA::Experimental::RTensor< float > & fChunkTensor
 
std::unique_ptr< TMVA::Experimental::RTensor< float > > fCurrentBatch
 
bool fIsActive = false
 
std::size_t fMaxBatches
 
std::size_t fNumColumns
 
std::queue< std::unique_ptr< TMVA::Experimental::RTensor< float > > > fTrainingBatchQueue
 
std::unique_ptr< TMVA::Experimental::RTensor< float > > fTrainingRemainder
 
std::size_t fTrainingRemainderRow = 0
 
std::queue< std::unique_ptr< TMVA::Experimental::RTensor< float > > > fValidationBatchQueue
 
std::unique_ptr< TMVA::Experimental::RTensor< float > > fValidationRemainder
 
std::size_t fValidationRemainderRow = 0
 

#include <TMVA/BatchGenerator/RBatchLoader.hxx>

Constructor & Destructor Documentation

◆ RBatchLoader()

TMVA::Experimental::Internal::RBatchLoader::RBatchLoader ( const TMVA::Experimental::RTensor< float > &  chunkTensor,
const std::size_t  batchSize,
const std::size_t  numColumns,
const std::size_t  maxBatches 
)
inline

Definition at line 55 of file RBatchLoader.hxx.

◆ ~RBatchLoader()

TMVA::Experimental::Internal::RBatchLoader::~RBatchLoader ( )
inline

Definition at line 66 of file RBatchLoader.hxx.

Member Function Documentation

◆ Activate()

void TMVA::Experimental::Internal::RBatchLoader::Activate ( )
inline

Activate the batchloader so it will accept chunks to batch.

Definition at line 108 of file RBatchLoader.hxx.

◆ CreateBatch()

std::unique_ptr< TMVA::Experimental::RTensor< float > > TMVA::Experimental::Internal::RBatchLoader::CreateBatch ( const TMVA::Experimental::RTensor< float > &  chunkTensor,
std::span< const std::size_t >  idxs,
std::size_t  batchSize 
)
inline

Definition at line 132 of file RBatchLoader.hxx.

◆ CreateFirstBatch()

std::unique_ptr< TMVA::Experimental::RTensor< float > > TMVA::Experimental::Internal::RBatchLoader::CreateFirstBatch ( const TMVA::Experimental::RTensor< float > &  remainderTensor,
std::size_t  remainderTensorRow,
std::span< const std::size_t >  eventIndices 
)
inline

Definition at line 147 of file RBatchLoader.hxx.

◆ CreateTrainingBatches()

void TMVA::Experimental::Internal::RBatchLoader::CreateTrainingBatches ( const std::vector< std::size_t > &  eventIndices)
inline

Create training batches from the given chunk of data based on the given event indices Batches are added to the training queue of batches.

Parameters
chunkTensor
eventIndices

Definition at line 186 of file RBatchLoader.hxx.

◆ CreateValidationBatches()

void TMVA::Experimental::Internal::RBatchLoader::CreateValidationBatches ( const std::vector< std::size_t > &  eventIndices)
inline

Create validation batches from the given chunk based on the given event indices Batches are added to the vector of validation batches.

Parameters
chunkTensor
eventIndices

Definition at line 234 of file RBatchLoader.hxx.

◆ DeActivate()

void TMVA::Experimental::Internal::RBatchLoader::DeActivate ( )
inline

DeActivate the batchloader.

This means that no more batches are created. Batches can still be returned if they are already loaded

Definition at line 122 of file RBatchLoader.hxx.

◆ GetTrainBatch()

const TMVA::Experimental::RTensor< float > & TMVA::Experimental::Internal::RBatchLoader::GetTrainBatch ( )
inline

Return a batch of data as a unique pointer.

After the batch has been processed, it should be destroyed.

Returns
Training batch

Definition at line 72 of file RBatchLoader.hxx.

◆ GetValidationBatch()

const TMVA::Experimental::RTensor< float > & TMVA::Experimental::Internal::RBatchLoader::GetValidationBatch ( )
inline

Returns a batch of data for validation The owner of this batch has to be with the RBatchLoader.

This is because the same validation batches should be used in all epochs.

Returns
Validation batch

Definition at line 94 of file RBatchLoader.hxx.

◆ LastBatches()

void TMVA::Experimental::Internal::RBatchLoader::LastBatches ( )
inline

Definition at line 261 of file RBatchLoader.hxx.

◆ SaveRemainingData()

void TMVA::Experimental::Internal::RBatchLoader::SaveRemainingData ( TMVA::Experimental::RTensor< float > &  remainderTensor,
const std::size_t  remainderTensorRow,
const std::vector< std::size_t >  eventIndices,
const std::size_t  start = 0 
)
inline

save to remaining data when the whole chunk has to be saved

Parameters
chunkTensor
remainderTensor
remainderTensorRow
eventIndices

Definition at line 172 of file RBatchLoader.hxx.

Member Data Documentation

◆ fBatchCondition

std::condition_variable TMVA::Experimental::Internal::RBatchLoader::fBatchCondition
private

Definition at line 45 of file RBatchLoader.hxx.

◆ fBatchLock

std::mutex TMVA::Experimental::Internal::RBatchLoader::fBatchLock
private

Definition at line 44 of file RBatchLoader.hxx.

◆ fBatchSize

std::size_t TMVA::Experimental::Internal::RBatchLoader::fBatchSize
private

Definition at line 36 of file RBatchLoader.hxx.

◆ fChunkTensor

const TMVA::Experimental::RTensor<float>& TMVA::Experimental::Internal::RBatchLoader::fChunkTensor
private

Definition at line 35 of file RBatchLoader.hxx.

◆ fCurrentBatch

std::unique_ptr<TMVA::Experimental::RTensor<float> > TMVA::Experimental::Internal::RBatchLoader::fCurrentBatch
private

Definition at line 49 of file RBatchLoader.hxx.

◆ fIsActive

bool TMVA::Experimental::Internal::RBatchLoader::fIsActive = false
private

Definition at line 42 of file RBatchLoader.hxx.

◆ fMaxBatches

std::size_t TMVA::Experimental::Internal::RBatchLoader::fMaxBatches
private

Definition at line 38 of file RBatchLoader.hxx.

◆ fNumColumns

std::size_t TMVA::Experimental::Internal::RBatchLoader::fNumColumns
private

Definition at line 37 of file RBatchLoader.hxx.

◆ fTrainingBatchQueue

std::queue<std::unique_ptr<TMVA::Experimental::RTensor<float> > > TMVA::Experimental::Internal::RBatchLoader::fTrainingBatchQueue
private

Definition at line 47 of file RBatchLoader.hxx.

◆ fTrainingRemainder

std::unique_ptr<TMVA::Experimental::RTensor<float> > TMVA::Experimental::Internal::RBatchLoader::fTrainingRemainder
private

Definition at line 51 of file RBatchLoader.hxx.

◆ fTrainingRemainderRow

std::size_t TMVA::Experimental::Internal::RBatchLoader::fTrainingRemainderRow = 0
private

Definition at line 39 of file RBatchLoader.hxx.

◆ fValidationBatchQueue

std::queue<std::unique_ptr<TMVA::Experimental::RTensor<float> > > TMVA::Experimental::Internal::RBatchLoader::fValidationBatchQueue
private

Definition at line 48 of file RBatchLoader.hxx.

◆ fValidationRemainder

std::unique_ptr<TMVA::Experimental::RTensor<float> > TMVA::Experimental::Internal::RBatchLoader::fValidationRemainder
private

Definition at line 52 of file RBatchLoader.hxx.

◆ fValidationRemainderRow

std::size_t TMVA::Experimental::Internal::RBatchLoader::fValidationRemainderRow = 0
private

Definition at line 40 of file RBatchLoader.hxx.

Libraries for TMVA::Experimental::Internal::RBatchLoader:

The documentation for this class was generated from the following file: