From: Parichay Kapoor Date: Thu, 10 Jun 2021 08:43:56 +0000 (+0900) Subject: [interpreter] Updated export_to usage with LayerNode X-Git-Tag: accepted/tizen/unified/20210829.234903~295 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c3a98447f67cd18287c09563f47315b804a3a57e;p=platform%2Fcore%2Fml%2Fnntrainer.git [interpreter] Updated export_to usage with LayerNode Updated export_to function usage based on LayerNode **Self evaluation:** 1. Build test: [x]Passed [ ]Failed [ ]Skipped 2. Run test: [x]Passed [ ]Failed [ ]Skipped Signed-off-by: Parichay Kapoor --- diff --git a/nntrainer/compiler/ini_interpreter.cpp b/nntrainer/compiler/ini_interpreter.cpp index 1c29786..0c37db0 100644 --- a/nntrainer/compiler/ini_interpreter.cpp +++ b/nntrainer/compiler/ini_interpreter.cpp @@ -261,13 +261,12 @@ void IniGraphInterpreter::serialize( for (auto iter = representation->cbegin(); iter != representation->cend(); iter++) { const auto &ln = *iter; - const auto &layer = ln->getObject(); - IniSection s(layer->getName()); - s.setEntry("type", layer->getType()); + IniSection s(ln->getName()); + s.setEntry("type", ln->getType()); Exporter e; - layer->export_to(e); + ln->export_to(e); const auto key_val_pairs = e.getResult(); diff --git a/nntrainer/compiler/tflite_interpreter.cpp b/nntrainer/compiler/tflite_interpreter.cpp index c582a9a..de4c766 100644 --- a/nntrainer/compiler/tflite_interpreter.cpp +++ b/nntrainer/compiler/tflite_interpreter.cpp @@ -246,7 +246,7 @@ buildOpNodes(std::shared_ptr representation) { iter++) { const auto &ln = *iter; Exporter e; - ln->getObject()->export_to(e, ExportMethods::METHOD_TFLITE); + ln->export_to(e, ExportMethods::METHOD_TFLITE); nodes.emplace_back(e.getResult()); } diff --git a/nntrainer/graph/network_graph.cpp b/nntrainer/graph/network_graph.cpp index 8e44353..fa7d100 100644 --- a/nntrainer/graph/network_graph.cpp +++ b/nntrainer/graph/network_graph.cpp @@ -333,7 +333,6 @@ void NetworkGraph::setOutputLayers() { if (layer_idx->getNumOutputs() == 0) { /** No output layer inplies its the last layer */ layer_idx->setOutputLayers({"__exit__"}); - ; last_layer_count += 1; } else { /** error for any other layer */ diff --git a/nntrainer/layers/layer_node.h b/nntrainer/layers/layer_node.h index 2efd58e..99f02d5 100644 --- a/nntrainer/layers/layer_node.h +++ b/nntrainer/layers/layer_node.h @@ -255,6 +255,7 @@ public: export_to(Exporter &exporter, ExportMethods method = ExportMethods::METHOD_STRINGVECTOR) const { exporter.saveResult(props, method, this); + layer->export_to(exporter, method); }; #ifdef PROFILE diff --git a/nntrainer/utils/node_exporter.cpp b/nntrainer/utils/node_exporter.cpp index b3a38fb..b7b2fa3 100644 --- a/nntrainer/utils/node_exporter.cpp +++ b/nntrainer/utils/node_exporter.cpp @@ -52,8 +52,7 @@ void Exporter::saveTflResult(const std::tuple &props, } template <> -void Exporter::saveTflResult(const std::tuple &props, - const LayerNode *self) { +void Exporter::saveTflResult(const std::tuple<> &props, const LayerNode *self) { createIfNull(tf_node); tf_node->setInOut(*self); tf_node->setInputs(self->getObject()->getInputRef()); diff --git a/nntrainer/utils/node_exporter.h b/nntrainer/utils/node_exporter.h index a0c5d40..0b39755 100644 --- a/nntrainer/utils/node_exporter.h +++ b/nntrainer/utils/node_exporter.h @@ -207,7 +207,6 @@ class Layer; /** * @copydoc template void * Exporter::saveTflResult(const PropsType &props, const NodeType *self); - * @todo remove this when layer is refactored */ template <> void Exporter::saveTflResult(const std::tuple &props, @@ -219,8 +218,7 @@ class LayerNode; * Exporter::saveTflResult(const PropsType &props, const NodeType *self); */ template <> -void Exporter::saveTflResult(const std::tuple &props, - const LayerNode *self); +void Exporter::saveTflResult(const std::tuple<> &props, const LayerNode *self); class FullyConnectedLayer; /**