From 71d5c17a2a14b55b8ce5d8e8e64f2470f685cb8a Mon Sep 17 00:00:00 2001 From: hyeonseok lee Date: Sat, 22 Apr 2023 00:06:08 +0900 Subject: [PATCH] [graph] fix web tct fail issue - replace insert with emplace - initialize member variable node_names Signed-off-by: hyeonseok lee --- nntrainer/graph/graph_core.cpp | 6 +++--- nntrainer/graph/graph_core.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nntrainer/graph/graph_core.cpp b/nntrainer/graph/graph_core.cpp index 4da00a0..b624e06 100644 --- a/nntrainer/graph/graph_core.cpp +++ b/nntrainer/graph/graph_core.cpp @@ -128,7 +128,7 @@ void GraphCore::ensureName(GraphNode &node, const std::string &prefix_, */ if (!orig_name_empty && !force_rename && !verifyNode(orig_name)) { node.setName(orig_name); - node_names.insert(orig_name); + node_names.emplace(orig_name); return; } @@ -137,7 +137,7 @@ void GraphCore::ensureName(GraphNode &node, const std::string &prefix_, std::string direct_name = prefix + orig_name + postfix; if (!verifyNode(direct_name)) { node.setName(direct_name); - node_names.insert(direct_name); + node_names.emplace(direct_name); return; } } @@ -156,7 +156,7 @@ void GraphCore::ensureName(GraphNode &node, const std::string &prefix_, } while (iter != node_names.end()); node.setName(name); - node_names.insert(name); + node_names.emplace(name); } void GraphCore::replaceNode(std::shared_ptr from, diff --git a/nntrainer/graph/graph_core.h b/nntrainer/graph/graph_core.h index 801c71f..83d3ce7 100644 --- a/nntrainer/graph/graph_core.h +++ b/nntrainer/graph/graph_core.h @@ -38,7 +38,7 @@ public: /** * @brief Constructor of Graph Core Class */ - GraphCore() : sorted(false), def_name_count(0) {} + GraphCore() : sorted(false), node_names(), def_name_count(0) {} /** * @brief Destructor of Graph Core Class -- 2.7.4