ROOT 6.10/09 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 73 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 (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
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 (TCpuBuffer< Double_t > &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 (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
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 (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
template<> | |
void | CopyOutput (TCpuBuffer< Double_t > &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 (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator, size_t batchSize) |
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 (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) |
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 129 of file DataLoader.h.
|
private |
Definition at line 127 of file DataLoader.h.
|
private |
Definition at line 126 of file DataLoader.h.
|
private |
Definition at line 128 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 193 of file DataLoader.h.
|
default |
|
default |
|
inline |
Definition at line 161 of file DataLoader.h.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCpu< Real_t > >::CopyInput | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 72 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCpu< Double_t > >::CopyInput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 112 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCuda< float > >::CopyInput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 145 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyInput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 152 of file CpuBuffer.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, TCuda< float > >::CopyInput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 185 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Real_t > >::CopyInput | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 211 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 244 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 284 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCpu< Real_t > >::CopyOutput | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 92 of file CpuBuffer.cxx.
void TMVA::DNN::TDataLoader< MatrixInput_t, TCpu< Double_t > >::CopyOutput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 132 of file CpuBuffer.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< MatrixInput_t, TCuda< float > >::CopyOutput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 165 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyOutput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 174 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 207 of file CudaBuffers.cxx.
void TMVA::DNN::TDataLoader< TMVAInput_t, TCpu< Real_t > >::CopyOutput | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator, | ||
size_t | batchSize | ||
) |
Definition at line 233 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 264 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 306 of file CudaBuffers.cxx.
|
inline |
Definition at line 162 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 218 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 253 of file DataLoader.h.
|
private |
Definition at line 137 of file DataLoader.h.
|
private |
Definition at line 134 of file DataLoader.h.
|
private |
Definition at line 131 of file DataLoader.h.
|
private |
Definition at line 140 of file DataLoader.h.
|
private |
Definition at line 141 of file DataLoader.h.
|
private |
Definition at line 135 of file DataLoader.h.
|
private |
Definition at line 136 of file DataLoader.h.
|
private |
Definition at line 133 of file DataLoader.h.
|
private |
Number of buffer pairs.
Definition at line 139 of file DataLoader.h.
|
private |
Ordering of the samples in the epoch.
Definition at line 143 of file DataLoader.h.