[neurun] Use Index as key for unordered_set (#2590)
author이한종/동작제어Lab(SR)/Engineer/삼성전자 <hanjoung.lee@samsung.com>
Wed, 5 Sep 2018 04:15:24 +0000 (13:15 +0900)
committer오형석/동작제어Lab(SR)/Staff Engineer/삼성전자 <hseok82.oh@samsung.com>
Wed, 5 Sep 2018 04:15:24 +0000 (13:15 +0900)
This commit revises `unordered_set`s to use `graph::Index` as key
which used `int` as key because hash function was not exist.

Signed-off-by: Hanjoung Lee <hanjoung.lee@samsung.com>
runtimes/neurun/src/backend/acl_cl/TensorBuilder.cc
runtimes/neurun/src/backend/acl_cl/TensorBuilder.h
runtimes/neurun/src/backend/cpu/TensorBuilder.cc
runtimes/neurun/src/backend/cpu/TensorBuilder.h

index 4ff2efd..880ff2d 100644 (file)
@@ -20,7 +20,7 @@ void TensorBuilder::mark(const ::neurun::graph::operand::Index &ind)
 {
   assert(_tensors.size() == 0);
 
-  _inds.insert(ind.asInt());
+  _inds.insert(ind);
 }
 
 void TensorBuilder::prepare(codegen::Plan &plan,
index c593416..e3c8664 100644 (file)
@@ -30,7 +30,7 @@ public:
   std::shared_ptr<::arm_compute::CLTensor> at(const ::neurun::graph::operand::Index &ind);
 
 private:
-  std::unordered_set<int> _inds;
+  std::unordered_set<graph::operand::Index> _inds;
   std::unordered_map<int, std::shared_ptr<::arm_compute::CLTensor>> _tensors;
 };
 
index f25a954..3b7fa80 100644 (file)
@@ -20,7 +20,7 @@ void TensorBuilder::mark(const ::neurun::graph::operand::Index &ind)
 {
   assert(_tensors.size() == 0);
 
-  _inds.insert(ind.asInt());
+  _inds.insert(ind);
 }
 
 void TensorBuilder::prepare(codegen::Plan &plan,
index 80fa12f..37f3581 100644 (file)
@@ -6,6 +6,7 @@
 
 #include "backend/ITensorBuilder.h"
 #include "backend/cpu/operand/Tensor.h"
+#include "graph/operand/Index.h"
 
 namespace neurun
 {
@@ -29,7 +30,7 @@ public:
   std::shared_ptr<operand::Tensor> at(const ::neurun::graph::operand::Index &ind);
 
 private:
-  std::unordered_set<int> _inds;
+  std::unordered_set<graph::operand::Index> _inds;
   std::unordered_map<int, std::shared_ptr<operand::Tensor>> _tensors;
 };