class torch.utils.data.DataLoader(dataset, batch_size=1, shuffle=False, sampler=None, num_workers=0, collate_fn=<function default_collate>, pin_memory=False, drop_last=False)
Data loader, a sampler and a combined data set, and to provide a single process or processes on the data set iterator
parameter:
- DataSet ( a Dataset ) - loading the data set of data.
- batch_size ( int , optional) - how many samples of each batch loaded (default: 1).
- shuffle ( BOOL , optional) - set
True
when re-disrupted data (default: False) in each epoch. - Sampler ( Sampler , optional) - defined strategy focused on samples extracted from the data. If you specify is ignored
shuffle
parameters. - num_workers ( int , optional) - To load data with the number of child processes. 0 indicates that the data will be loaded into the main process (default: 0)
- collate_fn (callable, optional) –
- pin_memory (bool, optional) –
- drop_last ( BOOL , optional) - If the data set size can not be divisible batch size is set to True to delete the last after an incomplete batch. If set to False and the size of the data set can not be divisible batch size, the last batch will be smaller. (Default: False)
class torch.utils.data.sampler.Sampler(data_source)
The base class for all samplers, each of the sampler subclass must provide a __iter__
method, a method of indexing an iterative set of data elements, and the length of the returned iterator __len__
method.