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

            Line data    Source code
       1              : // SPDX-License-Identifier: Apache-2.0
       2              : /**
       3              :  * Copyright (C) 2020 Parichay Kapoor <pk.kapoor@samsung.com>
       4              :  *
       5              :  * @file   addition_layer.h
       6              :  * @date   30 July 2020
       7              :  * @see    https://github.com/nnstreamer/nntrainer
       8              :  * @author Parichay Kapoor <pk.kapoor@samsung.com>
       9              :  * @bug    No known bugs except for NYI items
      10              :  * @brief  This is Addition Layer Class for Neural Network
      11              :  *
      12              :  */
      13              : 
      14              : #ifndef __ADDITION_LAYER_H__
      15              : #define __ADDITION_LAYER_H__
      16              : #ifdef __cplusplus
      17              : 
      18              : #include <common_properties.h>
      19              : #include <layer_devel.h>
      20              : 
      21              : namespace nntrainer {
      22              : 
      23              : /**
      24              :  * @class   Addition Layer
      25              :  * @brief   Addition Layer
      26              :  */
      27              : class AdditionLayer : public Layer {
      28              : public:
      29              :   /**
      30              :    * @brief     Constructor of Addition Layer
      31              :    */
      32          239 :   AdditionLayer() : Layer(), add_props(props::Print()) {}
      33              : 
      34              :   /**
      35              :    * @brief     Destructor of Addition Layer
      36              :    */
      37          478 :   ~AdditionLayer(){};
      38              : 
      39              :   /**
      40              :    *  @brief  Move constructor of AdditionLayer.
      41              :    *  @param[in] AdditionLayer &&
      42              :    */
      43              :   AdditionLayer(AdditionLayer &&rhs) noexcept = default;
      44              : 
      45              :   /**
      46              :    * @brief  Move assignment operator.
      47              :    * @parma[in] rhs AdditionLayer to be moved.
      48              :    */
      49              :   AdditionLayer &operator=(AdditionLayer &&rhs) = default;
      50              : 
      51              :   /**
      52              :    * @copydoc Layer::finalize(InitLayerContext &context)
      53              :    */
      54              :   void finalize(InitLayerContext &context) override;
      55              : 
      56              :   /**
      57              :    * @copydoc Layer::forwarding(RunLayerContext &context, bool training)
      58              :    */
      59              :   void forwarding(RunLayerContext &context, bool training) override;
      60              : 
      61              :   /**
      62              :    * @copydoc Layer::incremental_forwarding(RunLayerContext &context, unsigned
      63              :    * int from, unsigned int to, bool training)
      64              :    */
      65              :   void incremental_forwarding(RunLayerContext &context, unsigned int from,
      66              :                               unsigned int to, bool training) override;
      67              : 
      68              :   /**
      69              :    * @copydoc Layer::calcDerivative(RunLayerContext &context)
      70              :    */
      71              :   void calcDerivative(RunLayerContext &context) override;
      72              : 
      73              :   /**
      74              :    * @copydoc bool supportBackwarding() const
      75              :    */
      76          458 :   bool supportBackwarding() const override { return true; };
      77              : 
      78              :   /**
      79              :    * @copydoc Layer::exportTo(Exporter &exporter, ml::train::ExportMethods
      80              :    * method)
      81              :    */
      82          116 :   void exportTo(Exporter &exporter,
      83          116 :                 const ml::train::ExportMethods &method) const override {}
      84              : 
      85              :   /**
      86              :    * @copydoc Layer::setProperty(const std::vector<std::string> &values)
      87              :    */
      88              :   void setProperty(const std::vector<std::string> &values) override;
      89              : 
      90              :   /**
      91              :    * @copydoc Layer::getType()
      92              :    */
      93         4022 :   const std::string getType() const override { return AdditionLayer::type; };
      94              : 
      95              :   void updateTensorsByInputDimensions(
      96              :     nntrainer::RunLayerContext &context,
      97              :     std::vector<nntrainer::TensorDim> input_dimensions) override;
      98              : 
      99              :   std::tuple<props::Print>
     100              :     add_props; /**< fc layer properties : unit - number of output neurons */
     101              : 
     102              :   static constexpr const char *type = "addition";
     103              : };
     104              : 
     105              : } // namespace nntrainer
     106              : 
     107              : #endif /* __cplusplus */
     108              : #endif /* __ADDITION_LAYER_H__ */
        

Generated by: LCOV version 2.0-1