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_DECODE_RESIZE_JPEG_OP_H_ 18 #define MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_DECODE_RESIZE_JPEG_OP_H_ 19 20 #include <memory> 21 #include <string> 22 #include <vector> 23 24 #include "minddata/dataset/core/data_type.h" 25 #include "minddata/dataset/core/device_resource.h" 26 #include "minddata/dataset/core/tensor.h" 27 #include "minddata/dataset/kernels/image/dvpp/acl_adapter.h" 28 #include "minddata/dataset/kernels/image/dvpp/utils/ErrorCode.h" 29 #include "minddata/dataset/kernels/tensor_op.h" 30 #include "minddata/dataset/util/log_adapter.h" 31 #include "minddata/dataset/util/status.h" 32 33 namespace mindspore { 34 namespace dataset { 35 class DvppDecodeResizeJpegOp : public TensorOp { 36 public: DvppDecodeResizeJpegOp(int32_t resized_height,int32_t resized_width)37 DvppDecodeResizeJpegOp(int32_t resized_height, int32_t resized_width) 38 : resized_height_(resized_height), resized_width_(resized_width) {} 39 40 /// \brief Destructor 41 ~DvppDecodeResizeJpegOp() = default; 42 43 Status Compute(const std::shared_ptr<Tensor> &input, std::shared_ptr<Tensor> *output) override; 44 45 Status Compute(const std::shared_ptr<DeviceTensor> &input, std::shared_ptr<DeviceTensor> *output) override; 46 47 Status OutputShape(const std::vector<TensorShape> &inputs, std::vector<TensorShape> &outputs) override; 48 Name()49 std::string Name() const override { return kDvppDecodeResizeJpegOp; } 50 51 Status SetAscendResource(const std::shared_ptr<DeviceResource> &resource) override; 52 53 private: 54 int32_t resized_height_; 55 int32_t resized_width_; 56 std::shared_ptr<void> processor_; 57 }; 58 } // namespace dataset 59 } // namespace mindspore 60 #endif // MINDSPORE_CCSRC_MINDDATA_DATASET_KERNELS_IMAGE_DVPP_DVPP_DECODE_RESIZE_JPEG_OP_H_ 61