From 97ee3ba7d508b44ec729d084be00f3762c605229 Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=ED=95=9C=EC=A2=85/=EB=8F=99=EC=9E=91=EC=A0=9C?= =?utf8?q?=EC=96=B4Lab=28SR=29/Engineer/=EC=82=BC=EC=84=B1=EC=A0=84?= =?utf8?q?=EC=9E=90?= Date: Thu, 22 Nov 2018 10:45:34 +0900 Subject: [PATCH] [neurun] Remove NOP node (#3665) NOP node was first introduced for general testing purpose but it does not used or necessary any longer. Signed-off-by: Hanjoung Lee --- .../neurun/src/backend/acl_cl/StageGenerator.cc | 6 --- .../neurun/src/backend/acl_cl/StageGenerator.h | 1 - runtimes/neurun/src/backend/cpu/StageGenerator.cc | 6 --- runtimes/neurun/src/backend/cpu/StageGenerator.h | 1 - .../neurun/src/backend/interface/IStageGenerator.h | 1 - runtimes/neurun/src/compiler/OperationValidator.cc | 5 --- runtimes/neurun/src/compiler/OperationValidator.h | 1 - runtimes/neurun/src/compiler/SubTensorAnalyzer.cc | 5 --- runtimes/neurun/src/compiler/SubTensorAnalyzer.h | 1 - runtimes/neurun/src/graph/dumper/Dumper.cc | 16 -------- runtimes/neurun/src/graph/dumper/Dumper.h | 1 - runtimes/neurun/src/graph/operation/NOP.cc | 38 ------------------ runtimes/neurun/src/graph/operation/NOP.h | 45 ---------------------- runtimes/neurun/src/graph/operation/NodeVisitor.h | 2 - 14 files changed, 129 deletions(-) delete mode 100644 runtimes/neurun/src/graph/operation/NOP.cc delete mode 100644 runtimes/neurun/src/graph/operation/NOP.h diff --git a/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc b/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc index bdd5a11..4bc975d 100644 --- a/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc +++ b/runtimes/neurun/src/backend/acl_cl/StageGenerator.cc @@ -547,12 +547,6 @@ void StageGenerator::visit(const graph::operation::SoftmaxNode &node) }); } -void StageGenerator::visit(const graph::operation::NOPNode & /* node */) -{ - // DO NOTHING - returnStage(nullptr); -} - void StageGenerator::visit(const graph::operation::PermuteNode & /* node */) { throw "Unsupported"; diff --git a/runtimes/neurun/src/backend/acl_cl/StageGenerator.h b/runtimes/neurun/src/backend/acl_cl/StageGenerator.h index 40bd43c..8a36194 100644 --- a/runtimes/neurun/src/backend/acl_cl/StageGenerator.h +++ b/runtimes/neurun/src/backend/acl_cl/StageGenerator.h @@ -44,7 +44,6 @@ public: virtual void visit(const graph::operation::FullyConnectedNode &node) override; virtual void visit(const graph::operation::ReshapeNode &node) override; virtual void visit(const graph::operation::SoftmaxNode &node) override; - virtual void visit(const graph::operation::NOPNode &node) override; virtual void visit(const graph::operation::PermuteNode &node) override; virtual void visit(const graph::operation::AddNode &node) override; diff --git a/runtimes/neurun/src/backend/cpu/StageGenerator.cc b/runtimes/neurun/src/backend/cpu/StageGenerator.cc index d2d3148..f242d1a 100644 --- a/runtimes/neurun/src/backend/cpu/StageGenerator.cc +++ b/runtimes/neurun/src/backend/cpu/StageGenerator.cc @@ -530,12 +530,6 @@ void StageGenerator::visit(const graph::operation::SoftmaxNode &node) }); } -void StageGenerator::visit(const graph::operation::NOPNode & /* node */) -{ - // DO NOTHING - returnStage(nullptr); -} - void StageGenerator::visit(const graph::operation::PermuteNode &node) { VERBOSE(Permute) << "generate CPU Permute" << std::endl; diff --git a/runtimes/neurun/src/backend/cpu/StageGenerator.h b/runtimes/neurun/src/backend/cpu/StageGenerator.h index 9006e90..b115a45 100644 --- a/runtimes/neurun/src/backend/cpu/StageGenerator.h +++ b/runtimes/neurun/src/backend/cpu/StageGenerator.h @@ -45,7 +45,6 @@ public: virtual void visit(const graph::operation::FullyConnectedNode &node) override; virtual void visit(const graph::operation::ReshapeNode &node) override; virtual void visit(const graph::operation::SoftmaxNode &node) override; - virtual void visit(const graph::operation::NOPNode &node) override; virtual void visit(const graph::operation::PermuteNode &node) override; virtual void visit(const graph::operation::AddNode &node) override; diff --git a/runtimes/neurun/src/backend/interface/IStageGenerator.h b/runtimes/neurun/src/backend/interface/IStageGenerator.h index a9008de..383dd06 100644 --- a/runtimes/neurun/src/backend/interface/IStageGenerator.h +++ b/runtimes/neurun/src/backend/interface/IStageGenerator.h @@ -54,7 +54,6 @@ protected: virtual void visit(const graph::operation::FullyConnectedNode &) override {} virtual void visit(const graph::operation::ReshapeNode &) override {} virtual void visit(const graph::operation::SoftmaxNode &) override {} - virtual void visit(const graph::operation::NOPNode &) override {} virtual void visit(const graph::operation::PermuteNode &) override {} virtual void visit(const graph::operation::AddNode &) override {} diff --git a/runtimes/neurun/src/compiler/OperationValidator.cc b/runtimes/neurun/src/compiler/OperationValidator.cc index 8c53c4a..d778b33 100644 --- a/runtimes/neurun/src/compiler/OperationValidator.cc +++ b/runtimes/neurun/src/compiler/OperationValidator.cc @@ -101,11 +101,6 @@ void OperationValidator::visit(const graph::operation::SoftmaxNode &node) assert(_ctx.at(input_index).shape().dim(1) == _ctx.at(output_index).shape().dim(1)); } -void OperationValidator::visit(const graph::operation::NOPNode &) -{ - // DO NOTHING -} - void OperationValidator::visit(const graph::operation::PermuteNode &node) { (void)node; // NOTE To prevent from unused variable warning diff --git a/runtimes/neurun/src/compiler/OperationValidator.h b/runtimes/neurun/src/compiler/OperationValidator.h index 6c8d205..f58494c 100644 --- a/runtimes/neurun/src/compiler/OperationValidator.h +++ b/runtimes/neurun/src/compiler/OperationValidator.h @@ -48,7 +48,6 @@ public: virtual void visit(const graph::operation::ReshapeNode &) override; virtual void visit(const graph::operation::FullyConnectedNode &) override; virtual void visit(const graph::operation::SoftmaxNode &) override; - virtual void visit(const graph::operation::NOPNode &) override; virtual void visit(const graph::operation::PermuteNode &) override; virtual void visit(const graph::operation::AddNode &) override; diff --git a/runtimes/neurun/src/compiler/SubTensorAnalyzer.cc b/runtimes/neurun/src/compiler/SubTensorAnalyzer.cc index d16555f..829ac89 100644 --- a/runtimes/neurun/src/compiler/SubTensorAnalyzer.cc +++ b/runtimes/neurun/src/compiler/SubTensorAnalyzer.cc @@ -106,11 +106,6 @@ void SubTensorAnalyzer::visit(const graph::operation::SoftmaxNode &) // DO NOTHING } -void SubTensorAnalyzer::visit(const graph::operation::NOPNode &) -{ - // DO NOTHING -} - void SubTensorAnalyzer::visit(const graph::operation::PermuteNode &) { // DO NOTHING diff --git a/runtimes/neurun/src/compiler/SubTensorAnalyzer.h b/runtimes/neurun/src/compiler/SubTensorAnalyzer.h index 21404c3..fff4af9 100644 --- a/runtimes/neurun/src/compiler/SubTensorAnalyzer.h +++ b/runtimes/neurun/src/compiler/SubTensorAnalyzer.h @@ -61,7 +61,6 @@ public: virtual void visit(const graph::operation::ReshapeNode &) override; virtual void visit(const graph::operation::FullyConnectedNode &) override; virtual void visit(const graph::operation::SoftmaxNode &) override; - virtual void visit(const graph::operation::NOPNode &) override; virtual void visit(const graph::operation::PermuteNode &) override; virtual void visit(const graph::operation::AddNode &) override; diff --git a/runtimes/neurun/src/graph/dumper/Dumper.cc b/runtimes/neurun/src/graph/dumper/Dumper.cc index f21cde0..dab24d8 100644 --- a/runtimes/neurun/src/graph/dumper/Dumper.cc +++ b/runtimes/neurun/src/graph/dumper/Dumper.cc @@ -90,22 +90,6 @@ void Dumper::visit(const SoftmaxNode &node) VERBOSE(LIR) << " - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl; } -void Dumper::visit(const NOPNode &node) -{ - VERBOSE(LIR) << "* NOP" << std::endl; - std::string inputs, outputs; - for (auto i : node.getInputs()) - { - inputs += std::to_string(i.value()) + ","; - } - VERBOSE(LIR) << " - Inputs : IFM(" << inputs << ")" << std::endl; - for (auto i : node.getOutputs()) - { - outputs += std::to_string(i.value()) + ","; - } - VERBOSE(LIR) << " - Outputs : OFM(" << outputs << ")" << std::endl; -} - void Dumper::visit(const PermuteNode &node) { VERBOSE(LIR) << "* Permute" << std::endl; diff --git a/runtimes/neurun/src/graph/dumper/Dumper.h b/runtimes/neurun/src/graph/dumper/Dumper.h index d8ed270..fe5beb4 100644 --- a/runtimes/neurun/src/graph/dumper/Dumper.h +++ b/runtimes/neurun/src/graph/dumper/Dumper.h @@ -39,7 +39,6 @@ public: void visit(const graph::operation::FullyConnectedNode &node) override; void visit(const graph::operation::ReshapeNode &node) override; void visit(const graph::operation::SoftmaxNode &node) override; - void visit(const graph::operation::NOPNode &node) override; void visit(const graph::operation::PermuteNode &node) override; void visit(const graph::operation::AddNode &node) override; }; diff --git a/runtimes/neurun/src/graph/operation/NOP.cc b/runtimes/neurun/src/graph/operation/NOP.cc deleted file mode 100644 index 41a43b7..0000000 --- a/runtimes/neurun/src/graph/operation/NOP.cc +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "NOP.h" - -#include "NodeVisitor.h" -#include "LowerInfo.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ - -void NOPNode::accept(NodeVisitor &&v) const { v.visit(*this); } - -NOPNode::NOPNode(const graph::operation::Node::InitParam &) - : operation::Node{OperandConstraint::createExact(1u)} -{ -} - -} // namespace operation -} // namespace graph -} // namespace neurun diff --git a/runtimes/neurun/src/graph/operation/NOP.h b/runtimes/neurun/src/graph/operation/NOP.h deleted file mode 100644 index 3f22829..0000000 --- a/runtimes/neurun/src/graph/operation/NOP.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. All Rights Reserved - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef __NEURUN_GRAPH_OPERATION_NOP_H__ -#define __NEURUN_GRAPH_OPERATION_NOP_H__ - -#include - -#include "graph/operation/Node.h" - -namespace neurun -{ -namespace graph -{ -namespace operation -{ - -class NOPNode : public graph::operation::Node -{ -public: - NOPNode(const graph::operation::Node::InitParam &); - -public: - virtual void accept(NodeVisitor &&) const override; - virtual std::string getName() const override { return "NOP"; } -}; - -} // namespace operation -} // namespace graph -} // namespace neurun - -#endif // __NEURUN_GRAPH_OPERATION_NOP_H__ diff --git a/runtimes/neurun/src/graph/operation/NodeVisitor.h b/runtimes/neurun/src/graph/operation/NodeVisitor.h index a5e7d8a..8e2ad7c 100644 --- a/runtimes/neurun/src/graph/operation/NodeVisitor.h +++ b/runtimes/neurun/src/graph/operation/NodeVisitor.h @@ -24,7 +24,6 @@ #include "Reshape.h" #include "FullyConnected.h" #include "Softmax.h" -#include "NOP.h" #include "Permute.h" #include "Add.h" @@ -46,7 +45,6 @@ struct NodeVisitor virtual void visit(const ReshapeNode &) {} virtual void visit(const FullyConnectedNode &) {} virtual void visit(const SoftmaxNode &) {} - virtual void visit(const NOPNode &) {} virtual void visit(const PermuteNode &) {} virtual void visit(const AddNode &) {} }; -- 2.7.4