Unverified Commit 6bd19ea9 authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

remove contains_key() (#1613)

* remove contains_key()

* fix logic error
parent a517ba09
......@@ -153,7 +153,8 @@ bool runtime::interpreter::INTBackend::call(shared_ptr<Function> function,
{
descriptor::TensorView* tv = op->get_output_tensor_ptr(i).get();
shared_ptr<runtime::HostTensorView> htv;
if (!contains_key(tensor_map, tv))
auto it = tensor_map.find(tv);
if (it == tensor_map.end())
{
// the output tensor is not in the tensor map so create a new tensor
const Shape& shape = op->get_output_shape(i);
......@@ -164,7 +165,7 @@ bool runtime::interpreter::INTBackend::call(shared_ptr<Function> function,
}
else
{
htv = tensor_map.at(tv);
htv = it->second;
}
op_outputs.push_back(htv);
}
......
......@@ -84,31 +84,6 @@ namespace ngraph
return rc;
}
template <typename U, typename T>
bool contains_key(const U& container, const T& obj)
{
bool rc = false;
for (auto o : container)
{
if (o.first == obj)
{
rc = true;
break;
}
}
return rc;
}
template <typename U, typename T>
void remove_from(U& container, const T& obj)
{
auto it = container.find(obj);
if (it != container.end())
{
container.erase(it);
}
}
size_t hash_combine(const std::vector<size_t>& list);
void dump(std::ostream& out, const void*, size_t);
......
......@@ -73,7 +73,7 @@ public:
bool compile(const shared_ptr<Function>& func)
{
if (!contains_key(m_function_map, func))
if (m_function_map.find(func) == m_function_map.end())
{
// Clone function
FunctionInstance instance;
......
......@@ -48,7 +48,7 @@ string ngraph::prepend_disabled(const string& test_case_name,
}
}
}
if (contains(blacklist, test_name))
if (blacklist.find(test_name) != blacklist.end())
{
rc = "DISABLED_" + test_name;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment