[neurun] Enable setting the data type of mode operand::Object (#4881)
author장지섭/On-Device Lab(SR)/Engineer/삼성전자 <jiseob.jang@samsung.com>
Wed, 27 Mar 2019 10:56:38 +0000 (19:56 +0900)
committer오형석/On-Device Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 27 Mar 2019 10:56:38 +0000 (19:56 +0900)
This commit Enable setting the data type of made operand::Object.

Signed-off-by: jiseob.jang <jiseob.jang@samsung.com>
runtimes/neurun/core/include/model/operand/Info.h
runtimes/neurun/core/include/model/operand/Object.h
runtimes/neurun/core/include/model/operand/TypeInfo.h

index 9065196..cda2ddf 100644 (file)
@@ -43,6 +43,8 @@ public:
 public:
   const Shape &shape() const { return _shape; }
   const TypeInfo &typeInfo() const { return _typeInfo; }
+  void type(const DataType &type) { _typeInfo.type(type); }
+
   size_t total_size() const
   {
     const auto &dims = _shape.dims();
index 558ebd9..4581ad8 100644 (file)
@@ -26,6 +26,7 @@
 #include "Info.h"
 #include "graph/operand/ParentInfo.h" // TODO Remove this dependency
 #include "model/operation/IndexList.h"
+#include "model/operand/DataType.h"
 
 namespace neurun
 {
@@ -70,6 +71,9 @@ public:
   void removeDef(const operation::Index &idx);
 
 public:
+  void type(const DataType &type) { _info.type(type); };
+
+public:
   void data(std::unique_ptr<Data> &&data) { _data = std::move(data); }
   const Data &data(void) const
   {
@@ -117,7 +121,7 @@ public:
   graph::operand::ParentInfo *parent_info();
 
 private:
-  const Info _info;
+  Info _info;
   std::unique_ptr<Data> _data;
   Usage _usage;
 
index 5cbe213..10a47d9 100644 (file)
@@ -43,6 +43,9 @@ public:
   float scale() const { return _scale; }
   int32_t offset() const { return _offset; }
 
+public:
+  void type(const DataType &type) { _type = type; }
+
 private:
   DataType _type;
   float _scale;