From 9901976bb7a0386f7b7d020f8646c0c462f8942e Mon Sep 17 00:00:00 2001 From: Seungbaek Hong Date: Mon, 2 Jan 2023 16:06:49 +0900 Subject: [PATCH] [trivial] modify flatten_realizer script for consistent codes modify "flatten_realizer.cpp" script for consistent codes of "flatten_realizer.cpp" and "activation_realizer.cpp". "flatten_realizer" and "activation realizer" contain exactly same implementation but written in slightly different ways. It's a very trivial matter, but I thought it would be better to write the same implementation in the same code, so I modified it. **Self evaluation:** 1. Build test: [x]Passed []Failed []Skipped 2. Run test: [x]Passed []Failed []Skipped Signed-off-by: Seungbaek Hong --- nntrainer/compiler/flatten_realizer.cpp | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/nntrainer/compiler/flatten_realizer.cpp b/nntrainer/compiler/flatten_realizer.cpp index d84e658..20201f9 100644 --- a/nntrainer/compiler/flatten_realizer.cpp +++ b/nntrainer/compiler/flatten_realizer.cpp @@ -54,21 +54,20 @@ FlattenRealizer::realize(const GraphRepresentation &reference) { processed.push_back(std::move(flatten_node)); } } - RemapRealizer remap_others([&remap_table](std::string &name, unsigned &idx) { - if (auto iter = remap_table.find(name); iter != remap_table.end()) { - name = iter->second; - } - }); - - RemapRealizer recover_temp( - [&recovery_table](std::string &name, unsigned &idx) { + processed = + RemapRealizer([&remap_table](std::string &name, unsigned &idx) { + if (auto iter = remap_table.find(name); iter != remap_table.end()) { + name = iter->second; + } + }) + .realize(processed); + processed = + RemapRealizer([&recovery_table](std::string &name, unsigned &idx) { if (auto iter = recovery_table.find(name); iter != recovery_table.end()) { name = iter->second; } - }); - - processed = remap_others.realize(processed); - processed = recover_temp.realize(processed); + }) + .realize(processed); return processed; } -- 2.7.4