[ONNX] Refactoring tests on API 2.0 (#21748)
* Test in onnx_import_dyn_shapes.in.cpp moved to API 2.0 * Test in onnx_import_exception.cpp moved to API 2.0 * Tests in onnx_import_org_openvino.in.cpp moved to API 2.0 * Tests in onnx_import_org_pytorch.in.cpp moved to API 2.0 * Fixed code style
This commit is contained in:
committed by
GitHub
parent
e6ab01c681
commit
2779df5800
@@ -8,12 +8,13 @@
|
||||
|
||||
#include "openvino/core/deprecated.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
namespace onnx_import {
|
||||
namespace error {
|
||||
namespace detail {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
std::string get_error_msg_prefix(const Node& node) {
|
||||
|
||||
namespace ov {
|
||||
namespace frontend {
|
||||
namespace onnx_error {
|
||||
namespace detail {
|
||||
std::string get_error_msg_prefix(const ngraph::onnx_import::Node& node) {
|
||||
std::stringstream ss;
|
||||
ss << "While validating ONNX node '" << node << "'";
|
||||
return ss.str();
|
||||
@@ -23,12 +24,13 @@ std::string get_error_msg_prefix(const Node& node) {
|
||||
void OnnxNodeValidationFailure::create(const char* file,
|
||||
int line,
|
||||
const char* check_string,
|
||||
const Node& node,
|
||||
const ngraph::onnx_import::Node& node,
|
||||
const std::string& explanation) {
|
||||
throw OnnxNodeValidationFailure(
|
||||
make_what(file, line, check_string, detail::get_error_msg_prefix(node), explanation));
|
||||
}
|
||||
} // namespace onnx_error
|
||||
} // namespace frontend
|
||||
} // namespace ov
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} // namespace error
|
||||
} // namespace onnx_import
|
||||
} // namespace ngraph
|
||||
|
||||
@@ -6,19 +6,18 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "ngraph/check.hpp"
|
||||
#include "ngraph/except.hpp"
|
||||
#include "onnx_import/core/node.hpp"
|
||||
#include "openvino/core/deprecated.hpp"
|
||||
#include "openvino/core/except.hpp"
|
||||
#include "utils/tensor_external_data.hpp"
|
||||
|
||||
namespace ngraph {
|
||||
namespace onnx_import {
|
||||
namespace error {
|
||||
namespace ov {
|
||||
namespace frontend {
|
||||
namespace onnx_error {
|
||||
|
||||
namespace detail {
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
std::string get_error_msg_prefix(const Node& node);
|
||||
std::string get_error_msg_prefix(const ngraph::onnx_import::Node& node);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
} // namespace detail
|
||||
|
||||
@@ -27,7 +26,7 @@ public:
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START [[noreturn]] static void create(const char* file,
|
||||
int line,
|
||||
const char* check_string,
|
||||
const Node& node,
|
||||
const ngraph::onnx_import::Node& node,
|
||||
const std::string& explanation);
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
@@ -36,18 +35,24 @@ protected:
|
||||
};
|
||||
|
||||
OPENVINO_SUPPRESS_DEPRECATED_START
|
||||
struct invalid_external_data : ngraph_error {
|
||||
invalid_external_data(const onnx_import::detail::TensorExternalData& external_data)
|
||||
: ngraph_error{std::string{"invalid external data: "} + external_data.to_string()} {}
|
||||
invalid_external_data(const std::string& what_arg) : ngraph_error{what_arg} {}
|
||||
struct invalid_external_data : ov::Exception {
|
||||
invalid_external_data(const ngraph::onnx_import::detail::TensorExternalData& external_data)
|
||||
: ov::Exception{std::string{"invalid external data: "} + external_data.to_string()} {}
|
||||
invalid_external_data(const std::string& what_arg) : ov::Exception{what_arg} {}
|
||||
};
|
||||
OPENVINO_SUPPRESS_DEPRECATED_END
|
||||
|
||||
} // namespace error
|
||||
} // namespace onnx_error
|
||||
} // namespace frontend
|
||||
} // namespace ov
|
||||
|
||||
} // namespace onnx_import
|
||||
|
||||
} // namespace ngraph
|
||||
namespace ngraph {
|
||||
namespace onnx_import {
|
||||
namespace error {
|
||||
using namespace ov::frontend::onnx_error;
|
||||
} // namespace error
|
||||
} // namespace onnx_import
|
||||
} // namespace ngraph
|
||||
|
||||
#define CHECK_VALID_NODE(node_, cond_, ...) \
|
||||
OPENVINO_ASSERT_HELPER(::ngraph::onnx_import::error::OnnxNodeValidationFailure, (node_), (cond_), ##__VA_ARGS__)
|
||||
OPENVINO_ASSERT_HELPER(ov::frontend::onnx_error::OnnxNodeValidationFailure, (node_), (cond_), ##__VA_ARGS__)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -8,29 +8,22 @@
|
||||
#include "common_test_utils/type_prop.hpp"
|
||||
#include "exceptions.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/file_util.hpp"
|
||||
#include "ngraph/ngraph.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;
|
||||
|
||||
TEST(onnx_importer, exception_throws_ngraph_error) {
|
||||
EXPECT_THROW(onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/depth_to_space_bad_blocksize.onnx")),
|
||||
ngraph_error);
|
||||
TEST(onnx_importer, exception_throws_Exception) {
|
||||
EXPECT_THROW(convert_model("depth_to_space_bad_blocksize.onnx"), Exception);
|
||||
}
|
||||
|
||||
TEST(onnx_importer, exception_msg_ngraph_error) {
|
||||
TEST(onnx_importer, exception_msg_Exception) {
|
||||
try {
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/depth_to_space_bad_blocksize.onnx"));
|
||||
convert_model("depth_to_space_bad_blocksize.onnx");
|
||||
// Should have thrown, so fail if it didn't
|
||||
FAIL() << "ONNX Importer did not detected incorrect model!";
|
||||
} catch (const ngraph_error& e) {
|
||||
} catch (const Exception& e) {
|
||||
EXPECT_HAS_SUBSTRING(e.what(), std::string("must be a multiple of divisor"));
|
||||
} catch (...) {
|
||||
FAIL() << "The ONNX model importer failed for unexpected reason";
|
||||
@@ -39,12 +32,10 @@ TEST(onnx_importer, exception_msg_ngraph_error) {
|
||||
|
||||
TEST(onnx_importer, exception_msg_onnx_node_validation_failure) {
|
||||
try {
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/instance_norm_bad_scale_type.onnx"));
|
||||
convert_model("instance_norm_bad_scale_type.onnx");
|
||||
// Should have thrown, so fail if it didn't
|
||||
FAIL() << "ONNX Importer did not detected incorrect model!";
|
||||
} catch (const ::ngraph::onnx_import::error::OnnxNodeValidationFailure& e) {
|
||||
} catch (const ::ov::frontend::onnx_error::OnnxNodeValidationFailure& e) {
|
||||
EXPECT_HAS_SUBSTRING(e.what(), std::string("While validating ONNX node '<Node(InstanceNormalization)"));
|
||||
}
|
||||
// On MacOS after we re-throw OnnxNodeValidationFailure exception, we couldn't catch it as is,
|
||||
@@ -56,13 +47,11 @@ TEST(onnx_importer, exception_msg_onnx_node_validation_failure) {
|
||||
}
|
||||
}
|
||||
|
||||
// This test aims to check for wrapping all std::exception not deriving from ngraph_error.
|
||||
// This test aims to check for wrapping all std::exception not deriving from Exception.
|
||||
// This test should throw a std error because of attempt to access shape from dynamic tensor.
|
||||
TEST(onnx_importer, exception_msg_std_err_wrapped) {
|
||||
try {
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/eye_like_wrong_shape.onnx"));
|
||||
convert_model("eye_like_wrong_shape.onnx");
|
||||
// Should have thrown, so fail if it didn't
|
||||
FAIL() << "ONNX Importer did not detected incorrect model!";
|
||||
} catch (const std::exception& e) {
|
||||
|
||||
@@ -22,38 +22,32 @@
|
||||
#endif
|
||||
// clang-format on
|
||||
|
||||
#include "common_test_utils/file_utils.hpp"
|
||||
#include "default_opset.hpp"
|
||||
#include "common_test_utils/test_case.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "ngraph/ngraph.hpp"
|
||||
#include "ngraph/pass/constant_folding.hpp"
|
||||
#include "ngraph/pass/manager.hpp"
|
||||
#include "ngraph/file_util.hpp"
|
||||
#include "onnx_import/core/null_node.hpp"
|
||||
#include "onnx_import/onnx.hpp"
|
||||
#include "onnx_import/onnx_utils.hpp"
|
||||
#include "common_test_utils/all_close.hpp"
|
||||
#include "common_test_utils/file_utils.hpp"
|
||||
#include "common_test_utils/ndarray.hpp"
|
||||
#include "common_test_utils/test_case.hpp"
|
||||
#include "common_test_utils/test_control.hpp"
|
||||
#include "common_test_utils/test_tools.hpp"
|
||||
#include "common_test_utils/type_prop.hpp"
|
||||
#include "default_opset.hpp"
|
||||
#include "gtest/gtest.h"
|
||||
#include "onnx_import/core/null_node.hpp"
|
||||
#include "onnx_import/onnx.hpp"
|
||||
#include "onnx_import/onnx_utils.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}");
|
||||
|
||||
using Inputs = std::vector<std::vector<float>>;
|
||||
using Outputs = std::vector<std::vector<float>>;
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_prior_box) {
|
||||
const auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/prior_box.onnx"));
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
const auto model = convert_model("prior_box.onnx");
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
std::vector<float> A(3 * 2 * 2);
|
||||
std::vector<float> B(3 * 6 * 6);
|
||||
std::vector<float> output = {
|
||||
@@ -73,11 +67,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_prior_box) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_priorbox_clustered) {
|
||||
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/priorbox_clustered.onnx"));
|
||||
auto model = convert_model("priorbox_clustered.onnx");
|
||||
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
std::vector<float> A{15.0f};
|
||||
std::vector<float> B{10.0f};
|
||||
std::vector<float> output = {
|
||||
@@ -91,12 +83,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_priorbox_clustered) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_priorbox_clustered_most_attrs_default) {
|
||||
auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/priorbox_clustered_most_attrs_default.onnx"));
|
||||
auto model = convert_model("priorbox_clustered_most_attrs_default.onnx");
|
||||
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
std::vector<float> A(1 * 1 * 2 * 1);
|
||||
std::iota(std::begin(A), std::end(A), 0.0f);
|
||||
std::vector<float> B(1 * 1 * 3 * 3);
|
||||
@@ -125,12 +114,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_priorbox_clustered_most_attrs_default) {
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_priorbox_clustered_first_input_bad_shape) {
|
||||
try {
|
||||
auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/priorbox_clustered_first_input_bad_shape.onnx"));
|
||||
auto model = convert_model("priorbox_clustered_first_input_bad_shape.onnx");
|
||||
FAIL() << "Expected exception was not thrown";
|
||||
} catch (const ngraph::ngraph_error& e) {
|
||||
} catch (const ov::Exception& e) {
|
||||
EXPECT_HAS_SUBSTRING(e.what(), std::string("Only 4D inputs are supported. First input rank: 5 (should be 4)"));
|
||||
} catch (...) {
|
||||
FAIL() << "Expected OnnxNodeValidationFailure exception was not thrown";
|
||||
@@ -139,12 +125,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_priorbox_clustered_first_input_bad_shape) {
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_priorbox_clustered_second_input_bad_shape) {
|
||||
try {
|
||||
auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/priorbox_clustered_second_input_bad_shape.onnx"));
|
||||
auto model = convert_model("priorbox_clustered_second_input_bad_shape.onnx");
|
||||
FAIL() << "Expected exception was not thrown";
|
||||
} catch (const ngraph::ngraph_error& e) {
|
||||
} catch (const ov::Exception& e) {
|
||||
EXPECT_HAS_SUBSTRING(e.what(), std::string("Only 4D inputs are supported. Second input rank: 5 (should be 4)"));
|
||||
} catch (...) {
|
||||
FAIL() << "Expected OnnxNodeValidationFailure exception was not thrown";
|
||||
@@ -152,9 +135,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_priorbox_clustered_second_input_bad_shape) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_detection_output) {
|
||||
const auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/detection_output.onnx"));
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
const auto model = convert_model("detection_output.onnx");
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
|
||||
auto gen_vector = [](size_t size, float min, float max) -> std::vector<float> {
|
||||
float step = (max - min) / size;
|
||||
@@ -184,9 +166,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_detection_output) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_group_norm) {
|
||||
const auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/group_norm.onnx"));
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
const auto model = convert_model("group_norm.onnx");
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
Shape shape{2, 8, 2, 2};
|
||||
const auto size = shape_size(shape);
|
||||
std::vector<float> data(size);
|
||||
@@ -208,11 +189,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_group_norm) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_group_norm_squeeze_bias_and_scale) {
|
||||
const auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/group_norm_4D_bias_and_scale.onnx"));
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
const auto model = convert_model("group_norm_4D_bias_and_scale.onnx");
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
Shape shape{2, 8, 2, 2};
|
||||
const auto size = shape_size(shape);
|
||||
std::vector<float> data(size);
|
||||
@@ -234,9 +212,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_group_norm_squeeze_bias_and_scale) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_group_norm_5d) {
|
||||
const auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/group_norm_5d.onnx"));
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
const auto model = convert_model("group_norm_5d.onnx");
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
Shape shape{2, 8, 1, 2, 1};
|
||||
const auto size = shape_size(shape);
|
||||
std::vector<float> data(size);
|
||||
@@ -255,9 +232,8 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_group_norm_5d) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_normalize) {
|
||||
const auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/normalize.onnx"));
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
const auto model = convert_model("normalize.onnx");
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
std::vector<float> data(12);
|
||||
std::iota(data.begin(), data.end(), 1.f);
|
||||
std::vector<float> output = {
|
||||
@@ -280,11 +256,10 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_normalize) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_swish_with_beta) {
|
||||
auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(ov::test::utils::getExecutableDirectory(), SERIALIZED_ZOO, "onnx/swish_with_beta.onnx"));
|
||||
auto model = convert_model("swish_with_beta.onnx");
|
||||
|
||||
const Shape expected_output_shape{3};
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
std::vector<float> input_data{-0.5f, 0, 0.5f};
|
||||
test_case.add_input<float>(input_data);
|
||||
test_case.add_expected_output<float>(expected_output_shape, {-0.2036667f, 0.0f, 0.2963333f});
|
||||
@@ -293,12 +268,10 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_swish_with_beta) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_swish_without_beta) {
|
||||
auto function = onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/swish_without_beta.onnx"));
|
||||
auto model = convert_model("swish_without_beta.onnx");
|
||||
|
||||
const Shape expected_output_shape{3};
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
std::vector<float> input_data{-0.5f, 0, 0.5f};
|
||||
test_case.add_input<float>(input_data);
|
||||
test_case.add_expected_output<float>(expected_output_shape, {-0.18877034f, 0.0f, 0.31122968f});
|
||||
@@ -307,12 +280,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_swish_without_beta) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_detection_output) {
|
||||
auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/org.openvinotoolkit/experimental_detectron/detection_output.onnx"));
|
||||
auto model = convert_model("org.openvinotoolkit/experimental_detectron/detection_output.onnx");
|
||||
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
// rois
|
||||
test_case.add_input<float>({1.0f, 1.0f, 10.0f, 10.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 4.0f, 1.0f, 8.0f, 5.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
@@ -367,13 +337,10 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_detection_outpu
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_detection_output_most_attrs_default) {
|
||||
auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/org.openvinotoolkit/experimental_detectron/"
|
||||
"detection_output_most_attrs_default.onnx"));
|
||||
auto model = convert_model("org.openvinotoolkit/experimental_detectron/"
|
||||
"detection_output_most_attrs_default.onnx");
|
||||
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
// rois
|
||||
test_case.add_input<float>({1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
|
||||
@@ -410,13 +377,10 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_detection_outpu
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_generate_proposals_single_image) {
|
||||
auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/org.openvinotoolkit/experimental_detectron/"
|
||||
"generate_proposals_single_image.onnx"));
|
||||
auto model = convert_model("org.openvinotoolkit/experimental_detectron/"
|
||||
"generate_proposals_single_image.onnx");
|
||||
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
// im_info
|
||||
test_case.add_input<float>({1.0f, 1.0f, 1.0f});
|
||||
// anchors
|
||||
@@ -460,12 +424,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_generate_propos
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_group_norm) {
|
||||
auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/org.openvinotoolkit/experimental_detectron/group_norm.onnx"));
|
||||
auto model = convert_model("org.openvinotoolkit/experimental_detectron/group_norm.onnx");
|
||||
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
Shape shape{2, 8, 2, 2};
|
||||
const auto size = shape_size(shape);
|
||||
std::vector<float> data(size);
|
||||
@@ -487,12 +448,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_group_norm) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_prior_grid_generator) {
|
||||
auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/org.openvinotoolkit/experimental_detectron/prior_grid_generator.onnx"));
|
||||
auto model = convert_model("org.openvinotoolkit/experimental_detectron/prior_grid_generator.onnx");
|
||||
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
|
||||
std::vector<float> priors(shape_size(Shape{3, 4}));
|
||||
std::iota(priors.begin(), priors.end(), 0.f);
|
||||
@@ -514,12 +472,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_prior_grid_gene
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_roi_feature_extractor) {
|
||||
auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/org.openvinotoolkit/experimental_detectron/roi_feature_extractor.onnx"));
|
||||
auto model = convert_model("org.openvinotoolkit/experimental_detectron/roi_feature_extractor.onnx");
|
||||
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
|
||||
std::vector<float> rois(shape_size(Shape{2, 4}));
|
||||
std::iota(rois.begin(), rois.end(), 0.f);
|
||||
@@ -573,12 +528,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_roi_feature_ext
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_topk_rios) {
|
||||
auto function = onnx_import::import_onnx_model(
|
||||
file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/org.openvinotoolkit/experimental_detectron/topk_rios.onnx"));
|
||||
auto model = convert_model("org.openvinotoolkit/experimental_detectron/topk_rios.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.0f, 1.0f, 3.0f, 4.0f, 2.0f, 1.0f, 5.0f, 7.0f});
|
||||
test_case.add_input<float>({0.5f, 0.3f});
|
||||
@@ -588,12 +540,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_experimental_detectron_topk_rios) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_deformable_conv_2d) {
|
||||
auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/org.openvinotoolkit/deformable_conv_2d.onnx"));
|
||||
auto model = convert_model("org.openvinotoolkit/deformable_conv_2d.onnx");
|
||||
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
|
||||
// data
|
||||
test_case.add_input<float>(
|
||||
@@ -621,12 +570,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_deformable_conv_2d) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_generate_proposals) {
|
||||
auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/org.openvinotoolkit/generate_proposals.onnx"));
|
||||
auto model = convert_model("org.openvinotoolkit/generate_proposals.onnx");
|
||||
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
|
||||
// scores
|
||||
test_case.add_input<float>(
|
||||
@@ -674,12 +620,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_generate_proposals) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_generate_proposals_batch) {
|
||||
auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/org.openvinotoolkit/generate_proposals_batch2.onnx"));
|
||||
auto model = convert_model("org.openvinotoolkit/generate_proposals_batch2.onnx");
|
||||
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
|
||||
// scores
|
||||
test_case.add_input<float>(Shape{2, 3, 2, 3}, {5, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 7, 1, 1, 1, 1,
|
||||
|
||||
@@ -14,27 +14,22 @@
|
||||
// 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 "ngraph/file_util.hpp"
|
||||
#include "default_opset.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_adaptive_avg_pooling2d_nchw) {
|
||||
const auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/org.pytorch/adaptive_avg_pooling2d_nchw.onnx"));
|
||||
const auto model = convert_model("org.pytorch/adaptive_avg_pooling2d_nchw.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.9945f,
|
||||
0.3466f,
|
||||
0.2894f,
|
||||
@@ -56,12 +51,9 @@ OPENVINO_TEST(${BACKEND_NAME}, onnx_model_adaptive_avg_pooling2d_nchw) {
|
||||
}
|
||||
|
||||
OPENVINO_TEST(${BACKEND_NAME}, onnx_model_adaptive_avg_pooling2d_chw) {
|
||||
const auto function =
|
||||
onnx_import::import_onnx_model(file_util::path_join(ov::test::utils::getExecutableDirectory(),
|
||||
SERIALIZED_ZOO,
|
||||
"onnx/org.pytorch/adaptive_avg_pooling2d_chw.onnx"));
|
||||
const auto model = convert_model("org.pytorch/adaptive_avg_pooling2d_chw.onnx");
|
||||
|
||||
auto test_case = ov::test::TestCase(function, s_device);
|
||||
auto test_case = ov::test::TestCase(model, s_device);
|
||||
test_case.add_input<float>({12.0f, -1.0f, -56.0f, 20.0f, 1.0f, -8.0f, 7.0f, 9.0f});
|
||||
|
||||
test_case.add_expected_output<float>(Shape{1, 2, 2}, {5.5f, -18.0f, -3.5f, 8.0f});
|
||||
|
||||
Reference in New Issue
Block a user