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