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

            Line data    Source code
       1              : // SPDX-License-Identifier: Apache-2.0
       2              : /**
       3              :  * Copyright (C) 2021 Jihoon Lee <jhoon.it.lee@samsung.com>
       4              :  *
       5              :  * @file   identity.h
       6              :  * @date   16 Dec 2021
       7              :  * @brief  This is identity layer flows everything as it is
       8              :  * @see    https://github.com/nnstreamer/nntrainer
       9              :  * @author Jihoon Lee <jhoon.it.lee@samsung.com>
      10              :  * @bug    No known bugs except for NYI items
      11              :  *
      12              :  */
      13              : 
      14              : #ifndef __IDENTITY_LAYER_H__
      15              : #define __IDENTITY_LAYER_H__
      16              : #ifdef __cplusplus
      17              : 
      18              : #include <layer_devel.h>
      19              : 
      20              : namespace nntrainer {
      21              : 
      22              : /**
      23              :  * @class   Identity Layer
      24              :  * @brief   Identity Layer
      25              :  * @note    Identity layers takes multiple tensors as input, redirects to output
      26              :  * without doing nothing (or if unavoidable, copying)
      27              :  */
      28              : class IdentityLayer final : public Layer {
      29              : public:
      30              :   /**
      31              :    * @brief     Constructor of IdentityLayer
      32              :    */
      33              :   IdentityLayer();
      34              : 
      35              :   /**
      36              :    * @brief     Destructor of IdentityLayer
      37              :    */
      38              :   ~IdentityLayer();
      39              : 
      40              :   /**
      41              :    *  @brief  Move constructor of Identity Layer.
      42              :    *  @param rhs target
      43              :    */
      44              :   IdentityLayer(IdentityLayer &&rhs) noexcept = default;
      45              : 
      46              :   /**
      47              :    * @brief  Move assignment operator.
      48              :    * @param rhs IdentityLayer to be moved.
      49              :    */
      50              :   IdentityLayer &operator=(IdentityLayer &&rhs) noexcept = default;
      51              : 
      52              :   /**
      53              :    * @copydoc Layer::finalize(InitLayerContext &context)
      54              :    */
      55              :   void finalize(InitLayerContext &context) override;
      56              : 
      57              :   /**
      58              :    * @copydoc Layer::forwarding(RunLayerContext &context, bool training)
      59              :    */
      60              :   void forwarding(RunLayerContext &context, bool training) override;
      61              : 
      62              :   /**
      63              :    * @copydoc Layer::calcDerivative(RunLayerContext &context)
      64              :    */
      65              :   void calcDerivative(RunLayerContext &context) override;
      66              : 
      67              :   /**
      68              :    * @copydoc bool supportBackwarding() const
      69              :    */
      70          250 :   bool supportBackwarding() const override { return true; };
      71              : 
      72              :   /**
      73              :    * @brief Initialize the in-place settings of the layer
      74              :    * @return InPlaceType
      75              :    */
      76           50 :   InPlaceType initializeInPlace() final {
      77           50 :     is_inplace = true;
      78           50 :     return InPlaceType::RESTRICTING;
      79              :   }
      80              : 
      81              :   /**
      82              :    * @copydoc Layer::getType()
      83              :    */
      84         2551 :   const std::string getType() const override { return IdentityLayer::type; };
      85              : 
      86              :   /**
      87              :    * @copydoc Layer::setProperty(const std::vector<std::string> &values)
      88              :    */
      89              :   void setProperty(const std::vector<std::string> &values) override;
      90              : 
      91              :   static constexpr const char *type = "identity";
      92              : };
      93              : } // namespace nntrainer
      94              : 
      95              : #endif /* __cplusplus */
      96              : #endif /* __IDENTITY_LAYER_H__ */
        

Generated by: LCOV version 2.0-1