Class RandomChoice
Defined in File transforms.h
Inheritance Relationships
Base Type
public mindspore::dataset::TensorTransform
(Class TensorTransform)
Class Documentation
-
class RandomChoice : public mindspore::dataset::TensorTransform
Randomly select one transform from a list of transforms to perform on the input tensor.
Public Functions
-
explicit RandomChoice(const std::vector<TensorTransform*> &transforms)
Constructor.
- 参数
transforms – [in] A vector of raw pointers to TensorTransform objects to be applied.
样例/* Define operations */ auto resize_op(new vision::Resize({30, 30})); auto center_crop_op(new vision::CenterCrop({16, 16})); auto random_op(new transforms::RandomChoice({resize_op, center_crop_op})); /* dataset is an instance of Dataset object */ dataset = dataset->Map({random_op}, // operations {"image"}); // input columns
Constructor.
- 参数
transforms – [in] A vector of shared pointers to TensorTransform objects to be applied.
样例/* Define operations */ std::shared_ptr<TensorTransform> resize_op(new vision::Resize({30, 30})); std::shared_ptr<TensorTransform> center_crop_op(new vision::CenterCrop({16, 16})); std::shared_ptr<TensorTransform> random_op(new transforms::RandomChoice({resize_op, center_crop_op})); /* dataset is an instance of Dataset object */ dataset = dataset->Map({random_op}, // operations {"image"}); // input columns
-
explicit RandomChoice(const std::vector<std::reference_wrapper<TensorTransform>> &transforms)
Constructor.
- 参数
transforms – [in] A vector of TensorTransform objects to be applied.
样例/* Define operations */ vision::Resize resize_op = vision::Resize({30, 30}); vision::CenterCrop center_crop_op = vision::CenterCrop({16, 16}); transforms::RandomChoice random_op = transforms::RandomChoice({resize_op, center_crop_op}); /* dataset is an instance of Dataset object */ dataset = dataset->Map({random_op}, // operations {"image"}); // input columns
-
~RandomChoice() = default
Destructor.
-
explicit RandomChoice(const std::vector<TensorTransform*> &transforms)