[FIX] Fix coverity issues
authorJiho Chu <jiho.chu@samsung.com>
Wed, 31 Jan 2024 01:21:08 +0000 (10:21 +0900)
committerjijoong.moon <jijoong.moon@samsung.com>
Wed, 20 Mar 2024 06:17:51 +0000 (15:17 +0900)
Issue:
1740106
1742375
1747001

Signed-off-by: Jiho Chu <jiho.chu@samsung.com>
nntrainer/utils/node_exporter.cpp
nntrainer/utils/profiler.cpp

index 9aace49..c8879f2 100644 (file)
@@ -192,7 +192,7 @@ void Exporter::saveTflResult(
 
   tf_node->setOpType(tflite::BuiltinOperator_CONV_2D);
 
-  auto strides = std::get<std::array<props::Stride, CONV2D_DIM>>(props);
+  auto &strides = std::get<std::array<props::Stride, CONV2D_DIM>>(props);
   assert(strides.size() == CONV2D_DIM);
   const auto &padding = std::get<props::Padding2D>(props).get();
   if (padding != "same" && padding != "valid") {
@@ -304,7 +304,7 @@ void Exporter::saveTflResult(const std::tuple<props::TargetShape> &props,
   createIfNull(tf_node);
 
   tf_node->setOpType(tflite::BuiltinOperator_RESHAPE);
-  auto targetShape = std::get<props::TargetShape>(props).get();
+  auto &targetShape = std::get<props::TargetShape>(props).get();
 
   /// @todo new shape should be 2 rank {batch, channel * height * width}
   std::vector<int32_t> new_shape_vec = {
index f5afb9d..6d5eaed 100644 (file)
@@ -339,6 +339,7 @@ void Profiler::unsubscribe(std::shared_ptr<ProfileListener> listener) {
 }
 
 int Profiler::registerTimeItem(const std::string &name) {
+  std::lock_guard<std::mutex> lock_listener(listeners_mutex);
   std::lock_guard<std::mutex> lock(registr_mutex);
 
   int item = time_item_names.size() + 1;