ROOT 6.14/05 Reference Guide |
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 achitecture class of the underlying architecture. |
Definition at line 79 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 () |
template<> | |
void | CopyInput (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyInput (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyInput (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyInput (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyInput (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyInput (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyInput (HostBuffer_t &buffer, IndexIterator_t begin, size_t batchSize) |
Copy input matrix into the given host buffer. More... | |
template<> | |
void | CopyInput (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyInput (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyInput (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyInput (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyInput (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyInput (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyOutput (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyOutput (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyOutput (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyOutput (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyOutput (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyOutput (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyOutput (HostBuffer_t &buffer, IndexIterator_t begin, size_t batchSize) |
Copy output matrix into the given host buffer. More... | |
template<> | |
void | CopyOutput (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyOutput (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyOutput (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyOutput (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyOutput (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyOutput (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyWeights (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyWeights (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyWeights (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyWeights (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
void | CopyWeights (HostBuffer_t &buffer, IndexIterator_t begin, size_t batchSize) |
Copy weight matrix into the given host buffer. More... | |
template<> | |
void | CopyWeights (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyWeights (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyWeights (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyWeights (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyWeights (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyWeights (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyWeights (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyWeights (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
BatchIterator_t | end () |
TBatch< AArchitecture > | GetBatch () |
Return the next batch from the training set. More... | |
TDataLoader & | operator= (const TDataLoader &)=default |
TDataLoader & | operator= (TDataLoader &&)=default |
void | Shuffle () |
Shuffle the order of the samples in the batch. More... | |
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. More... | |
std::vector< size_t > | fSampleIndices |
Ordering of the samples in the epoch. More... | |
#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< 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< MatrixInput_t, TCpu< Real_t > >::CopyInput | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 71 of file CpuBuffer.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< MatrixInput_t, TCpu< Double_t > >::CopyInput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 121 of file CpuBuffer.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< MatrixInput_t, TCuda< float > >::CopyInput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 140 of file CudaBuffers.cxx.
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< TMVAInput_t, TCpu< Double_t > >::CopyInput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 171 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCuda< float > >::CopyInput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 188 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TReference< Double_t > >::CopyInput | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 190 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Real_t > >::CopyInput | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 235 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 252 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 300 of file CudaBuffers.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< MatrixInput_t, TCpu< Real_t > >::CopyOutput | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 89 of file CpuBuffer.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< MatrixInput_t, TCpu< Double_t > >::CopyOutput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 139 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TReference< Real_t > >::CopyOutput | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 146 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCuda< float > >::CopyOutput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 158 of file CudaBuffers.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-spcific backend.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyOutput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 188 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCuda< float > >::CopyOutput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 205 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TReference< Double_t > >::CopyOutput | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 210 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Real_t > >::CopyOutput | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 252 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 270 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 317 of file CudaBuffers.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< MatrixInput_t, TCpu< Real_t > >::CopyWeights | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 107 of file CpuBuffer.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< MatrixInput_t, TCpu< Double_t > >::CopyWeights | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 157 of file CpuBuffer.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-spcific backend.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCuda< float > >::CopyWeights | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 176 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TReference< Real_t > >::CopyWeights | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 178 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyWeights | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 223 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCuda< float > >::CopyWeights | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 240 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TReference< Double_t > >::CopyWeights | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 243 of file DataLoader.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Real_t > >::CopyWeights | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 287 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 288 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 352 of file CudaBuffers.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.