Unverified Commit 5d3456e4 authored by Robert Kimball's avatar Robert Kimball Committed by GitHub

Merge pull request #3324 from NervanaSystems/bob/unit-test

Changes to get allow NNP to pass tests
parents f4d44bbc 9733630b
......@@ -89,7 +89,8 @@ NGRAPH_TEST(${BACKEND_NAME}, batch_mat_mul_forward)
auto backend_results = execute(backend_f, batchmatmul_args, "${BACKEND_NAME}");
for (size_t i = 0; i < ref_results.size(); i++)
{
EXPECT_TRUE(test::all_close(ref_results.at(i), backend_results.at(i), 1.0e-4f, 1.0e-4f));
EXPECT_TRUE(test::all_close_f(
ref_results.at(i), backend_results.at(i), DEFAULT_FLOAT_TOLERANCE_BITS + 3));
}
}
#endif
......@@ -55,16 +55,19 @@ NGRAPH_TEST(${BACKEND_NAME}, computation_reuse)
vector<float> weights(512, 0.5f);
vector<float> rv(128);
auto a = backend->create_tensor(element::f32, shape_a, input.data());
auto b = backend->create_tensor(element::f32, shape_b, weights.data());
auto result = backend->create_tensor(element::f32, shape_r, rv.data());
auto a = backend->create_tensor(element::f32, shape_a);
auto b = backend->create_tensor(element::f32, shape_b);
auto result = backend->create_tensor(element::f32, shape_r);
auto handle = backend->compile(f);
handle->call_with_validate({result}, {a, b});
copy_data(a, input);
copy_data(b, weights);
vector<float> rv_saved(rv);
auto exec = backend->compile(f);
exec->call_with_validate({result}, {a, b});
vector<float> rv_saved(read_vector<float>(result));
b->set_stale(false);
handle->call_with_validate({result}, {a, b});
EXPECT_TRUE(test::all_close_f(rv_saved, rv));
exec->call_with_validate({result}, {a, b});
EXPECT_TRUE(test::all_close_f(rv_saved, read_vector<float>(result)));
}
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