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