Commit b7e2fd7f authored by Robert Kimball's avatar Robert Kimball

add unit test to check that set_parameters_and_results is called

parent 9530267d
......@@ -6703,3 +6703,30 @@ NGRAPH_TEST(${BACKEND_NAME}, quantize_dynamic_offset)
EXPECT_EQ((vector<output_c_type>{1, 1, 2, 3, 3, 3, 4, 5, 5, 5, 6, 7}),
read_vector<output_c_type>(y));
}
NGRAPH_TEST(${BACKEND_NAME}, get_parameters_and_results)
{
Shape shape{2, 2};
auto A = make_shared<op::Parameter>(element::f32, shape);
auto B = make_shared<op::Parameter>(element::f32, shape);
auto C = make_shared<op::Parameter>(element::f32, shape);
auto f = make_shared<Function>((A + B) * C, ParameterVector{A, B, C});
auto backend = runtime::Backend::create("${BACKEND_NAME}");
// Create some tensors for input/output
shared_ptr<runtime::Tensor> a = backend->create_tensor(element::f32, shape);
shared_ptr<runtime::Tensor> b = backend->create_tensor(element::f32, shape);
shared_ptr<runtime::Tensor> c = backend->create_tensor(element::f32, shape);
shared_ptr<runtime::Tensor> result = backend->create_tensor(element::f32, shape);
copy_data(a, test::NDArray<float, 2>({{1, 2}, {3, 4}}).get_vector());
copy_data(b, test::NDArray<float, 2>({{5, 6}, {7, 8}}).get_vector());
copy_data(c, test::NDArray<float, 2>({{9, 10}, {11, 12}}).get_vector());
auto handle = backend->compile(f);
auto parameters = handle->get_parameters();
auto results = handle->get_results();
EXPECT_EQ(parameters.size(), 3);
EXPECT_EQ(results.size(), 1);
}
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