Commit c92198fb authored by Yixing Lao's avatar Yixing Lao

fix namespace collision in runtime test

parent 953b8c59
......@@ -22,15 +22,15 @@
using namespace std;
using namespace ngraph;
using namespace ngraph::runtime;
using namespace ngraph::runtime::eigen;
namespace ngeigen = ngraph::runtime::eigen;
TEST(runtime, test_add)
{
auto x = make_shared<PrimaryTensorView<element::Float32>>(Shape{2, 2});
auto x = make_shared<ngeigen::PrimaryTensorView<element::Float32>>(Shape{2, 2});
*x = std::vector<float>{1, 2, 3, 4};
auto y = make_shared<PrimaryTensorView<element::Float32>>(Shape{2, 2});
auto y = make_shared<ngeigen::PrimaryTensorView<element::Float32>>(Shape{2, 2});
*y = std::vector<float>{5, 6, 7, 8};
auto z = make_shared<PrimaryTensorView<element::Float32>>(Shape{2, 2});
auto z = make_shared<ngeigen::PrimaryTensorView<element::Float32>>(Shape{2, 2});
add(*x, *y, *z);
ASSERT_EQ((vector<float>{6, 8, 10, 12}), z->get_vector());
}
......@@ -58,25 +58,26 @@ TEST(runtime, test_add_multiply)
// 4: t0
auto instructions = make_shared<std::vector<std::shared_ptr<ngraph::runtime::Instruction>>>();
// a + b -> t0
instructions->push_back(make_shared<AddInstruction<element::Float32>>(0, 1, 4));
instructions->push_back(make_shared<ngeigen::AddInstruction<element::Float32>>(0, 1, 4));
// t0 * c -> result
instructions->push_back(make_shared<MultiplyInstruction<element::Float32>>(4, 2, 3));
instructions->push_back(make_shared<ReturnInstruction>());
instructions->push_back(make_shared<ngeigen::MultiplyInstruction<element::Float32>>(4, 2, 3));
instructions->push_back(make_shared<ngeigen::ReturnInstruction>());
runtime::CallFrame cf{3,
1,
PTVs{make_shared<PrimaryTensorView<element::Float32>>(Shape{2, 2})},
0,
instructions};
runtime::CallFrame cf{
3,
1,
PTVs{make_shared<ngeigen::PrimaryTensorView<element::Float32>>(Shape{2, 2})},
0,
instructions};
// Create some tensors for input/output
auto a = make_shared<PrimaryTensorView<element::Float32>>(Shape{2, 2});
auto a = make_shared<ngeigen::PrimaryTensorView<element::Float32>>(Shape{2, 2});
*a = vector<float>{1, 2, 3, 4};
auto b = make_shared<PrimaryTensorView<element::Float32>>(Shape{2, 2});
auto b = make_shared<ngeigen::PrimaryTensorView<element::Float32>>(Shape{2, 2});
*b = vector<float>{5, 6, 7, 8};
auto c = make_shared<PrimaryTensorView<element::Float32>>(Shape{2, 2});
auto c = make_shared<ngeigen::PrimaryTensorView<element::Float32>>(Shape{2, 2});
*c = vector<float>{9, 10, 11, 12};
auto result = make_shared<PrimaryTensorView<element::Float32>>(Shape{2, 2});
auto result = make_shared<ngeigen::PrimaryTensorView<element::Float32>>(Shape{2, 2});
cf(PTVs{a, b, c}, PTVs{result});
ASSERT_EQ((vector<float>{54, 80, 110, 144}), result->get_vector());
......
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