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

            Line data    Source code
       1              : // SPDX-License-Identifier: Apache-2.0
       2              : /**
       3              :  * Copyright (C) 2021 Jijoong Moon <jijoong.moon@samsung.com>
       4              :  *
       5              :  * @file   conv1d_layer.h
       6              :  * @date   13 Oct 2021
       7              :  * @see    https://github.com/nnstreamer/nntrainer
       8              :  * @author Jijoong Moon <jijoong.moon@samsung.com>
       9              :  * @bug    No known bugs except for NYI items
      10              :  * @brief  This is Convolution 1D Layer Class for Neural Network
      11              :  *
      12              :  */
      13              : 
      14              : #ifndef __CONV1D_LAYER_H_
      15              : #define __CONV1D_LAYER_H_
      16              : #ifdef __cplusplus
      17              : 
      18              : #include <common_properties.h>
      19              : #include <layer_impl.h>
      20              : #include <memory.h>
      21              : 
      22              : namespace nntrainer {
      23              : 
      24              : class Conv2DLayer;
      25              : 
      26              : /**
      27              :  * @class   Convolution 1D Layer
      28              :  * @brief   Convolution 1D Layer
      29              :  */
      30              : class Conv1DLayer : public LayerImpl {
      31              : public:
      32              :   /**
      33              :    * @brief     Constructor of Conv 1D Layer
      34              :    */
      35              :   Conv1DLayer();
      36              : 
      37              :   /**
      38              :    * @brief     Destructor of Conv 1D Layer
      39              :    */
      40              :   ~Conv1DLayer();
      41              : 
      42              :   /**
      43              :    *  @brief  Move constructor of Conv 1D Layer.
      44              :    *  @param[in] Conv1dLayer &&
      45              :    */
      46              :   Conv1DLayer(Conv1DLayer &&rhs) noexcept = default;
      47              : 
      48              :   /**
      49              :    * @brief  Move assignment operator.
      50              :    * @parma[in] rhs Conv1DLayer to be moved.
      51              :    */
      52              :   Conv1DLayer &operator=(Conv1DLayer &&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 Layer::calcGradient(RunLayerContext &context)
      71              :    */
      72              :   void calcGradient(RunLayerContext &context) override;
      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::getType()
      83              :    */
      84           65 :   const std::string getType() const override { return Conv1DLayer::type; };
      85              : 
      86              :   /**
      87              :    * @copydoc Layer::supportBackwarding()
      88              :    */
      89            2 :   bool supportBackwarding() const override { return true; }
      90              : 
      91              :   using Layer::setProperty;
      92              : 
      93              :   /**
      94              :    * @copydoc Layer::setProperty(const PropertyType type, const std::string
      95              :    * &value)
      96              :    */
      97              :   void setProperty(const std::vector<std::string> &values) override;
      98              : 
      99              :   static constexpr const char *type = "conv1d";
     100              : 
     101              : private:
     102              :   std::tuple<props::FilterSize, props::KernelSize, props::Stride,
     103              :              props::Padding1D, props::Dilation>
     104              :     conv_props;
     105              : 
     106              :   std::array<unsigned int, 5> wt_idx; /**< indices of the weights and tensors */
     107              :   std::unique_ptr<Conv2DLayer> conv2d_layer; /**< conv2d layer instance */
     108              : };
     109              : 
     110              : } // namespace nntrainer
     111              : 
     112              : #endif /* __cplusplus */
     113              : #endif /* __CONV1D_LAYER_H__ */
        

Generated by: LCOV version 2.0-1