LCOV - code coverage report
Current view: top level - nntrainer/layers - reduce_mean_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: 75.0 % 4 3

            Line data    Source code
       1              : // SPDX-License-Identifier: Apache-2.0
       2              : /**
       3              :  * Copyright (C) 2021 Parichay Kapoor <pk.kapoor@samsung.com>
       4              :  *
       5              :  * @file   reduce_mean_layer.h
       6              :  * @date   25 Nov 2021
       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 Reduce Mean Layer Class for Neural Network
      11              :  *
      12              :  */
      13              : 
      14              : #ifndef __REDUCE_MEAN_LAYER_H__
      15              : #define __REDUCE_MEAN_LAYER_H__
      16              : #ifdef __cplusplus
      17              : 
      18              : #include <common_properties.h>
      19              : #include <layer_devel.h>
      20              : 
      21              : namespace nntrainer {
      22              : 
      23              : class RunLayerContext;
      24              : class InitLayerContext;
      25              : 
      26              : /**
      27              :  * @class   Reduce Mean Layer
      28              :  * @brief   Reduce Mean Layer
      29              :  */
      30              : class ReduceMeanLayer : public Layer {
      31              : public:
      32              :   /**
      33              :    * @brief     Constructor of Reduce Mean Layer
      34              :    */
      35           37 :   ReduceMeanLayer() : Layer() {}
      36              : 
      37              :   /**
      38              :    * @brief     Destructor of Reduce Mean Layer
      39              :    */
      40           45 :   ~ReduceMeanLayer(){};
      41              : 
      42              :   /**
      43              :    *  @brief  Move constructor of ReduceMeanLayer.
      44              :    *  @param[in] ReduceMeanLayer &&
      45              :    */
      46              :   ReduceMeanLayer(ReduceMeanLayer &&rhs) noexcept = default;
      47              : 
      48              :   /**
      49              :    * @brief  Move assignment operator.
      50              :    * @parma[in] rhs ReduceMeanLayer to be moved.
      51              :    */
      52              :   ReduceMeanLayer &operator=(ReduceMeanLayer &&rhs) = default;
      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            4 :   bool supportBackwarding() const override { return true; };
      73              : 
      74              :   /**
      75              :    * @copydoc Layer::exportTo(Exporter &exporter, ml::train::ExportMethods
      76              :    * method)
      77              :    */
      78              :   void exportTo(Exporter &exporter,
      79              :                 const ml::train::ExportMethods &method) const override;
      80              : 
      81              :   /**
      82              :    * @copydoc Layer::setProperty(const std::vector<std::string> &values)
      83              :    */
      84              :   void setProperty(const std::vector<std::string> &values) override;
      85              : 
      86              :   /**
      87              :    * @copydoc Layer::getType()
      88              :    */
      89           45 :   const std::string getType() const override { return ReduceMeanLayer::type; };
      90              : 
      91              :   static constexpr const char *type = "reduce_mean";
      92              : 
      93              : private:
      94              :   /** TODO: support scalar multiplier to simulate reduce_sum */
      95              :   std::tuple<props::ReduceDimension>
      96              :     reduce_mean_props; /**< reduce_mean properties : axis to reduce along */
      97              : };
      98              : 
      99              : } // namespace nntrainer
     100              : 
     101              : #endif /* __cplusplus */
     102              : #endif /* __REDUCE_MEAN_LAYER_H__ */
        

Generated by: LCOV version 2.0-1