RandomApply
- class torchvision.transforms.RandomApply(transforms, p=0.5)[source]
Apply randomly a list of transformations with a given probability.
Apply randomly a list of transformations with a given probability.
>>> transforms = transforms.RandomApply(torch.nn.ModuleList([
>>> transforms.ColorJitter(),
>>> ]), p=0.3)
>>> scripted_transforms = torch.jit.script(transforms)
Make sure to use only scriptable transformations, i.e. that work with torch.Tensor, does not require
lambda functions or PIL.Image.
transforms (sequence or torch.nn.Module) – list of transformations
p (float) – probability
Examples using RandomApply:
Define the computation performed at every call.
Should be overridden by all subclasses.