• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 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_ADDER_H_
18 #define MINDSPORE_CORE_OPS_ADDER_H_
19 
20 #include <map>
21 #include <memory>
22 #include <string>
23 #include <vector>
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 kNameAdder = "Adder";
31 /// \brief All defined All operator prototype of lite.
32 class MIND_API Adder : public BaseOperator {
33  public:
34   MIND_API_BASE_MEMBER(Adder);
35   /// \brief Constructor.
BaseOperator(k_name)36   explicit Adder(const std::string &k_name = kNameAdder) : BaseOperator(k_name) {}
37 
38   /// \brief Method to init the op's attributes.
39   ///
40   /// \param[in] in_channel Define the input channel.
41   /// \param[in] out_channel Define the output channel.
42   /// \param[in] kernel_size Define the kernel size.
43   /// \param[in] pad_mode Define the pad mode.
44   /// \param[in] stride Define the stride.
45   /// \param[in] pad_list Define the pad list.
46   /// \param[in] dilation Define the dilation.
47   /// \param[in] group Define the group.
48   /// \param[in] format Define the format.
49   void Init(const int64_t in_channel, const int64_t out_channel, const std::vector<int64_t> &kernel_size,
50             const PadMode &pad_mode, const std::vector<int64_t> &stride, const std::vector<int64_t> &pad_list,
51             const std::vector<int64_t> &dilation, const int64_t group, const Format &format);
52 
53   /// \brief Method to set in_channel attributes.
54   ///
55   /// \param[in] in_channel Define the input channel.
56   void set_in_channel(const int64_t in_channel);
57 
58   /// \brief Method to set out_channel attributes.
59   ///
60   /// \param[in] out_channel Define the output channel.
61   void set_out_channel(const int64_t out_channel);
62 
63   /// \brief Method to set kernel_size attributes.
64   ///
65   /// \param[in] kernel_size Define the kernel size.
66   void set_kernel_size(const std::vector<int64_t> &kernel_size);
67 
68   /// \brief Method to set pad_mode attributes.
69   ///
70   /// \param[in] pad_mode Define the pad mode.
71   void set_pad_mode(const PadMode &pad_mode);
72 
73   /// \brief Method to set stride attributes.
74   ///
75   /// \param[in] stride Define the stride.
76   void set_stride(const std::vector<int64_t> &stride);
77 
78   /// \brief Method to set pad_list attributes.
79   ///
80   /// \param[in] pad_list Define the pad list.
81   void set_pad_list(const std::vector<int64_t> &pad_list);
82 
83   /// \brief Method to set dilation attributes.
84   ///
85   /// \param[in] dilation Define the dilation.
86   void set_dilation(const std::vector<int64_t> &dilation);
87 
88   /// \brief Method to set group attributes.
89   ///
90   /// \param[in] group Define the group.
91   void set_group(const int64_t group);
92 
93   /// \brief Method to set format attributes.
94   ///
95   /// \param[in] format Define the format.
96   void set_format(const Format &format);
97 
98   /// \brief Method to get in_channel attributes.
99   ///
100   /// \return in_channel attributes.
101   int64_t get_in_channel() const;
102 
103   /// \brief Method to get out_channel attributes.
104   ///
105   /// \return out_channel attributes.
106   int64_t get_out_channel() const;
107 
108   /// \brief Method to get kernel_size attributes.
109   ///
110   /// \return kernel_size attributes.
111   std::vector<int64_t> get_kernel_size() const;
112 
113   /// \brief Method to get pad_mode attributes.
114   ///
115   /// \return pad_mode attributes.
116   PadMode get_pad_mode() const;
117 
118   /// \brief Method to get stride attributes.
119   ///
120   /// \return stride attributes.
121   std::vector<int64_t> get_stride() const;
122 
123   /// \brief Method to get pad_list attributes.
124   ///
125   /// \return pad_list attributes.
126   std::vector<int64_t> get_pad_list() const;
127 
128   /// \brief Method to get dilation attributes.
129   ///
130   /// \return dilation attributes.
131   std::vector<int64_t> get_dilation() const;
132 
133   /// \brief Method to get group attributes.
134   ///
135   /// \return group attributes.
136   int64_t get_group() const;
137 
138   /// \brief Method to get format attributes.
139   ///
140   /// \return format attributes.
141   Format get_format() const;
142 };
143 }  // namespace ops
144 }  // namespace mindspore
145 
146 #endif  // MINDSPORE_CORE_OPS_ADDER_H_
147