1 /** 2 * Copyright 2020-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_CORE_OPS_CONV2D_BACKPROP_INPUT_H_ 18 #define MINDSPORE_CORE_OPS_CONV2D_BACKPROP_INPUT_H_ 19 #include <map> 20 #include <memory> 21 #include <string> 22 #include <vector> 23 #include "abstract/ops/op_infer.h" 24 #include "mindapi/base/format.h" 25 #include "mindapi/base/types.h" 26 #include "ops/base_operator.h" 27 28 namespace mindspore { 29 namespace ops { 30 constexpr auto kNameConv2DBackpropInput = "Conv2DBackpropInput"; 31 class MIND_API Conv2DBackpropInput : public BaseOperator { 32 public: 33 MIND_API_BASE_MEMBER(Conv2DBackpropInput); BaseOperator(k_name)34 explicit Conv2DBackpropInput(const std::string &k_name = kNameConv2DBackpropInput) : BaseOperator(k_name) { 35 InitIOName({"out_backprop", "filter", "input_sizes"}, {"output"}); 36 } 37 void Init(int64_t out_channel, const std::vector<int64_t> &kernel_size, int64_t mode = 1, 38 const PadMode &pad_mode = VALID, const std::vector<int64_t> &pad = {0, 0, 0, 0}, 39 const std::vector<int64_t> &stride = {1, 1, 1, 1}, const std::vector<int64_t> &dilation = {1, 1, 1, 1}, 40 int64_t group = 1, const Format &format = NCHW, const std::vector<int64_t> &pad_list = {0, 0, 0, 0}); 41 void set_kernel_size(const std::vector<int64_t> &kernel_size); 42 void set_stride(const std::vector<int64_t> &stride); 43 void set_dilation(const std::vector<int64_t> &dilation); 44 void set_pad_mode(const PadMode &pad_mode); 45 void set_pad(const std::vector<int64_t> &pad); 46 void set_mode(int64_t mode); 47 void set_group(int64_t group); 48 void set_out_channel(int64_t out_channel); 49 void set_format(const Format &format); 50 void set_pad_list(const std::vector<int64_t> &pad_list); 51 std::vector<int64_t> get_kernel_size() const; 52 std::vector<int64_t> get_stride() const; 53 std::vector<int64_t> get_dilation() const; 54 PadMode get_pad_mode() const; 55 std::vector<int64_t> get_pad() const; 56 int64_t get_mode() const; 57 int64_t get_group() const; 58 int64_t get_out_channel() const; 59 Format get_format() const; 60 std::vector<int64_t> get_pad_list() const; 61 }; 62 MIND_API abstract::AbstractBasePtr Conv2DBackpropInputInfer(const abstract::AnalysisEnginePtr &, 63 const PrimitivePtr &primitive, 64 const std::vector<abstract::AbstractBasePtr> &input_args); 65 66 BaseShapePtr Conv2DBackpropInputInferShape(const PrimitivePtr &primitive, 67 const std::vector<AbstractBasePtr> &input_args); 68 TypePtr Conv2DBackpropInputInferType(const PrimitivePtr &prim, const std::vector<AbstractBasePtr> &input_args); 69 } // namespace ops 70 } // namespace mindspore 71 #endif // MINDSPORE_CORE_OPS_CONV2D_BACKPROP_INPUT_H_ 72