Skip to content

WARNING

该页面尚未翻译。 以下内容为英文原版。

tensorplay.vision.datasets.mnist

Classes

class MNIST [source]

python
MNIST(root=None, train=True, transform=None, target_transform=None, download=False)

Bases: VisionDataset

MNIST <http://yann.lecun.com/exdb/mnist/>_ Dataset.

Args

  • root (string, optional): Root directory of dataset where MNIST/processed/training.pt and MNIST/processed/test.pt exist. If None, uses default cache directory.
  • 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.
Methods

__init__(self, root=None, train=True, transform=None, target_transform=None, download=False) [source]

Initialize self. See help(type(self)) for accurate signature.


download(self) [source]

Download the MNIST data if it doesn't exist in processed_folder already.


extra_repr(self) -> str [source]


基于 Apache 2.0 许可发布。

📚DeepWiki