mindspore.dataset.transforms.c_transforms.RandomApply
- class mindspore.dataset.transforms.c_transforms.RandomApply(transforms, prob=0.5)[source]
Randomly perform a series of transforms with a given probability.
- Parameters
- Raises
TypeError – If transforms is not of type list.
ValueError – If transforms is empty.
TypeError – If elements of transforms are neither Python callable objects nor data processing operations in c_transforms.
TypeError – If prob is not of type float.
ValueError – If prob is not in range [0.0, 1.0].
- Supported Platforms:
CPU
Examples
>>> rand_apply = c_transforms.RandomApply([c_vision.RandomCrop(512)]) >>> image_folder_dataset = image_folder_dataset.map(operations=rand_apply)