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

            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   layer_impl.h
       6              :  * @date   21 June 2021
       7              :  * @brief  This is base layer implementation class
       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              : #include <layer_impl.h>
      14              : 
      15              : #include <string>
      16              : #include <vector>
      17              : 
      18              : #include <common_properties.h>
      19              : #include <nntrainer_error.h>
      20              : #include <nntrainer_log.h>
      21              : #include <node_exporter.h>
      22              : #include <util_func.h>
      23              : namespace nntrainer {
      24              : 
      25         2086 : LayerImpl::LayerImpl() :
      26         2086 :   layer_impl_props(
      27              :     std::make_unique<
      28              :       std::tuple<props::WeightRegularizer, props::WeightRegularizerConstant,
      29              :                  props::WeightInitializer, props::WeightDecay, props::BiasDecay,
      30         2086 :                  props::BiasInitializer, props::DisableBias, props::Print>>()) {
      31         2086 : }
      32              : 
      33         9302 : void LayerImpl::setProperty(const std::vector<std::string> &values) {
      34         9302 :   auto remain_props = loadProperties(values, *layer_impl_props);
      35         9300 :   NNTR_THROW_IF(!remain_props.empty(), std::invalid_argument)
      36           33 :     << "[LayerImpl] Unknown Layer Properties count " +
      37           66 :          std::to_string(values.size());
      38         9300 : }
      39              : 
      40            0 : std::string LayerImpl::getProperty(const std::string &key) {
      41            0 :   if (!layer_impl_props)
      42            0 :     return "";
      43              : 
      44              :   std::string result = find_in_tuple(*layer_impl_props, key);
      45            0 :   return !result.empty() ? result : "";
      46              : }
      47              : 
      48          931 : void LayerImpl::exportTo(Exporter &exporter,
      49              :                          const ml::train::ExportMethods &method) const {
      50          931 :   exporter.saveResult(*layer_impl_props, method, this);
      51          931 : }
      52              : 
      53              : } // namespace nntrainer
        

Generated by: LCOV version 2.0-1