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 architecture class of the underlying architecture. |
Definition at line 133 of file TensorDataLoader.h.
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 |
using | Shape_t = typename Architecture_t::Tensor_t::Shape_t |
using | Tensor_t = typename Architecture_t::Tensor_t |
Private Attributes | |
size_t | fBatchDepth |
The number of matrices in the tensor. | |
size_t | fBatchHeight |
The number od rows in each matrix. | |
size_t | fBatchIndex |
The index of the batch when there are multiple batches in parallel. | |
size_t | fBatchSize |
The size of a batch. | |
size_t | fBatchWidth |
The number of columns in each matrix. | |
const Data_t & | fData |
The data that should be loaded in the batches. | |
std::vector< DeviceBuffer_t > | fDeviceBuffers |
The device buffers used to keep the input, output and weight data. | |
std::vector< HostBuffer_t > | fHostBuffers |
The host buffers used to load the input, output and weight data. | |
Shape_t | fInputLayout |
The input data layout (does not include batch size) | |
size_t | fNOutputFeatures |
The number of outputs from the classifier/regressor. | |
size_t | fNSamples |
The total number of samples in the dataset. | |
size_t | fNStreams |
Number of buffer pairs. | |
std::vector< size_t > | fSampleIndices |
Ordering of the samples in the epoch. | |
#include <TMVA/DNN/TensorDataLoader.h>
|
private |
Definition at line 140 of file TensorDataLoader.h.
|
private |
Definition at line 136 of file TensorDataLoader.h.
|
private |
Definition at line 135 of file TensorDataLoader.h.
|
private |
Definition at line 137 of file TensorDataLoader.h.
|
private |
Definition at line 139 of file TensorDataLoader.h.
|
private |
Definition at line 138 of file TensorDataLoader.h.
TMVA::DNN::TTensorDataLoader< Data_t, Architecture_t >::TTensorDataLoader | ( | const Data_t & | data, |
size_t | nSamples, | ||
size_t | batchSize, | ||
const Shape_t & | inputLayout, | ||
const Shape_t & | batchLayout, | ||
size_t | nOutputFeatures, | ||
size_t | nStreams = 1 |
||
) |
Constructor.
Definition at line 209 of file TensorDataLoader.h.
|
default |
|
default |
|
inline |
Definition at line 179 of file TensorDataLoader.h.
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< 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< 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, 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< 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< TensorInput, TCpu< Double_t > >::CopyTensorInput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 386 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyTensorInput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 473 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCpu< Float_t > >::CopyTensorInput | ( | TCpuBuffer< Float_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 301 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCpu< Float_t > >::CopyTensorInput | ( | TCpuBuffer< Float_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 583 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCuda< Double_t > >::CopyTensorInput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 519 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCuda< Double_t > >::CopyTensorInput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 580 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCudnn< double > >::CopyTensorInput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 174 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCudnn< double > >::CopyTensorInput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 234 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCuda< float > >::CopyTensorInput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 374 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCuda< float > >::CopyTensorInput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 434 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCudnn< float > >::CopyTensorInput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 29 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCudnn< float > >::CopyTensorInput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 90 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-specific backend.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCpu< Double_t > >::CopyTensorOutput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 416 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyTensorOutput | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 511 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCpu< Float_t > >::CopyTensorOutput | ( | TCpuBuffer< Float_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 331 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCpu< Float_t > >::CopyTensorOutput | ( | TCpuBuffer< Float_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 621 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCuda< Double_t > >::CopyTensorOutput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 549 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCuda< Double_t > >::CopyTensorOutput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 619 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCudnn< double > >::CopyTensorOutput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 204 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCudnn< double > >::CopyTensorOutput | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 271 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCuda< float > >::CopyTensorOutput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 404 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCuda< float > >::CopyTensorOutput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 472 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCudnn< float > >::CopyTensorOutput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 59 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCudnn< float > >::CopyTensorOutput | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 128 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< 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, TReference< Real_t > >::CopyTensorOutput | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 68 of file TensorDataLoader.cxx.
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< 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-specific backend.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCpu< Double_t > >::CopyTensorWeights | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 434 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCpu< Double_t > >::CopyTensorWeights | ( | TCpuBuffer< Double_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 546 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCpu< Float_t > >::CopyTensorWeights | ( | TCpuBuffer< Float_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 349 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCpu< Float_t > >::CopyTensorWeights | ( | TCpuBuffer< Float_t > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 656 of file CpuBuffer.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCuda< Double_t > >::CopyTensorWeights | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 567 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCuda< Double_t > >::CopyTensorWeights | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 654 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCudnn< double > >::CopyTensorWeights | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 222 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCudnn< double > >::CopyTensorWeights | ( | TCudaHostBuffer< double > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 306 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCuda< float > >::CopyTensorWeights | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 422 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCuda< float > >::CopyTensorWeights | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 507 of file CudaBuffers.cxx.
void TMVA::DNN::TTensorDataLoader< TensorInput, TCudnn< float > >::CopyTensorWeights | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 77 of file TensorDataLoader.cxx.
void TMVA::DNN::TTensorDataLoader< TMVAInput_t, TCudnn< float > >::CopyTensorWeights | ( | TCudaHostBuffer< float > & | buffer, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 162 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< 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, TReference< Real_t > >::CopyTensorWeights | ( | TMatrixT< Real_t > & | matrix, |
IndexIterator_t | sampleIterator | ||
) |
Definition at line 86 of file TensorDataLoader.cxx.
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.
|
inline |
Definition at line 180 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 233 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 285 of file TensorDataLoader.h.
|
private |
The number of matrices in the tensor.
Definition at line 146 of file TensorDataLoader.h.
|
private |
The number od rows in each matrix.
Definition at line 147 of file TensorDataLoader.h.
|
private |
The index of the batch when there are multiple batches in parallel.
Definition at line 150 of file TensorDataLoader.h.
|
private |
The size of a batch.
Definition at line 144 of file TensorDataLoader.h.
|
private |
The number of columns in each matrix.
Definition at line 148 of file TensorDataLoader.h.
|
private |
The data that should be loaded in the batches.
Definition at line 142 of file TensorDataLoader.h.
|
private |
The device buffers used to keep the input, output and weight data.
Definition at line 154 of file TensorDataLoader.h.
|
private |
The host buffers used to load the input, output and weight data.
Definition at line 155 of file TensorDataLoader.h.
|
private |
The input data layout (does not include batch size)
Definition at line 145 of file TensorDataLoader.h.
|
private |
The number of outputs from the classifier/regressor.
Definition at line 149 of file TensorDataLoader.h.
|
private |
The total number of samples in the dataset.
Definition at line 143 of file TensorDataLoader.h.
|
private |
Number of buffer pairs.
Definition at line 153 of file TensorDataLoader.h.
|
private |
Ordering of the samples in the epoch.
Definition at line 157 of file TensorDataLoader.h.