Torchvision provides many built-in datasets in the
torchvision.datasets module, as well as utility classes for building your own datasets.
使用方法
All the datasets have almost
similar API. They all havetwo common arguments:transformandtarget_transformto transform the input and target respectively. You can also create your own datasets using the provided base classes.
loader:加载器。把东西加载到神经网络中
从dataset中取数据
在官网中找到dataloader


dataset (Dataset) – dataset from which to load the data.
batch_size (int, optional) – how many samples per batch to load (default: 1).
shuffle (bool, optional) – set to True to have the data reshuffled at every epoch (default: False).
sampler (Sampler or Iterable, optional) – defines the strategy to draw samples from the dataset. Can be any Iterable with __len__ implemented. If specified, shuffle must not be specified.
drop_last (bool, optional) – set to True to drop the last incomplete batch, if the dataset size is not divisible by the batch size. If False and the size of dataset is not divisible by the batch size, then the last batch will be smaller. (default: False)