[neurun] Modification for Add op (#3414)
authorSiva Sai Vaddipati/System SW /SRI-Bangalore/Engineer/삼성전자 <siva.sai@samsung.com>
Wed, 31 Oct 2018 08:51:13 +0000 (14:21 +0530)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 31 Oct 2018 08:51:13 +0000 (17:51 +0900)
The changes made are aligned with the discussion in #3250

Signed-off-by: Siva Sai <siva.sai@samsung.com>
13 files changed:
runtimes/neurun/src/backend/acl_cl/StageGenerator.cc
runtimes/neurun/src/backend/acl_cl/StageGenerator.h
runtimes/neurun/src/backend/cpu/StageGenerator.cc
runtimes/neurun/src/backend/cpu/StageGenerator.h
runtimes/neurun/src/backend/interface/IInitializerGenerator.h
runtimes/neurun/src/backend/interface/IStageGenerator.h
runtimes/neurun/src/codegen/Planner.cc
runtimes/neurun/src/codegen/Planner.h
runtimes/neurun/src/graph/dumper/Dumper.cc
runtimes/neurun/src/graph/dumper/Dumper.h
runtimes/neurun/src/graph/operation/Add.cc
runtimes/neurun/src/graph/operation/Add.h
runtimes/neurun/src/graph/operation/NodeVisitor.h

index 4a70e48..a2200fb 100644 (file)
@@ -542,7 +542,7 @@ Stage StageGenerator::generate(const graph::operation::Permute::Node & /* node *
   throw "Unsupported";
 }
 
-Stage StageGenerator::generate(const graph::operation::Add::Node &)
+Stage StageGenerator::generate(const graph::operation::AddNode &)
 {
   VERBOSE(Add) << "generate CPU Add" << std::endl;
 
index a230720..1cbf72b 100644 (file)
@@ -46,7 +46,7 @@ public:
   virtual Stage generate(const graph::operation::Softmax::Node &node) override;
   virtual Stage generate(const graph::operation::NOP::Node &node) override;
   virtual Stage generate(const graph::operation::Permute::Node &node) override;
-  virtual Stage generate(const graph::operation::Add::Node &node) override;
+  virtual Stage generate(const graph::operation::AddNode &node) override;
 
 private:
   const neurun::graph::operand::Set &_ctx;
index 50761ad..8382aa2 100644 (file)
@@ -599,7 +599,7 @@ Stage StageGenerator::generate(const graph::operation::Permute::Node &node)
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::Add::Node &)
+Stage StageGenerator::generate(const graph::operation::AddNode &)
 {
   VERBOSE(Add) << "generate CPU Add" << std::endl;
 
index 0ba088a..ede9243 100644 (file)
@@ -47,7 +47,7 @@ public:
   virtual Stage generate(const graph::operation::Softmax::Node &node) override;
   virtual Stage generate(const graph::operation::NOP::Node &node) override;
   virtual Stage generate(const graph::operation::Permute::Node &node) override;
-  virtual Stage generate(const graph::operation::Add::Node &node) override;
+  virtual Stage generate(const graph::operation::AddNode &node) override;
 
 private:
   const neurun::graph::operand::Set &_ctx;
index f9ddc1d..89a17a7 100644 (file)
@@ -73,7 +73,7 @@ struct IInitializerGenerator
   virtual Initializer generate(const graph::operation::Softmax::Node &) { return Initializer{}; }
   virtual Initializer generate(const graph::operation::NOP::Node &) { return Initializer{}; }
   virtual Initializer generate(const graph::operation::Permute::Node &) { return Initializer{}; }
-  virtual Initializer generate(const graph::operation::Add::Node &) { return Initializer{}; }
+  virtual Initializer generate(const graph::operation::AddNode &) { return Initializer{}; }
 };
 
 } // namespace backend
index b86338e..8ecb3f1 100644 (file)
@@ -63,7 +63,7 @@ struct IStageGenerator
   virtual Stage generate(const graph::operation::Softmax::Node &node) = 0;
   virtual Stage generate(const graph::operation::NOP::Node &node) = 0;
   virtual Stage generate(const graph::operation::Permute::Node &node) = 0;
-  virtual Stage generate(const graph::operation::Add::Node &node) = 0;
+  virtual Stage generate(const graph::operation::AddNode &node) = 0;
 };
 
 } // namespace backend
index c0063d6..4d6c44c 100644 (file)
@@ -202,7 +202,7 @@ void Planner::visit(const graph::operation::Permute::Node &node)
   _builder.addStage(stage_gen->generate(node));
 }
 
-void Planner::visit(const graph::operation::Add::Node &node)
+void Planner::visit(const graph::operation::AddNode &node)
 {
   VERBOSE(Add) << "Configure Add operation" << std::endl;
 
index 0156f42..e1cdb76 100644 (file)
@@ -55,7 +55,7 @@ public:
   virtual void visit(const graph::operation::Softmax::Node &) override;
   virtual void visit(const graph::operation::NOP::Node &) override;
   virtual void visit(const graph::operation::Permute::Node &) override;
-  virtual void visit(const graph::operation::Add::Node &) override;
+  virtual void visit(const graph::operation::AddNode &) override;
 
 private:
   const neurun::graph::operand::Set &_ctx;
index 0b2a99f..6e10409 100644 (file)
@@ -113,7 +113,7 @@ void Dumper::visit(const Permute::Node &node)
   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
 }
 
-void Dumper::visit(const Add::Node &node)
+void Dumper::visit(const AddNode &node)
 {
   VERBOSE(LIR) << "* Add" << std::endl;
   VERBOSE(LIR) << "  - Inputs : Input(" << node.getInputs().at(0).value() << ", "
index 393fc93..00fe9cd 100644 (file)
@@ -41,7 +41,7 @@ public:
   void visit(const graph::operation::Softmax::Node &node) override;
   void visit(const graph::operation::NOP::Node &node) override;
   void visit(const graph::operation::Permute::Node &node) override;
-  void visit(const graph::operation::Add::Node &node) override;
+  void visit(const graph::operation::AddNode &node) override;
 };
 
 } // namespace dumper
index 369ae9c..193c449 100644 (file)
@@ -26,12 +26,10 @@ namespace graph
 {
 namespace operation
 {
-namespace Add
-{
 
-void Node::accept(NodeVisitor &&v) const { v.visit(*this); }
+void AddNode::accept(NodeVisitor &&v) const { v.visit(*this); }
 
-Node::Node(const graph::operation::Node::InitParam &init_param)
+AddNode::AddNode(const graph::operation::Node::InitParam &init_param)
     : operation::Node{OperandConstraint::createExact(2u)}
 {
   assert(init_param.input_count == 2);
@@ -46,7 +44,6 @@ Node::Node(const graph::operation::Node::InitParam &init_param)
   setOutputs({init_param.outputs[0]});
 }
 
-} // namespace Add
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index e1d8a07..252a262 100644 (file)
@@ -25,8 +25,6 @@ namespace graph
 {
 namespace operation
 {
-namespace Add
-{
 
 enum Input
 {
@@ -39,17 +37,16 @@ struct Param
   operand::Index activation_index;
 };
 
-class Node : public graph::operation::Node
+class AddNode : public graph::operation::Node
 {
 public:
-  Node(const graph::operation::Node::InitParam &init_param);
+  AddNode(const graph::operation::Node::InitParam &init_param);
 
 public:
   virtual void accept(NodeVisitor &&) const override;
   virtual std::string getName() const override { return "Add"; }
 };
 
-} // namespace Add
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index a7349a7..9738948 100644 (file)
@@ -48,7 +48,7 @@ struct NodeVisitor
   virtual void visit(const Softmax::Node &) = 0;
   virtual void visit(const NOP::Node &) = 0;
   virtual void visit(const Permute::Node &) = 0;
-  virtual void visit(const Add::Node &) = 0;
+  virtual void visit(const AddNode &) = 0;
 };
 
 } // namespace operation