LCOV - code coverage report
Current view: top level - nntrainer/layers - preprocess_l2norm_layer.h (source / functions) Coverage Total Hit
Test: coverage_filtered.info Lines: 71.4 % 7 5
Test Date: 2025-12-14 20:38:17 Functions: 60.0 % 5 3

            Line data    Source code
       1              : 
       2              : // SPDX-License-Identifier: Apache-2.0
       3              : /**
       4              :  * Copyright (C) 2020 Jihoon Lee <jhoon.it.lee@samsung.com>
       5              :  *
       6              :  * @file   preprocess_l2norm_layer.h
       7              :  * @date   09 Jan 2021
       8              :  * @brief  This file contains the simple l2norm layer which normalizes
       9              :  * the given feature
      10              :  * @see    https://github.com/nnstreamer/nntrainer
      11              :  * @author Jihoon Lee <jhoon.it.lee@samsung.com>
      12              :  * @bug    No known bugs except for NYI items
      13              :  *
      14              :  */
      15              : 
      16              : #ifndef __PREPROCESS_L2NORM_LAYER_H__
      17              : #define __PREPROCESS_L2NORM_LAYER_H__
      18              : #include <string>
      19              : 
      20              : #include <layer_devel.h>
      21              : 
      22              : namespace nntrainer {
      23              : 
      24              : /**
      25              :  * @brief Layer class that l2normalizes a feature vector
      26              :  *
      27              :  */
      28              : class PreprocessL2NormLayer : public Layer {
      29              : public:
      30              :   /**
      31              :    * @brief Construct a new L2norm Layer object
      32              :    * that normalizes given feature with l2norm
      33              :    */
      34            5 :   PreprocessL2NormLayer() : Layer(), l2norm_props(props::Epsilon()) {}
      35              : 
      36              :   /**
      37              :    *  @brief  Move constructor.
      38              :    *  @param[in] PreprocessL2NormLayer &&
      39              :    */
      40              :   PreprocessL2NormLayer(PreprocessL2NormLayer &&rhs) noexcept = default;
      41              : 
      42              :   /**
      43              :    * @brief  Move assignment operator.
      44              :    * @parma[in] rhs PreprocessL2NormLayer to be moved.
      45              :    */
      46              :   PreprocessL2NormLayer &operator=(PreprocessL2NormLayer &&rhs) = default;
      47              : 
      48              :   /**
      49              :    * @brief Destroy the Centering Layer object
      50              :    *
      51              :    */
      52           10 :   ~PreprocessL2NormLayer() {}
      53              : 
      54              :   /**
      55              :    * @copydoc Layer::finalize(InitLayerContext &context)
      56              :    */
      57              :   void finalize(InitLayerContext &context) override;
      58              : 
      59              :   /**
      60              :    * @copydoc Layer::forwarding(RunLayerContext &context, bool training)
      61              :    */
      62              :   void forwarding(RunLayerContext &context, bool training) override;
      63              : 
      64              :   /**
      65              :    * @copydoc Layer::calcDerivative(RunLayerContext &context)
      66              :    */
      67              :   void calcDerivative(RunLayerContext &context) override;
      68              : 
      69              :   /**
      70              :    * @copydoc bool supportBackwarding() const
      71              :    */
      72            1 :   bool supportBackwarding() const override { return false; };
      73              : 
      74              :   /**
      75              :    * @copydoc Layer::exportTo(Exporter &exporter, ml::train::ExportMethods
      76              :    * method)
      77              :    */
      78            0 :   void exportTo(Exporter &exporter,
      79            0 :                 const ml::train::ExportMethods &method) const override {}
      80              : 
      81              :   /**
      82              :    * @copydoc Layer::getType()
      83              :    */
      84           25 :   const std::string getType() const override {
      85           25 :     return PreprocessL2NormLayer::type;
      86              :   };
      87              : 
      88              :   /**
      89              :    * @copydoc Layer::setProperty(const std::vector<std::string> &values)
      90              :    */
      91              :   void setProperty(const std::vector<std::string> &values) override;
      92              : 
      93              :   static constexpr const char *type = "preprocess_l2norm";
      94              : 
      95              : private:
      96              :   std::tuple<props::Epsilon> l2norm_props;
      97              : };
      98              : } // namespace nntrainer
      99              : 
     100              : #endif // __PREPROCESS_L2NORM_LAYER_H__
        

Generated by: LCOV version 2.0-1