Service class managing the streaming of the training data from the input data type to the accelerator device or the CPU. A TDataLoader object manages a number of host and device buffer pairs that are used in a round-robin manner for the transfer of batches to the device.
Each TDataLoader object has an associated batch size and a number of total samples in the dataset. One epoch is the number of buffers required to transfer the complete training set. Using the begin() and end() member functions allows the user to iterate over the batches in one epoch.
AData | The input data type. |
AArchitecture | The architecture class of the underlying architecture. |
Definition at line 128 of file DataLoader.h.
Public Member Functions | |
TDataLoader (const Data_t &data, size_t nSamples, size_t batchSize, size_t nInputFeatures, size_t nOutputFeatures, size_t nStreams=1) | |
TDataLoader (const TDataLoader &)=default | |
TDataLoader (TDataLoader &&)=default | |
BatchIterator_t | begin () |
void | CopyInput (HostBuffer_t &buffer, IndexIterator_t begin, size_t batchSize) |
Copy input matrix into the given host buffer. | |
void | CopyInput (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyInput (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyInput (TCpuBuffer< Float_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyInput (TCpuBuffer< Float_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyInput (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyInput (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyInput (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyInput (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyInput (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyInput (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyInput (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyInput (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyOutput (HostBuffer_t &buffer, IndexIterator_t begin, size_t batchSize) |
Copy output matrix into the given host buffer. | |
void | CopyOutput (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyOutput (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyOutput (TCpuBuffer< Float_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyOutput (TCpuBuffer< Float_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyOutput (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyOutput (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyOutput (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyOutput (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyOutput (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyOutput (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyOutput (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyOutput (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyWeights (HostBuffer_t &buffer, IndexIterator_t begin, size_t batchSize) |
Copy weight matrix into the given host buffer. | |
void | CopyWeights (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyWeights (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyWeights (TCpuBuffer< Float_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyWeights (TCpuBuffer< Float_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyWeights (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyWeights (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyWeights (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyWeights (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyWeights (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyWeights (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyWeights (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyWeights (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
BatchIterator_t | end () |
TBatch< AArchitecture > | GetBatch () |
Return the next batch from the training set. | |
TDataLoader & | operator= (const TDataLoader &)=default |
TDataLoader & | operator= (TDataLoader &&)=default |
void | Shuffle () |
Shuffle the order of the samples in the batch. | |
Private Types | |
using | BatchIterator_t = TBatchIterator< Data_t, AArchitecture > |
using | DeviceBuffer_t = typename AArchitecture::DeviceBuffer_t |
using | HostBuffer_t = typename AArchitecture::HostBuffer_t |
using | Matrix_t = typename AArchitecture::Matrix_t |
Private Attributes | |
size_t | fBatchIndex |
size_t | fBatchSize |
const Data_t & | fData |
std::vector< DeviceBuffer_t > | fDeviceBuffers |
std::vector< HostBuffer_t > | fHostBuffers |
size_t | fNInputFeatures |
size_t | fNOutputFeatures |
size_t | fNSamples |
size_t | fNStreams |
Number of buffer pairs. | |
std::vector< size_t > | fSampleIndices |
Ordering of the samples in the epoch. | |
#include <TMVA/DNN/DataLoader.h>
|
private |
Definition at line 135 of file DataLoader.h.
|
private |
Definition at line 133 of file DataLoader.h.
|
private |
Definition at line 132 of file DataLoader.h.
|
private |
Definition at line 134 of file DataLoader.h.
TMVA::DNN::TDataLoader< Data_t, AArchitecture >::TDataLoader | ( | const Data_t & | data, |
size_t | nSamples, | ||
size_t | batchSize, | ||
size_t | nInputFeatures, | ||
size_t | nOutputFeatures, | ||
size_t | nStreams = 1 |
||
) |
Definition at line 202 of file DataLoader.h.
|
default |
|
default |
|
inline |
Definition at line 170 of file DataLoader.h.
void TMVA::DNN::TDataLoader< Data_t, AArchitecture >::CopyInput | ( | HostBuffer_t & | buffer, |
IndexIterator_t | begin, | ||
size_t | batchSize | ||
) |
Copy input matrix into the given host buffer.
Function to be specialized by the architecture-specific backend.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCpu< Double_t > >::CopyInput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 123 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyInput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 173 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCpu< Float_t > >::CopyInput | ( | TCpuBuffer< Float_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 73 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Float_t > >::CopyInput | ( | TCpuBuffer< Float_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 237 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCuda< double > >::CopyInput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 262 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCuda< double > >::CopyInput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 310 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCuda< float > >::CopyInput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 150 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCuda< float > >::CopyInput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 198 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TReference< Double_t > >::CopyInput | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 75 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TReference< Double_t > >::CopyInput | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 199 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TReference< Real_t > >::CopyInput | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 25 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TReference< Real_t > >::CopyInput | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 126 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< Data_t, AArchitecture >::CopyOutput | ( | HostBuffer_t & | buffer, |
IndexIterator_t | begin, | ||
size_t | batchSize | ||
) |
Copy output matrix into the given host buffer.
Function to be specialized by the architecture-specific backend.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCpu< Double_t > >::CopyOutput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 141 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyOutput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 190 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCpu< Float_t > >::CopyOutput | ( | TCpuBuffer< Float_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 91 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Float_t > >::CopyOutput | ( | TCpuBuffer< Float_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 254 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCuda< double > >::CopyOutput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 280 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCuda< double > >::CopyOutput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 327 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCuda< float > >::CopyOutput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 168 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCuda< float > >::CopyOutput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 215 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TReference< Double_t > >::CopyOutput | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 93 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TReference< Double_t > >::CopyOutput | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 221 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TReference< Real_t > >::CopyOutput | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 42 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TReference< Real_t > >::CopyOutput | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 149 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< Data_t, AArchitecture >::CopyWeights | ( | HostBuffer_t & | buffer, |
IndexIterator_t | begin, | ||
size_t | batchSize | ||
) |
Copy weight matrix into the given host buffer.
Function to be specialized by the architecture-specific backend.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCpu< Double_t > >::CopyWeights | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 159 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyWeights | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 225 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCpu< Float_t > >::CopyWeights | ( | TCpuBuffer< Float_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 109 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Float_t > >::CopyWeights | ( | TCpuBuffer< Float_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 289 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCuda< double > >::CopyWeights | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 298 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCuda< double > >::CopyWeights | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 362 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCuda< float > >::CopyWeights | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 186 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCuda< float > >::CopyWeights | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 250 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TReference< Double_t > >::CopyWeights | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 111 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TReference< Double_t > >::CopyWeights | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 254 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TReference< Real_t > >::CopyWeights | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 60 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TReference< Real_t > >::CopyWeights | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 184 of file DataLoader.cxx.
|
inline |
Definition at line 171 of file DataLoader.h.
TBatch< AArchitecture > TMVA::DNN::TDataLoader< Data_t, AArchitecture >::GetBatch |
Return the next batch from the training set.
The TDataLoader object keeps an internal counter that cycles over the batches in the training set.
Definition at line 228 of file DataLoader.h.
|
default |
|
default |
void TMVA::DNN::TDataLoader< Data_t, AArchitecture >::Shuffle |
Shuffle the order of the samples in the batch.
The shuffling is indirect, i.e. only the indices are shuffled. No input data is moved by this routine.
Definition at line 269 of file DataLoader.h.
|
private |
Definition at line 143 of file DataLoader.h.
|
private |
Definition at line 140 of file DataLoader.h.
|
private |
Definition at line 137 of file DataLoader.h.
|
private |
Definition at line 146 of file DataLoader.h.
|
private |
Definition at line 147 of file DataLoader.h.
|
private |
Definition at line 141 of file DataLoader.h.
|
private |
Definition at line 142 of file DataLoader.h.
|
private |
Definition at line 139 of file DataLoader.h.
|
private |
Number of buffer pairs.
Definition at line 145 of file DataLoader.h.
|
private |
Ordering of the samples in the epoch.
Definition at line 149 of file DataLoader.h.