15#ifndef TMVA_RBATCHLOADER
16#define TMVA_RBATCHLOADER
25#include <condition_variable>
74 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{0,
fNumColumns});
76 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{0,
fNumColumns});
79 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{0,
fNumColumns});
81 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{0,
fNumColumns});
113 std::unique_ptr<TMVA::Experimental::RTensor<float>>
117 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>({
fBatchSize,
fNumColumns}));
130 fCurrentBatch = std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>({0}));
146 fCurrentBatch = std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>({0}));
169 std::vector<std::unique_ptr<TMVA::Experimental::RTensor<float>>>
batches;
172 for (std::size_t i = 0; i <
Batches; i++) {
189 (*fPrimaryLeftoverTrainingBatch) =
197 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{
fBatchSize,
fNumColumns});
200 batches.emplace_back(std::move(copy));
205 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{0,
fNumColumns});
212 (*fPrimaryLeftoverTrainingBatch) = (*fPrimaryLeftoverTrainingBatch).Resize({
fBatchSize,
fNumColumns});
217 (*fSecondaryLeftoverTrainingBatch) =
225 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{
fBatchSize,
fNumColumns});
228 batches.emplace_back(std::move(copy));
235 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{0,
fNumColumns});
242 auto copy = std::make_unique<TMVA::Experimental::RTensor<float>>(
244 std::copy((*fPrimaryLeftoverTrainingBatch).GetData(),
246 batches.emplace_back(std::move(copy));
250 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{0,
fNumColumns});
252 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{0,
fNumColumns});
256 for (std::size_t i = 0; i <
batches.size(); i++) {
274 std::vector<std::unique_ptr<TMVA::Experimental::RTensor<float>>>
batches;
276 for (std::size_t i = 0; i <
Batches; i++) {
290 (*fPrimaryLeftoverValidationBatch) =
297 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{
fBatchSize,
fNumColumns});
300 batches.emplace_back(std::move(copy));
303 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{0,
fNumColumns});
308 (*fPrimaryLeftoverValidationBatch) = (*fPrimaryLeftoverValidationBatch).Resize({
fBatchSize,
NumCols});
311 (*fSecondaryLeftoverValidationBatch) =
317 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{
fBatchSize,
fNumColumns});
320 batches.emplace_back(std::move(copy));
323 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{0,
fNumColumns});
329 auto copy = std::make_unique<TMVA::Experimental::RTensor<float>>(
331 std::copy((*fPrimaryLeftoverValidationBatch).GetData(),
334 batches.emplace_back(std::move(copy));
337 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{0,
fNumColumns});
339 std::make_unique<TMVA::Experimental::RTensor<float>>(std::vector<std::size_t>{0,
fNumColumns});
342 for (std::size_t i = 0; i <
batches.size(); i++) {
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
These classes encapsulate the necessary data for the computations.
std::unique_ptr< TMVA::Experimental::RTensor< float > > fSecondaryLeftoverValidationBatch
TMVA::Experimental::RTensor< float > GetValidationBatch()
Loading the validation batch from the queue.
RBatchLoader(std::size_t batchSize, std::size_t numColumns)
std::unique_ptr< TMVA::Experimental::RTensor< float > > fSecondaryLeftoverTrainingBatch
std::unique_ptr< TMVA::Experimental::RTensor< float > > fPrimaryLeftoverValidationBatch
void CreateTrainingBatches(TMVA::Experimental::RTensor< float > &chunkTensor, int lastbatch, std::size_t leftoverBatchSize, bool dropRemainder)
Creating the training batches from a chunk and add them to the queue.
std::unique_ptr< TMVA::Experimental::RTensor< float > > fPrimaryLeftoverTrainingBatch
std::queue< std::unique_ptr< TMVA::Experimental::RTensor< float > > > fValidationBatchQueue
TMVA::Experimental::RTensor< float > GetTrainBatch()
Loading the training batch from the queue.
std::unique_ptr< TMVA::Experimental::RTensor< float > > CreateBatch(TMVA::Experimental::RTensor< float > &chunkTensor, std::size_t idxs)
Return a batch of data as a unique pointer.
std::condition_variable fBatchCondition
std::size_t fNumValidationBatchQueue
void CreateValidationBatches(TMVA::Experimental::RTensor< float > &chunkTensor, std::size_t lastbatch, std::size_t leftoverBatchSize, bool dropRemainder)
Creating the validation batches from a chunk and adding them to the queue.
std::size_t fNumTrainingBatchQueue
std::size_t GetNumValidationBatchQueue()
std::unique_ptr< TMVA::Experimental::RTensor< float > > fCurrentBatch
void DeActivate()
DeActivate the batchloader.
std::queue< std::unique_ptr< TMVA::Experimental::RTensor< float > > > fTrainingBatchQueue
std::size_t GetNumTrainingBatchQueue()
RTensor is a container with contiguous memory and shape information.