Shortcuts

FakeData

class torchvision.datasets.FakeData(size: int = 1000, image_size: Tuple[int, int, int] = (3, 224, 224), num_classes: int = 10, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, random_offset: int = 0)[source]

A fake dataset that returns randomly generated images and returns them as PIL images

Parameters:
  • size (int, optional) – Size of the dataset. Default: 1000 images

  • image_size (tuple, optional) – Size if the returned images. Default: (3, 224, 224)

  • num_classes (int, optional) – Number of classes in the dataset. Default: 10

  • 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.

  • random_offset (int) – Offsets the index-based random seed used to generate each image. Default: 0

Examples using FakeData:

How to use CutMix and MixUp

How to use CutMix and MixUp
Special-members:

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

index (int) – Index

Returns:

(image, target) where target is class_index of the target class.

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