• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_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 
25 #include "minddata/dataset/core/device_resource.h"
26 #include "minddata/dataset/core/device_tensor.h"
27 #include "minddata/dataset/kernels/tensor_op.h"
28 #include "minddata/dataset/util/log_adapter.h"
29 #include "minddata/dataset/util/status.h"
30 
31 namespace mindspore {
32 namespace dataset {
33 class DvppNormalizeOp : public TensorOp {
34  public:
DvppNormalizeOp(std::vector<float> mean,std::vector<float> std)35   DvppNormalizeOp(std::vector<float> mean, std::vector<float> std) : 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 }  // namespace dataset
50 }  // namespace mindspore
51 #endif  // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_NORMALIZE_JPEG_OP_H_
52