From a0119fc3dabc6af41ee99ff572378e776da47d60 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=91=D0=B0=D1=80?= =?utf8?q?=D0=B0=D0=BD=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2/AI=20Tools=20Lab=20/S?= =?utf8?q?RR/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Wed, 28 Aug 2019 16:55:17 +0900 Subject: [PATCH] [mir_tflite] Do not set names of operations (#6955) Remove useless setting of operation names. Signed-off-by: Sergei Barannikov --- compiler/mir-tflite-importer/tflite_importer.cpp | 21 +++------------------ compiler/mir-tflite-importer/tflite_importer.h | 5 ----- compiler/mir-tflite-importer/tflite_op_creator.h | 3 +-- 3 files changed, 4 insertions(+), 25 deletions(-) diff --git a/compiler/mir-tflite-importer/tflite_importer.cpp b/compiler/mir-tflite-importer/tflite_importer.cpp index 66a80da..aa8afe4 100644 --- a/compiler/mir-tflite-importer/tflite_importer.cpp +++ b/compiler/mir-tflite-importer/tflite_importer.cpp @@ -139,7 +139,6 @@ std::unique_ptr TfliteImporter::importModel() void TfliteImporter::walkGraphAndCreateMIR() { walkModel(_modelPacked); - setIrNodeNames(); setGraphOutputs(); } @@ -166,8 +165,7 @@ void TfliteImporter::walkSubGraph(const SubGraph *s) input_shape.dim(dim) = t->shape()->Get(dim); } - auto input = _graph->create(t->name()->c_str(), input_shape)->getOutput(0); - + auto input = _graph->create(input_shape)->getOutput(0); input->setName(t->name()->c_str()); assert(_tensorMap.find(i) == _tensorMap.cend()); _tensorMap[i] = input; @@ -308,7 +306,7 @@ std::vector TfliteImporter::getMIRInputsForOperator(co { assert(_tensorMap.find(i) == _tensorMap.end()); mir::TensorVariant mir_tensor = createTensor(tensor, buffer); - inputs.emplace_back(_graph->create("", mir_tensor)->getOutput(0)); + inputs.emplace_back(_graph->create(mir_tensor)->getOutput(0)); } else { @@ -362,20 +360,7 @@ void TfliteImporter::setGraphOutputs() for (auto output_idx : _graphOutputs) { auto output = _tensorMap[output_idx]; - _graph->create(output->getNode()->getName(), output); - output->getNode()->setName(""); - } -} - -void TfliteImporter::setIrNodeNames() -{ - // Setting names of the nodes. - // Note: we change the computation graph, (for example, TFLite Conv2D - // turns into IR Conv2D->Add->ReLU), so not all of the nodes will have names. - for (auto iter : _tensorMap) - { - const Tensor *tensor = (*_tensors)[iter.first]; - iter.second->getNode()->setName(tensor->name()->c_str()); + _graph->create(output); } } diff --git a/compiler/mir-tflite-importer/tflite_importer.h b/compiler/mir-tflite-importer/tflite_importer.h index e235096..c324d53 100644 --- a/compiler/mir-tflite-importer/tflite_importer.h +++ b/compiler/mir-tflite-importer/tflite_importer.h @@ -86,11 +86,6 @@ private: void setGraphOutputs(); /** - * @brief Set MIR node names - */ - void setIrNodeNames(); - - /** * @brief Returns MIR operation outputs corresponding to the inputs of the given operator. */ std::vector getMIRInputsForOperator(const ::tflite::Operator *op); diff --git a/compiler/mir-tflite-importer/tflite_op_creator.h b/compiler/mir-tflite-importer/tflite_op_creator.h index fb757d9..abe997e 100644 --- a/compiler/mir-tflite-importer/tflite_op_creator.h +++ b/compiler/mir-tflite-importer/tflite_op_creator.h @@ -163,8 +163,7 @@ private: template mir::Operation *TFLiteOpCreator::createOp(Types &&... args) { - // TODO: how to name operations? in Tensorflow tensors get names, not operations - return _graph->create("", std::forward(args)...); + return _graph->create(std::forward(args)...); } } // namespace mir_tflite -- 2.7.4