From 1d59a5a29b90dafa7510ecc5b7a889437209db38 Mon Sep 17 00:00:00 2001 From: Ivan Novoselov Date: Wed, 11 Jan 2023 10:50:39 +0000 Subject: [PATCH] Common test infrastructure suggestions (#14343) * Common test infrastructure: test helper for partial shapes, data generation fix * Overload static_shapes_to_test_representation to accept PartialShape vector * Rename to static_partial_shapes_to_test_representation --- .../include/shared_test_classes/base/ov_subgraph.hpp | 10 ++++++++++ .../src/base/utils/generate_inputs.cpp | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/ov_subgraph.hpp b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/ov_subgraph.hpp index 7f7f9b2c1064d9..d2c8e4a179e9e8 100644 --- a/src/tests/functional/shared_test_classes/include/shared_test_classes/base/ov_subgraph.hpp +++ b/src/tests/functional/shared_test_classes/include/shared_test_classes/base/ov_subgraph.hpp @@ -62,6 +62,16 @@ class SubgraphBaseTest : public CommonTestUtils::TestsCommon { virtual std::vector get_plugin_outputs(); }; +inline std::vector static_partial_shapes_to_test_representation(const std::vector& shapes) { + std::vector result; + for (const auto& staticShape : shapes) { + if (staticShape.is_dynamic()) + throw std::runtime_error("static_partial_shapes_to_test_representation can process only static partial shapes"); + result.push_back({{staticShape}, {staticShape.get_shape()}}); + } + return result; +} + inline std::vector> static_shapes_to_test_representation(const std::vector>& shapes) { std::vector> result; for (const auto& staticShapes : shapes) { diff --git a/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp b/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp index bc9d806a26e30b..f4ccb9480e3d64 100644 --- a/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp +++ b/src/tests/functional/shared_test_classes/src/base/utils/generate_inputs.cpp @@ -45,7 +45,7 @@ ov::runtime::Tensor generate(const std::shared_ptr& node, namespace Activation { ov::runtime::Tensor generate(const ov::element::Type& elemType, const ov::Shape& targetShape, - InputGenerateData inGenData = InputGenerateData(10, 20, 32768, 1)) { + InputGenerateData inGenData = InputGenerateData(-1, 2*32768, 32768, 1)) { if (!elemType.is_signed()) { inGenData.range = 15; inGenData.start_from = 0;