1 /** 2 * Copyright 2020-2022 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_LRN_H_ 18 #define MINDSPORE_CORE_OPS_LRN_H_ 19 #include <map> 20 #include <memory> 21 #include <string> 22 #include <vector> 23 #include "mindapi/base/types.h" 24 #include "ops/base_operator.h" 25 26 namespace mindspore { 27 namespace ops { 28 // An unique id for MS Lite. 29 constexpr auto kNameLRN = "LRN"; 30 /// \brief Local Response Normalization. Refer to Python API @ref mindspore.ops.LRN for more details. 31 class MIND_API LRN : public BaseOperator { 32 public: 33 MIND_API_BASE_MEMBER(LRN); 34 /// \brief Constructor. LRN()35 LRN() : BaseOperator(kNameLRN) { InitIOName({"x"}, {"y"}); } 36 /// \brief Init. Refer to the parameters of Python API @ref mindspore.ops.LRN for the inputs. 37 void Init(const int64_t depth_radius = 5, const float bias = 1.0, const float alpha = 1.0, const float beta = 0.5, 38 const std::string &norm_region = "ACROSS_CHANNELS"); 39 /// \brief Set depth_radius. 40 void set_depth_radius(const int64_t depth_radius); 41 /// \brief Set bias. 42 void set_bias(const float bias); 43 /// \brief Set alpha. 44 void set_alpha(const float alpha); 45 /// \brief Set beta. 46 void set_beta(const float beta); 47 /// \brief Set norm_region. 48 void set_norm_region(const std::string &norm_region); 49 /// \brief Get depth_radius. 50 /// 51 /// \return depth_radius. 52 int64_t get_depth_radius() const; 53 /// \brief Get bias. 54 /// 55 /// \return bias. 56 float get_bias() const; 57 /// \brief Get alpha. 58 /// 59 /// \return alpha. 60 float get_alpha() const; 61 /// \brief Get beta. 62 /// 63 /// \return beta. 64 float get_beta() const; 65 /// \brief Get norm_region. 66 /// 67 /// \return norm_region. 68 std::string get_norm_region() const; 69 }; 70 MIND_API abstract::AbstractBasePtr LrnInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive, 71 const std::vector<abstract::AbstractBasePtr> &input_args); 72 } // namespace ops 73 } // namespace mindspore 74 #endif // MINDSPORE_CORE_OPS_LRN_H_ 75