oneDNN Wrapper
DataLoader Class Reference

DataLoader allows to create a dataloader object to implement minibatch stochastic gradient descent. More...

#include <data_loader.h>

Public Member Functions

void write_to_memory (dnnl::memory dst_mem_features, dnnl::memory dst_mem_labels)
 Method that writes the curr batch to memory and moves the index forward.
 
 DataLoader (std::string features_path, std::string labels_path, int _minibatch_size, std::vector< int > dataset_shape, dnnl::engine _eng)
 Construct a new Data Loader object. More...
 

Public Attributes

int dataset_size
 Total number of samples.
 
int minibatch_size
 Minibatch size.
 
std::vector< float > dataset
 Vector containing the entire dataset.
 
std::vector< float > dataset_labels
 Vector containing the labels.
 
std::vector< float > curr_batch
 Vector containing the current batch that will be written to the engine.
 
std::vector< float > curr_batch_labels
 Vector containing the labels that will be written to the engine.
 

Detailed Description

DataLoader allows to create a dataloader object to implement minibatch stochastic gradient descent.

Constructor & Destructor Documentation

◆ DataLoader()

DataLoader::DataLoader ( std::string  features_path,
std::string  labels_path,
int  _minibatch_size,
std::vector< int >  dataset_shape,
dnnl::engine  _eng 
)

Construct a new Data Loader object.

This allows the creation of a class which implements minibatch stochastic gradient descent

Parameters
features_pathpath to the text file containing the flattened features (in row-major order)
labels_pathpath to the labels corresponding to the features
_minibatch_sizesize of the minibatch (-1 for full batch)
dataset_shapeshape of the single sample eg. {C} or {C, H, W}, the N will be stored in the dataset_size variable
_engoneAPI engine

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