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 TTensorDataLoader 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 TTensorDataLoader 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.
Data_t | The input data type. |
Architecture_t | The achitecture class of the underlying architecture. |
Definition at line 82 of file TensorDataLoader.h.
Public Member Functions | |
TTensorDataLoader (const Data_t &data, size_t nSamples, size_t batchSize, size_t batchDepth, size_t batchHeight, size_t batchWidth, size_t nOutputFeatures, size_t nStreams=1) | |
Constructor. More... | |
TTensorDataLoader (const TTensorDataLoader &)=default | |
TTensorDataLoader (TTensorDataLoader &&)=default | |
BatchIterator_t | begin () |
template<> | |
void | CopyTensorInput (std::vector< TMatrixT< Real_t >> &tensor, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorInput (std::vector< TMatrixT< Double_t >> &tensor, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorInput (std::vector< TMatrixT< Real_t >> &tensor, IndexIterator_t sampleIterator) |
void | CopyTensorInput (HostBuffer_t &buffer, IndexIterator_t begin) |
Copy input tensor into the given host buffer. More... | |
template<> | |
void | CopyTensorInput (std::vector< TMatrixT< Double_t >> &tensor, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorInput (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorInput (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorInput (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorInput (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorInput (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorInput (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorInput (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorInput (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorOutput (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorOutput (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyTensorOutput (HostBuffer_t &buffer, IndexIterator_t begin) |
Copy output matrix into the given host buffer. More... | |
template<> | |
void | CopyTensorOutput (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorOutput (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorOutput (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorOutput (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorOutput (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorOutput (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorOutput (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorOutput (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorOutput (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorOutput (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorWeights (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorWeights (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
void | CopyTensorWeights (HostBuffer_t &buffer, IndexIterator_t begin) |
Copy weight matrix into the given host buffer. More... | |
template<> | |
void | CopyTensorWeights (TMatrixT< Real_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorWeights (TMatrixT< Double_t > &matrix, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorWeights (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorWeights (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorWeights (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorWeights (TCudaHostBuffer< float > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorWeights (TCpuBuffer< Double_t > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorWeights (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorWeights (TCpuBuffer< Real_t > &buffer, IndexIterator_t sampleIterator) |
template<> | |
void | CopyTensorWeights (TCudaHostBuffer< double > &buffer, IndexIterator_t sampleIterator) |
BatchIterator_t | end () |
TTensorBatch< Architecture_t > | GetTensorBatch () |
Return the next batch from the training set. More... | |
TTensorDataLoader & | operator= (const TTensorDataLoader &)=default |
TTensorDataLoader & | operator= (TTensorDataLoader &&)=default |
template<typename RNG > | |
void | Shuffle (RNG &rng) |
Shuffle the order of the samples in the batch. More... | |
Private Types | |
using | BatchIterator_t = TTensorBatchIterator< Data_t, Architecture_t > |
using | DeviceBuffer_t = typename Architecture_t::DeviceBuffer_t |
using | HostBuffer_t = typename Architecture_t::HostBuffer_t |
using | Matrix_t = typename Architecture_t::Matrix_t |
Private Attributes | |
size_t | fBatchDepth |
The number of matrices in the tensor. More... | |
size_t | fBatchHeight |
The number od rows in each matrix. More... | |
size_t | fBatchIndex |
The index of the batch when there are multiple batches in parallel. More... | |
size_t | fBatchSize |
The size of a batch. More... | |
size_t | fBatchWidth |
The number of columns in each matrix. More... | |
const Data_t & | fData |
The data that should be loaded in the batches. More... | |
std::vector< DeviceBuffer_t > | fDeviceBuffers |
The device buffers used to keep the input, output and weight data. More... | |
std::vector< HostBuffer_t > | fHostBuffers |
The host buffers used to load the input, output and weight data. More... | |
size_t | fNOutputFeatures |
The number of outputs from the classifier/regressor. More... | |
size_t | fNSamples |
The total number of samples in the dataset. More... | |
size_t | fNStreams |
Number of buffer pairs. More... | |
std::vector< size_t > | fSampleIndices |
Ordering of the samples in the epoch. More... | |
#include <TMVA/DNN/TensorDataLoader.h>
|
private |
Definition at line 135 of file TensorDataLoader.h.
|
private |
Definition at line 133 of file TensorDataLoader.h.
|
private |
Definition at line 132 of file TensorDataLoader.h.
|
private |
Definition at line 134 of file TensorDataLoader.h.
TMVA::DNN::TTensorDataLoader< Data_t, Architecture_t >::TTensorDataLoader | ( | const Data_t & | data, |
size_t | nSamples, | ||
size_t | batchSize, | ||
size_t | batchDepth, | ||
size_t | batchHeight, | ||
size_t | batchWidth, | ||
size_t | nOutputFeatures, | ||
size_t | nStreams = 1 |
||
) |
Constructor.
Definition at line 203 of file TensorDataLoader.h.
|
default |
|
default |
|
inline |
Definition at line 173 of file TensorDataLoader.h.
void TMVA::DNN::TTensorDataLoader< TensorInput, TReference< Real_t > >::CopyTensorInput | ( | std::vector< TMatrixT< Real_t >> & | tensor, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 40 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TReference< Double_t > >::CopyTensorInput | ( | std::vector< TMatrixT< Double_t >> & | tensor, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 100 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TReference< Real_t > >::CopyTensorInput | ( | std::vector< TMatrixT< Real_t >> & | tensor, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 160 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< Data_t, Architecture_t >::CopyTensorInput | ( | HostBuffer_t & | buffer, |
IndexIterator_t | begin | ||
) |
Copy input tensor into the given host buffer.
Function to be specialized by the architecture-specific backend.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TReference< Double_t > >::CopyTensorInput | ( | std::vector< TMatrixT< Double_t >> & | tensor, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 232 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCpu< Real_t > >::CopyTensorInput | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 299 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCpu< Double_t > >::CopyTensorInput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 361 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCuda< float > >::CopyTensorInput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 364 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCuda< float > >::CopyTensorInput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 413 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyTensorInput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 424 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCuda< double > >::CopyTensorInput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 497 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCpu< Real_t > >::CopyTensorInput | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 510 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCuda< double > >::CopyTensorInput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 546 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TReference< Real_t > >::CopyTensorOutput | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 68 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TReference< Double_t > >::CopyTensorOutput | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 128 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< Data_t, Architecture_t >::CopyTensorOutput | ( | HostBuffer_t & | buffer, |
IndexIterator_t | begin | ||
) |
Copy output matrix into the given host buffer.
Function to be specialized by the architecture-spcific backend.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TReference< Real_t > >::CopyTensorOutput | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 191 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TReference< Double_t > >::CopyTensorOutput | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 263 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCpu< Real_t > >::CopyTensorOutput | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 329 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCuda< float > >::CopyTensorOutput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 383 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCpu< Double_t > >::CopyTensorOutput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 391 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCuda< float > >::CopyTensorOutput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 450 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyTensorOutput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 462 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCuda< double > >::CopyTensorOutput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 516 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCpu< Real_t > >::CopyTensorOutput | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 548 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCuda< double > >::CopyTensorOutput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 584 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TReference< Real_t > >::CopyTensorWeights | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 86 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TReference< Double_t > >::CopyTensorWeights | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 146 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< Data_t, Architecture_t >::CopyTensorWeights | ( | HostBuffer_t & | buffer, |
IndexIterator_t | begin | ||
) |
Copy weight matrix into the given host buffer.
Function to be specialized by the architecture-spcific backend.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TReference< Real_t > >::CopyTensorWeights | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 220 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TReference< Double_t > >::CopyTensorWeights | ( | TMatrixT< Double_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 292 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCpu< Real_t > >::CopyTensorWeights | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 347 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCuda< float > >::CopyTensorWeights | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 401 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCpu< Double_t > >::CopyTensorWeights | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 409 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCuda< float > >::CopyTensorWeights | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 485 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyTensorWeights | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 497 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCuda< double > >::CopyTensorWeights | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 534 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCpu< Real_t > >::CopyTensorWeights | ( | TCpuBuffer< Real_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 583 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCuda< double > >::CopyTensorWeights | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 619 of file CudaBuffers.cxx.
|
inline |
Definition at line 174 of file TensorDataLoader.h.
TTensorBatch< Architecture_t > TMVA::DNN::TTensorDataLoader< Data_t, Architecture_t >::GetTensorBatch | ( | ) |
Return the next batch from the training set.
The TTensorDataLoader object keeps an internal counter that cycles over the batches in the training set.
Definition at line 227 of file TensorDataLoader.h.
|
default |
|
default |
void TMVA::DNN::TTensorDataLoader< Data_t, Architecture_t >::Shuffle | ( | RNG & | rng | ) |
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 276 of file TensorDataLoader.h.
|
private |
The number of matrices in the tensor.
Definition at line 141 of file TensorDataLoader.h.
|
private |
The number od rows in each matrix.
Definition at line 142 of file TensorDataLoader.h.
|
private |
The index of the batch when there are multiple batches in parallel.
Definition at line 145 of file TensorDataLoader.h.
|
private |
The size of a batch.
Definition at line 140 of file TensorDataLoader.h.
|
private |
The number of columns in each matrix.
Definition at line 143 of file TensorDataLoader.h.
|
private |
The data that should be loaded in the batches.
Definition at line 137 of file TensorDataLoader.h.
|
private |
The device buffers used to keep the input, output and weight data.
Definition at line 148 of file TensorDataLoader.h.
|
private |
The host buffers used to load the input, output and weight data.
Definition at line 149 of file TensorDataLoader.h.
|
private |
The number of outputs from the classifier/regressor.
Definition at line 144 of file TensorDataLoader.h.
|
private |
The total number of samples in the dataset.
Definition at line 139 of file TensorDataLoader.h.
|
private |
Number of buffer pairs.
Definition at line 147 of file TensorDataLoader.h.
|
private |
Ordering of the samples in the epoch.
Definition at line 151 of file TensorDataLoader.h.