• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_GROUP_CONV2D_GRAD_INPUT_H_
18 #define MINDSPORE_CORE_OPS_GROUP_CONV2D_GRAD_INPUT_H_
19 #include <vector>
20 #include <memory>
21 
22 #include "ops/primitive_c.h"
23 #include "abstract/abstract_value.h"
24 #include "utils/check_convert_utils.h"
25 
26 namespace mindspore {
27 namespace ops {
28 constexpr auto kNameGroupConv2DGradInput = "GroupConv2DGradInput";
29 class MS_CORE_API GroupConv2DGradInput : public PrimitiveC {
30  public:
GroupConv2DGradInput()31   GroupConv2DGradInput() : PrimitiveC(kNameGroupConv2DGradInput) {}
32   ~GroupConv2DGradInput() = default;
33   MS_DECLARE_PARENT(GroupConv2DGradInput, PrimitiveC);
34   void Init(const int64_t &in_channel, const int64_t &out_channel, const std::vector<int64_t> &kernel_size,
35             const PadMode &pad_mode, const std::vector<int64_t> &pad_list, const std::vector<int64_t> &stride,
36             const std::vector<int64_t> &dilation, const int64_t &group, const std::vector<int64_t> &input_shape,
37             const Format &format = NCHW, const ActivationType &activation_type = NO_ACTIVATION,
38             const bool has_bias = false);
39   void set_in_channel(const int64_t &in_channel);
40   void set_out_channel(const int64_t &out_channel);
41   void set_kernel_size(const std::vector<int64_t> &kernel_size);
42   void set_pad_mode(const PadMode &pad_mode);
43   void set_pad_list(const std::vector<int64_t> &pad_list);
44   void set_stride(const std::vector<int64_t> &stride);
45   void set_dilation(const std::vector<int64_t> &dilation);
46   void set_group(const int64_t &group);
47   void set_input_shape(const std::vector<int64_t> &input_shape);
48   void set_format(const Format &format);
49   void set_activation_type(const ActivationType &activation_type);
50   void set_has_bias(const bool has_bias);
51   //  kernel_size(h, w)
52   //  stride(h, w)
53   //  pad_list(up, down, left, right)
54 
55   int64_t get_in_channel() const;
56   int64_t get_out_channel() const;
57   std::vector<int64_t> get_kernel_size() const;
58   PadMode get_pad_mode() const;
59   std::vector<int64_t> get_pad_list() const;
60   std::vector<int64_t> get_stride() const;
61   std::vector<int64_t> get_dilation() const;
62   int64_t get_group() const;
63   std::vector<int64_t> get_input_shape() const;
64   Format get_format() const;
65   ActivationType get_activation_type() const;
66   bool get_has_bias() const;
67 };
68 AbstractBasePtr GroupConv2DGradInputInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive,
69                                           const std::vector<AbstractBasePtr> &input_args);
70 using PrimGroupConv2DGradInputPtr = std::shared_ptr<GroupConv2DGradInput>;
71 }  // namespace ops
72 }  // namespace mindspore
73 
74 #endif  // MINDSPORE_CORE_OPS_GROUP_CONV2D_GRAD_INPUT_H_
75