[neurun] Introduce operand::LowerInfo (#2622)
author이한종/동작제어Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Thu, 6 Sep 2018 09:48:48 +0000 (18:48 +0900)
committer박세희/동작제어Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Thu, 6 Sep 2018 09:48:48 +0000 (18:48 +0900)
This commit introduces operand::LowerInfo which contains normalized
4D shape and tensor layout.

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
runtimes/neurun/src/graph/operand/LowerInfo.cc [new file with mode: 0644]
runtimes/neurun/src/graph/operand/LowerInfo.h [new file with mode: 0644]

diff --git a/runtimes/neurun/src/graph/operand/LowerInfo.cc b/runtimes/neurun/src/graph/operand/LowerInfo.cc
new file mode 100644 (file)
index 0000000..bdc392d
--- /dev/null
@@ -0,0 +1,14 @@
+#include "LowerInfo.h"
+
+namespace neurun
+{
+namespace graph
+{
+namespace operand
+{
+
+// NO IMPLEMENTATION YET
+
+} // namespace operand
+} // namespace graph
+} // namespace neurun
diff --git a/runtimes/neurun/src/graph/operand/LowerInfo.h b/runtimes/neurun/src/graph/operand/LowerInfo.h
new file mode 100644 (file)
index 0000000..7030d62
--- /dev/null
@@ -0,0 +1,64 @@
+#ifndef __NEURUN_GRAPH_OPERAND_LOWER_INFO_H__
+#define __NEURUN_GRAPH_OPERAND_LOWER_INFO_H__
+
+#include <stdint.h>
+
+#include "LayoutSet.h"
+
+namespace neurun
+{
+namespace graph
+{
+namespace operand
+{
+
+class LowerInfo
+{
+public:
+  class Shape4D
+  {
+  public:
+    Shape4D(uint32_t n, uint32_t h, uint32_t w, uint32_t c) : _n{n}, _h{h}, _w{w}, _c{c}
+    {
+      // DO NOTHING
+    }
+
+  public:
+    uint32_t n(void) const { return _n; }
+    uint32_t h(void) const { return _h; }
+    uint32_t w(void) const { return _w; }
+    uint32_t c(void) const { return _c; }
+
+  private:
+    uint32_t _n;
+    uint32_t _h;
+    uint32_t _w;
+    uint32_t _c;
+  };
+
+public:
+  LowerInfo(const Shape4D &shape) : _shape{shape}
+  {
+    // DO NOTHING
+  }
+
+public:
+  const Shape4D &shape(void) const { return _shape; }
+  const LayoutSet &def_layouts(void) const { return _def_layouts; }
+  const LayoutSet &use_layouts(void) const { return _use_layouts; }
+
+public:
+  void addDefLayout(const Layout &layout) { _def_layouts.add(layout); }
+  void addUseLayout(const Layout &layout) { _use_layouts.add(layout); }
+
+private:
+  Shape4D _shape;
+  LayoutSet _def_layouts;
+  LayoutSet _use_layouts;
+};
+
+} // namespace operand
+} // namespace graph
+} // namespace neurun
+
+#endif // __NEURUN_GRAPH_OPERAND_LOWED_INFO_H__