[ONNX] Refactoring tests on API 2.0 (#21840)

* Tests in onnx_import_rnn.in.cpp moved to API 2.0

* Tests in onnx_import_signal.in.cpp moved to API 2.0
This commit is contained in:
Georgy Krivoruchko 2023-12-22 05:51:15 -08:00 committed by GitHub
parent ef3526c3c0
commit b0feb2f632
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 176 additions and 338 deletions

View File

@ -21,24 +21,23 @@
#include "common_test_utils/test_control.hpp"
#include "common_test_utils/test_tools.hpp"
#include "gtest/gtest.h"
#include "ngraph/file_util.hpp"
#include "ngraph/ngraph.hpp"
#include "onnx_import/onnx.hpp"
#include "onnx_utils.hpp"
#include "openvino/op/gru_sequence.hpp"
#include "openvino/op/lstm_sequence.hpp"
#include "openvino/op/rnn_sequence.hpp"
using namespace ngraph;
OPENVINO_SUPPRESS_DEPRECATED_START
using namespace ov;
using namespace ov::frontend::onnx::tests;
static std::string s_manifest = ngraph::file_util::path_join(ov::test::utils::getExecutableDirectory(), "${MANIFEST}");
static std::string s_manifest = onnx_backend_manifest("${MANIFEST}");
static std::string s_device = backend_name_to_device("${BACKEND_NAME}");
// ONNX LSTM tests (implemented by nGraph LSTMCell and LSTMSequence)
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_default_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_fwd_default_const.onnx"));
auto model = convert_model("lstm_fwd_default_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>({0.68172926f, 1.1405563f, -0.03931177f, -0.03759607f}); // X
test_case.add_expected_output<float>(Shape{2, 1, 1, 2},
@ -50,11 +49,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_default_const) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_reverse_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_reverse_const.onnx"));
auto model = convert_model("lstm_reverse_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>({0.68172926f, 1.1405563f, -0.03931177f, -0.03759607f}); // X
test_case.add_expected_output<float>(Shape{2, 1, 1, 2},
@ -66,10 +63,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_reverse_const) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_bidir_const) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/lstm_bidir_const.onnx"));
auto model = convert_model("lstm_bidir_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>({0.68172926f, 1.1405563f, -0.03931177f, -0.03759607f}); // X
test_case.add_expected_output<float>(Shape{2, 2, 1, 2},
@ -90,11 +86,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_bidir_const) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_with_clip_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_fwd_clip_const.onnx"));
auto model = convert_model("lstm_fwd_clip_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>({0.68172926f, 1.1405563f, -0.03931177f, -0.03759607f}); // X
test_case.add_expected_output<float>(Shape{2, 1, 1, 2},
@ -106,11 +100,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_with_clip_const) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_mixed_seq_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_fwd_mixed_seq_const.onnx"));
auto model = convert_model("lstm_fwd_mixed_seq_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>({0.68172926f, 1.1405563f, -0.03931177f, -0.03759607f}); // X
test_case.add_expected_output<float>(Shape{2, 1, 2, 3},
@ -137,11 +129,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_mixed_seq_const) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_reverse_mixed_seq_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_reverse_mixed_seq_const.onnx"));
auto model = convert_model("lstm_reverse_mixed_seq_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>({0.68172926f, 1.1405563f, -0.03931177f, -0.03759607f}); // X
test_case.add_expected_output<float>(Shape{2, 1, 2, 3},
@ -168,11 +158,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_reverse_mixed_seq_const) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_bidir_mixed_seq_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_bidir_mixed_seq_const.onnx"));
auto model = convert_model("lstm_bidir_mixed_seq_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(
{0.68172926f, 1.1405563f, -0.03931177f, -0.03759607f, 1.1397027f, 0.60444903f, 1.3246384f, -0.28191715f}); // X
@ -216,11 +204,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_bidir_mixed_seq_const) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_with_clip_peepholes) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_fwd_with_clip_peepholes.onnx"));
auto model = convert_model("lstm_fwd_with_clip_peepholes.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>({-0.455351f, -0.276391f, -0.185934f, -0.269585f}); // X
test_case.add_input<float>({-0.494659f, // W
0.0453352f,
@ -284,11 +270,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_with_clip_peepholes) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_mixed_seq) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_fwd_mixed_seq.onnx"));
auto model = convert_model("lstm_fwd_mixed_seq.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
int hidden_size{3};
test_case.add_input<float>({1.f, 2.f, 10.f, 11.f}); // X
test_case.add_input<float>({0.1f, 0.2f, 0.3f, 0.4f, 1.f, 2.f, 3.f, 4.f, 10.f, 11.f, 12.f, 13.f}); // W
@ -322,11 +306,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_mixed_seq) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_hardsigmoid_activation) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_fwd_hardsigmoid_activation.onnx"));
auto model = convert_model("lstm_fwd_hardsigmoid_activation.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
// X
test_case.add_input<float>({-0.455351f, -0.276391f, -0.185934f, -0.269585f});
@ -377,11 +359,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_hardsigmoid_activation) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_large_batch_no_clip) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_fwd_large_batch_no_clip.onnx"));
auto model = convert_model("lstm_fwd_large_batch_no_clip.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
std::size_t seq_length = 2;
std::size_t batch_size = 32;
@ -419,11 +399,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_fwd_large_batch_no_clip) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_bdir_short_input_seq_peepholes) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_bdir_short_input_seq.onnx"));
auto model = convert_model("lstm_bdir_short_input_seq.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
// X
test_case.add_input<float>({-0.455351f, -0.276391f, -0.185934f, -0.269585f});
@ -465,11 +443,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_bdir_short_input_seq_peepholes) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_mixed_seq_reverse) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_mixed_seq_reverse.onnx"));
auto model = convert_model("lstm_mixed_seq_reverse.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
size_t hidden_size = 3;
@ -508,9 +484,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_mixed_seq_reverse) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_import_only_lstm_dynamic_batch_seq_all_inputs) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dynamic_shapes/lstm_dyn_batch_seq.onnx"));
auto model = convert_model("dynamic_shapes/lstm_dyn_batch_seq.onnx");
auto batch_size = Dimension::dynamic();
auto seq_length = Dimension::dynamic();
@ -520,19 +494,16 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_import_only_lstm_dynamic_batch_seq_all
auto Y_h_expected_output = PartialShape{num_directions, batch_size, hidden_size};
auto Y_c_expected_output = PartialShape{num_directions, batch_size, hidden_size};
EXPECT_EQ(function->get_output_size(), 3);
EXPECT_EQ(function->get_output_partial_shape(0), Y_expected_output);
EXPECT_EQ(function->get_output_partial_shape(1), Y_h_expected_output);
EXPECT_EQ(function->get_output_partial_shape(2), Y_c_expected_output);
EXPECT_EQ(model->get_output_size(), 3);
EXPECT_EQ(model->get_output_partial_shape(0), Y_expected_output);
EXPECT_EQ(model->get_output_partial_shape(1), Y_h_expected_output);
EXPECT_EQ(model->get_output_partial_shape(2), Y_c_expected_output);
EXPECT_EQ(count_ops_of_type<op::v5::LSTMSequence>(function), 1);
EXPECT_EQ(count_ops_of_type<op::v5::LSTMSequence>(model), 1);
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_import_only_lstm_dynamic_batch_seq_3_inputs) {
auto function =
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dynamic_shapes/lstm_dyn_batch_seq_3_inputs.onnx"));
auto model = convert_model("dynamic_shapes/lstm_dyn_batch_seq_3_inputs.onnx");
auto batch_size = Dimension::dynamic();
auto seq_length = Dimension::dynamic();
@ -542,21 +513,18 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_import_only_lstm_dynamic_batch_seq_3_i
auto Y_h_expected_output = PartialShape{num_directions, batch_size, hidden_size};
auto Y_c_expected_output = PartialShape{num_directions, batch_size, hidden_size};
EXPECT_EQ(function->get_output_size(), 3);
EXPECT_EQ(function->get_output_partial_shape(0), Y_expected_output);
EXPECT_EQ(function->get_output_partial_shape(1), Y_h_expected_output);
EXPECT_EQ(function->get_output_partial_shape(2), Y_c_expected_output);
EXPECT_EQ(model->get_output_size(), 3);
EXPECT_EQ(model->get_output_partial_shape(0), Y_expected_output);
EXPECT_EQ(model->get_output_partial_shape(1), Y_h_expected_output);
EXPECT_EQ(model->get_output_partial_shape(2), Y_c_expected_output);
EXPECT_EQ(count_ops_of_type<op::v5::LSTMSequence>(function), 1);
EXPECT_EQ(count_ops_of_type<op::v5::LSTMSequence>(model), 1);
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_lstm_dynamic_batch_size_and_seq_len) {
auto function =
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/lstm_dynamic_batch_size_and_seq_len.onnx"));
auto model = convert_model("lstm_dynamic_batch_size_and_seq_len.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>({1, 2, 3, 4, 5, 6});
test_case.add_expected_output<float>(Shape{1, 1, 3, 2},
@ -667,11 +635,9 @@ protected:
};
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_defaults_fwd_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_defaults_fwd_const.onnx"));
auto model = convert_model("gru_defaults_fwd_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -711,10 +677,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_defaults_fwd_cons
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_defaults_fwd) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/gru_defaults_fwd.onnx"));
auto model = convert_model("gru_defaults_fwd.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -758,12 +723,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_defaults_fwd) {
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_activations_const) {
// activations: relu, sigmoid
auto function =
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_fwd_activations_relu_sigmoid_const.onnx"));
auto model = convert_model("gru_fwd_activations_relu_sigmoid_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -800,12 +762,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_activations_c
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_activations_relu_hardsigmoid) {
// activations: relu, hardsigmoid
auto function =
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_fwd_activations_relu_hardsigmoid.onnx"));
auto model = convert_model("gru_fwd_activations_relu_hardsigmoid.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -847,11 +806,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_activations_r
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_mixed_seq_len) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_fwd_mixed_seq_len.onnx"));
auto model = convert_model("gru_fwd_mixed_seq_len.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -897,11 +854,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_mixed_seq_len
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_mixed_seq_len_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_fwd_mixed_seq_len_const.onnx"));
auto model = convert_model("gru_fwd_mixed_seq_len_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
@ -939,11 +894,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_mixed_seq_len
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_reverse_mixed_seq_len_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_reverse_mixed_seq_len_const.onnx"));
auto model = convert_model("gru_reverse_mixed_seq_len_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
@ -981,11 +934,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_reverse_mixed_seq
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_bidir_mixed_seq_len_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_bidir_mixed_seq_len_const.onnx"));
auto model = convert_model("gru_bidir_mixed_seq_len_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
@ -1023,10 +974,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_bidir_mixed_seq_l
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_rev_clip) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/gru_rev_clip.onnx"));
auto model = convert_model("gru_rev_clip.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -1069,11 +1019,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_rev_clip) {
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_rev_clip_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_rev_clip_const.onnx"));
auto model = convert_model("gru_rev_clip_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -1113,10 +1061,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_rev_clip_const) {
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_reverse_const) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/gru_reverse_const.onnx"));
auto model = convert_model("gru_reverse_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -1156,10 +1103,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_reverse_const) {
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_reverse) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/gru_reverse.onnx"));
auto model = convert_model("gru_reverse.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -1202,11 +1148,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_reverse) {
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_bias_initial_h_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_fwd_bias_initial_h_const.onnx"));
auto model = convert_model("gru_fwd_bias_initial_h_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -1246,11 +1190,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_bias_initial_
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_bias_initial_h) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_fwd_bias_initial_h.onnx"));
auto model = convert_model("gru_fwd_bias_initial_h.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -1295,11 +1237,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_bias_initial_
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_bidirectional_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_bidirectional_const.onnx"));
auto model = convert_model("gru_bidirectional_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -1338,10 +1278,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_bidirectional_con
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_bidirectional) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/gru_bidirectional.onnx"));
auto model = convert_model("gru_bidirectional.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_bdir_W);
@ -1383,11 +1322,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_bidirectional) {
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_linear_before_reset_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_fwd_linear_before_reset_const.onnx"));
auto model = convert_model("gru_fwd_linear_before_reset_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -1427,11 +1364,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_linear_before
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_linear_before_reset) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/gru_fwd_linear_before_reset.onnx"));
auto model = convert_model("gru_fwd_linear_before_reset.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -1475,12 +1410,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_fwd_linear_before
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_defaults_fwd_const_dynamic) {
auto function =
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dynamic_shapes/gru_defaults_fwd_const_dynamic.onnx"));
auto model = convert_model("dynamic_shapes/gru_defaults_fwd_const_dynamic.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{4, 3, 2}, in_X);
// Y
@ -1520,10 +1452,7 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_gru_defaults_fwd_cons
}
OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_import_only_gru_defaults_fwd_const_dynamic) {
auto function =
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dynamic_shapes/gru_defaults_fwd_const_dynamic.onnx"));
auto model = convert_model("dynamic_shapes/gru_defaults_fwd_const_dynamic.onnx");
auto batch_size = Dimension::dynamic();
auto seq_length = Dimension::dynamic();
@ -1532,11 +1461,11 @@ OPENVINO_TEST_F(${BACKEND_NAME}, GRUSequenceOp, onnx_model_import_only_gru_defau
auto Y_expected_output = PartialShape{batch_size, num_directions, seq_length, hidden_size};
auto Y_h_expected_output = PartialShape{num_directions, batch_size, hidden_size};
EXPECT_EQ(function->get_output_size(), 2);
EXPECT_EQ(function->get_output_partial_shape(0), Y_expected_output);
EXPECT_EQ(function->get_output_partial_shape(1), Y_h_expected_output);
EXPECT_EQ(model->get_output_size(), 2);
EXPECT_EQ(model->get_output_partial_shape(0), Y_expected_output);
EXPECT_EQ(model->get_output_partial_shape(1), Y_h_expected_output);
EXPECT_EQ(count_ops_of_type<op::v5::GRUSequence>(function), 1);
EXPECT_EQ(count_ops_of_type<op::v5::GRUSequence>(model), 1);
}
// RNNLikeSequenceOp test fixture for test setup reuse
@ -1622,11 +1551,9 @@ protected:
};
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_defaults_fwd_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/rnn_defaults_fwd_const.onnx"));
auto model = convert_model("rnn_defaults_fwd_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -1666,10 +1593,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_defaults_fwd_cons
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_defaults_fwd) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/rnn_defaults_fwd.onnx"));
auto model = convert_model("rnn_defaults_fwd.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -1712,11 +1638,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_defaults_fwd) {
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_fwd_activations_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/rnn_fwd_activations_const.onnx"));
auto model = convert_model("rnn_fwd_activations_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
@ -1756,11 +1680,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_fwd_activations_c
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_fwd_activations) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/rnn_fwd_activations.onnx"));
auto model = convert_model("rnn_fwd_activations.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -1802,11 +1724,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_fwd_activations)
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_fwd_mixed_seq_len_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/rnn_fwd_mixed_seq_len_const.onnx"));
auto model = convert_model("rnn_fwd_mixed_seq_len_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -1846,11 +1766,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_fwd_mixed_seq_len
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_fwd_mixed_seq_len) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/rnn_fwd_mixed_seq_len.onnx"));
auto model = convert_model("rnn_fwd_mixed_seq_len.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -1896,11 +1814,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_fwd_mixed_seq_len
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_reverse_mixed_seq_len_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/rnn_reverse_mixed_seq_len_const.onnx"));
auto model = convert_model("rnn_reverse_mixed_seq_len_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -1936,11 +1852,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_reverse_mixed_seq
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_bidir_mixed_seq_len_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/rnn_bidir_mixed_seq_len_const.onnx"));
auto model = convert_model("rnn_bidir_mixed_seq_len_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -1980,11 +1894,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_bidir_mixed_seq_l
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_rev_clip_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/rnn_rev_clip_const.onnx"));
auto model = convert_model("rnn_rev_clip_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -2024,10 +1936,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_rev_clip_const) {
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_rev_clip) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/rnn_rev_clip.onnx"));
auto model = convert_model("rnn_rev_clip.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -2070,10 +1981,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_rev_clip) {
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_reverse_const) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/rnn_reverse_const.onnx"));
auto model = convert_model("rnn_reverse_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -2113,10 +2023,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_reverse_const) {
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_reverse) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/rnn_reverse.onnx"));
auto model = convert_model("rnn_reverse.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -2159,11 +2068,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_reverse) {
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_fwd_bias_initial_h_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/rnn_fwd_bias_initial_h_const.onnx"));
auto model = convert_model("rnn_fwd_bias_initial_h_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
// Y
@ -2203,11 +2110,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_fwd_bias_initial_
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_fwd_bias_initial_h) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/rnn_fwd_bias_initial_h.onnx"));
auto model = convert_model("rnn_fwd_bias_initial_h.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_W);
@ -2252,10 +2157,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_fwd_bias_initial_
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_bidirectional) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/rnn_bidirectional.onnx"));
auto model = convert_model("rnn_bidirectional.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
test_case.add_input<float>(in_bdir_W);
@ -2298,11 +2202,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_bidirectional) {
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_bidirectional_const) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/rnn_bidirectional_const.onnx"));
auto model = convert_model("rnn_bidirectional_const.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(in_X);
@ -2343,12 +2245,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_bidirectional_con
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_defaults_fwd_const_dynamic) {
auto function =
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dynamic_shapes/rnn_defaults_fwd_const_dynamic.onnx"));
auto model = convert_model("dynamic_shapes/rnn_defaults_fwd_const_dynamic.onnx");
auto test_case = ov::test::TestCase(function, s_device);
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{4, 3, 2}, in_X);
// Y
@ -2388,10 +2287,7 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_rnn_defaults_fwd_cons
}
OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_import_only_rnn_defaults_fwd_const_dynamic) {
auto function =
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dynamic_shapes/rnn_defaults_fwd_const_dynamic.onnx"));
auto model = convert_model("dynamic_shapes/rnn_defaults_fwd_const_dynamic.onnx");
auto batch_size = Dimension::dynamic();
auto seq_length = Dimension::dynamic();
@ -2400,9 +2296,9 @@ OPENVINO_TEST_F(${BACKEND_NAME}, RNNSequenceOp, onnx_model_import_only_rnn_defau
auto Y_expected_output = PartialShape{batch_size, num_directions, seq_length, hidden_size};
auto Y_h_expected_output = PartialShape{num_directions, batch_size, hidden_size};
EXPECT_EQ(function->get_output_size(), 2);
EXPECT_EQ(function->get_output_partial_shape(0), Y_expected_output);
EXPECT_EQ(function->get_output_partial_shape(1), Y_h_expected_output);
EXPECT_EQ(model->get_output_size(), 2);
EXPECT_EQ(model->get_output_partial_shape(0), Y_expected_output);
EXPECT_EQ(model->get_output_partial_shape(1), Y_h_expected_output);
EXPECT_EQ(count_ops_of_type<op::v5::RNNSequence>(function), 1);
EXPECT_EQ(count_ops_of_type<op::v5::RNNSequence>(model), 1);
}

View File

@ -4,8 +4,6 @@
#include <vector>
#include "ngraph/file_util.hpp"
// clang-format off
#ifdef ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS
#define DEFAULT_FLOAT_TOLERANCE_BITS ${BACKEND_NAME}_FLOAT_TOLERANCE_BITS
@ -16,23 +14,20 @@
// clang-format on
#include "common_test_utils/file_utils.hpp"
#include "default_opset.hpp"
#include "common_test_utils/test_case.hpp"
#include "onnx_import/onnx.hpp"
#include "common_test_utils/test_control.hpp"
#include "onnx_import/onnx.hpp"
#include "onnx_utils.hpp"
OPENVINO_SUPPRESS_DEPRECATED_START
using namespace ov;
using namespace ov::frontend::onnx::tests;
using namespace ngraph;
static std::string s_manifest = ngraph::file_util::path_join(ov::test::utils::getExecutableDirectory(), "${MANIFEST}");
static std::string s_manifest = onnx_backend_manifest("${MANIFEST}");
static std::string s_device = backend_name_to_device("${BACKEND_NAME}");
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("dft.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f,
3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f,
6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f,
@ -47,9 +42,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_only_real) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft_only_real.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("dft_only_real.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{3, 5, 1},
{
0.000000f,
@ -77,9 +71,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_only_real) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_onesided) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft_onesided.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("dft_onesided.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(
Shape{2, 4},
{0.000000f, 1.000000f, 2.000000f, 3.000000f, 4.000000f, 5.000000f, 6.000000f, 7.000000f});
@ -99,11 +92,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_onesided) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_onesided_skip_convert_to_complex) {
auto function =
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dft_onesided_skip_convert_to_complex.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("dft_onesided_skip_convert_to_complex.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(
Shape{2, 4, 1},
{0.000000f, 1.000000f, 2.000000f, 3.000000f, 4.000000f, 5.000000f, 6.000000f, 7.000000f});
@ -123,10 +113,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_onesided_skip_convert_to_complex)
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_length_provided) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dft_lenght_provided.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("dft_lenght_provided.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f,
3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f,
6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f,
@ -138,10 +126,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_length_provided) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_length_provided_onesided) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dft_lenght_provided_onesided.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("dft_lenght_provided_onesided.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{4, 3},
{0.000000f,
1.000000f,
@ -160,9 +146,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_length_provided_onesided) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inverse) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/dft_inverse.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("dft_inverse.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f,
3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f,
6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f,
@ -177,10 +162,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inverse) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_only_real) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dft_inverse_only_real.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("dft_inverse_only_real.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{3, 5, 1},
{0.000000f,
1.000000f,
@ -206,10 +189,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_only_real) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_onesided) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dft_inverse_onesided.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("dft_inverse_onesided.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{2, 3, 2},
{6.000000f,
0.000000f,
@ -229,20 +210,16 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_onesided) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_onesided_real_input) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dft_inverse_onesided_real_input.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("dft_inverse_onesided_real_input.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{2, 3, 1}, {1.000000f, 0.000000f, -1.000000f, 0.5000000f, -0.5000000f, 0.000000f});
test_case.add_expected_output<float>(Shape{2, 3, 1},
{0.750000f, -0.250000f, -0.500000f, 0.250000f, 0.250000f, -0.500000f});
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inversed_length_provided) {
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dft_inversed_lenght_provided.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("dft_inversed_lenght_provided.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{3, 5, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f,
3.000000f, 0.000000f, 4.000000f, 0.000000f, 5.000000f, 0.000000f,
6.000000f, 0.000000f, 7.000000f, 0.000000f, 8.000000f, 0.000000f,
@ -254,11 +231,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inversed_length_provided) {
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_length_provided_onesided) {
auto function =
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/dft_inverse_lenght_provided_onesided.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("dft_inverse_lenght_provided_onesided.onnx");
auto test_case = ov::test::TestCase(model, s_device);
test_case.add_input<float>(Shape{1, 3, 2}, {0.000000f, 0.000000f, 1.000000f, 0.000000f, 2.000000f, 0.000000f});
test_case.add_expected_output<float>(Shape{4, 3},
{0.000000f,
@ -276,11 +250,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_dft_inverse_length_provided_onesided)
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_onesided_real_input_no_window_default_length) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/stft_onesided_real_input_no_window_default_length.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("stft_onesided_real_input_no_window_default_length.onnx");
auto test_case = ov::test::TestCase(model, s_device);
const Shape signal_shape{1, 128, 1};
std::vector<float> signal(ov::shape_size(signal_shape));
std::iota(std::begin(signal), std::end(signal), 0.f);
@ -317,11 +288,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_onesided_real_input_no_window_def
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_real_input_no_window_default_length) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/stft_no_onesided_real_input_no_window_default_length.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("stft_no_onesided_real_input_no_window_default_length.onnx");
auto test_case = ov::test::TestCase(model, s_device);
const Shape signal_shape{1, 128, 1};
std::vector<float> signal(ov::shape_size(signal_shape));
std::iota(std::begin(signal), std::end(signal), 0.f);
@ -379,11 +347,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_real_input_no_window_
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_no_window_default_length) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/stft_no_onesided_complex_input_no_window_default_length.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("stft_no_onesided_complex_input_no_window_default_length.onnx");
auto test_case = ov::test::TestCase(model, s_device);
const Shape signal_shape{1, 128, 2};
std::vector<float> signal(ov::shape_size(signal_shape));
std::iota(std::begin(signal), std::end(signal), 0.f);
@ -872,11 +837,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_no_wind
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_no_window_default_length_2) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/stft_no_onesided_complex_input_no_window_default_length_2.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("stft_no_onesided_complex_input_no_window_default_length_2.onnx");
auto test_case = ov::test::TestCase(model, s_device);
const Shape signal_shape{2, 64, 2};
std::vector<float> signal(ov::shape_size(signal_shape));
std::iota(std::begin(signal), std::end(signal), 0.f);
@ -949,11 +911,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_no_wind
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_no_window_no_default_length) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/stft_no_onesided_complex_input_no_window_no_default_length.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("stft_no_onesided_complex_input_no_window_no_default_length.onnx");
auto test_case = ov::test::TestCase(model, s_device);
const Shape signal_shape{4, 32, 2};
std::vector<float> signal(ov::shape_size(signal_shape));
std::iota(std::begin(signal), std::end(signal), 0.f);
@ -1346,11 +1305,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_no_wind
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_given_window_default_length) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/stft_no_onesided_complex_input_given_window_default_length.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("stft_no_onesided_complex_input_given_window_default_length.onnx");
auto test_case = ov::test::TestCase(model, s_device);
const Shape signal_shape{3, 32, 2};
std::vector<float> signal(ov::shape_size(signal_shape));
std::iota(std::begin(signal), std::end(signal), 0.f);
@ -1430,11 +1386,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_given_w
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_given_window_no_default_length) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/stft_no_onesided_complex_input_given_window_no_default_length.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("stft_no_onesided_complex_input_given_window_no_default_length.onnx");
auto test_case = ov::test::TestCase(model, s_device);
const Shape signal_shape{2, 48, 2};
std::vector<float> signal(ov::shape_size(signal_shape));
std::iota(std::begin(signal), std::end(signal), 0.f);
@ -1487,11 +1440,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_no_onesided_complex_input_given_w
}
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_onesided_real_input_given_window_no_default_length) {
auto function = onnx_import::import_onnx_model(
file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/stft_onesided_real_input_given_window_no_default_length.onnx"));
auto test_case = ov::test::TestCase(function, s_device);
auto model = convert_model("stft_onesided_real_input_given_window_no_default_length.onnx");
auto test_case = ov::test::TestCase(model, s_device);
const Shape signal_shape{2, 32, 1};
std::vector<float> signal(ov::shape_size(signal_shape));
std::iota(std::begin(signal), std::end(signal), 0.f);
@ -1533,9 +1483,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_onesided_real_input_given_window_
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_proper_exception_if_non_const_frame_step) {
try {
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/stft_non_const_frame_step.onnx"));
convert_model("stft_non_const_frame_step.onnx");
FAIL() << "Unknown error during STFT import";
} catch (const std::runtime_error& exc) {
std::string msg{exc.what()};
@ -1545,9 +1493,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_proper_exception_if_non_const_fra
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_proper_exception_if_dynamic_singal_shape) {
try {
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/stft_dynamic_signal_shape.onnx"));
convert_model("stft_dynamic_signal_shape.onnx");
FAIL() << "Unknown error during STFT import";
} catch (const std::runtime_error& exc) {
std::string msg{exc.what()};
@ -1557,9 +1503,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_proper_exception_if_dynamic_singa
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_proper_exception_if_non_const_frame_length) {
try {
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/stft_non_const_frame_length.onnx"));
convert_model("stft_non_const_frame_length.onnx");
FAIL() << "Unknown error during STFT import";
} catch (const std::runtime_error& exc) {
std::string msg{exc.what()};
@ -1569,9 +1513,7 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_proper_exception_if_non_const_fra
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_stft_proper_exception_if_complex_signal_and_onesided) {
try {
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
SERIALIZED_ZOO,
"onnx/stft_onesided_complex_input.onnx"));
convert_model("stft_onesided_complex_input.onnx");
FAIL() << "Unknown error during STFT import";
} catch (const std::runtime_error& exc) {
std::string msg{exc.what()};