18 #ifndef TMVA_DNN_DATALOADER 19 #define TMVA_DNN_DATALOADER 40 std::tuple<const std::vector<Event *> &,
const DataSetInfo &>;
53 template <
typename AArchitecture>
58 using Matrix_t =
typename AArchitecture::Matrix_t;
79 template<
typename Data_t,
typename AArchitecture>
class TDataLoader;
89 template<
typename Data_t,
typename AArchitecture>
100 : fDataLoader(dataLoader), fBatchIndex(index)
127 template<
typename Data_t,
typename AArchitecture>
154 size_t nInputFeatures,
size_t nOutputFeatures,
size_t nStreams = 1);
191 template <
typename AArchitecture>
201 template<
typename Data_t,
typename AArchitecture>
203 const Data_t &
data,
size_t nSamples,
size_t batchSize,
204 size_t nInputFeatures,
size_t nOutputFeatures,
size_t nStreams)
205 : fData(data), fNSamples(nSamples), fBatchSize(batchSize),
206 fNInputFeatures(nInputFeatures), fNOutputFeatures(nOutputFeatures),
207 fBatchIndex(0), fNStreams(nStreams), fDeviceBuffers(), fHostBuffers(),
227 template<
typename Data_t,
typename AArchitecture>
241 HostBuffer_t inputHostBuffer = hostBuffer.GetSubBuffer(0, inputMatrixSize);
242 HostBuffer_t outputHostBuffer = hostBuffer.GetSubBuffer(inputMatrixSize,
244 HostBuffer_t weightHostBuffer = hostBuffer.GetSubBuffer(inputMatrixSize + outputMatrixSize, weightMatrixSize);
246 DeviceBuffer_t inputDeviceBuffer = deviceBuffer.GetSubBuffer(0, inputMatrixSize);
247 DeviceBuffer_t outputDeviceBuffer = deviceBuffer.GetSubBuffer(inputMatrixSize,
249 DeviceBuffer_t weightDeviceBuffer = deviceBuffer.GetSubBuffer(inputMatrixSize + outputMatrixSize, weightMatrixSize);
254 CopyInput(inputHostBuffer, sampleIndexIterator, fBatchSize);
255 CopyOutput(outputHostBuffer, sampleIndexIterator, fBatchSize);
256 CopyWeights(weightHostBuffer, sampleIndexIterator, fBatchSize);
258 deviceBuffer.CopyFrom(hostBuffer);
259 Matrix_t inputMatrix(inputDeviceBuffer, fBatchSize, fNInputFeatures);
260 Matrix_t outputMatrix(outputDeviceBuffer, fBatchSize, fNOutputFeatures);
261 Matrix_t weightMatrix(weightDeviceBuffer, fBatchSize, fNOutputFeatures);
268 template<
typename Data_t,
typename AArchitecture>
TBatch< AArchitecture > operator*()
Matrix_t & GetInput()
Return the matrix representing the input data.
void CopyOutput(HostBuffer_t &buffer, IndexIterator_t begin, size_t batchSize)
Copy output matrix into the given host buffer.
TBatch< AArchitecture > GetBatch()
Return the next batch from the training set.
void CopyInput(HostBuffer_t &buffer, IndexIterator_t begin, size_t batchSize)
Copy input matrix into the given host buffer.
size_t fNStreams
Number of buffer pairs.
bool operator!=(const TBatchIterator &other)
std::tuple< const TMatrixT< Double_t > &, const TMatrixT< Double_t > &, const TMatrixT< Double_t > & > MatrixInput_t
TBatch(Matrix_t &, Matrix_t &, Matrix_t &)
TDataLoader< Data_t, AArchitecture > & fDataLoader
typename AArchitecture::Matrix_t Matrix_t
TBatchIterator operator++()
TBatchIterator(TDataLoader< Data_t, AArchitecture > &dataLoader, size_t index=0)
typename AArchitecture::DeviceBuffer_t DeviceBuffer_t
Class that contains all the data information.
typename std::vector< size_t >::iterator IndexIterator_t
typename AArchitecture::Matrix_t Matrix_t
typename AArchitecture::HostBuffer_t HostBuffer_t
void Shuffle()
Shuffle the order of the samples in the batch.
TBatch & operator=(const TBatch &)=default
TDataLoader(const Data_t &data, size_t nSamples, size_t batchSize, size_t nInputFeatures, size_t nOutputFeatures, size_t nStreams=1)
std::vector< size_t > fSampleIndices
Ordering of the samples in the epoch.
Abstract ClassifierFactory template that handles arbitrary types.
std::tuple< const std::vector< Event * > &, const DataSetInfo & > TMVAInput_t
std::vector< DeviceBuffer_t > fDeviceBuffers
std::vector< HostBuffer_t > fHostBuffers
Matrix_t & GetOutput()
Return the matrix representing the output data.
void CopyWeights(HostBuffer_t &buffer, IndexIterator_t begin, size_t batchSize)
Copy weight matrix into the given host buffer.
Matrix_t & GetWeights()
Return the matrix holding the event weights.