Rate this Page

Template Class StatefulDataLoader#

Inheritance Relationships#

Base Type#

Class Documentation#

template<typename Dataset>
class StatefulDataLoader : public torch::data::DataLoaderBase<Dataset, Dataset::BatchType::value_type, Dataset::BatchRequestType>#

A dataloader for stateful datasets.

A dataloader for stateful datatasets differs from one for stateless datasets one in that the dataset is shared among worker threads, and that this dataset is itself responsible for producing batches rather than depending on a sampler. The statefulness here actually refers to the dataset. The StatefulDataLoader simply alters the data loading algorithm to accommodate the stateful, shared nature of the dataset. Note that the dataset must be thread safe if more than one worker thread is used.

A stateful dataloader is created by calling make_data_loader with a stateful dataset.

Public Types

using super = DataLoaderBase<Dataset, typename Dataset::BatchType::value_type, typename Dataset::BatchRequestType>#
using BatchRequestType = BatchRequest#

Public Functions

inline StatefulDataLoader(Dataset dataset, DataLoaderOptions options)#

Constructs the StatefulDataLoader from a dataset and some options.