pulsatrix
Loading...
Searching...
No Matches
pulsatrix::TransformDataset Class Reference

Decorates a Dataset with a Transform, applied to every sample get() returns – lets Transform/Compose compose with any Dataset without modifying it or DataLoader. More...

#include <transform.hpp>

Inheritance diagram for pulsatrix::TransformDataset:
Collaboration diagram for pulsatrix::TransformDataset:

Public Member Functions

 TransformDataset (std::shared_ptr< Dataset > base, std::shared_ptr< Transform > transform)
 
int64_t size () const override
 Number of samples in this dataset.
 
Sample get (int64_t index) const override
 Loads one sample by index.
 
- Public Member Functions inherited from pulsatrix::Dataset
virtual ~Dataset ()=default
 

Detailed Description

Decorates a Dataset with a Transform, applied to every sample get() returns – lets Transform/Compose compose with any Dataset without modifying it or DataLoader.

Constructor & Destructor Documentation

◆ TransformDataset()

pulsatrix::TransformDataset::TransformDataset ( std::shared_ptr< Dataset >  base,
std::shared_ptr< Transform >  transform 
)
inline

Member Function Documentation

◆ get()

Sample pulsatrix::TransformDataset::get ( int64_t  index) const
inlineoverridevirtual

Loads one sample by index.

Parameters
indexSample index, must be in [0, size()).
Returns
The sample at index.
Exceptions
std::out_of_rangeif index is out of bounds – external boundary: the index is chosen by a Sampler/DataLoader from possibly-external configuration (shuffle seed, resumed epoch offset), not a compile-time-known loop bound.

Implements pulsatrix::Dataset.

◆ size()

int64_t pulsatrix::TransformDataset::size ( ) const
inlineoverridevirtual

Number of samples in this dataset.

Implements pulsatrix::Dataset.


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