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 <vector> 21 #include <string> 22 #include <memory> 23 24 #include "ops/op_utils.h" 25 #include "ops/primitive_c.h" 26 #include "abstract/abstract_value.h" 27 #include "utils/check_convert_utils.h" 28 namespace mindspore { 29 namespace ops { 30 constexpr auto kNameConv2DBackpropInput = "Conv2DBackpropInput"; 31 class MS_CORE_API Conv2DBackpropInput : public PrimitiveC { 32 public: PrimitiveC(k_name)33 explicit Conv2DBackpropInput(const std::string &k_name = kNameConv2DBackpropInput) : PrimitiveC(k_name) { 34 InitIOName({"out_backprop", "filter", "input_sizes"}, {"output"}); 35 } 36 ~Conv2DBackpropInput() = default; 37 MS_DECLARE_PARENT(Conv2DBackpropInput, PrimitiveC); 38 void Init(int64_t out_channel, const std::vector<int64_t> &kernel_size, int64_t mode = 1, 39 const PadMode &pad_mode = VALID, const std::vector<int64_t> &pad = {0, 0, 0, 0}, 40 const std::vector<int64_t> &stride = {1, 1, 1, 1}, const std::vector<int64_t> &dilation = {1, 1, 1, 1}, 41 int64_t group = 1, const Format &format = NCHW, const std::vector<int64_t> &pad_list = {0, 0, 0, 0}); 42 void set_kernel_size(const std::vector<int64_t> &kernel_size); 43 void set_stride(const std::vector<int64_t> &stride); 44 void set_dilation(const std::vector<int64_t> &dilation); 45 void set_pad_mode(const PadMode &pad_mode); 46 void set_pad(const std::vector<int64_t> &pad); 47 void set_mode(int64_t mode); 48 void set_group(int64_t group); 49 void set_out_channel(int64_t out_channel); 50 void set_format(const Format &format); 51 void set_pad_list(const std::vector<int64_t> &pad_list); 52 std::vector<int64_t> get_kernel_size() const; 53 std::vector<int64_t> get_stride() const; 54 std::vector<int64_t> get_dilation() const; 55 PadMode get_pad_mode() const; 56 std::vector<int64_t> get_pad() const; 57 int64_t get_mode() const; 58 int64_t get_group() const; 59 int64_t get_out_channel() const; 60 Format get_format() const; 61 std::vector<int64_t> get_pad_list() const; 62 }; 63 AbstractBasePtr Conv2DBackpropInputInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive, 64 const std::vector<AbstractBasePtr> &input_args); 65 using PrimConv2DBackpropInputPtr = std::shared_ptr<Conv2DBackpropInput>; 66 } // namespace ops 67 } // namespace mindspore 68 #endif // MINDSPORE_CORE_OPS_CONV2D_BACKPROP_INPUT_H_ 69