1 /** 2 * Copyright 2021 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_IMAGE_DVPP_DVPP_NORMALIZE_JPEG_OP_H 18 #define MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_NORMALIZE_JPEG_OP_H 19 20 #include <memory> 21 #include <string> 22 #include <utility> 23 #include <vector> 24 #include "minddata/dataset/core/device_tensor.h" 25 #include "minddata/dataset/core/device_resource.h" 26 #include "minddata/dataset/kernels/tensor_op.h" 27 #include "minddata/dataset/util/status.h" 28 #include "mindspore/core/utils/log_adapter.h" 29 30 namespace mindspore { 31 namespace dataset { 32 class DvppNormalizeOp : public TensorOp { 33 public: DvppNormalizeOp(std::vector<float> mean,std::vector<float> std)34 explicit DvppNormalizeOp(std::vector<float> mean, std::vector<float> std) 35 : mean_(std::move(mean)), std_(std::move(std)) {} 36 37 ~DvppNormalizeOp() = default; 38 39 Status Compute(const std::shared_ptr<DeviceTensor> &input, std::shared_ptr<DeviceTensor> *output) override; 40 Name()41 std::string Name() const override { return kDvppNormalizeOp; } 42 43 Status SetAscendResource(const std::shared_ptr<DeviceResource> &resource) override; 44 45 private: 46 std::vector<float> mean_; 47 std::vector<float> std_; 48 }; 49 50 } // namespace dataset 51 } // namespace mindspore 52 53 #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_NORMALIZE_JPEG_OP_H 54