Fix SetIO test (#4715)
author오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 13 Mar 2019 09:16:34 +0000 (18:16 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 13 Mar 2019 09:16:34 +0000 (18:16 +0900)
- Remove dynamic casting
- Remove unused header
- Remove unused alias

Signed-off-by: Hyeongseok Oh <hseok82.oh@samsung.com>
runtimes/neurun/test/graph/operation/SetIO.cc

index dc389da..ccba87d 100644 (file)
@@ -17,9 +17,6 @@
 #include <gtest/gtest.h>
 
 #include "graph/Graph.h"
-#include "cpp14/memory.h"
-#include "model/operation/Conv2DNode.h"
-#include "model/operation/ConcatNode.h"
 #include "model/operand/Index.h"
 #include "model/operand/IndexSet.h"
 #include "frontend/wrapper/OperationFactory.h"
@@ -28,7 +25,6 @@
 
 using Index = neurun::model::operand::IO::Index;
 using IndexSet = neurun::model::operand::IndexSet;
-using GraphNodeInitParam = neurun::model::operation::Node::InitParam; // TODO remove this
 
 TEST(graph_operation_setIO, operation_setIO_conv)
 {
@@ -46,11 +42,12 @@ TEST(graph_operation_setIO, operation_setIO_conv)
   }
   uint32_t outoperand = graph.addOperand(shape, type).value();
 
-  using GraphNode = neurun::model::operation::Conv2DNode;
+  using GraphNode = neurun::model::operation::Node;
 
-  auto conv =
-      std::unique_ptr<GraphNode>{dynamic_cast<GraphNode *>(OperationFactory::instance().create(
-          ANEURALNETWORKS_CONV_2D, {7, params.data(), 1, &outoperand}))};
+  auto conv = std::unique_ptr<GraphNode>{OperationFactory::instance().create(
+      ANEURALNETWORKS_CONV_2D, {7, params.data(), 1, &outoperand})};
+
+  ASSERT_NE(conv, nullptr);
   ASSERT_EQ(conv->getInputs().at(Index{0}).value(), params[0]);
   conv->setInputs({8, 9, 10});
   ASSERT_NE(conv->getInputs().at(Index{0}).value(), params[0]);
@@ -73,12 +70,12 @@ TEST(graph_operation_setIO, operation_setIO_concat)
   }
   uint32_t outoperand = graph.addOperand(shape, type).value();
 
-  using GraphNode = neurun::model::operation::ConcatNode;
+  using GraphNode = neurun::model::operation::Node;
 
-  auto concat =
-      std::unique_ptr<GraphNode>{dynamic_cast<GraphNode *>(OperationFactory::instance().create(
-          ANEURALNETWORKS_CONCATENATION, {7, params.data(), 1, &outoperand}))};
+  auto concat = std::unique_ptr<GraphNode>{OperationFactory::instance().create(
+      ANEURALNETWORKS_CONCATENATION, {7, params.data(), 1, &outoperand})};
 
+  ASSERT_NE(concat, nullptr);
   ASSERT_EQ(concat->getInputs().size(), 6);
   ASSERT_EQ(concat->getInputs().at(Index{0}).value(), params[0]);