datasets.MNIST()函数解析

datasets.MNIST(
root,
train=True,
transform=None,
target_transform=None,
download=False,
)
Docstring:
MNIST _ Dataset.

Args:
root (string): Root directory of dataset where MNIST/processed/training.pt
and MNIST/processed/test.pt exist.
train (bool, optional): If True, creates dataset from training.pt,
otherwise from test.pt.
download (bool, optional): If true, downloads the dataset from the internet and
puts it in root directory. If dataset is already downloaded, it is not
downloaded again.
transform (callable, optional): A function/transform that takes in an PIL image
and returns a transformed version. E.g, transforms.RandomCrop
target_transform (callable, optional): A function/transform that takes in the
target and transforms it.
File: c:\users\michael\anaconda3\envs\mpytorch\lib\site-packages\torchvision\datasets\mnist.py
Type: type
Subclasses: FashionMNIST, KMNIST, EMNIST, QMNIST
可以看到 这是lecun mnist数据集对应的一个函数 root,
train=True,
transform=None, 这几个关键参数
root 取数据的地址把
train 设置是读取train数据集 还是test lecun的数据集有4个
transform就是对图像数据进行处理 传入dataloader的transform类型
download 设置 强调是否一定要download

你可能感兴趣的:(pytorch)