mindspore.dataset.transforms.c_transforms.RandomChoice
- class mindspore.dataset.transforms.c_transforms.RandomChoice(transforms)[source]
Randomly select one transform from a list of transforms to perform operation.
- Parameters
transforms (list) – List of transformations to be chosen from to apply.
- 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.
- Supported Platforms:
CPU
Examples
>>> rand_choice = c_transforms.RandomChoice([c_vision.CenterCrop(50), c_vision.RandomCrop(512)]) >>> image_folder_dataset = image_folder_dataset.map(operations=rand_choice)