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

            Line data    Source code
       1              : // SPDX-License-Identifier: Apache-2.0
       2              : /**
       3              :  * Copyright (C) 2020 Jihoon Lee <jhoon.it.lee@samsung.com>
       4              :  *
       5              :  * @file   activation_layer.h
       6              :  * @date   17 June 2020
       7              :  * @see    https://github.com/nnstreamer/nntrainer
       8              :  * @author Jihoon Lee <jhoon.it.lee@samsung.com>
       9              :  * @bug    No known bugs except for NYI items
      10              :  * @brief  This is Activation Layer Class for Neural Network
      11              :  *
      12              :  */
      13              : 
      14              : #ifndef __ACTIVATION_LAYER_H__
      15              : #define __ACTIVATION_LAYER_H__
      16              : #ifdef __cplusplus
      17              : 
      18              : #include <memory>
      19              : 
      20              : #include <acti_func.h>
      21              : #include <layer_devel.h>
      22              : 
      23              : namespace nntrainer {
      24              : 
      25              : /**
      26              :  * @class   Activation Layer
      27              :  * @brief   Activation Layer
      28              :  */
      29              : class ActivationLayer : public Layer {
      30              : 
      31              : public:
      32              :   /**
      33              :    * @brief     Constructor of Activation Layer
      34              :    */
      35              :   ActivationLayer();
      36              : 
      37              :   /**
      38              :    * @brief     Destructor of Activation Layer
      39              :    */
      40         1516 :   ~ActivationLayer() = default;
      41              : 
      42              :   /**
      43              :    * @copydoc Layer::finalize(InitLayerContext &context)
      44              :    */
      45              :   void finalize(InitLayerContext &context) override;
      46              : 
      47              :   /**
      48              :    * @copydoc Layer::forwarding(RunLayerContext &context, bool training)
      49              :    */
      50              :   void forwarding(RunLayerContext &context, bool training) override;
      51              : 
      52              :   /**
      53              :    * @copydoc Layer::calcDerivative(RunLayerContext &context)
      54              :    */
      55              :   void calcDerivative(RunLayerContext &context) override;
      56              : 
      57              :   /**
      58              :    * @copydoc bool supportBackwarding() const
      59              :    */
      60          706 :   bool supportBackwarding() const override { return true; };
      61              : 
      62              :   /**
      63              :    * @copydoc Layer::exportTo(Exporter &exporter, ml::train::ExportMethods
      64              :    * method)
      65              :    */
      66              :   void exportTo(Exporter &exporter,
      67              :                 const ml::train::ExportMethods &method) const override;
      68              : 
      69              :   /**
      70              :    * @copydoc Layer::getType()
      71              :    */
      72        13273 :   const std::string getType() const override { return ActivationLayer::type; };
      73              : 
      74              :   /**
      75              :    * @copydoc Layer::setProperty(const std::vector<std::string> &values)
      76              :    */
      77              :   void setProperty(const std::vector<std::string> &values) override;
      78              : 
      79              :   /**
      80              :    * @copydoc Layer::supportInPlace()
      81              :    */
      82          840 :   bool supportInPlace() const override { return acti_func.supportInPlace(); }
      83              : 
      84              :   static constexpr const char *type = "activation";
      85              : 
      86              : private:
      87              :   using PropTypes = std::tuple<props::Activation>;
      88              : 
      89              :   std::unique_ptr<PropTypes> activation_props; /**< activation props */
      90              : 
      91              :   ActiFunc acti_func; /**< activation function from activation type */
      92              : };
      93              : 
      94              : } // namespace nntrainer
      95              : 
      96              : #endif /* __cplusplus */
      97              : #endif /* __ACTIVATION_LAYER_H__ */
        

Generated by: LCOV version 2.0-1