Deep Learning Algorithm Implementations 1.0.0
C++ implementations of fundamental deep learning algorithms
Loading...
Searching...
No Matches
dl::utils::DataLoader< T > Class Template Reference

#include <data_loader.hpp>

Public Member Functions

 DataLoader (const Dataset< T > &dataset, size_t batch_size, bool shuffle=false)
 Constructor for data loader.
 
bool has_next () const
 Check if more batches are available in current epoch.
 
std::pair< MatrixD, MatrixDnext_batch ()
 Get the next batch of data.
 
void reset ()
 Reset iterator to start of dataset.
 

Detailed Description

template<typename T>
class dl::utils::DataLoader< T >

Definition at line 129 of file data_loader.hpp.

Constructor & Destructor Documentation

◆ DataLoader()

template<typename T >
dl::utils::DataLoader< T >::DataLoader ( const Dataset< T > &  dataset,
size_t  batch_size,
bool  shuffle = false 
)

Constructor for data loader.

Parameters
datasetReference to the dataset to iterate over
batch_sizeNumber of samples per batch
shuffleWhether to shuffle data at the start of each epoch

Definition at line 59 of file data_loader.cpp.

Member Function Documentation

◆ has_next()

template<typename T >
bool dl::utils::DataLoader< T >::has_next ( ) const

Check if more batches are available in current epoch.

Returns
True if more batches exist, false otherwise
Examples
/home/runner/work/deep-learning-algo-impls/deep-learning-algo-impls/include/utils/data_loader.hpp.

Definition at line 65 of file data_loader.cpp.

◆ next_batch()

template<typename T >
std::pair< MatrixD, MatrixD > dl::utils::DataLoader< T >::next_batch ( )

Get the next batch of data.

Returns
Pair of (features, labels) matrices for the next batch
Note
Advances the internal iterator. Call has_next() first to check availability
Examples
/home/runner/work/deep-learning-algo-impls/deep-learning-algo-impls/include/utils/data_loader.hpp.

Definition at line 71 of file data_loader.cpp.

◆ reset()

template<typename T >
void dl::utils::DataLoader< T >::reset ( )

Reset iterator to start of dataset.

Note
If shuffle is enabled, reshuffles the dataset
Examples
/home/runner/work/deep-learning-algo-impls/deep-learning-algo-impls/include/utils/data_loader.hpp.

Definition at line 84 of file data_loader.cpp.


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