Shortcuts

LSUN

class torchvision.datasets.LSUN(root: Union[str, Path], classes: Union[str, List[str]] = 'train', transform: Optional[Callable] = None, target_transform: Optional[Callable] = None)[source]

LSUN dataset.

You will need to install the lmdb package to use this dataset: run pip install lmdb

Parameters:
  • root (str or pathlib.Path) – Root directory for the database files.

  • classes (string or list) – One of {‘train’, ‘val’, ‘test’} or a list of categories to load. e,g. [‘bedroom_train’, ‘church_outdoor_train’].

  • transform (callable, optional) – A function/transform that takes in a 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.

Special-members:

__getitem__(index: int) Tuple[Any, Any][source]
Parameters:

index (int) – Index

Returns:

Tuple (image, target) where target is the index of the target category.

Return type:

tuple

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources