R/utils-data-dataloader.R
dataloader.Rd
Data loader. Combines a dataset and a sampler, and provides single- or multi-process iterators over the dataset.
dataloader( dataset, batch_size = 1, shuffle = FALSE, sampler = NULL, batch_sampler = NULL, num_workers = 0, collate_fn = NULL, pin_memory = FALSE, drop_last = FALSE, timeout = -1, worker_init_fn = NULL )
dataset | (Dataset): dataset from which to load the data. |
---|---|
batch_size | (int, optional): how many samples per batch to load
(default: |
shuffle | (bool, optional): set to |
sampler | (Sampler, optional): defines the strategy to draw samples from
the dataset. If specified, |
batch_sampler | (Sampler, optional): like sampler, but returns a batch of
indices at a time. Mutually exclusive with |
num_workers | (int, optional): how many subprocesses to use for data
loading. 0 means that the data will be loaded in the main process.
(default: |
collate_fn | (callable, optional): merges a list of samples to form a mini-batch. |
pin_memory | (bool, optional): If |
drop_last | (bool, optional): set to |
timeout | (numeric, optional): if positive, the timeout value for collecting a batch
from workers. -1 means no timeout. (default: |
worker_init_fn | (callable, optional): If not |