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