1 /** 2 * Copyright 2021-2023 Huawei Technologies Co., Ltd 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_COLOR_IR_H_ 18 #define MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_COLOR_IR_H_ 19 20 #include <map> 21 #include <memory> 22 #include <string> 23 24 #include "include/api/status.h" 25 #include "minddata/dataset/include/dataset/constants.h" 26 #include "minddata/dataset/include/dataset/transforms.h" 27 #include "minddata/dataset/kernels/ir/tensor_operation.h" 28 29 namespace mindspore { 30 namespace dataset { 31 namespace vision { 32 constexpr char kRandomColorOperation[] = "RandomColor"; 33 34 class RandomColorOperation : public TensorOperation { 35 public: 36 RandomColorOperation(float t_lb, float t_ub); 37 38 ~RandomColorOperation() override; 39 40 std::shared_ptr<TensorOp> Build() override; 41 42 Status ValidateParams() override; 43 44 std::string Name() const override; 45 46 Status to_json(nlohmann::json *out_json) override; 47 48 static Status from_json(nlohmann::json op_params, std::shared_ptr<TensorOperation> *operation); 49 50 private: 51 float t_lb_; 52 float t_ub_; 53 }; 54 } // namespace vision 55 } // namespace dataset 56 } // namespace mindspore 57 #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IR_VISION_RANDOM_COLOR_IR_H_ 58