[neurun] Structural changes for ops (#3436)
authorSiva Sai Vaddipati/System SW /SRI-Bangalore/Engineer/삼성전자 <siva.sai@samsung.com>
Mon, 5 Nov 2018 07:14:35 +0000 (12:44 +0530)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Mon, 5 Nov 2018 07:14:35 +0000 (16:14 +0900)
This commit follows the discussions on #3250

Signed-off-by: Siva Sai <siva.sai@samsung.com>
39 files changed:
runtimes/neurun/src/backend/acl_cl/InitializerGenerator.cc
runtimes/neurun/src/backend/acl_cl/InitializerGenerator.h
runtimes/neurun/src/backend/acl_cl/StageGenerator.cc
runtimes/neurun/src/backend/acl_cl/StageGenerator.h
runtimes/neurun/src/backend/cpu/InitializerGenerator.cc
runtimes/neurun/src/backend/cpu/InitializerGenerator.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/BackendResolver.h
runtimes/neurun/src/codegen/Planner.cc
runtimes/neurun/src/codegen/Planner.h
runtimes/neurun/src/frontend/model.cc
runtimes/neurun/src/graph/dumper/Dumper.cc
runtimes/neurun/src/graph/dumper/Dumper.h
runtimes/neurun/src/graph/operation/Add.h
runtimes/neurun/src/graph/operation/AvgPool2D.cc
runtimes/neurun/src/graph/operation/AvgPool2D.h
runtimes/neurun/src/graph/operation/Concat.cc
runtimes/neurun/src/graph/operation/Concat.h
runtimes/neurun/src/graph/operation/Conv2D.cc
runtimes/neurun/src/graph/operation/Conv2D.h
runtimes/neurun/src/graph/operation/FullyConnected.cc
runtimes/neurun/src/graph/operation/FullyConnected.h
runtimes/neurun/src/graph/operation/MaxPool2D.cc
runtimes/neurun/src/graph/operation/MaxPool2D.h
runtimes/neurun/src/graph/operation/NOP.cc
runtimes/neurun/src/graph/operation/NOP.h
runtimes/neurun/src/graph/operation/NodeVisitor.h
runtimes/neurun/src/graph/operation/Op.lst
runtimes/neurun/src/graph/operation/Permute.cc
runtimes/neurun/src/graph/operation/Permute.h
runtimes/neurun/src/graph/operation/Reshape.cc
runtimes/neurun/src/graph/operation/Reshape.h
runtimes/neurun/src/graph/operation/Softmax.cc
runtimes/neurun/src/graph/operation/Softmax.h
runtimes/neurun/src/graph/pass/PermutationInsertionPass.cc
runtimes/neurun/test/graph/operation/SetIO.cc

index 51048ce..be3d280 100644 (file)
@@ -34,28 +34,27 @@ InitializerGenerator::InitializerGenerator(const neurun::graph::operand::Set &ct
   // DO NOTHING
 }
 
-Initializer InitializerGenerator::generate(const graph::operation::Conv2D::Implicit::Node &node)
+Initializer InitializerGenerator::generate(const graph::operation::Conv2DNode &node)
 {
-  using graph::operation::Conv2D::Implicit::Input;
+  using graph::operation::Conv2DNode;
 
   Initializer ret;
-  ret.push_back({node.getInputs().at(Input::KERNEL), generateWeight(node)});
-  ret.push_back({node.getInputs().at(Input::BIAS), generateBias(node)});
+  ret.push_back({node.getInputs().at(Conv2DNode::Input::KERNEL), generateWeight(node)});
+  ret.push_back({node.getInputs().at(Conv2DNode::Input::BIAS), generateBias(node)});
   return ret;
 }
 
-Initializer InitializerGenerator::generate(const graph::operation::FullyConnected::Node &node)
+Initializer InitializerGenerator::generate(const graph::operation::FullyConnectedNode &node)
 {
-  using graph::operation::FullyConnected::Input;
+  using graph::operation::FullyConnectedNode;
 
   Initializer ret;
-  ret.push_back({node.getInputs().at(Input::WEIGHT), generateWeight(node)});
-  ret.push_back({node.getInputs().at(Input::BIAS), generateBias(node)});
+  ret.push_back({node.getInputs().at(FullyConnectedNode::Input::WEIGHT), generateWeight(node)});
+  ret.push_back({node.getInputs().at(FullyConnectedNode::Input::BIAS), generateBias(node)});
   return ret;
 }
 
-InitializerFn
-InitializerGenerator::generateWeight(const graph::operation::Conv2D::Implicit::Node &node)
+InitializerFn InitializerGenerator::generateWeight(const graph::operation::Conv2DNode &node)
 {
   const auto ker_index{node.getInputs().at(1)};
 
@@ -75,8 +74,7 @@ InitializerGenerator::generateWeight(const graph::operation::Conv2D::Implicit::N
   };
 }
 
-InitializerFn
-InitializerGenerator::generateWeight(const graph::operation::FullyConnected::Node &node)
+InitializerFn InitializerGenerator::generateWeight(const graph::operation::FullyConnectedNode &node)
 {
   const auto weight_index{node.getInputs().at(1)};
   const auto input_index{node.getInputs().at(0)};
@@ -114,8 +112,7 @@ InitializerGenerator::generateWeight(const graph::operation::FullyConnected::Nod
   };
 }
 
-InitializerFn
-InitializerGenerator::generateBias(const graph::operation::Conv2D::Implicit::Node &node)
+InitializerFn InitializerGenerator::generateBias(const graph::operation::Conv2DNode &node)
 {
   // TODO Refactor so we can reuse the common code
 
@@ -139,7 +136,7 @@ InitializerGenerator::generateBias(const graph::operation::Conv2D::Implicit::Nod
   };
 }
 
-InitializerFn InitializerGenerator::generateBias(const graph::operation::FullyConnected::Node &node)
+InitializerFn InitializerGenerator::generateBias(const graph::operation::FullyConnectedNode &node)
 {
   const auto bias_index{node.getInputs().at(2)};
 
index e259013..bf076f6 100644 (file)
@@ -34,15 +34,15 @@ public:
   InitializerGenerator(const neurun::graph::operand::Set &ctx);
 
 public:
-  Initializer generate(const graph::operation::Conv2D::Implicit::Node &node) override;
-  Initializer generate(const graph::operation::FullyConnected::Node &node) override;
+  Initializer generate(const graph::operation::Conv2DNode &node) override;
+  Initializer generate(const graph::operation::FullyConnectedNode &node) override;
 
 private:
-  InitializerFn generateWeight(const graph::operation::Conv2D::Implicit::Node &node);
-  InitializerFn generateWeight(const graph::operation::FullyConnected::Node &node);
+  InitializerFn generateWeight(const graph::operation::Conv2DNode &node);
+  InitializerFn generateWeight(const graph::operation::FullyConnectedNode &node);
 
-  InitializerFn generateBias(const graph::operation::Conv2D::Implicit::Node &node);
-  InitializerFn generateBias(const graph::operation::FullyConnected::Node &node);
+  InitializerFn generateBias(const graph::operation::Conv2DNode &node);
+  InitializerFn generateBias(const graph::operation::FullyConnectedNode &node);
 
 private:
   const neurun::graph::operand::Set &_ctx;
index a2200fb..b8e5181 100644 (file)
@@ -120,14 +120,14 @@ StageGenerator::StageGenerator(const neurun::graph::operand::Set &ctx,
   // DO NOTHING
 }
 
-Stage StageGenerator::generate(const graph::operation::Conv2D::Implicit::Node &node)
+Stage StageGenerator::generate(const graph::operation::Conv2DNode &node)
 {
-  using namespace graph::operation::Conv2D::Implicit;
+  using graph::operation::Conv2DNode;
 
   const auto ofm_index{node.getOutputs().at(0)};
-  const auto ifm_index{node.getInputs().at(Input::INPUT)};
-  const auto ker_index{node.getInputs().at(Input::KERNEL)};
-  const auto bias_index{node.getInputs().at(Input::BIAS)};
+  const auto ifm_index{node.getInputs().at(Conv2DNode::Input::INPUT)};
+  const auto ker_index{node.getInputs().at(Conv2DNode::Input::KERNEL)};
+  const auto bias_index{node.getInputs().at(Conv2DNode::Input::BIAS)};
 
   const auto vstride_index{node.param().vstride_index};
   const auto hstride_index{node.param().hstride_index};
@@ -199,10 +199,10 @@ Stage StageGenerator::generate(const graph::operation::Conv2D::Implicit::Node &n
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::MaxPool2D::Implicit::Node &node)
+Stage StageGenerator::generate(const graph::operation::MaxPool2DNode &node)
 {
   const auto ofm_index{node.getOutputs().at(0)};
-  const auto ifm_index{node.getInputs().at(graph::operation::MaxPool2D::Implicit::Input::INPUT)};
+  const auto ifm_index{node.getInputs().at(graph::operation::MaxPool2DNode::Input::INPUT)};
 
   const auto kh_index{node.param().kh_index};
   const auto kw_index{node.param().kw_index};
@@ -285,10 +285,10 @@ Stage StageGenerator::generate(const graph::operation::MaxPool2D::Implicit::Node
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::AvgPool2D::Implicit::Node &node)
+Stage StageGenerator::generate(const graph::operation::AvgPool2DNode &node)
 {
   const auto ofm_index{node.getOutputs().at(0)};
-  const auto ifm_index{node.getInputs().at(graph::operation::AvgPool2D::Implicit::Input::INPUT)};
+  const auto ifm_index{node.getInputs().at(graph::operation::AvgPool2DNode::Input::INPUT)};
 
   const auto kh_index{node.param().kh_index};
   const auto kw_index{node.param().kw_index};
@@ -375,7 +375,7 @@ Stage StageGenerator::generate(const graph::operation::AvgPool2D::Implicit::Node
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::Concat::Node &node)
+Stage StageGenerator::generate(const graph::operation::ConcatNode &node)
 {
   const auto ofm_index{node.getOutputs().at(0)};
   const auto axis_index{node.param().axis_index};
@@ -417,14 +417,14 @@ Stage StageGenerator::generate(const graph::operation::Concat::Node &node)
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::FullyConnected::Node &node)
+Stage StageGenerator::generate(const graph::operation::FullyConnectedNode &node)
 {
-  using namespace graph::operation::FullyConnected;
+  using graph::operation::FullyConnectedNode;
 
   const auto output_index{node.getOutputs().at(0)};
-  const auto input_index{node.getInputs().at(Input::INPUT)};
-  const auto weight_index{node.getInputs().at(Input::WEIGHT)};
-  const auto bias_index{node.getInputs().at(Input::BIAS)};
+  const auto input_index{node.getInputs().at(FullyConnectedNode::Input::INPUT)};
+  const auto weight_index{node.getInputs().at(FullyConnectedNode::Input::WEIGHT)};
+  const auto bias_index{node.getInputs().at(FullyConnectedNode::Input::BIAS)};
   const auto activation_index{node.param().activation_index};
 
   // Construct operation parameters
@@ -466,10 +466,10 @@ Stage StageGenerator::generate(const graph::operation::FullyConnected::Node &nod
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::Reshape::Node &node)
+Stage StageGenerator::generate(const graph::operation::ReshapeNode &node)
 {
   const auto output_index{node.getOutputs().at(0)};
-  const auto input_index{node.getInputs().at(graph::operation::Reshape::Input::INPUT)};
+  const auto input_index{node.getInputs().at(graph::operation::ReshapeNode::Input::INPUT)};
 
   struct Param
   {
@@ -496,10 +496,10 @@ Stage StageGenerator::generate(const graph::operation::Reshape::Node &node)
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::Softmax::Node &node)
+Stage StageGenerator::generate(const graph::operation::SoftmaxNode &node)
 {
   const auto output_index{node.getOutputs().at(0)};
-  const auto input_index{node.getInputs().at(graph::operation::Softmax::Input::INPUT)};
+  const auto input_index{node.getInputs().at(graph::operation::SoftmaxNode::Input::INPUT)};
   const auto scale_index{node.param().scale_index};
 
   assert(_ctx.at(scale_index).shape().rank() == 0);
@@ -531,13 +531,13 @@ Stage StageGenerator::generate(const graph::operation::Softmax::Node &node)
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::NOP::Node & /* node */)
+Stage StageGenerator::generate(const graph::operation::NOPNode & /* node */)
 {
   // DO NOTHING
   return nullptr;
 }
 
-Stage StageGenerator::generate(const graph::operation::Permute::Node & /* node */)
+Stage StageGenerator::generate(const graph::operation::PermuteNode & /* node */)
 {
   throw "Unsupported";
 }
index 1cbf72b..4a48086 100644 (file)
@@ -37,15 +37,15 @@ public:
 
   virtual std::shared_ptr<ITensorBuilder> tensor_builder() override { return _tensor_builder; }
 
-  virtual Stage generate(const graph::operation::Conv2D::Implicit::Node &node) override;
-  virtual Stage generate(const graph::operation::MaxPool2D::Implicit::Node &node) override;
-  virtual Stage generate(const graph::operation::AvgPool2D::Implicit::Node &node) override;
-  virtual Stage generate(const graph::operation::Concat::Node &node) override;
-  virtual Stage generate(const graph::operation::FullyConnected::Node &node) override;
-  virtual Stage generate(const graph::operation::Reshape::Node &node) override;
-  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::Conv2DNode &node) override;
+  virtual Stage generate(const graph::operation::MaxPool2DNode &node) override;
+  virtual Stage generate(const graph::operation::AvgPool2DNode &node) override;
+  virtual Stage generate(const graph::operation::ConcatNode &node) override;
+  virtual Stage generate(const graph::operation::FullyConnectedNode &node) override;
+  virtual Stage generate(const graph::operation::ReshapeNode &node) override;
+  virtual Stage generate(const graph::operation::SoftmaxNode &node) override;
+  virtual Stage generate(const graph::operation::NOPNode &node) override;
+  virtual Stage generate(const graph::operation::PermuteNode &node) override;
   virtual Stage generate(const graph::operation::AddNode &node) override;
 
 private:
index 468cb37..f415c71 100644 (file)
@@ -34,28 +34,27 @@ InitializerGenerator::InitializerGenerator(const neurun::graph::operand::Set &ct
   // DO NOTHING
 }
 
-Initializer InitializerGenerator::generate(const graph::operation::Conv2D::Implicit::Node &node)
+Initializer InitializerGenerator::generate(const graph::operation::Conv2DNode &node)
 {
-  using graph::operation::Conv2D::Implicit::Input;
+  using graph::operation::Conv2DNode;
 
   Initializer ret;
-  ret.push_back({node.getInputs().at(Input::KERNEL), generateWeight(node)});
-  ret.push_back({node.getInputs().at(Input::BIAS), generateBias(node)});
+  ret.push_back({node.getInputs().at(Conv2DNode::Input::KERNEL), generateWeight(node)});
+  ret.push_back({node.getInputs().at(Conv2DNode::Input::BIAS), generateBias(node)});
   return ret;
 }
 
-Initializer InitializerGenerator::generate(const graph::operation::FullyConnected::Node &node)
+Initializer InitializerGenerator::generate(const graph::operation::FullyConnectedNode &node)
 {
-  using graph::operation::FullyConnected::Input;
+  using graph::operation::FullyConnectedNode;
 
   Initializer ret;
-  ret.push_back({node.getInputs().at(Input::WEIGHT), generateWeight(node)});
-  ret.push_back({node.getInputs().at(Input::BIAS), generateBias(node)});
+  ret.push_back({node.getInputs().at(FullyConnectedNode::Input::WEIGHT), generateWeight(node)});
+  ret.push_back({node.getInputs().at(FullyConnectedNode::Input::BIAS), generateBias(node)});
   return ret;
 }
 
-InitializerFn
-InitializerGenerator::generateWeight(const graph::operation::Conv2D::Implicit::Node &node)
+InitializerFn InitializerGenerator::generateWeight(const graph::operation::Conv2DNode &node)
 {
   const auto ker_index{node.getInputs().at(1)};
 
@@ -75,8 +74,7 @@ InitializerGenerator::generateWeight(const graph::operation::Conv2D::Implicit::N
   };
 }
 
-InitializerFn
-InitializerGenerator::generateWeight(const graph::operation::FullyConnected::Node &node)
+InitializerFn InitializerGenerator::generateWeight(const graph::operation::FullyConnectedNode &node)
 {
   const auto weight_index{node.getInputs().at(1)};
   const auto input_index{node.getInputs().at(0)};
@@ -151,8 +149,7 @@ InitializerGenerator::generateWeight(const graph::operation::FullyConnected::Nod
   }
 }
 
-InitializerFn
-InitializerGenerator::generateBias(const graph::operation::Conv2D::Implicit::Node &node)
+InitializerFn InitializerGenerator::generateBias(const graph::operation::Conv2DNode &node)
 {
   // TODO Refactor so we can reuse the common code
 
@@ -176,7 +173,7 @@ InitializerGenerator::generateBias(const graph::operation::Conv2D::Implicit::Nod
   };
 }
 
-InitializerFn InitializerGenerator::generateBias(const graph::operation::FullyConnected::Node &node)
+InitializerFn InitializerGenerator::generateBias(const graph::operation::FullyConnectedNode &node)
 {
   const auto bias_index{node.getInputs().at(2)};
 
index b7e7302..859504a 100644 (file)
@@ -34,15 +34,15 @@ public:
   InitializerGenerator(const neurun::graph::operand::Set &ctx);
 
 public:
-  Initializer generate(const graph::operation::Conv2D::Implicit::Node &node) override;
-  Initializer generate(const graph::operation::FullyConnected::Node &node) override;
+  Initializer generate(const graph::operation::Conv2DNode &node) override;
+  Initializer generate(const graph::operation::FullyConnectedNode &node) override;
 
 private:
-  InitializerFn generateWeight(const graph::operation::Conv2D::Implicit::Node &node);
-  InitializerFn generateWeight(const graph::operation::FullyConnected::Node &node);
+  InitializerFn generateWeight(const graph::operation::Conv2DNode &node);
+  InitializerFn generateWeight(const graph::operation::FullyConnectedNode &node);
 
-  InitializerFn generateBias(const graph::operation::Conv2D::Implicit::Node &node);
-  InitializerFn generateBias(const graph::operation::FullyConnected::Node &node);
+  InitializerFn generateBias(const graph::operation::Conv2DNode &node);
+  InitializerFn generateBias(const graph::operation::FullyConnectedNode &node);
 
 private:
   const neurun::graph::operand::Set &_ctx;
index 8382aa2..105324d 100644 (file)
@@ -50,14 +50,14 @@ StageGenerator::StageGenerator(const neurun::graph::operand::Set &operand_ctx,
   // DO NOTHING
 }
 
-Stage StageGenerator::generate(const graph::operation::Conv2D::Implicit::Node &node)
+Stage StageGenerator::generate(const graph::operation::Conv2DNode &node)
 {
-  using namespace graph::operation::Conv2D::Implicit;
+  using graph::operation::Conv2DNode;
 
   const auto ofm_index{node.getOutputs().at(0)};
-  const auto ifm_index{node.getInputs().at(Input::INPUT)};
-  const auto ker_index{node.getInputs().at(Input::KERNEL)};
-  const auto bias_index{node.getInputs().at(Input::BIAS)};
+  const auto ifm_index{node.getInputs().at(Conv2DNode::Input::INPUT)};
+  const auto ker_index{node.getInputs().at(Conv2DNode::Input::KERNEL)};
+  const auto bias_index{node.getInputs().at(Conv2DNode::Input::BIAS)};
 
   const auto vstride_index{node.param().vstride_index};
   const auto hstride_index{node.param().hstride_index};
@@ -137,12 +137,12 @@ Stage StageGenerator::generate(const graph::operation::Conv2D::Implicit::Node &n
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::MaxPool2D::Implicit::Node &node)
+Stage StageGenerator::generate(const graph::operation::MaxPool2DNode &node)
 {
   VERBOSE(MaxPool2D) << "generate CPU MaxPool2D" << std::endl;
 
   const auto ofm_index{node.getOutputs().at(0)};
-  const auto ifm_index{node.getInputs().at(graph::operation::MaxPool2D::Implicit::Input::INPUT)};
+  const auto ifm_index{node.getInputs().at(graph::operation::MaxPool2DNode::Input::INPUT)};
 
   const auto kh_index{node.param().kh_index};
   const auto kw_index{node.param().kw_index};
@@ -233,12 +233,12 @@ Stage StageGenerator::generate(const graph::operation::MaxPool2D::Implicit::Node
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::AvgPool2D::Implicit::Node &node)
+Stage StageGenerator::generate(const graph::operation::AvgPool2DNode &node)
 {
   VERBOSE(AvgPool2D) << "generate CPU AvgPool2D" << std::endl;
 
   const auto ofm_index{node.getOutputs().at(0)};
-  const auto ifm_index{node.getInputs().at(graph::operation::AvgPool2D::Implicit::Input::INPUT)};
+  const auto ifm_index{node.getInputs().at(graph::operation::AvgPool2DNode::Input::INPUT)};
 
   const auto kh_index{node.param().kh_index};
   const auto kw_index{node.param().kw_index};
@@ -333,7 +333,7 @@ Stage StageGenerator::generate(const graph::operation::AvgPool2D::Implicit::Node
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::Concat::Node &node)
+Stage StageGenerator::generate(const graph::operation::ConcatNode &node)
 {
   VERBOSE(Concat) << "generate CPU Concat" << std::endl;
 
@@ -387,16 +387,16 @@ Stage StageGenerator::generate(const graph::operation::Concat::Node &node)
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::FullyConnected::Node &node)
+Stage StageGenerator::generate(const graph::operation::FullyConnectedNode &node)
 {
   VERBOSE(FullyConnected) << "generate CPU FullyConnected" << std::endl;
 
-  using namespace graph::operation::FullyConnected;
+  using graph::operation::FullyConnectedNode;
 
   const auto output_index{node.getOutputs().at(0)};
-  const auto input_index{node.getInputs().at(Input::INPUT)};
-  const auto weight_index{node.getInputs().at(Input::WEIGHT)};
-  const auto bias_index{node.getInputs().at(Input::BIAS)};
+  const auto input_index{node.getInputs().at(FullyConnectedNode::Input::INPUT)};
+  const auto weight_index{node.getInputs().at(FullyConnectedNode::Input::WEIGHT)};
+  const auto bias_index{node.getInputs().at(FullyConnectedNode::Input::BIAS)};
   const auto activation_index{node.param().activation_index};
 
   // Construct operation parameters
@@ -448,10 +448,10 @@ Stage StageGenerator::generate(const graph::operation::FullyConnected::Node &nod
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::Reshape::Node &node)
+Stage StageGenerator::generate(const graph::operation::ReshapeNode &node)
 {
   const auto output_index{node.getOutputs().at(0)};
-  const auto input_index{node.getInputs().at(graph::operation::Reshape::Input::INPUT)};
+  const auto input_index{node.getInputs().at(graph::operation::ReshapeNode::Input::INPUT)};
 
   struct Param
   {
@@ -485,12 +485,12 @@ Stage StageGenerator::generate(const graph::operation::Reshape::Node &node)
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::Softmax::Node &node)
+Stage StageGenerator::generate(const graph::operation::SoftmaxNode &node)
 {
   VERBOSE(Softmax) << "generate CPU Softmax" << std::endl;
 
   const auto output_index{node.getOutputs().at(0)};
-  const auto input_index{node.getInputs().at(graph::operation::Softmax::Input::INPUT)};
+  const auto input_index{node.getInputs().at(graph::operation::SoftmaxNode::Input::INPUT)};
   const auto scale_index{node.param().scale_index};
 
   struct Param
@@ -530,13 +530,13 @@ Stage StageGenerator::generate(const graph::operation::Softmax::Node &node)
   };
 }
 
-Stage StageGenerator::generate(const graph::operation::NOP::Node & /* node */)
+Stage StageGenerator::generate(const graph::operation::NOPNode & /* node */)
 {
   // DO NOTHING
   return nullptr;
 }
 
-Stage StageGenerator::generate(const graph::operation::Permute::Node &node)
+Stage StageGenerator::generate(const graph::operation::PermuteNode &node)
 {
   VERBOSE(Permute) << "generate CPU Permute" << std::endl;
 
index ede9243..cb99b1a 100644 (file)
@@ -38,15 +38,15 @@ public:
 
   virtual std::shared_ptr<ITensorBuilder> tensor_builder() override { return _tensor_builder; }
 
-  virtual Stage generate(const graph::operation::Conv2D::Implicit::Node &node) override;
-  virtual Stage generate(const graph::operation::MaxPool2D::Implicit::Node &node) override;
-  virtual Stage generate(const graph::operation::AvgPool2D::Implicit::Node &node) override;
-  virtual Stage generate(const graph::operation::Concat::Node &node) override;
-  virtual Stage generate(const graph::operation::FullyConnected::Node &node) override;
-  virtual Stage generate(const graph::operation::Reshape::Node &node) override;
-  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::Conv2DNode &node) override;
+  virtual Stage generate(const graph::operation::MaxPool2DNode &node) override;
+  virtual Stage generate(const graph::operation::AvgPool2DNode &node) override;
+  virtual Stage generate(const graph::operation::ConcatNode &node) override;
+  virtual Stage generate(const graph::operation::FullyConnectedNode &node) override;
+  virtual Stage generate(const graph::operation::ReshapeNode &node) override;
+  virtual Stage generate(const graph::operation::SoftmaxNode &node) override;
+  virtual Stage generate(const graph::operation::NOPNode &node) override;
+  virtual Stage generate(const graph::operation::PermuteNode &node) override;
   virtual Stage generate(const graph::operation::AddNode &node) override;
 
 private:
index 89a17a7..6aca1e4 100644 (file)
@@ -52,27 +52,18 @@ struct IInitializerGenerator
 {
   virtual ~IInitializerGenerator() = default;
 
-  virtual Initializer generate(const graph::operation::Conv2D::Implicit::Node &)
+  virtual Initializer generate(const graph::operation::Conv2DNode &) { return Initializer{}; }
+  virtual Initializer generate(const graph::operation::MaxPool2DNode &) { return Initializer{}; }
+  virtual Initializer generate(const graph::operation::AvgPool2DNode &) { return Initializer{}; }
+  virtual Initializer generate(const graph::operation::ConcatNode &) { return Initializer{}; }
+  virtual Initializer generate(const graph::operation::FullyConnectedNode &)
   {
     return Initializer{};
   }
-  virtual Initializer generate(const graph::operation::MaxPool2D::Implicit::Node &)
-  {
-    return Initializer{};
-  }
-  virtual Initializer generate(const graph::operation::AvgPool2D::Implicit::Node &)
-  {
-    return Initializer{};
-  }
-  virtual Initializer generate(const graph::operation::Concat::Node &) { return Initializer{}; }
-  virtual Initializer generate(const graph::operation::FullyConnected::Node &)
-  {
-    return Initializer{};
-  }
-  virtual Initializer generate(const graph::operation::Reshape::Node &) { return Initializer{}; }
-  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::ReshapeNode &) { return Initializer{}; }
+  virtual Initializer generate(const graph::operation::SoftmaxNode &) { return Initializer{}; }
+  virtual Initializer generate(const graph::operation::NOPNode &) { return Initializer{}; }
+  virtual Initializer generate(const graph::operation::PermuteNode &) { return Initializer{}; }
   virtual Initializer generate(const graph::operation::AddNode &) { return Initializer{}; }
 };
 
index 8ecb3f1..58e0272 100644 (file)
@@ -54,15 +54,15 @@ struct IStageGenerator
 
   virtual std::shared_ptr<ITensorBuilder> tensor_builder() = 0;
 
-  virtual Stage generate(const graph::operation::Conv2D::Implicit::Node &node) = 0;
-  virtual Stage generate(const graph::operation::MaxPool2D::Implicit::Node &node) = 0;
-  virtual Stage generate(const graph::operation::AvgPool2D::Implicit::Node &node) = 0;
-  virtual Stage generate(const graph::operation::Concat::Node &node) = 0;
-  virtual Stage generate(const graph::operation::FullyConnected::Node &node) = 0;
-  virtual Stage generate(const graph::operation::Reshape::Node &node) = 0;
-  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::Conv2DNode &node) = 0;
+  virtual Stage generate(const graph::operation::MaxPool2DNode &node) = 0;
+  virtual Stage generate(const graph::operation::AvgPool2DNode &node) = 0;
+  virtual Stage generate(const graph::operation::ConcatNode &node) = 0;
+  virtual Stage generate(const graph::operation::FullyConnectedNode &node) = 0;
+  virtual Stage generate(const graph::operation::ReshapeNode &node) = 0;
+  virtual Stage generate(const graph::operation::SoftmaxNode &node) = 0;
+  virtual Stage generate(const graph::operation::NOPNode &node) = 0;
+  virtual Stage generate(const graph::operation::PermuteNode &node) = 0;
   virtual Stage generate(const graph::operation::AddNode &node) = 0;
 };
 
index d410690..e788836 100644 (file)
@@ -44,10 +44,10 @@ public:
     if (backend_all_str.compare("none") != 0)
     {
       VERBOSE(BackendResolver) << "Use backend for all ops: " << backend_all_str << std::endl;
-#define OP(InternalName, NnApiName)                                   \
-  {                                                                   \
-    auto backend = _backend_manager->get(backend_all_str);            \
-    _gen_map[typeid(graph::operation::InternalName::Node)] = backend; \
+#define OP(InternalName, NnApiName)                             \
+  {                                                             \
+    auto backend = _backend_manager->get(backend_all_str);      \
+    _gen_map[typeid(graph::operation::InternalName)] = backend; \
   }
 #include "graph/operation/Op.lst"
 #undef OP
@@ -60,7 +60,7 @@ public:
         ::nnfw::util::EnvVar{std::string("OP_BACKEND_") + #NnApiName}.asString("acl_cl");         \
     auto backend = _backend_manager->get(backend_str);                                            \
     VERBOSE(BackendResolver) << "backend for " << #NnApiName << ": " << backend_str << std::endl; \
-    _gen_map[typeid(graph::operation::InternalName::Node)] = backend;                             \
+    _gen_map[typeid(graph::operation::InternalName)] = backend;                                   \
   }
 
 #include "graph/operation/Op.lst"
index 4d6c44c..9393156 100644 (file)
@@ -30,7 +30,7 @@ namespace neurun
 namespace codegen
 {
 
-void Planner::visit(const graph::operation::Conv2D::Implicit::Node &node)
+void Planner::visit(const graph::operation::Conv2DNode &node)
 {
   // backend
   auto backend = node.lower_info()->backend();
@@ -44,7 +44,7 @@ void Planner::visit(const graph::operation::Conv2D::Implicit::Node &node)
   _builder.addStage(stage_gen->generate(node));
 }
 
-void Planner::visit(const graph::operation::MaxPool2D::Implicit::Node &node)
+void Planner::visit(const graph::operation::MaxPool2DNode &node)
 {
   // backend
   auto backend = node.lower_info()->backend();
@@ -58,7 +58,7 @@ void Planner::visit(const graph::operation::MaxPool2D::Implicit::Node &node)
   _builder.addStage(stage_gen->generate(node));
 }
 
-void Planner::visit(const graph::operation::AvgPool2D::Implicit::Node &node)
+void Planner::visit(const graph::operation::AvgPool2DNode &node)
 {
   // backend
   auto backend = node.lower_info()->backend();
@@ -72,7 +72,7 @@ void Planner::visit(const graph::operation::AvgPool2D::Implicit::Node &node)
   _builder.addStage(stage_gen->generate(node));
 }
 
-void Planner::visit(const graph::operation::Concat::Node &node)
+void Planner::visit(const graph::operation::ConcatNode &node)
 {
   // NOTE This implementation assumes concat over feature depth
   // TODO Remove this assumption
@@ -91,7 +91,7 @@ void Planner::visit(const graph::operation::Concat::Node &node)
   _builder.addStage(stage_gen->generate(node));
 }
 
-void Planner::visit(const graph::operation::FullyConnected::Node &node)
+void Planner::visit(const graph::operation::FullyConnectedNode &node)
 {
   VERBOSE(FullyConnected) << "Configure FULLY_CONNECTED operation" << std::endl;
 
@@ -107,7 +107,7 @@ void Planner::visit(const graph::operation::FullyConnected::Node &node)
   _builder.addStage(stage_gen->generate(node));
 }
 
-void Planner::visit(const graph::operation::Reshape::Node &node)
+void Planner::visit(const graph::operation::ReshapeNode &node)
 {
   const auto output_index{node.getOutputs().at(0)};
   const auto input_index{node.getInputs().at(0)};
@@ -140,7 +140,7 @@ void Planner::visit(const graph::operation::Reshape::Node &node)
   _builder.addStage(stage_gen->generate(node));
 }
 
-void Planner::visit(const graph::operation::Softmax::Node &node)
+void Planner::visit(const graph::operation::SoftmaxNode &node)
 {
   VERBOSE(Softmax) << "Configure SOFTMAX operation" << std::endl;
 
@@ -167,7 +167,7 @@ void Planner::visit(const graph::operation::Softmax::Node &node)
   _builder.addStage(stage_gen->generate(node));
 }
 
-void Planner::visit(const graph::operation::NOP::Node &node)
+void Planner::visit(const graph::operation::NOPNode &node)
 {
   // backend
   auto backend = node.lower_info()->backend();
@@ -181,7 +181,7 @@ void Planner::visit(const graph::operation::NOP::Node &node)
   _builder.addStage(stage_gen->generate(node));
 }
 
-void Planner::visit(const graph::operation::Permute::Node &node)
+void Planner::visit(const graph::operation::PermuteNode &node)
 {
   VERBOSE(Permute) << "Configure Permute operation" << std::endl;
 
index e1cdb76..1b96c17 100644 (file)
@@ -46,15 +46,15 @@ public:
   }
 
 public:
-  virtual void visit(const graph::operation::Conv2D::Implicit::Node &) override;
-  virtual void visit(const graph::operation::MaxPool2D::Implicit::Node &) override;
-  virtual void visit(const graph::operation::AvgPool2D::Implicit::Node &) override;
-  virtual void visit(const graph::operation::Concat::Node &) override;
-  virtual void visit(const graph::operation::Reshape::Node &) override;
-  virtual void visit(const graph::operation::FullyConnected::Node &) override;
-  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::Conv2DNode &) override;
+  virtual void visit(const graph::operation::MaxPool2DNode &) override;
+  virtual void visit(const graph::operation::AvgPool2DNode &) override;
+  virtual void visit(const graph::operation::ConcatNode &) override;
+  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;
 
 private:
index 28a9b25..52cae4a 100644 (file)
@@ -243,7 +243,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model,
 
       if (inputCount == 7)
       {
-        using GraphNode = neurun::graph::operation::Conv2D::Implicit::Node;
+        using GraphNode = neurun::graph::operation::Conv2DNode;
 
         graph.addOperation(nnfw::make_unique<GraphNode>(node_param));
       }
@@ -264,7 +264,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model,
 
       if (inputCount == 7)
       {
-        using GraphNode = neurun::graph::operation::MaxPool2D::Implicit::Node;
+        using GraphNode = neurun::graph::operation::MaxPool2DNode;
 
         graph.addOperation(nnfw::make_unique<GraphNode>(node_param));
       }
@@ -285,7 +285,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model,
 
       if (inputCount == 7)
       {
-        using GraphNode = neurun::graph::operation::AvgPool2D::Implicit::Node;
+        using GraphNode = neurun::graph::operation::AvgPool2DNode;
 
         graph.addOperation(nnfw::make_unique<GraphNode>(node_param));
       }
@@ -298,7 +298,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model,
     }
     case ANEURALNETWORKS_CONCATENATION:
     {
-      using GraphNode = neurun::graph::operation::Concat::Node;
+      using GraphNode = neurun::graph::operation::ConcatNode;
 
       graph.addOperation(nnfw::make_unique<GraphNode>(node_param));
 
@@ -306,7 +306,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model,
     }
     case ANEURALNETWORKS_RESHAPE:
     {
-      using GraphNode = neurun::graph::operation::Reshape::Node;
+      using GraphNode = neurun::graph::operation::ReshapeNode;
 
       graph.addOperation(nnfw::make_unique<GraphNode>(node_param));
 
@@ -314,7 +314,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model,
     }
     case ANEURALNETWORKS_FULLY_CONNECTED:
     {
-      using GraphNode = neurun::graph::operation::FullyConnected::Node;
+      using GraphNode = neurun::graph::operation::FullyConnectedNode;
 
       graph.addOperation(nnfw::make_unique<GraphNode>(node_param));
 
@@ -322,7 +322,7 @@ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model,
     }
     case ANEURALNETWORKS_SOFTMAX:
     {
-      using GraphNode = neurun::graph::operation::Softmax::Node;
+      using GraphNode = neurun::graph::operation::SoftmaxNode;
 
       graph.addOperation(nnfw::make_unique<GraphNode>(node_param));
 
index 6e10409..f21cde0 100644 (file)
@@ -29,7 +29,7 @@ namespace dumper
 
 using namespace neurun::graph::operation;
 
-void Dumper::visit(const Conv2D::Implicit::Node &node)
+void Dumper::visit(const Conv2DNode &node)
 {
   VERBOSE(LIR) << "* Conv2D(Implicit)" << std::endl;
   VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(0).value() << ") Kernel("
@@ -38,21 +38,21 @@ void Dumper::visit(const Conv2D::Implicit::Node &node)
   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
 }
 
-void Dumper::visit(const MaxPool2D::Implicit::Node &node)
+void Dumper::visit(const MaxPool2DNode &node)
 {
   VERBOSE(LIR) << "* MaxPool2D(Implicit)" << std::endl;
   VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(0).value() << ")" << std::endl;
   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
 }
 
-void Dumper::visit(const AvgPool2D::Implicit::Node &node)
+void Dumper::visit(const AvgPool2DNode &node)
 {
   VERBOSE(LIR) << "* AvgPool2D(Implicit)" << std::endl;
   VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(0).value() << ")" << std::endl;
   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
 }
 
-void Dumper::visit(const Concat::Node &node)
+void Dumper::visit(const ConcatNode &node)
 {
   VERBOSE(LIR) << "* Concat" << std::endl;
   std::string inputs;
@@ -64,7 +64,7 @@ void Dumper::visit(const Concat::Node &node)
   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
 }
 
-void Dumper::visit(const FullyConnected::Node &node)
+void Dumper::visit(const FullyConnectedNode &node)
 {
   VERBOSE(LIR) << "* FullyConnected" << std::endl;
   VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(0).value() << ") Weight("
@@ -73,7 +73,7 @@ void Dumper::visit(const FullyConnected::Node &node)
   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
 }
 
-void Dumper::visit(const Reshape::Node &node)
+void Dumper::visit(const ReshapeNode &node)
 {
   VERBOSE(LIR) << "* Reshape" << std::endl;
   // TODO The shape index should be "node.getInputs().at(1).value()" but not valid for now
@@ -83,14 +83,14 @@ void Dumper::visit(const Reshape::Node &node)
   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
 }
 
-void Dumper::visit(const Softmax::Node &node)
+void Dumper::visit(const SoftmaxNode &node)
 {
   VERBOSE(LIR) << "* Softmax" << std::endl;
   VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(0).value() << ")" << std::endl;
   VERBOSE(LIR) << "  - Output : OFM(" << node.getOutputs().at(0).value() << ")" << std::endl;
 }
 
-void Dumper::visit(const NOP::Node &node)
+void Dumper::visit(const NOPNode &node)
 {
   VERBOSE(LIR) << "* NOP" << std::endl;
   std::string inputs, outputs;
@@ -106,7 +106,7 @@ void Dumper::visit(const NOP::Node &node)
   VERBOSE(LIR) << "  - Outputs : OFM(" << outputs << ")" << std::endl;
 }
 
-void Dumper::visit(const Permute::Node &node)
+void Dumper::visit(const PermuteNode &node)
 {
   VERBOSE(LIR) << "* Permute" << std::endl;
   VERBOSE(LIR) << "  - Inputs : IFM(" << node.getInputs().at(0).value() << ")" << std::endl;
index 00fe9cd..d8ed270 100644 (file)
@@ -32,15 +32,15 @@ public:
   Dumper() = default;
 
 public:
-  void visit(const graph::operation::Conv2D::Implicit::Node &node) override;
-  void visit(const graph::operation::MaxPool2D::Implicit::Node &node) override;
-  void visit(const graph::operation::AvgPool2D::Implicit::Node &node) override;
-  void visit(const graph::operation::Concat::Node &node) override;
-  void visit(const graph::operation::FullyConnected::Node &node) override;
-  void visit(const graph::operation::Reshape::Node &node) override;
-  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::Conv2DNode &node) override;
+  void visit(const graph::operation::MaxPool2DNode &node) override;
+  void visit(const graph::operation::AvgPool2DNode &node) override;
+  void visit(const graph::operation::ConcatNode &node) override;
+  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;
 };
 
index 252a262..de732a5 100644 (file)
@@ -26,22 +26,22 @@ namespace graph
 namespace operation
 {
 
-enum Input
-{
-  LHS = 0,
-  RHS
-};
-
-struct Param
-{
-  operand::Index activation_index;
-};
-
 class AddNode : public graph::operation::Node
 {
 public:
   AddNode(const graph::operation::Node::InitParam &init_param);
 
+  enum Input
+  {
+    LHS = 0,
+    RHS
+  };
+
+  struct Param
+  {
+    operand::Index activation_index;
+  };
+
 public:
   virtual void accept(NodeVisitor &&) const override;
   virtual std::string getName() const override { return "Add"; }
index 8150d32..2ae767e 100644 (file)
@@ -27,14 +27,10 @@ namespace graph
 {
 namespace operation
 {
-namespace AvgPool2D
-{
-namespace Implicit
-{
 
-void Node::accept(NodeVisitor &&v) const { v.visit(*this); }
+void AvgPool2DNode::accept(NodeVisitor &&v) const { v.visit(*this); }
 
-Node::Node(const graph::operation::Node::InitParam &init_param)
+AvgPool2DNode::AvgPool2DNode(const graph::operation::Node::InitParam &init_param)
     : operation::Node{OperandConstraint::createExact(1u)}
 {
   assert(init_param.input_count == 7);
@@ -62,8 +58,6 @@ Node::Node(const graph::operation::Node::InitParam &init_param)
   _param.activation_index = operand::Index{init_param.inputs[6]};
 }
 
-} // namespace Implicit
-} // namespace AvgPool2D
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 8f4c455..2a4f4cb 100644 (file)
@@ -27,32 +27,28 @@ namespace graph
 {
 namespace operation
 {
-namespace AvgPool2D
-{
-namespace Implicit
-{
 
-enum Input
+class AvgPool2DNode : public graph::operation::Node
 {
-  INPUT = 0
-};
+public:
+  AvgPool2DNode(const graph::operation::Node::InitParam &init_param);
 
-struct Param
-{
-  operand::Index kw_index;
-  operand::Index kh_index;
+  enum Input
+  {
+    INPUT = 0
+  };
 
-  operand::Index hstride_index;
-  operand::Index vstride_index;
+  struct Param
+  {
+    operand::Index kw_index;
+    operand::Index kh_index;
 
-  operand::Index padding_index;
-  operand::Index activation_index;
-};
+    operand::Index hstride_index;
+    operand::Index vstride_index;
 
-class Node : public graph::operation::Node
-{
-public:
-  Node(const graph::operation::Node::InitParam &init_param);
+    operand::Index padding_index;
+    operand::Index activation_index;
+  };
 
 public:
   virtual void accept(NodeVisitor &&) const override;
@@ -65,8 +61,6 @@ private:
   Param _param;
 };
 
-} // namespace Implicit
-} // namespace AvgPool2D
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 255b710..e9c6efb 100644 (file)
@@ -27,12 +27,10 @@ namespace graph
 {
 namespace operation
 {
-namespace Concat
-{
 
-void Node::accept(NodeVisitor &&v) const { v.visit(*this); }
+void ConcatNode::accept(NodeVisitor &&v) const { v.visit(*this); }
 
-Node::Node(const graph::operation::Node::InitParam &init_param)
+ConcatNode::ConcatNode(const graph::operation::Node::InitParam &init_param)
     : operation::Node{OperandConstraint::createAtLeast(2u)}
 {
   assert(init_param.input_count >= 2); // At least one one input tensor and axis
@@ -57,7 +55,6 @@ Node::Node(const graph::operation::Node::InitParam &init_param)
   _param.axis_index = operand::Index{init_param.inputs[init_param.input_count - 1]};
 }
 
-} // namespace Concat
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 7710d46..f9ac208 100644 (file)
@@ -27,18 +27,16 @@ namespace graph
 {
 namespace operation
 {
-namespace Concat
-{
 
-struct Param
-{
-  operand::Index axis_index;
-};
-
-class Node : public graph::operation::Node
+class ConcatNode : public graph::operation::Node
 {
 public:
-  Node(const graph::operation::Node::InitParam &init_param);
+  ConcatNode(const graph::operation::Node::InitParam &init_param);
+
+  struct Param
+  {
+    operand::Index axis_index;
+  };
 
 public:
   virtual void accept(NodeVisitor &&) const override;
@@ -51,7 +49,6 @@ private:
   Param _param;
 };
 
-} // namespace Concat
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 4a248c7..0c35e81 100644 (file)
@@ -27,14 +27,10 @@ namespace graph
 {
 namespace operation
 {
-namespace Conv2D
-{
-namespace Implicit
-{
 
-void Node::accept(NodeVisitor &&v) const { v.visit(*this); }
+void Conv2DNode::accept(NodeVisitor &&v) const { v.visit(*this); }
 
-Node::Node(const graph::operation::Node::InitParam &init_param)
+Conv2DNode::Conv2DNode(const graph::operation::Node::InitParam &init_param)
     : operation::Node{OperandConstraint::createExact(3u)}
 {
   assert(init_param.input_count == 7 && init_param.output_count == 1);
@@ -59,8 +55,6 @@ Node::Node(const graph::operation::Node::InitParam &init_param)
   _param.activation_index = operand::Index{init_param.inputs[6]};
 }
 
-} // namespace Implicit
-} // namespace Conv2D
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index b0eec01..3bb4cc4 100644 (file)
@@ -27,31 +27,27 @@ namespace graph
 {
 namespace operation
 {
-namespace Conv2D
-{
-namespace Implicit
-{
 
-enum Input
+class Conv2DNode : public graph::operation::Node
 {
-  INPUT = 0,
-  KERNEL,
-  BIAS
-};
+public:
+  Conv2DNode(const graph::operation::Node::InitParam &);
 
-struct Param
-{
-  operand::Index hstride_index;
-  operand::Index vstride_index;
+  enum Input
+  {
+    INPUT = 0,
+    KERNEL,
+    BIAS
+  };
 
-  operand::Index padding_index;
-  operand::Index activation_index;
-};
+  struct Param
+  {
+    operand::Index hstride_index;
+    operand::Index vstride_index;
 
-class Node : public graph::operation::Node
-{
-public:
-  Node(const graph::operation::Node::InitParam &);
+    operand::Index padding_index;
+    operand::Index activation_index;
+  };
 
 public:
   virtual void accept(NodeVisitor &&) const override;
@@ -64,9 +60,7 @@ private:
   Param _param;
 };
 
-} // namespace Implicit
-} // namespace Conv2D
-} // namespace coperation
+} // namespace operation
 } // namespace graph
 } // namespace neurun
 
index 601436c..6b081ac 100644 (file)
@@ -27,12 +27,10 @@ namespace graph
 {
 namespace operation
 {
-namespace FullyConnected
-{
 
-void Node::accept(NodeVisitor &&v) const { v.visit(*this); }
+void FullyConnectedNode::accept(NodeVisitor &&v) const { v.visit(*this); }
 
-Node::Node(const graph::operation::Node::InitParam &init_param)
+FullyConnectedNode::FullyConnectedNode(const graph::operation::Node::InitParam &init_param)
     : operation::Node{OperandConstraint::createExact(3u)}
 {
   assert(init_param.input_count == 4 && init_param.output_count == 1);
@@ -50,7 +48,6 @@ Node::Node(const graph::operation::Node::InitParam &init_param)
   _param.activation_index = operand::Index{init_param.inputs[3]};
 }
 
-} // namespace FullyConnected
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 2c28452..73dc991 100644 (file)
@@ -27,25 +27,23 @@ namespace graph
 {
 namespace operation
 {
-namespace FullyConnected
-{
 
-enum Input
+class FullyConnectedNode : public graph::operation::Node
 {
-  INPUT = 0,
-  WEIGHT,
-  BIAS
-};
+public:
+  FullyConnectedNode(const graph::operation::Node::InitParam &init_param);
 
-struct Param
-{
-  operand::Index activation_index;
-};
+  enum Input
+  {
+    INPUT = 0,
+    WEIGHT,
+    BIAS
+  };
 
-class Node : public graph::operation::Node
-{
-public:
-  Node(const graph::operation::Node::InitParam &init_param);
+  struct Param
+  {
+    operand::Index activation_index;
+  };
 
 public:
   virtual void accept(NodeVisitor &&) const override;
@@ -58,7 +56,6 @@ private:
   Param _param;
 };
 
-} // namespace FullyConnected
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index fe5507b..5b1485c 100644 (file)
@@ -27,14 +27,10 @@ namespace graph
 {
 namespace operation
 {
-namespace MaxPool2D
-{
-namespace Implicit
-{
 
-void Node::accept(NodeVisitor &&v) const { v.visit(*this); }
+void MaxPool2DNode::accept(NodeVisitor &&v) const { v.visit(*this); }
 
-Node::Node(const graph::operation::Node::InitParam &init_param)
+MaxPool2DNode::MaxPool2DNode(const graph::operation::Node::InitParam &init_param)
     : operation::Node{OperandConstraint::createExact(1u)}
 {
   assert(init_param.input_count == 7);
@@ -62,8 +58,6 @@ Node::Node(const graph::operation::Node::InitParam &init_param)
   _param.activation_index = operand::Index{init_param.inputs[6]};
 }
 
-} // namespace Implicit
-} // namespace MaxPool2D
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index d626ec5..5e8e9f2 100644 (file)
@@ -27,46 +27,40 @@ namespace graph
 {
 namespace operation
 {
-namespace MaxPool2D
-{
-namespace Implicit
-{
 
-enum Input
+class MaxPool2DNode : public graph::operation::Node
 {
-  INPUT = 0
-};
+public:
+  MaxPool2DNode(const graph::operation::Node::InitParam &init_param);
 
-struct Param
-{
-  operand::Index kw_index;
-  operand::Index kh_index;
+  enum Input
+  {
+    INPUT = 0
+  };
 
-  operand::Index hstride_index;
-  operand::Index vstride_index;
+  struct Param
+  {
+    operand::Index kw_index;
+    operand::Index kh_index;
 
-  operand::Index padding_index;
-  operand::Index activation_index;
-};
+    operand::Index hstride_index;
+    operand::Index vstride_index;
+
+    operand::Index padding_index;
+    operand::Index activation_index;
+  };
 
-class Node : public graph::operation::Node
-{
 public:
   virtual void accept(NodeVisitor &&) const override;
   virtual std::string getName() const override { return "MaxPool2D"; }
 
 public:
-  Node(const graph::operation::Node::InitParam &init_param);
-
-public:
   const Param &param() const { return _param; }
 
 private:
   Param _param;
 };
 
-} // namespace Implicit
-} // namespace MaxPool2D
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 008320d..41a43b7 100644 (file)
@@ -25,17 +25,14 @@ namespace graph
 {
 namespace operation
 {
-namespace NOP
-{
 
-void Node::accept(NodeVisitor &&v) const { v.visit(*this); }
+void NOPNode::accept(NodeVisitor &&v) const { v.visit(*this); }
 
-Node::Node(const graph::operation::Node::InitParam &)
+NOPNode::NOPNode(const graph::operation::Node::InitParam &)
     : operation::Node{OperandConstraint::createExact(1u)}
 {
 }
 
-} // namespace NOP
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 193c5d4..3f22829 100644 (file)
@@ -27,20 +27,17 @@ namespace graph
 {
 namespace operation
 {
-namespace NOP
-{
 
-class Node : public graph::operation::Node
+class NOPNode : public graph::operation::Node
 {
 public:
-  Node(const graph::operation::Node::InitParam &);
+  NOPNode(const graph::operation::Node::InitParam &);
 
 public:
   virtual void accept(NodeVisitor &&) const override;
   virtual std::string getName() const override { return "NOP"; }
 };
 
-} // namespace NOP
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 9738948..0f2e7ec 100644 (file)
@@ -39,15 +39,15 @@ struct NodeVisitor
 {
   virtual ~NodeVisitor() = default;
 
-  virtual void visit(const Conv2D::Implicit::Node &) = 0;
-  virtual void visit(const MaxPool2D::Implicit::Node &) = 0;
-  virtual void visit(const AvgPool2D::Implicit::Node &) = 0;
-  virtual void visit(const Concat::Node &) = 0;
-  virtual void visit(const Reshape::Node &) = 0;
-  virtual void visit(const FullyConnected::Node &) = 0;
-  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 Conv2DNode &) = 0;
+  virtual void visit(const MaxPool2DNode &) = 0;
+  virtual void visit(const AvgPool2DNode &) = 0;
+  virtual void visit(const ConcatNode &) = 0;
+  virtual void visit(const ReshapeNode &) = 0;
+  virtual void visit(const FullyConnectedNode &) = 0;
+  virtual void visit(const SoftmaxNode &) = 0;
+  virtual void visit(const NOPNode &) = 0;
+  virtual void visit(const PermuteNode &) = 0;
   virtual void visit(const AddNode &) = 0;
 };
 
index 23b4123..763815f 100644 (file)
 
 // NOTE The relation between "Internal Name" and "NN API Name" is "1 : N".
 
-// Internal Name       | NN API Name
-OP(Conv2D::Implicit    , CONV_2D)
-OP(AvgPool2D::Implicit , AVERAGE_POOL_2D)
-OP(MaxPool2D::Implicit , MAX_POOL_2D)
-OP(Concat              , CONCATENATION)
-OP(FullyConnected      , FULLY_CONNECTED)
-OP(Reshape             , RESHAPE)
-OP(Softmax             , SOFTMAX)
+// Internal Name           | NN API Name
+OP(Conv2DNode              , CONV_2D)
+OP(AvgPool2DNode           , AVERAGE_POOL_2D)
+OP(MaxPool2DNode           , MAX_POOL_2D)
+OP(ConcatNode              , CONCATENATION)
+OP(FullyConnectedNode      , FULLY_CONNECTED)
+OP(ReshapeNode             , RESHAPE)
+OP(SoftmaxNode             , SOFTMAX)
index 30a2a1a..ae475cb 100644 (file)
@@ -26,19 +26,16 @@ namespace graph
 {
 namespace operation
 {
-namespace Permute
-{
 
-void Node::accept(NodeVisitor &&v) const { v.visit(*this); }
+void PermuteNode::accept(NodeVisitor &&v) const { v.visit(*this); }
 
-Node::Node(const operand::Index &input, const operand::Index &output)
+PermuteNode::PermuteNode(const operand::Index &input, const operand::Index &output)
     : operation::Node{OperandConstraint::createExact(1u)}
 {
   setInputs({input});
   setOutputs({output});
 }
 
-} // namespace Permute
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 1ebbbee..c496722 100644 (file)
@@ -25,20 +25,17 @@ namespace graph
 {
 namespace operation
 {
-namespace Permute
-{
 
-class Node : public graph::operation::Node
+class PermuteNode : public graph::operation::Node
 {
 public:
   virtual void accept(NodeVisitor &&) const override;
   virtual std::string getName() const override { return "Permute"; }
 
 public:
-  Node(const operand::Index &input, const operand::Index &output);
+  PermuteNode(const operand::Index &input, const operand::Index &output);
 };
 
-} // namespace Permute
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 5367b0a..6656abb 100644 (file)
@@ -27,12 +27,10 @@ namespace graph
 {
 namespace operation
 {
-namespace Reshape
-{
 
-void Node::accept(NodeVisitor &&v) const { v.visit(*this); }
+void ReshapeNode::accept(NodeVisitor &&v) const { v.visit(*this); }
 
-Node::Node(const graph::operation::Node::InitParam &init_param)
+ReshapeNode::ReshapeNode(const graph::operation::Node::InitParam &init_param)
     : operation::Node{OperandConstraint::createExact(1u)}
 {
   assert(init_param.input_count == 2 && init_param.output_count == 1);
@@ -48,7 +46,6 @@ Node::Node(const graph::operation::Node::InitParam &init_param)
   setOutputs({init_param.outputs[0]});
 }
 
-} // namespace Reshape
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 3959007..eb90a5a 100644 (file)
@@ -27,25 +27,22 @@ namespace graph
 {
 namespace operation
 {
-namespace Reshape
-{
 
-enum Input
+class ReshapeNode : public graph::operation::Node
 {
-  INPUT = 0
-};
+public:
+  ReshapeNode(const graph::operation::Node::InitParam &init_param);
+
+  enum Input
+  {
+    INPUT = 0
+  };
 
-class Node : public graph::operation::Node
-{
 public:
   virtual void accept(NodeVisitor &&) const override;
   virtual std::string getName() const override { return "Reshape"; }
-
-public:
-  Node(const graph::operation::Node::InitParam &init_param);
 };
 
-} // namespace Reshape
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 82b4bfe..3368da3 100644 (file)
@@ -27,12 +27,10 @@ namespace graph
 {
 namespace operation
 {
-namespace Softmax
-{
 
-void Node::accept(NodeVisitor &&v) const { v.visit(*this); }
+void SoftmaxNode::accept(NodeVisitor &&v) const { v.visit(*this); }
 
-Node::Node(const graph::operation::Node::InitParam &init_param)
+SoftmaxNode::SoftmaxNode(const graph::operation::Node::InitParam &init_param)
     : operation::Node{OperandConstraint::createExact(1u)}
 {
   assert(init_param.input_count == 2 && init_param.output_count == 1);
@@ -48,7 +46,6 @@ Node::Node(const graph::operation::Node::InitParam &init_param)
   _param.scale_index = operand::Index{init_param.inputs[1]};
 }
 
-} // namespace Softmax
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 8fc8ae8..0037648 100644 (file)
@@ -27,36 +27,32 @@ namespace graph
 {
 namespace operation
 {
-namespace Softmax
-{
 
-enum Input
+class SoftmaxNode : public graph::operation::Node
 {
-  INPUT = 0
-};
+public:
+  SoftmaxNode(const graph::operation::Node::InitParam &init_param);
+  enum Input
+  {
+    INPUT = 0
+  };
 
-struct Param
-{
-  operand::Index scale_index;
-};
+  struct Param
+  {
+    operand::Index scale_index;
+  };
 
-class Node : public graph::operation::Node
-{
 public:
   virtual void accept(NodeVisitor &&) const override;
   virtual std::string getName() const override { return "SoftMax"; }
 
 public:
-  Node(const graph::operation::Node::InitParam &init_param);
-
-public:
   const Param &param() const { return _param; }
 
 private:
   Param _param;
 };
 
-} // namespace Softmax
 } // namespace operation
 } // namespace graph
 } // namespace neurun
index 329f53d..e64f5e5 100644 (file)
@@ -140,7 +140,7 @@ operation::Index PermutationInsertionPass::insertPermute(const operand::Index &o
   operand.lower_info()->addUseBackend(operand.lower_info()->def_backends().getOnlyElement());
 
   // Insert permute operation to the graph
-  auto insert_node = nnfw::make_unique<operation::Permute::Node>(operand_index, out_operand_index);
+  auto insert_node = nnfw::make_unique<operation::PermuteNode>(operand_index, out_operand_index);
   insert_node->lower_info(
       nnfw::make_unique<operation::LowerInfo>(_graph.backend_resolver()->getDefaultBackend()));
 
index c0a0c90..2f2289f 100644 (file)
@@ -45,7 +45,7 @@ TEST(graph_operation_setIO, operation_setIO_conv)
   }
   uint32_t outoperand = graph.addOperand(shape, type).asInt();
 
-  using GraphNode = neurun::graph::operation::Conv2D::Implicit::Node;
+  using GraphNode = neurun::graph::operation::Conv2DNode;
 
   auto conv = nnfw::make_unique<GraphNode>(GraphNodeInitParam{7, params.data(), 1, &outoperand});
   ASSERT_EQ(conv->getInputs().at(Index{0}).asInt(), params[0]);
@@ -70,7 +70,7 @@ TEST(graph_operation_setIO, operation_setIO_concat)
   }
   uint32_t outoperand = graph.addOperand(shape, type).asInt();
 
-  using GraphNode = neurun::graph::operation::Concat::Node;
+  using GraphNode = neurun::graph::operation::ConcatNode;
 
   auto concat = nnfw::make_unique<GraphNode>(GraphNodeInitParam{7, params.data(), 1, &outoperand});