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_ADDER_FUSION_H_ 18 #define MINDSPORE_CORE_OPS_ADDER_FUSION_H_ 19 20 #include <map> 21 #include <vector> 22 #include <string> 23 #include <memory> 24 #include "ops/adder.h" 25 #include "abstract/abstract_value.h" 26 #include "utils/check_convert_utils.h" 27 28 namespace mindspore { 29 namespace ops { 30 constexpr auto kNameAdderFusion = "AdderFusion"; 31 /// \brief AdderFusion defined Adder operator prototype of lite. 32 class MS_CORE_API AdderFusion : public Adder { 33 public: 34 /// \brief Constructor. AdderFusion()35 AdderFusion() : Adder(kNameAdderFusion) {} 36 37 /// \brief Destructor. 38 ~AdderFusion() = default; 39 40 MS_DECLARE_PARENT(AdderFusion, Adder); 41 42 /// \brief Method to init the op's attributes. 43 /// 44 /// \param[in] in_channel Define the number of input channel. 45 /// \param[in] out_channel Define the number of output channel. 46 /// \param[in] kernel_size Define the size of the filter kernel. 47 /// \param[in] pad_mode Define the padding method. 48 /// \param[in] stride Define the moving size of the filter kernel. 49 /// \param[in] pad_list Define the concrete padding value on H and W dimension. 50 /// \param[in] dilation Define the coefficient of expansion of the filter kernel. 51 /// \param[in] group Define the number of group. 52 /// \param[in] format Define the format of input tensor. 53 /// \param[in] activation_type Define the activation type. 54 void Init(const int64_t in_channel, const int64_t out_channel, const std::vector<int64_t> &kernel_size, 55 const PadMode &pad_mode, const std::vector<int64_t> &stride, const std::vector<int64_t> &pad_list, 56 const std::vector<int64_t> &dilation, const int64_t group, const Format &format, 57 const ActivationType activation_type); 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 activation type. 65 /// 66 /// \return activation type. 67 ActivationType get_activation_type() const; 68 }; 69 } // namespace ops 70 } // namespace mindspore 71 72 #endif // MINDSPORE_CORE_OPS_ADDER_FUSION_H_ 73