Logo ROOT   6.21/01
Reference Guide
TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > > Class Template Reference

template<typename AData, typename AReal>
class TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >

Definition at line 47 of file TensorDataLoader.h.

Public Member Functions

 TTensorDataLoader (const AData &data, size_t nSamples, size_t batchDepth, size_t batchHeight, size_t batchWidth, size_t nOutputFeatures, std::vector< size_t > inputShape, size_t nStreams=1)
 Constructor. More...
 
 TTensorDataLoader (const TTensorDataLoader &)=default
 
 TTensorDataLoader (TTensorDataLoader &&)=default
 
BatchIterator_t begin ()
 
void CopyTensorInput (std::vector< TMatrixT< AReal >> &tensor, IndexIterator_t sampleIterator)
 Copy input tensor into the given host buffer. More...
 
void CopyTensorOutput (TMatrixT< AReal > &matrix, IndexIterator_t sampleIterator)
 Copy output matrix into the given host buffer. More...
 
void CopyTensorWeights (TMatrixT< AReal > &matrix, IndexIterator_t sampleIterator)
 Copy weight matrix into the given host buffer. More...
 
BatchIterator_t end ()
 
TTensorBatch< TReference< AReal > > GetTensorBatch ()
 Return the next batch from the training set. More...
 
TTensorDataLoaderoperator= (const TTensorDataLoader &)=default
 
TTensorDataLoaderoperator= (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< AData, TReference< AReal > >
 

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 fBatchWidth
 The number of columns in each matrix. More...
 
const AData & fData
 The data that should be loaded in the batches. More...
 
std::vector< size_t > fInputShape
 Defines the batch depth, no. of channels and spatial dimensions of an input tensor. 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...
 
std::vector< size_t > fSampleIndices
 Ordering of the samples in the epoch. More...
 
std::vector< TMatrixT< AReal > > inputTensor
 The 3D tensor used to keep the input data. More...
 
TMatrixT< AReal > outputMatrix
 The matrix used to keep the output. More...
 
TMatrixT< AReal > weightMatrix
 The matrix used to keep the batch weights. More...
 

#include <TMVA/DNN/Architectures/Reference/TensorDataLoader.h>

Member Typedef Documentation

◆ BatchIterator_t

template<typename AData , typename AReal >
using TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::BatchIterator_t = TTensorBatchIterator<AData, TReference<AReal> >
private

Definition at line 49 of file TensorDataLoader.h.

Constructor & Destructor Documentation

◆ TTensorDataLoader() [1/3]

template<typename AData , typename AReal >
TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::TTensorDataLoader ( const AData &  data,
size_t  nSamples,
size_t  batchDepth,
size_t  batchHeight,
size_t  batchWidth,
size_t  nOutputFeatures,
std::vector< size_t >  inputShape,
size_t  nStreams = 1 
)

Constructor.

Definition at line 109 of file TensorDataLoader.h.

◆ TTensorDataLoader() [2/3]

template<typename AData , typename AReal >
TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::TTensorDataLoader ( const TTensorDataLoader< AData, TReference< AReal > > &  )
default

◆ TTensorDataLoader() [3/3]

template<typename AData , typename AReal >
TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::TTensorDataLoader ( TTensorDataLoader< AData, TReference< AReal > > &&  )
default

Member Function Documentation

◆ begin()

template<typename AData , typename AReal >
BatchIterator_t TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::begin ( )
inline

Definition at line 90 of file TensorDataLoader.h.

◆ CopyTensorInput()

template<typename AData , typename AReal >
void TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::CopyTensorInput ( std::vector< TMatrixT< AReal >> &  tensor,
IndexIterator_t  sampleIterator 
)

Copy input tensor into the given host buffer.

Function to be specialized by the architecture-specific backend.

◆ CopyTensorOutput()

template<typename AData , typename AReal >
void TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::CopyTensorOutput ( TMatrixT< AReal > &  matrix,
IndexIterator_t  sampleIterator 
)

Copy output matrix into the given host buffer.

Function to be specialized by the architecture-spcific backend.

◆ CopyTensorWeights()

template<typename AData , typename AReal >
void TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::CopyTensorWeights ( TMatrixT< AReal > &  matrix,
IndexIterator_t  sampleIterator 
)

Copy weight matrix into the given host buffer.

Function to be specialized by the architecture-spcific backend.

◆ end()

template<typename AData , typename AReal >
BatchIterator_t TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::end ( )
inline

Definition at line 91 of file TensorDataLoader.h.

◆ GetTensorBatch()

template<typename AData , typename AReal >
auto TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::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 136 of file TensorDataLoader.h.

◆ operator=() [1/2]

template<typename AData , typename AReal >
TTensorDataLoader& TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::operator= ( const TTensorDataLoader< AData, TReference< AReal > > &  )
default

◆ operator=() [2/2]

template<typename AData , typename AReal >
TTensorDataLoader& TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::operator= ( TTensorDataLoader< AData, TReference< AReal > > &&  )
default

◆ Shuffle()

template<typename AData , typename AReal >
template<typename RNG >
void TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::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 130 of file TensorDataLoader.h.

Member Data Documentation

◆ fBatchDepth

template<typename AData , typename AReal >
size_t TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::fBatchDepth
private

The number of matrices in the tensor.

Definition at line 55 of file TensorDataLoader.h.

◆ fBatchHeight

template<typename AData , typename AReal >
size_t TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::fBatchHeight
private

The number od rows in each matrix.

Definition at line 56 of file TensorDataLoader.h.

◆ fBatchIndex

template<typename AData , typename AReal >
size_t TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::fBatchIndex
private

The index of the batch when there are multiple batches in parallel.

Definition at line 59 of file TensorDataLoader.h.

◆ fBatchWidth

template<typename AData , typename AReal >
size_t TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::fBatchWidth
private

The number of columns in each matrix.

Definition at line 57 of file TensorDataLoader.h.

◆ fData

template<typename AData , typename AReal >
const AData& TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::fData
private

The data that should be loaded in the batches.

Definition at line 51 of file TensorDataLoader.h.

◆ fInputShape

template<typename AData , typename AReal >
std::vector<size_t> TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::fInputShape
private

Defines the batch depth, no. of channels and spatial dimensions of an input tensor.

Definition at line 61 of file TensorDataLoader.h.

◆ fNOutputFeatures

template<typename AData , typename AReal >
size_t TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::fNOutputFeatures
private

The number of outputs from the classifier/regressor.

Definition at line 58 of file TensorDataLoader.h.

◆ fNSamples

template<typename AData , typename AReal >
size_t TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::fNSamples
private

The total number of samples in the dataset.

Definition at line 53 of file TensorDataLoader.h.

◆ fSampleIndices

template<typename AData , typename AReal >
std::vector<size_t> TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::fSampleIndices
private

Ordering of the samples in the epoch.

Definition at line 67 of file TensorDataLoader.h.

◆ inputTensor

template<typename AData , typename AReal >
std::vector<TMatrixT<AReal> > TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::inputTensor
private

The 3D tensor used to keep the input data.

Definition at line 63 of file TensorDataLoader.h.

◆ outputMatrix

template<typename AData , typename AReal >
TMatrixT<AReal> TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::outputMatrix
private

The matrix used to keep the output.

Definition at line 64 of file TensorDataLoader.h.

◆ weightMatrix

template<typename AData , typename AReal >
TMatrixT<AReal> TMVA::DNN::TTensorDataLoader< AData, TReference< AReal > >::weightMatrix
private

The matrix used to keep the batch weights.

Definition at line 65 of file TensorDataLoader.h.


The documentation for this class was generated from the following file: