3 #include <torch/data/dataloader/base.h> 24 template <
typename Dataset>
27 typename Dataset::BatchType::value_type,
28 typename Dataset::BatchRequestType> {
32 typename Dataset::BatchType::value_type,
33 typename Dataset::BatchRequestType>;
34 using typename super::BatchRequestType;
40 torch::make_unique<Dataset>(
std::move(dataset))) {
41 for (
size_t w = 0; w < this->
options_.workers; ++w) {
51 void reset()
override {
const FullDataLoaderOptions & options() const noexcept
Returns the options with which the DataLoader was configured.
const FullDataLoaderOptions options_
The options the DataLoader was configured with.
Options to configure a DataLoader.
virtual void reset()
Resets the internal state of the DataLoader, optionally pre-fetching new jobs.
std::vector< std::thread > workers_
The worker threads, running the worker_thread() method.
StatefulDataLoader(Dataset dataset, DataLoaderOptions options)
Constructs the StatefulDataLoader from a dataset and some options.
std::unique_ptr< Dataset > main_thread_dataset_
The dataset for the main thread, only has a value if the number of worker threads was configured as z...
A dataloader for stateful datasets.
void worker_thread(Dataset &dataset)
The function that worker threads run.