[locomotiv] Node domain annotation for Session (#3682)
author박천교/On-Device Lab(SR)/Engineer/삼성전자 <ch.bahk@samsung.com>
Wed, 5 Jun 2019 06:39:10 +0000 (15:39 +0900)
committer박종현/On-Device Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 5 Jun 2019 06:39:10 +0000 (15:39 +0900)
Session now annotate node domain on input setting, and delete annotated
domain information on destruction.

Signed-off-by: Cheongyo Bahk <ch.bahk@samsung.com>
contrib/locomotiv/src/Session.cpp
contrib/locomotiv/src/Session.internal.test.cpp

index 8bccbda..5e58bf6 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "NodeDataImpl.h"
 #include "NodeExecution.h"
+#include "NodeDomain.h"
 
 namespace locomotiv
 {
@@ -29,6 +30,7 @@ Session::~Session()
   {
     auto node = _graph->nodes()->at(i);
     erase_annot_data(node);
+    erase_annot_domain(node);
   }
 }
 
@@ -62,6 +64,7 @@ bool Session::set_input(uint32_t index, std::unique_ptr<NodeData> &&data)
   }
 
   annot_data(pull, std::move(data));
+  annot_domain(pull, loco::Domain::Tensor);
   return true;
 }
 
index ed7d08d..4869722 100644 (file)
@@ -17,8 +17,9 @@
 #include "locomotiv/Session.h"
 #include "locomotiv/NodeData.h"
 
-// This flie is internal test because it includes this local header
+// This flie is internal test because it includes these local header
 #include "NodeDataImpl.h"
+#include "NodeDomain.h"
 
 #include <loco.h>
 #include <nncc/core/ADT/tensor/Shape.h>
@@ -55,8 +56,12 @@ TEST(Session, dtor)
 
     auto data_annotated = locomotiv::annot_data(input->node());
     ASSERT_NE(data_annotated, nullptr);
+    auto domain_annotated = locomotiv::annot_domain(input->node());
+    ASSERT_EQ(domain_annotated, loco::Domain::Tensor);
   }
 
   auto data_annotated = locomotiv::annot_data(input->node());
   ASSERT_EQ(data_annotated, nullptr);
+  auto domain_annotated = locomotiv::annot_domain(input->node());
+  ASSERT_EQ(domain_annotated, loco::Domain::Unknown);
 }