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

            Line data    Source code
       1              : // SPDX-License-Identifier: Apache-2.0
       2              : /**
       3              :  * Copyright (C) 2025 SeungBaek Hong <sb92.hong@samsung.com>
       4              :  *
       5              :  * @file   sine_layer.cpp
       6              :  * @date   19 March 2025
       7              :  * @see    https://github.com/nnstreamer/nntrainer
       8              :  * @author SeungBaek Hong <sb92.hong@samsung.com>
       9              :  * @bug    No known bugs except for NYI items
      10              :  * @brief  This is sine layer class (operation layer)
      11              :  *
      12              :  */
      13              : 
      14              : #include "common_properties.h"
      15              : #include <nntrainer_error.h>
      16              : #include <nntrainer_log.h>
      17              : #include <node_exporter.h>
      18              : #include <sine_layer.h>
      19              : #include <util_func.h>
      20              : 
      21              : #include <layer_context.h>
      22              : 
      23              : namespace nntrainer {
      24              : 
      25           12 : void SineLayer::finalize(InitLayerContext &context) {
      26           12 :   context.setOutputDimensions({context.getInputDimensions()[0]});
      27           12 : }
      28              : 
      29            6 : void SineLayer::forwarding_operation(const Tensor &input, Tensor &hidden) {
      30            6 :   input.sin(hidden);
      31            6 : }
      32              : 
      33            3 : void SineLayer::calcDerivative(RunLayerContext &context) {
      34            3 :   auto &deriv = context.getOutgoingDerivative(SINGLE_INOUT_IDX);
      35            3 :   context.getInput(SINGLE_INOUT_IDX).cos(deriv);
      36            3 :   deriv.multiply(context.getIncomingDerivative(SINGLE_INOUT_IDX));
      37            3 : }
      38              : 
      39           88 : void SineLayer::setProperty(const std::vector<std::string> &values) {
      40           88 :   auto remain_props = loadProperties(values, sine_props);
      41           86 :   if (!remain_props.empty()) {
      42              :     std::string msg = "[SineLayer] Unknown Layer Properties count " +
      43            4 :                       std::to_string(values.size());
      44            8 :     throw exception::not_supported(msg);
      45              :   }
      46           86 : }
      47              : } /* namespace nntrainer */
        

Generated by: LCOV version 2.0-1