• 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_CONV2D_BACKPROP_INPUT_FUSION_H_
18 #define MINDSPORE_CORE_OPS_CONV2D_BACKPROP_INPUT_FUSION_H_
19 #include <vector>
20 #include "mindapi/base/types.h"
21 #include "ops/grad/conv2d_backprop_input.h"
22 
23 namespace mindspore {
24 namespace ops {
25 constexpr auto kNameConv2DBackpropInputFusion = "Conv2DBackpropInputFusion";
26 /// \brief Conv2DBackpropInputFusion defined Conv2DBackpropInput operator prototype of lite.
27 class MIND_API Conv2DBackpropInputFusion : public Conv2DBackpropInput {
28  public:
29   MIND_API_BASE_MEMBER(Conv2DBackpropInputFusion);
30   /// \brief Constructor.
Conv2DBackpropInputFusion()31   Conv2DBackpropInputFusion() : Conv2DBackpropInput(kNameConv2DBackpropInputFusion) {}
32 
33   /// \brief Method to init the op's attributes.
34   ///
35   /// \param[in] in_channel Define the number of input channel.
36   /// \param[in] out_channel Define the number of output channel.
37   /// \param[in] kernel_size Define the size of the filter kernel.
38   /// \param[in] mode Define the category of conv, which is useless on lite.
39   /// \param[in] pad_mode Define the padding method.
40   /// \param[in] pad Define the concrete padding value on H and W dimension, which is replaced with pad_list.
41   /// \param[in] stride Define the moving size of the filter kernel.
42   /// \param[in] dilation Define the coefficient of expansion of the filter kernel, which is useful for dilated
43   ///            convolution.
44   /// \param[in] group Define the number of group.
45   /// \param[in] format Define the format of input tensor.
46   /// \param[in] pad_list Define the concrete padding value on H and W dimension.
47   /// \param[in] activation_type Define the activation type.
48   void Init(int64_t in_channel, int64_t out_channel, const std::vector<int64_t> &kernel_size, int64_t mode = 1,
49             const PadMode &pad_mode = VALID, const std::vector<int64_t> &pad = {0, 0, 0, 0},
50             const std::vector<int64_t> &stride = {1, 1, 1, 1}, const std::vector<int64_t> &dilation = {1, 1, 1, 1},
51             int64_t group = 1, const Format &format = NCHW, const std::vector<int64_t> &pad_list = {0, 0, 0, 0},
52             const ActivationType &activation_type = NO_ACTIVATION);
53 
54   /// \brief Method to set in_channel attribute.
55   ///
56   /// \param[in] in_channel Define the number of input channel.
57   void set_in_channel(int64_t in_channel);
58 
59   /// \brief Method to set activation type.
60   ///
61   /// \param[in] activation_type Define the activation type.
62   void set_activation_type(const ActivationType &activation_type);
63 
64   /// \brief Method to get in_channel attribute.
65   ///
66   /// \return the number of input channel.
67   int64_t get_in_channel() const;
68 
69   /// \brief Method to get activation type.
70   ///
71   /// \return activation type.
72   ActivationType get_activation_type() const;
73 };
74 }  // namespace ops
75 }  // namespace mindspore
76 
77 #endif  // MINDSPORE_CORE_OPS_CONV2D_BACKPROP_INPUT_FUSION_H_
78