nGraph unit tests refactoring (#1495)
This commit is contained in:
@@ -33,16 +33,15 @@
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "util/all_close.hpp"
|
||||
#include "util/all_close_f.hpp"
|
||||
#include "util/ndarray.hpp"
|
||||
#include "util/engine/test_engines.hpp"
|
||||
#include "util/test_case.hpp"
|
||||
#include "util/test_control.hpp"
|
||||
#include "util/test_tools.hpp"
|
||||
|
||||
using namespace std;
|
||||
using namespace ngraph;
|
||||
|
||||
static string s_manifest = "${MANIFEST}";
|
||||
using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME});
|
||||
|
||||
NGRAPH_TEST(${BACKEND_NAME}, acosh)
|
||||
{
|
||||
@@ -50,19 +49,15 @@ NGRAPH_TEST(${BACKEND_NAME}, acosh)
|
||||
auto A = make_shared<op::Parameter>(element::f32, shape);
|
||||
auto f = make_shared<Function>(make_shared<op::Acosh>(A), ParameterVector{A});
|
||||
|
||||
auto backend = runtime::Backend::create("${BACKEND_NAME}");
|
||||
|
||||
// Create some tensors for input/output
|
||||
auto a = backend->create_tensor(element::f32, shape);
|
||||
vector<float> input{0.f, 1.f, -1.f, 2.f, -2.f, 3.f, -3.f, 4.f, 5.f, 10.f, 100.f};
|
||||
copy_data(a, input);
|
||||
auto result = backend->create_tensor(element::f32, shape);
|
||||
auto handle = backend->compile(f);
|
||||
handle->call_with_validate({result}, {a});
|
||||
vector<float> expected;
|
||||
for (float f : input)
|
||||
{
|
||||
expected.push_back(std::acosh(f));
|
||||
}
|
||||
EXPECT_TRUE(test::all_close_f(expected, read_vector<float>(result)));
|
||||
|
||||
auto test_case = test::TestCase<TestEngine>(f);
|
||||
test_case.add_input<float>(input);
|
||||
test_case.add_expected_output<float>(shape, expected);
|
||||
test_case.run();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user