From 5044f9885bde1fe75f424ea94cfa8c51ea0a68ef Mon Sep 17 00:00:00 2001 From: Donghak PARK Date: Wed, 23 Oct 2024 08:53:46 +0900 Subject: [PATCH] [Unittest] Add constant DerivativeLossLayer unittest Currently, there is a layersemantics in the NNTrainer Unittest that verifies the behavior of the losslayer but it does not include the case for the constant DerivativeLossLayer. By simply filling in the parameters and passing them over, we can perform unit tests on basic operations so I added this feature. **Self evaluation:** 1. Build test: [X]Passed [ ]Failed [ ]Skipped 2. Run test: [X]Passed [ ]Failed [ ]Skipped Signed-off-by: Donghak PARK --- test/unittest/layers/unittest_layers_loss.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/unittest/layers/unittest_layers_loss.cpp b/test/unittest/layers/unittest_layers_loss.cpp index 83215ae7ee..ebc7de5044 100644 --- a/test/unittest/layers/unittest_layers_loss.cpp +++ b/test/unittest/layers/unittest_layers_loss.cpp @@ -13,6 +13,7 @@ #include +#include #include #include #include @@ -34,6 +35,11 @@ auto semantic_loss_mse = LayerSemanticsParamType( nntrainer::MSELossLayer::type, {}, LayerCreateSetPropertyOptions::AVAILABLE_FROM_APP_CONTEXT, false, 1); +auto semantic_loss_constant_derivative = LayerSemanticsParamType( + nntrainer::createLayer, + nntrainer::ConstantDerivativeLossLayer::type, {}, + LayerCreateSetPropertyOptions::AVAILABLE_FROM_APP_CONTEXT, false, 1); + auto semantic_loss_cross = LayerSemanticsParamType( nntrainer::createLayer, nntrainer::CrossEntropyLossLayer::type, {}, 0, true, 1); @@ -41,4 +47,5 @@ auto semantic_loss_cross = LayerSemanticsParamType( GTEST_PARAMETER_TEST(LossCross, LayerSemantics, ::testing::Values(semantic_loss_cross, semantic_loss_mse, semantic_loss_cross_softmax, - semantic_loss_cross_sigmoid)); + semantic_loss_cross_sigmoid, + semantic_loss_constant_derivative));