[neurun] Introduce getOperandLayout (#2591)
author이한종/동작제어Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Wed, 5 Sep 2018 04:18:02 +0000 (13:18 +0900)
committer박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Wed, 5 Sep 2018 04:18:02 +0000 (13:18 +0900)
Introduce `IBackendConfig::getOperandLayout` which returns
`operand::Layout` for each backend. Note that this assumes a backend
only support one type of operand layout.

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
runtimes/neurun/src/backend/IBackendConfig.h
runtimes/neurun/src/backend/acl_cl/BackendConfig.h
runtimes/neurun/src/backend/cpu/BackendConfig.h
runtimes/neurun/src/graph/operand/Layout.h [new file with mode: 0644]

index 7ba6291..85ae507 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __INTERNAL_IBACKEND_CONFIG_H__
 #define __INTERNAL_IBACKEND_CONFIG_H__
 
+#include "graph/operand/Layout.h"
+
 namespace neurun
 {
 namespace backend
@@ -11,6 +13,8 @@ struct IBackendConfig
   virtual ~IBackendConfig() = default;
 
   virtual void initialize() = 0;
+  // NOTE Assume backend has only one type of operand layout
+  virtual graph::operand::Layout getOperandLayout() = 0;
 };
 
 } // namespace backend
index 294950f..e0d1248 100644 (file)
@@ -19,6 +19,7 @@ public:
   }
 
   virtual void initialize() override;
+  virtual graph::operand::Layout getOperandLayout() { return graph::operand::Layout::NCHW; }
 };
 
 } // namespace acl_cl
index de5f7ee..a4ddf5d 100644 (file)
@@ -19,6 +19,7 @@ public:
   }
 
   virtual void initialize() override;
+  virtual graph::operand::Layout getOperandLayout() { return graph::operand::Layout::NHWC; }
 };
 
 } // namespace cpu
diff --git a/runtimes/neurun/src/graph/operand/Layout.h b/runtimes/neurun/src/graph/operand/Layout.h
new file mode 100644 (file)
index 0000000..d35667f
--- /dev/null
@@ -0,0 +1,22 @@
+#ifndef __NEURUN_GRAPH_OPERAND_LAYOUT_H__
+#define __NEURUN_GRAPH_OPERAND_LAYOUT_H__
+
+namespace neurun
+{
+namespace graph
+{
+namespace operand
+{
+
+enum class Layout
+{
+  UNKNOWN = 0,
+  NHWC,
+  NCHW
+};
+
+} // namespace operand
+} // namespace graph
+} // namespace neurun
+
+#endif // __NEURUN_GRAPH_OPERAND_LAYOUT_H__