[ coverity ] Fix Coverity issue
authorDonghak PARK <donghak.park@samsung.com>
Fri, 22 Mar 2024 06:04:46 +0000 (15:04 +0900)
committerjijoong.moon <jijoong.moon@samsung.com>
Thu, 28 Mar 2024 23:45:19 +0000 (08:45 +0900)
Fix Coverity issue on
- /test/unittest/layers/layers_golden_tests.cpp
- /test/unittest/models/unittest_models_recurrent.cpp
- /test/unittest/unittest_nntrainer_models.cpp

Resolves:
```
Use of auto that causes a copy (AUTO_CAUSES_COPY)
auto_causes_copy: This lambda has an unspecified return type
copy: This return statement creates a copy.
```
**Self evaluation:**
1. Build test:  [X]Passed [ ]Failed [ ]Skipped
2. Run test:  [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Donghak PARK <donghak.park@samsung.com>
test/unittest/layers/layers_golden_tests.cpp

index 4c0e3ce..e647816 100644 (file)
@@ -358,7 +358,7 @@ bool LayerGoldenTest::shouldSkipCosineSimilarity() {
 }
 
 TEST_P(LayerGoldenTest, run) {
-  auto f = std::get<0>(GetParam());
+  const auto &f = std::get<0>(GetParam());
   auto layer = f(std::get<1>(GetParam()));
   std::string format = std::get<5>(GetParam());
   std::string type_w = std::get<6>(GetParam());