Moved migrated classes to ov::test namespace (#20226)

* Moved migrated classes to ov::test namespace

* Revert redundant changes

* Fixed build
This commit is contained in:
Ilya Churaev 2023-10-08 17:16:24 +04:00 committed by GitHub
parent ad41d0f52f
commit 51afe489aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 584 additions and 522 deletions

View File

@ -2,183 +2,195 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "subgraph_tests/conv_eltwise_fusion.hpp"
#include <vector> #include <vector>
#include "subgraph_tests/conv_eltwise_fusion.hpp"
#include "common_test_utils/test_constants.hpp" #include "common_test_utils/test_constants.hpp"
using namespace SubgraphTestsDefinitions; using namespace SubgraphTestsDefinitions;
namespace { namespace {
const std::vector<ngraph::element::Type> types{ngraph::element::f32, ngraph::element::f16}; const std::vector<ov::element::Type> types{ov::element::f32, ov::element::f16};
const std::vector<ngraph::NodeTypeInfo> eltwise_types{ngraph::opset4::Multiply::get_type_info_static(), const std::vector<ov::NodeTypeInfo> eltwise_types{ov::op::v1::Multiply::get_type_info_static(),
/* ngraph::opset4::Add::get_type_info_static() */}; /* ov::opset4::Add::get_type_info_static() */};
INSTANTIATE_TEST_SUITE_P(smoke_Convolution_1D, ConvEltwiseFusion, INSTANTIATE_TEST_SUITE_P(smoke_Convolution_1D,
::testing::Combine( ConvEltwiseFusion,
::testing::Values(std::tuple<ngraph::NodeTypeInfo, size_t>{ngraph::opset4::Convolution::get_type_info_static(), 2}), ::testing::Combine(::testing::Values(std::tuple<ov::NodeTypeInfo, size_t>{
::testing::ValuesIn(eltwise_types), ov::op::v1::Convolution::get_type_info_static(),
::testing::Values(false), 2}),
::testing::Values(ngraph::Shape{1, 8, 64}), ::testing::ValuesIn(eltwise_types),
::testing::Values(ngraph::Shape{64, 8, 1}), ::testing::Values(false),
::testing::Values(ngraph::Shape{64, 1}), ::testing::Values(ov::Shape{1, 8, 64}),
::testing::ValuesIn(types), ::testing::Values(ov::Shape{64, 8, 1}),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::Shape{64, 1}),
ConvEltwiseFusion::getTestCaseName); ::testing::ValuesIn(types),
::testing::Values(ov::test::utils::DEVICE_CPU)),
ConvEltwiseFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolution_1D, ConvEltwiseFusion, INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolution_1D,
::testing::Combine( ConvEltwiseFusion,
::testing::Values(std::tuple<ngraph::NodeTypeInfo, size_t>{ngraph::opset4::GroupConvolution::get_type_info_static(), 2}), ::testing::Combine(::testing::Values(std::tuple<ov::NodeTypeInfo, size_t>{
::testing::ValuesIn(eltwise_types), ov::op::v1::GroupConvolution::get_type_info_static(),
::testing::Values(false), 2}),
::testing::Values(ngraph::Shape{1, 12, 5}), ::testing::ValuesIn(eltwise_types),
::testing::Values(ngraph::Shape{4, 5, 3, 2}), ::testing::Values(false),
::testing::Values(ngraph::Shape{20, 1}), ::testing::Values(ov::Shape{1, 12, 5}),
::testing::ValuesIn(types), ::testing::Values(ov::Shape{4, 5, 3, 2}),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::Shape{20, 1}),
ConvEltwiseFusion::getTestCaseName); ::testing::ValuesIn(types),
::testing::Values(ov::test::utils::DEVICE_CPU)),
ConvEltwiseFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_ConvolutionBackpropData_1D, ConvEltwiseFusion, INSTANTIATE_TEST_SUITE_P(
::testing::Combine( smoke_ConvolutionBackpropData_1D,
::testing::Combine( ConvEltwiseFusion,
::testing::Values(ngraph::opset4::ConvolutionBackpropData::get_type_info_static()), ::testing::Combine(
::testing::ValuesIn(std::vector<size_t>{2, 3})), ::testing::Combine(::testing::Values(ov::op::v1::ConvolutionBackpropData::get_type_info_static()),
::testing::ValuesIn(eltwise_types), ::testing::ValuesIn(std::vector<size_t>{2, 3})),
::testing::Values(false), ::testing::ValuesIn(eltwise_types),
::testing::Values(ngraph::Shape{1, 12, 64}), ::testing::Values(false),
::testing::Values(ngraph::Shape{12, 20, 1}), ::testing::Values(ov::Shape{1, 12, 64}),
::testing::Values(ngraph::Shape{20, 1}), ::testing::Values(ov::Shape{12, 20, 1}),
::testing::ValuesIn(types), ::testing::Values(ov::Shape{20, 1}),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::ValuesIn(types),
ConvEltwiseFusion::getTestCaseName); ::testing::Values(ov::test::utils::DEVICE_CPU)),
ConvEltwiseFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolutionBackpropData_1D, ConvEltwiseFusion, INSTANTIATE_TEST_SUITE_P(
::testing::Combine( smoke_GroupConvolutionBackpropData_1D,
::testing::Combine( ConvEltwiseFusion,
::testing::Values(ngraph::opset4::GroupConvolutionBackpropData::get_type_info_static()), ::testing::Combine(
::testing::ValuesIn(std::vector<size_t>{2, 3})), ::testing::Combine(::testing::Values(ov::op::v1::GroupConvolutionBackpropData::get_type_info_static()),
::testing::ValuesIn(eltwise_types), ::testing::ValuesIn(std::vector<size_t>{2, 3})),
::testing::Values(false), ::testing::ValuesIn(eltwise_types),
::testing::Values(ngraph::Shape{1, 12, 64}), ::testing::Values(false),
::testing::Values(ngraph::Shape{4, 3, 5, 1}), ::testing::Values(ov::Shape{1, 12, 64}),
::testing::Values(ngraph::Shape{1, 20, 1}), ::testing::Values(ov::Shape{4, 3, 5, 1}),
::testing::ValuesIn(types), ::testing::Values(ov::Shape{1, 20, 1}),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::ValuesIn(types),
ConvEltwiseFusion::getTestCaseName); ::testing::Values(ov::test::utils::DEVICE_CPU)),
ConvEltwiseFusion::getTestCaseName);
const std::vector<ngraph::Shape> const_shapes_2d{ const std::vector<ov::Shape> const_shapes_2d{{}, {1, 1}, {1, 1, 1}, {20, 1, 1}, {1, 1, 1, 1}};
{},
{1, 1},
{1, 1, 1},
{20, 1, 1},
{1, 1, 1, 1}
};
INSTANTIATE_TEST_SUITE_P(smoke_Convolution_2D, ConvEltwiseFusion, INSTANTIATE_TEST_SUITE_P(smoke_Convolution_2D,
::testing::Combine( ConvEltwiseFusion,
::testing::Values(std::tuple<ngraph::NodeTypeInfo, size_t>{ngraph::opset4::Convolution::get_type_info_static(), 2}), ::testing::Combine(::testing::Values(std::tuple<ov::NodeTypeInfo, size_t>{
::testing::ValuesIn(eltwise_types), ov::op::v1::Convolution::get_type_info_static(),
::testing::Values(false), 2}),
::testing::Values(ngraph::Shape{1, 3, 64, 64}), ::testing::ValuesIn(eltwise_types),
::testing::Values(ngraph::Shape{20, 3, 1, 1}), ::testing::Values(false),
::testing::ValuesIn(const_shapes_2d), ::testing::Values(ov::Shape{1, 3, 64, 64}),
::testing::ValuesIn(types), ::testing::Values(ov::Shape{20, 3, 1, 1}),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::ValuesIn(const_shapes_2d),
ConvEltwiseFusion::getTestCaseName); ::testing::ValuesIn(types),
::testing::Values(ov::test::utils::DEVICE_CPU)),
ConvEltwiseFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolution_2D, ConvEltwiseFusion, INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolution_2D,
::testing::Combine( ConvEltwiseFusion,
::testing::Values(std::tuple<ngraph::NodeTypeInfo, size_t>{ngraph::opset4::GroupConvolution::get_type_info_static(), 2}), ::testing::Combine(::testing::Values(std::tuple<ov::NodeTypeInfo, size_t>{
::testing::ValuesIn(eltwise_types), ov::op::v1::GroupConvolution::get_type_info_static(),
::testing::Values(false), 2}),
::testing::Values(ngraph::Shape{1, 12, 64, 64}), ::testing::ValuesIn(eltwise_types),
::testing::Values(ngraph::Shape{4, 5, 3, 1, 2}), ::testing::Values(false),
::testing::ValuesIn(const_shapes_2d), ::testing::Values(ov::Shape{1, 12, 64, 64}),
::testing::ValuesIn(types), ::testing::Values(ov::Shape{4, 5, 3, 1, 2}),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::ValuesIn(const_shapes_2d),
ConvEltwiseFusion::getTestCaseName); ::testing::ValuesIn(types),
::testing::Values(ov::test::utils::DEVICE_CPU)),
ConvEltwiseFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_ConvolutionBackpropData_2D, ConvEltwiseFusion, INSTANTIATE_TEST_SUITE_P(
::testing::Combine( smoke_ConvolutionBackpropData_2D,
::testing::Combine( ConvEltwiseFusion,
::testing::Values(ngraph::opset4::ConvolutionBackpropData::get_type_info_static()), ::testing::Combine(
::testing::ValuesIn(std::vector<size_t>{2, 3})), ::testing::Combine(::testing::Values(ov::op::v1::ConvolutionBackpropData::get_type_info_static()),
::testing::ValuesIn(eltwise_types), ::testing::ValuesIn(std::vector<size_t>{2, 3})),
::testing::Values(false), ::testing::ValuesIn(eltwise_types),
::testing::Values(ngraph::Shape{1, 3, 64, 64}), ::testing::Values(false),
::testing::Values(ngraph::Shape{3, 20, 3, 3}), ::testing::Values(ov::Shape{1, 3, 64, 64}),
::testing::ValuesIn(const_shapes_2d), ::testing::Values(ov::Shape{3, 20, 3, 3}),
::testing::ValuesIn(types), ::testing::ValuesIn(const_shapes_2d),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::ValuesIn(types),
ConvEltwiseFusion::getTestCaseName); ::testing::Values(ov::test::utils::DEVICE_CPU)),
ConvEltwiseFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolutionBackpropData_2D, ConvEltwiseFusion, INSTANTIATE_TEST_SUITE_P(
::testing::Combine( smoke_GroupConvolutionBackpropData_2D,
::testing::Combine( ConvEltwiseFusion,
::testing::Values(ngraph::opset4::GroupConvolutionBackpropData::get_type_info_static()), ::testing::Combine(
::testing::ValuesIn(std::vector<size_t>{2, 3})), ::testing::Combine(::testing::Values(ov::op::v1::GroupConvolutionBackpropData::get_type_info_static()),
::testing::ValuesIn(eltwise_types), ::testing::ValuesIn(std::vector<size_t>{2, 3})),
::testing::Values(false), ::testing::ValuesIn(eltwise_types),
::testing::Values(ngraph::Shape{1, 12, 64, 64}), ::testing::Values(false),
::testing::Values(ngraph::Shape{4, 3, 5, 1, 1}), ::testing::Values(ov::Shape{1, 12, 64, 64}),
::testing::ValuesIn(const_shapes_2d), ::testing::Values(ov::Shape{4, 3, 5, 1, 1}),
::testing::ValuesIn(types), ::testing::ValuesIn(const_shapes_2d),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::ValuesIn(types),
ConvEltwiseFusion::getTestCaseName); ::testing::Values(ov::test::utils::DEVICE_CPU)),
ConvEltwiseFusion::getTestCaseName);
const std::vector<ngraph::Shape> neg_const_shapes_2d{ const std::vector<ov::Shape> neg_const_shapes_2d{{1, 1, 1, 1, 1}, /* Broadcast output */
{1, 1, 1, 1, 1}, /* Broadcast output */ {3},
{3}, {3, 1}, {3, 1, 1, 1} {3, 1},
}; {3, 1, 1, 1}};
INSTANTIATE_TEST_SUITE_P(smoke_Convolution_2D_Negative, ConvEltwiseFusion, INSTANTIATE_TEST_SUITE_P(smoke_Convolution_2D_Negative,
::testing::Combine( ConvEltwiseFusion,
::testing::Values(std::tuple<ngraph::NodeTypeInfo, size_t>{ngraph::opset4::Convolution::get_type_info_static(), 2}), ::testing::Combine(::testing::Values(std::tuple<ov::NodeTypeInfo, size_t>{
::testing::ValuesIn(eltwise_types), ov::op::v1::Convolution::get_type_info_static(),
::testing::Values(true), 2}),
::testing::Values(ngraph::Shape{1, 3, 3, 3}), ::testing::ValuesIn(eltwise_types),
::testing::Values(ngraph::Shape{3, 3, 1, 1}), ::testing::Values(true),
::testing::ValuesIn(neg_const_shapes_2d), ::testing::Values(ov::Shape{1, 3, 3, 3}),
::testing::ValuesIn(types), ::testing::Values(ov::Shape{3, 3, 1, 1}),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::ValuesIn(neg_const_shapes_2d),
ConvEltwiseFusion::getTestCaseName); ::testing::ValuesIn(types),
::testing::Values(ov::test::utils::DEVICE_CPU)),
ConvEltwiseFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolution_2D_Negative, ConvEltwiseFusion, INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolution_2D_Negative,
::testing::Combine( ConvEltwiseFusion,
::testing::Values( ::testing::Combine(::testing::Values(std::tuple<ov::NodeTypeInfo, size_t>{
std::tuple<ngraph::NodeTypeInfo, size_t>{ngraph::opset4::GroupConvolution::get_type_info_static(), 2}), ov::op::v1::GroupConvolution::get_type_info_static(),
::testing::ValuesIn(eltwise_types), 2}),
::testing::Values(true), ::testing::ValuesIn(eltwise_types),
::testing::Values(ngraph::Shape{1, 12, 3, 3}), ::testing::Values(true),
::testing::Values(ngraph::Shape{4, 5, 3, 1, 1}), ::testing::Values(ov::Shape{1, 12, 3, 3}),
::testing::ValuesIn(neg_const_shapes_2d), ::testing::Values(ov::Shape{4, 5, 3, 1, 1}),
::testing::ValuesIn(types), ::testing::ValuesIn(neg_const_shapes_2d),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::ValuesIn(types),
ConvEltwiseFusion::getTestCaseName); ::testing::Values(ov::test::utils::DEVICE_CPU)),
ConvEltwiseFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_ConvolutionBackpropData_2D_Negative, ConvEltwiseFusion, INSTANTIATE_TEST_SUITE_P(smoke_ConvolutionBackpropData_2D_Negative,
::testing::Combine( ConvEltwiseFusion,
::testing::Values( ::testing::Combine(::testing::Values(std::tuple<ov::NodeTypeInfo, size_t>{
std::tuple<ngraph::NodeTypeInfo, size_t>{ngraph::opset4::ConvolutionBackpropData::get_type_info_static(), 2}), ov::op::v1::ConvolutionBackpropData::get_type_info_static(),
::testing::ValuesIn(eltwise_types), 2}),
::testing::Values(true), ::testing::ValuesIn(eltwise_types),
::testing::Values(ngraph::Shape{1, 12, 3, 3}), ::testing::Values(true),
::testing::Values(ngraph::Shape{12, 3, 1, 1}), ::testing::Values(ov::Shape{1, 12, 3, 3}),
::testing::ValuesIn(neg_const_shapes_2d), ::testing::Values(ov::Shape{12, 3, 1, 1}),
::testing::ValuesIn(types), ::testing::ValuesIn(neg_const_shapes_2d),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::ValuesIn(types),
ConvEltwiseFusion::getTestCaseName); ::testing::Values(ov::test::utils::DEVICE_CPU)),
ConvEltwiseFusion::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolutionBackpropData_2D_Negative, ConvEltwiseFusion, INSTANTIATE_TEST_SUITE_P(smoke_GroupConvolutionBackpropData_2D_Negative,
::testing::Combine( ConvEltwiseFusion,
::testing::Values( ::testing::Combine(::testing::Values(std::tuple<ov::NodeTypeInfo, size_t>{
std::tuple<ngraph::NodeTypeInfo, size_t>{ngraph::opset4::GroupConvolutionBackpropData::get_type_info_static(), 2}), ov::op::v1::GroupConvolutionBackpropData::get_type_info_static(),
::testing::ValuesIn(eltwise_types), 2}),
::testing::Values(true), ::testing::ValuesIn(eltwise_types),
::testing::Values(ngraph::Shape{1, 12, 3, 3}), ::testing::Values(true),
::testing::Values(ngraph::Shape{4, 3, 5, 1, 1}), ::testing::Values(ov::Shape{1, 12, 3, 3}),
::testing::ValuesIn(neg_const_shapes_2d), ::testing::Values(ov::Shape{4, 3, 5, 1, 1}),
::testing::ValuesIn(types), ::testing::ValuesIn(neg_const_shapes_2d),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::ValuesIn(types),
ConvEltwiseFusion::getTestCaseName); ::testing::Values(ov::test::utils::DEVICE_CPU)),
ConvEltwiseFusion::getTestCaseName);
} // namespace } // namespace

View File

@ -3,28 +3,31 @@
// //
#include "subgraph_tests/parameter_result.hpp" #include "subgraph_tests/parameter_result.hpp"
#include "common_test_utils/test_constants.hpp" #include "common_test_utils/test_constants.hpp"
using namespace SubgraphTestsDefinitions; using namespace SubgraphTestsDefinitions;
using namespace ov::test;
namespace { namespace {
INSTANTIATE_TEST_SUITE_P(smoke_Check, ParameterResultSubgraphTestLegacyApi, INSTANTIATE_TEST_SUITE_P(smoke_Check,
::testing::Combine( ParameterResultSubgraphTestLegacyApi,
::testing::Values(ov::test::InputShape{{1, 3, 10, 10}, {}}), ::testing::Combine(::testing::Values(ov::test::InputShape{{1, 3, 10, 10}, {}}),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::test::utils::DEVICE_CPU)),
ParameterResultSubgraphTestBase::getTestCaseName); ParameterResultSubgraphTestBase::getTestCaseName);
const std::vector<ov::test::InputShape> inputShapes = { const std::vector<ov::test::InputShape> inputShapes = {
ov::test::InputShape{{1, 3, 10, 10}, {{ 1, 3, 10, 10}, { 1, 3, 10, 10}}}, ov::test::InputShape{{1, 3, 10, 10}, {{1, 3, 10, 10}, {1, 3, 10, 10}}},
ov::test::InputShape{{-1, -1, -1, -1}, {{ 1, 3, 10, 10}, { 2, 5, 3, 10}, { 1, 3, 10, 10}, { 1, 3, 10, 10}}}, ov::test::InputShape{{-1, -1, -1, -1}, {{1, 3, 10, 10}, {2, 5, 3, 10}, {1, 3, 10, 10}, {1, 3, 10, 10}}},
ov::test::InputShape{{{1, 10}, {1, 10}, {1, 10}, {1, 10}}, {{ 1, 3, 10, 10}, { 2, 5, 3, 10}, { 1, 3, 10, 10}, { 1, 3, 10, 10}}}, ov::test::InputShape{{{1, 10}, {1, 10}, {1, 10}, {1, 10}},
{{1, 3, 10, 10}, {2, 5, 3, 10}, {1, 3, 10, 10}, {1, 3, 10, 10}}},
}; };
INSTANTIATE_TEST_SUITE_P(smoke_Check, ParameterResultSubgraphTest, INSTANTIATE_TEST_SUITE_P(smoke_Check,
::testing::Combine( ParameterResultSubgraphTest,
::testing::ValuesIn(inputShapes), ::testing::Combine(::testing::ValuesIn(inputShapes),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::test::utils::DEVICE_CPU)),
ParameterResultSubgraphTestBase::getTestCaseName); ParameterResultSubgraphTestBase::getTestCaseName);
} // namespace } // namespace

View File

@ -2,14 +2,15 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include <vector>
#include "shared_test_classes/subgraph/preprocess.hpp" #include "shared_test_classes/subgraph/preprocess.hpp"
using namespace SubgraphTestsDefinitions; #include <vector>
INSTANTIATE_TEST_SUITE_P(smoke_PrePostProcess, PrePostProcessTest, using namespace ov::test;
::testing::Combine(
::testing::ValuesIn(ov::builder::preprocess::generic_preprocess_functions()), INSTANTIATE_TEST_SUITE_P(
::testing::Values(ov::test::utils::DEVICE_CPU)), smoke_PrePostProcess,
PrePostProcessTest::getTestCaseName); PrePostProcessTest,
::testing::Combine(::testing::ValuesIn(ov::builder::preprocess::generic_preprocess_functions()),
::testing::Values(ov::test::utils::DEVICE_CPU)),
PrePostProcessTest::getTestCaseName);

View File

@ -4,121 +4,81 @@
#include "shared_test_classes/subgraph/simple_if.hpp" #include "shared_test_classes/subgraph/simple_if.hpp"
using namespace SubgraphTestsDefinitions; using namespace ov::test;
namespace { namespace {
std::vector<std::vector<ov::test::InputShape>> inputShapes = { std::vector<std::vector<ov::test::InputShape>> inputShapes = {
{ {
{{}, {{5, 7}}}, {{}, {{5, 7}}},
{{}, {{5, 7}}}, {{}, {{5, 7}}},
}, },
{ {{{}, {{30, 20, 10}}}, {{}, {{30, 20, 10}}}},
{{}, {{30, 20, 10}}}, {{{-1, -1, -1}, {{10, 20, 5}, {10, 0, 5}, {1, 5, 5}}}, {{-1, -1, -1}, {{10, 20, 5}, {10, 0, 5}, {1, 1, 5}}}},
{{}, {{30, 20, 10}}} {{{-1, 5, -1}, {{10, 5, 10}, {2, 5, 5}, {1, 5, 5}}}, {{-1, 5, -1}, {{1, 5, 1}, {2, 5, 5}, {5, 5, 5}}}},
}, {{{{1, 10}, {1, 10}, {1, 10}}, {{2, 5, 10}, {2, 5, 1}, {1, 5, 5}}},
{ {{{1, 10}, {1, 10}, {1, 10}}, {{2, 5, 10}, {2, 1, 5}, {5, 5, 5}}}},
{
{-1, -1, -1},
{{10, 20, 5}, {10, 0, 5}, {1, 5, 5}}
},
{
{-1, -1, -1},
{{10, 20, 5}, {10, 0, 5}, {1, 1, 5}}
}
},
{
{
{-1, 5, -1},
{{10, 5, 10}, {2, 5, 5}, {1, 5, 5}}
},
{
{-1, 5, -1},
{{1, 5, 1}, {2, 5, 5}, {5, 5, 5}}
}
},
{
{
{{1, 10}, {1, 10}, {1, 10}},
{{2, 5, 10}, {2, 5, 1}, {1, 5, 5}}
},
{
{{1, 10}, {1, 10}, {1, 10}},
{{2, 5, 10}, {2, 1, 5}, {5, 5, 5}}
}
},
}; };
const std::vector<ov::test::ElementType> inTypes = { const std::vector<ov::test::ElementType> inTypes = {ov::test::ElementType::f32,
ov::test::ElementType::f32, ov::test::ElementType::bf16,
ov::test::ElementType::bf16, ov::test::ElementType::i8};
ov::test::ElementType::i8
};
std::vector<bool> conditions = {true, false}; std::vector<bool> conditions = {true, false};
INSTANTIATE_TEST_SUITE_P(smoke_If, SimpleIfTest, INSTANTIATE_TEST_SUITE_P(smoke_If,
::testing::Combine( SimpleIfTest,
::testing::ValuesIn(inputShapes), ::testing::Combine(::testing::ValuesIn(inputShapes),
::testing::ValuesIn(inTypes), ::testing::ValuesIn(inTypes),
::testing::ValuesIn(conditions), ::testing::ValuesIn(conditions),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::test::utils::DEVICE_CPU)),
SimpleIfTest::getTestCaseName); SimpleIfTest::getTestCaseName);
TEST_P(SimpleIfTest, CompareWithRefs) { TEST_P(SimpleIfTest, CompareWithRefs) {
run(); run();
}; };
INSTANTIATE_TEST_SUITE_P(smoke_If, SimpleIf2OutTest, INSTANTIATE_TEST_SUITE_P(smoke_If,
::testing::Combine( SimpleIf2OutTest,
::testing::ValuesIn(inputShapes), ::testing::Combine(::testing::ValuesIn(inputShapes),
::testing::ValuesIn(inTypes), ::testing::ValuesIn(inTypes),
::testing::ValuesIn(conditions), ::testing::ValuesIn(conditions),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::test::utils::DEVICE_CPU)),
SimpleIf2OutTest::getTestCaseName); SimpleIf2OutTest::getTestCaseName);
TEST_P(SimpleIf2OutTest, CompareWithRefs) { TEST_P(SimpleIf2OutTest, CompareWithRefs) {
run(); run();
}; };
INSTANTIATE_TEST_SUITE_P(smoke_If, SimpleIfNotConstConditionTest, INSTANTIATE_TEST_SUITE_P(smoke_If,
::testing::Combine( SimpleIfNotConstConditionTest,
::testing::ValuesIn(inputShapes), ::testing::Combine(::testing::ValuesIn(inputShapes),
::testing::ValuesIn(inTypes), ::testing::ValuesIn(inTypes),
::testing::ValuesIn(conditions), ::testing::ValuesIn(conditions),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::test::utils::DEVICE_CPU)),
SimpleIfNotConstConditionTest::getTestCaseName); SimpleIfNotConstConditionTest::getTestCaseName);
TEST_P(SimpleIfNotConstConditionTest, CompareWithRefs) { TEST_P(SimpleIfNotConstConditionTest, CompareWithRefs) {
run(); run();
}; };
std::vector<std::vector<ov::test::InputShape>> inputShapes_2 = { std::vector<std::vector<ov::test::InputShape>> inputShapes_2 = {
{ {
{ {{-1, -1, -1}, {{10, 20, 5}, {10, 20, 5}, {1, 5, 5}}},
{-1, -1, -1}, },
{{10, 20, 5}, {10, 20, 5}, {1, 5, 5}} {
}, {{-1, 5, -1}, {{10, 5, 10}, {2, 5, 5}, {1, 5, 5}}},
}, },
{ {
{ {{{0, 10}, {0, 10}, {0, 10}}, {{2, 5, 10}, {2, 5, 1}, {2, 5, 0}, {1, 5, 5}}},
{-1, 5, -1}, },
{{10, 5, 10}, {2, 5, 5}, {1, 5, 5}}
},
},
{
{
{{0, 10}, {0, 10}, {0, 10}},
{{2, 5, 10}, {2, 5, 1}, {2, 5, 0}, {1, 5, 5}}
},
},
}; };
INSTANTIATE_TEST_SUITE_P(smoke_If, SimpleIfNotConstConditionAndInternalDynamismTest, INSTANTIATE_TEST_SUITE_P(smoke_If,
::testing::Combine( SimpleIfNotConstConditionAndInternalDynamismTest,
::testing::ValuesIn(inputShapes_2), ::testing::Combine(::testing::ValuesIn(inputShapes_2),
::testing::ValuesIn(inTypes), ::testing::ValuesIn(inTypes),
::testing::ValuesIn(conditions), ::testing::ValuesIn(conditions),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::test::utils::DEVICE_CPU)),
SimpleIfNotConstConditionTest::getTestCaseName); SimpleIfNotConstConditionTest::getTestCaseName);
TEST_P(SimpleIfNotConstConditionAndInternalDynamismTest, CompareWithRefs) { TEST_P(SimpleIfNotConstConditionAndInternalDynamismTest, CompareWithRefs) {
@ -126,51 +86,43 @@ TEST_P(SimpleIfNotConstConditionAndInternalDynamismTest, CompareWithRefs) {
}; };
std::vector<std::vector<ov::test::InputShape>> inputShapes_3 = { std::vector<std::vector<ov::test::InputShape>> inputShapes_3 = {
{ {
{ {{-1, 2, -1}, {{1, 2, 0}, {2, 2, 5}}},
{-1, 2, -1}, },
{{1, 2, 0}, {2, 2, 5}} {
}, {{{0, 10}, {0, 10}, {0, 10}}, {{2, 5, 10}, {2, 0, 0}}},
}, },
{
{
{{0, 10}, {0, 10}, {0, 10}},
{{2, 5, 10}, {2, 0, 0}}
},
},
}; };
INSTANTIATE_TEST_SUITE_P(smoke_If, SimpleIfNotConstConditionAndDimsIncreaseTest, INSTANTIATE_TEST_SUITE_P(smoke_If,
::testing::Combine( SimpleIfNotConstConditionAndDimsIncreaseTest,
::testing::ValuesIn(inputShapes_3), ::testing::Combine(::testing::ValuesIn(inputShapes_3),
::testing::ValuesIn(inTypes), ::testing::ValuesIn(inTypes),
::testing::ValuesIn(conditions), ::testing::ValuesIn(conditions),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::test::utils::DEVICE_CPU)),
SimpleIfNotConstConditionTest::getTestCaseName); SimpleIfNotConstConditionTest::getTestCaseName);
TEST_P(SimpleIfNotConstConditionAndDimsIncreaseTest, CompareWithRefs) { TEST_P(SimpleIfNotConstConditionAndDimsIncreaseTest, CompareWithRefs) {
run(); run();
}; };
// the axis of split in test suit "SimpleIfNotConstConditionUnusedOutputPortsTest" is hardcoded as 1, so shape[axis] should be static // the axis of split in test suit "SimpleIfNotConstConditionUnusedOutputPortsTest" is hardcoded as 1, so shape[axis]
// should be static
std::vector<std::vector<ov::test::InputShape>> inputShapes_4 = { std::vector<std::vector<ov::test::InputShape>> inputShapes_4 = {
{ {
{{}, {{5, 7}}}, {{}, {{5, 7}}},
}, },
{ {
{ {{-1, 5, -1}, {{10, 5, 10}, {2, 5, 5}, {1, 5, 5}}},
{-1, 5, -1}, },
{{10, 5, 10}, {2, 5, 5}, {1, 5, 5}}
},
},
}; };
INSTANTIATE_TEST_SUITE_P(smoke_If, SimpleIfNotConstConditionUnusedOutputPortsTest, INSTANTIATE_TEST_SUITE_P(smoke_If,
::testing::Combine( SimpleIfNotConstConditionUnusedOutputPortsTest,
::testing::ValuesIn(inputShapes_4), ::testing::Combine(::testing::ValuesIn(inputShapes_4),
::testing::ValuesIn(inTypes), ::testing::ValuesIn(inTypes),
::testing::ValuesIn(conditions), ::testing::ValuesIn(conditions),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::test::utils::DEVICE_CPU)),
SimpleIfNotConstConditionUnusedOutputPortsTest::getTestCaseName); SimpleIfNotConstConditionUnusedOutputPortsTest::getTestCaseName);
TEST_P(SimpleIfNotConstConditionUnusedOutputPortsTest, CompareWithRefs) { TEST_P(SimpleIfNotConstConditionUnusedOutputPortsTest, CompareWithRefs) {

View File

@ -2,21 +2,21 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include <vector>
#include "subgraph_tests/split_concat_memory.hpp" #include "subgraph_tests/split_concat_memory.hpp"
using namespace ov::test::subgraph; #include <vector>
using namespace ov::test;
namespace { namespace {
const std::vector<ov::element::Type> netPrecisions = { const std::vector<ov::element::Type> netPrecisions = {
ov::element::f32, ov::element::f32,
ov::element::i32, ov::element::i32,
ov::element::f16, ov::element::f16,
ov::element::i16, ov::element::i16,
ov::element::u8, ov::element::u8,
ov::element::i8, ov::element::i8,
}; };
const std::vector<ov::Shape> shapes = { const std::vector<ov::Shape> shapes = {
@ -26,11 +26,11 @@ const std::vector<ov::Shape> shapes = {
{3, 8}, {3, 8},
}; };
INSTANTIATE_TEST_SUITE_P(smoke_CPU, SplitConcatMemory, INSTANTIATE_TEST_SUITE_P(smoke_CPU,
::testing::Combine( SplitConcatMemory,
::testing::ValuesIn(shapes), ::testing::Combine(::testing::ValuesIn(shapes),
::testing::ValuesIn(netPrecisions), ::testing::ValuesIn(netPrecisions),
::testing::Values(1), ::testing::Values(1),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::test::utils::DEVICE_CPU)),
SplitConcatMemory::getTestCaseName); SplitConcatMemory::getTestCaseName);
} // namespace } // namespace

View File

@ -2,16 +2,17 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "shared_test_classes/subgraph/parameter_result.hpp"
#include "common_test_utils/test_constants.hpp" #include "common_test_utils/test_constants.hpp"
#include "shared_test_classes/subgraph/parameter_result.hpp"
using namespace SubgraphTestsDefinitions; using namespace SubgraphTestsDefinitions;
using namespace ov::test;
using namespace InferenceEngine; using namespace InferenceEngine;
namespace CPULayerTestsDefinitions { namespace CPULayerTestsDefinitions {
class ParameterResultCustomBlobTest : public ParameterResultSubgraphTestLegacyApi { class ParameterResultCustomBlobTest : public ParameterResultSubgraphTestLegacyApi {
protected: protected:
void Infer() override { void Infer() override {
constexpr size_t inferIterations = 10lu; constexpr size_t inferIterations = 10lu;
@ -25,7 +26,7 @@ class ParameterResultCustomBlobTest : public ParameterResultSubgraphTestLegacyAp
std::string inputName = cnnNetwork.getInputsInfo().begin()->first; std::string inputName = cnnNetwork.getInputsInfo().begin()->first;
std::vector<float> customInpData(elementsCount); std::vector<float> customInpData(elementsCount);
auto inpBlobData = inputBlob->buffer().as<const float *>(); auto inpBlobData = inputBlob->buffer().as<const float*>();
std::copy(inpBlobData, inpBlobData + elementsCount, customInpData.begin()); std::copy(inpBlobData, inpBlobData + elementsCount, customInpData.begin());
auto& tensorDesc = inputsInfo->getTensorDesc(); auto& tensorDesc = inputsInfo->getTensorDesc();
@ -38,7 +39,7 @@ class ParameterResultCustomBlobTest : public ParameterResultSubgraphTestLegacyAp
} }
} }
void Validate() override { void Validate() override {
//Do nothing. We call Validate() in the Infer() method // Do nothing. We call Validate() in the Infer() method
} }
}; };
@ -51,12 +52,12 @@ TEST_P(ParameterResultCustomBlobTest, CompareWithRefs) {
Run(); Run();
} }
namespace { namespace {
INSTANTIATE_TEST_SUITE_P(smoke_Check_Custom_Blob, ParameterResultCustomBlobTest, INSTANTIATE_TEST_SUITE_P(smoke_Check_Custom_Blob,
::testing::Combine( ParameterResultCustomBlobTest,
::testing::Values(ov::test::InputShape{{1, 3, 10, 10}, {{}}}), ::testing::Combine(::testing::Values(ov::test::InputShape{{1, 3, 10, 10}, {{}}}),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::test::utils::DEVICE_CPU)),
ParameterResultSubgraphTestBase::getTestCaseName); ParameterResultSubgraphTestBase::getTestCaseName);
} // namespace } // namespace
class ParameterResultSameBlobTest : public ParameterResultSubgraphTestLegacyApi { class ParameterResultSameBlobTest : public ParameterResultSubgraphTestLegacyApi {
protected: protected:
@ -69,7 +70,7 @@ protected:
} }
} }
void Validate() override { void Validate() override {
//Do nothing. We call Validate() in the Infer() method // Do nothing. We call Validate() in the Infer() method
} }
}; };
@ -77,10 +78,10 @@ TEST_P(ParameterResultSameBlobTest, CompareWithRefs) {
Run(); Run();
} }
namespace { namespace {
INSTANTIATE_TEST_SUITE_P(smoke_Check_Same_Blob, ParameterResultSameBlobTest, INSTANTIATE_TEST_SUITE_P(smoke_Check_Same_Blob,
::testing::Combine( ParameterResultSameBlobTest,
::testing::Values(ov::test::InputShape{{1, 3, 10, 10}, {{}}}), ::testing::Combine(::testing::Values(ov::test::InputShape{{1, 3, 10, 10}, {{}}}),
::testing::Values(ov::test::utils::DEVICE_CPU)), ::testing::Values(ov::test::utils::DEVICE_CPU)),
ParameterResultSubgraphTestBase::getTestCaseName); ParameterResultSubgraphTestBase::getTestCaseName);
} // namespace } // namespace
} // namespace CPULayerTestsDefinitions } // namespace CPULayerTestsDefinitions

View File

@ -2,25 +2,27 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "subgraph_tests/parameter_result.hpp"
#include <vector> #include <vector>
#include "subgraph_tests/parameter_result.hpp"
#include "common_test_utils/test_constants.hpp" #include "common_test_utils/test_constants.hpp"
using namespace SubgraphTestsDefinitions; using namespace SubgraphTestsDefinitions;
using namespace ov::test;
namespace { namespace {
INSTANTIATE_TEST_SUITE_P(smoke_Check, ParameterResultSubgraphTestLegacyApi, INSTANTIATE_TEST_SUITE_P(smoke_Check,
::testing::Combine( ParameterResultSubgraphTestLegacyApi,
::testing::Values(ov::test::InputShape{{1, 3, 10, 10}, {}}), ::testing::Combine(::testing::Values(ov::test::InputShape{{1, 3, 10, 10}, {}}),
::testing::Values(ov::test::utils::DEVICE_GPU)), ::testing::Values(ov::test::utils::DEVICE_GPU)),
ParameterResultSubgraphTestBase::getTestCaseName); ParameterResultSubgraphTestBase::getTestCaseName);
INSTANTIATE_TEST_SUITE_P(smoke_Check, ParameterResultSubgraphTest, INSTANTIATE_TEST_SUITE_P(smoke_Check,
::testing::Combine( ParameterResultSubgraphTest,
::testing::Values(ov::test::InputShape{{1, 3, 10, 10}, {{1, 3, 10, 10}}}), ::testing::Combine(::testing::Values(ov::test::InputShape{{1, 3, 10, 10}, {{1, 3, 10, 10}}}),
::testing::Values(ov::test::utils::DEVICE_GPU)), ::testing::Values(ov::test::utils::DEVICE_GPU)),
ParameterResultSubgraphTestBase::getTestCaseName); ParameterResultSubgraphTestBase::getTestCaseName);
} // namespace } // namespace

View File

@ -2,11 +2,11 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include <vector>
#include "shared_test_classes/subgraph/preprocess.hpp" #include "shared_test_classes/subgraph/preprocess.hpp"
using namespace SubgraphTestsDefinitions; #include <vector>
using namespace ov::test;
namespace { namespace {
@ -28,7 +28,7 @@ inline std::vector<preprocess_func> GPU_smoke_preprocess_functions() {
preprocess_func(resize_nearest, "resize_nearest", 0.01f), preprocess_func(resize_nearest, "resize_nearest", 0.01f),
preprocess_func(resize_linear_nhwc, "resize_linear_nhwc", 0.01f), preprocess_func(resize_linear_nhwc, "resize_linear_nhwc", 0.01f),
preprocess_func(resize_cubic, "resize_cubic", 0.01f), preprocess_func(resize_cubic, "resize_cubic", 0.01f),
preprocess_func(resize_dynamic, "resize_dynamic", 0.01f, { ov::Shape {1, 3, 123, 123} }), preprocess_func(resize_dynamic, "resize_dynamic", 0.01f, {ov::Shape{1, 3, 123, 123}}),
preprocess_func(crop_basic, "crop_basic", 0.000001f), preprocess_func(crop_basic, "crop_basic", 0.000001f),
preprocess_func(crop_negative, "crop_negative", 0.000001f), preprocess_func(crop_negative, "crop_negative", 0.000001f),
preprocess_func(convert_layout_by_dims, "convert_layout_by_dims", 0.01f), preprocess_func(convert_layout_by_dims, "convert_layout_by_dims", 0.01f),
@ -43,10 +43,10 @@ inline std::vector<preprocess_func> GPU_smoke_preprocess_functions() {
}; };
} }
INSTANTIATE_TEST_SUITE_P(smoke_PrePostProcess_GPU, PrePostProcessTest, INSTANTIATE_TEST_SUITE_P(smoke_PrePostProcess_GPU,
::testing::Combine( PrePostProcessTest,
::testing::ValuesIn(GPU_smoke_preprocess_functions()), ::testing::Combine(::testing::ValuesIn(GPU_smoke_preprocess_functions()),
::testing::Values(ov::test::utils::DEVICE_GPU)), ::testing::Values(ov::test::utils::DEVICE_GPU)),
PrePostProcessTest::getTestCaseName); PrePostProcessTest::getTestCaseName);
} // namespace } // namespace

View File

@ -11,4 +11,5 @@ namespace SubgraphTestsDefinitions {
TEST_P(ConvEltwiseFusion, CompareWithRefs) { TEST_P(ConvEltwiseFusion, CompareWithRefs) {
Run(); Run();
} }
} // namespace SubgraphTestsDefinitions
} // namespace SubgraphTestsDefinitions

View File

@ -12,8 +12,14 @@ TEST_P(ParameterResultSubgraphTestLegacyApi, CompareWithRefs) {
Run(); Run();
} }
} // namespace SubgraphTestsDefinitions
namespace ov {
namespace test {
TEST_P(ParameterResultSubgraphTest, CompareWithRefs) { TEST_P(ParameterResultSubgraphTest, CompareWithRefs) {
run(); run();
} }
} // namespace SubgraphTestsDefinitions } // namespace test
} // namespace ov

View File

@ -4,12 +4,11 @@
#pragma once #pragma once
#include "shared_test_classes/subgraph/split_concat_memory.hpp"
#include "common_test_utils/data_utils.hpp" #include "common_test_utils/data_utils.hpp"
#include "shared_test_classes/subgraph/split_concat_memory.hpp"
namespace ov { namespace ov {
namespace test { namespace test {
namespace subgraph {
TEST_P(SplitConcatMemory, cyclicBufferCorrectness) { TEST_P(SplitConcatMemory, cyclicBufferCorrectness) {
/* /*
@ -28,7 +27,7 @@ TEST_P(SplitConcatMemory, cyclicBufferCorrectness) {
auto o_tensor = inferRequest.get_tensor(*function->outputs().begin()); auto o_tensor = inferRequest.get_tensor(*function->outputs().begin());
auto output_tensor_ref = ov::Tensor(o_tensor.get_element_type(), o_tensor.get_shape()); auto output_tensor_ref = ov::Tensor(o_tensor.get_element_type(), o_tensor.get_shape());
auto fill_by_quarter = [this] (ov::Tensor& tensor, std::vector<float> vals) { auto fill_by_quarter = [this](ov::Tensor& tensor, std::vector<float> vals) {
OPENVINO_ASSERT(vals.size() == 4); OPENVINO_ASSERT(vals.size() == 4);
auto quarter_blocked_shape = tensor.get_shape(); auto quarter_blocked_shape = tensor.get_shape();
@ -38,7 +37,7 @@ TEST_P(SplitConcatMemory, cyclicBufferCorrectness) {
quarter_blocked_shape.insert(quarter_blocked_shape.begin() + axis, vals.size()); quarter_blocked_shape.insert(quarter_blocked_shape.begin() + axis, vals.size());
OPENVINO_ASSERT(ov::shape_size(quarter_blocked_shape) == tensor.get_size()); OPENVINO_ASSERT(ov::shape_size(quarter_blocked_shape) == tensor.get_size());
auto quarter_blocked_view = ov::Tensor(tensor.get_element_type(), quarter_blocked_shape, tensor.data()); auto quarter_blocked_view = ov::Tensor(tensor.get_element_type(), quarter_blocked_shape, tensor.data());
ov::test::utils::fill_data_with_broadcast(quarter_blocked_view, axis, vals); ov::test::utils::fill_data_with_broadcast(quarter_blocked_view, axis, vals);
}; };
@ -63,7 +62,6 @@ TEST_P(SplitConcatMemory, cyclicBufferCorrectness) {
compare({output_tensor_ref}, {o_tensor}); compare({output_tensor_ref}, {o_tensor});
} }
} // namespace subgraph
} // namespace test } // namespace test
} // namespace ov } // namespace ov

View File

@ -4,37 +4,35 @@
#pragma once #pragma once
#include <tuple>
#include <string> #include <string>
#include <tuple>
#include <vector> #include <vector>
#include "shared_test_classes/base/layer_test_utils.hpp"
#include "ov_models/builders.hpp" #include "ov_models/builders.hpp"
#include <ngraph/shape.hpp> #include "shared_test_classes/base/layer_test_utils.hpp"
#include <ngraph/node.hpp>
namespace SubgraphTestsDefinitions { namespace SubgraphTestsDefinitions {
typedef std::tuple< typedef std::tuple<std::tuple<ov::NodeTypeInfo, // Convolution type
std::tuple< size_t // Number of inputs
ngraph::NodeTypeInfo, // Convolution type >,
size_t // Number of inputs ov::NodeTypeInfo, // Eltwise type
>, bool, // Is the test negative or not
ngraph::NodeTypeInfo, // Eltwise type ov::Shape, // Input shape
bool, // Is the test negative or not ov::Shape, // Weights shape
ngraph::Shape, // Input shape ov::Shape, // Const shape
ngraph::Shape, // Weights shape ov::element::Type, // Network precision
ngraph::Shape, // Const shape std::string // Device name
ngraph::element::Type, // Network precision >
std::string // Device name ConvEltwiseFusionParams;
> ConvEltwiseFusionParams;
class ConvEltwiseFusion class ConvEltwiseFusion : public testing::WithParamInterface<ConvEltwiseFusionParams>,
: public testing::WithParamInterface<ConvEltwiseFusionParams>, virtual public LayerTestsUtils::LayerTestsCommon {
virtual public LayerTestsUtils::LayerTestsCommon {
public: public:
static std::string getTestCaseName(const testing::TestParamInfo<ConvEltwiseFusionParams> &obj); static std::string getTestCaseName(const testing::TestParamInfo<ConvEltwiseFusionParams>& obj);
protected: protected:
void SetUp() override; void SetUp() override;
}; };
} // namespace SubgraphTestsDefinitions
} // namespace SubgraphTestsDefinitions

View File

@ -4,37 +4,42 @@
#pragma once #pragma once
#include <tuple>
#include <string>
#include <vector>
#include <memory> #include <memory>
#include <string>
#include <tuple>
#include <vector>
#include "shared_test_classes/base/layer_test_utils.hpp" #include "shared_test_classes/base/layer_test_utils.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp" #include "shared_test_classes/base/ov_subgraph.hpp"
#include "ov_models/builders.hpp"
namespace ov {
namespace test {
using parameterResultParams = std::tuple<ov::test::InputShape, // Input shape
std::string>; // Device name
class ParameterResultSubgraphTestBase : public testing::WithParamInterface<parameterResultParams> {
public:
static std::string getTestCaseName(const testing::TestParamInfo<parameterResultParams>& obj);
protected:
std::shared_ptr<ov::Model> createModel(const ov::PartialShape& shape);
};
class ParameterResultSubgraphTest : public ParameterResultSubgraphTestBase, virtual public ov::test::SubgraphBaseTest {
protected:
void SetUp() override;
};
} // namespace test
} // namespace ov
namespace SubgraphTestsDefinitions { namespace SubgraphTestsDefinitions {
using parameterResultParams = std::tuple<ov::test::InputShape, // Input shape class ParameterResultSubgraphTestLegacyApi : public ov::test::ParameterResultSubgraphTestBase,
std::string>; // Device name
class ParameterResultSubgraphTestBase : public testing::WithParamInterface<parameterResultParams> {
public:
static std::string getTestCaseName(const testing::TestParamInfo<parameterResultParams>& obj);
protected:
std::shared_ptr<ov::Model> createModel(const ov::PartialShape& shape);
};
class ParameterResultSubgraphTestLegacyApi : public ParameterResultSubgraphTestBase,
virtual public LayerTestsUtils::LayerTestsCommon { virtual public LayerTestsUtils::LayerTestsCommon {
protected: protected:
void SetUp() override; void SetUp() override;
}; };
class ParameterResultSubgraphTest : public ParameterResultSubgraphTestBase,
virtual public ov::test::SubgraphBaseTest {
protected:
void SetUp() override;
};
} // namespace SubgraphTestsDefinitions } // namespace SubgraphTestsDefinitions

View File

@ -4,29 +4,37 @@
#pragma once #pragma once
#include <tuple>
#include <string>
#include <vector>
#include <memory> #include <memory>
#include <string>
#include <tuple>
#include <vector>
#include "shared_test_classes/base/ov_subgraph.hpp"
#include "ov_models/builders.hpp" #include "ov_models/builders.hpp"
#include "ov_models/preprocess/preprocess_builders.hpp" #include "ov_models/preprocess/preprocess_builders.hpp"
#include "ov_models/utils/ov_helpers.hpp" #include "ov_models/utils/ov_helpers.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp"
namespace SubgraphTestsDefinitions { namespace ov {
namespace test {
using preprocessParamsTuple = std::tuple< using preprocessParamsTuple = std::tuple<ov::builder::preprocess::preprocess_func, // Function with preprocessing
ov::builder::preprocess::preprocess_func, // Function with preprocessing std::string>; // Device name
std::string>; // Device name
class PrePostProcessTest : public testing::WithParamInterface<preprocessParamsTuple>, class PrePostProcessTest : public testing::WithParamInterface<preprocessParamsTuple>,
virtual public ov::test::SubgraphBaseTest { virtual public ov::test::SubgraphBaseTest {
public: public:
static std::string getTestCaseName(const testing::TestParamInfo<preprocessParamsTuple> &obj); static std::string getTestCaseName(const testing::TestParamInfo<preprocessParamsTuple>& obj);
protected: protected:
void SetUp() override; void SetUp() override;
}; };
} // namespace test
} // namespace ov
namespace SubgraphTestsDefinitions {
using ov::test::PrePostProcessTest;
using ov::test::preprocessParamsTuple;
} // namespace SubgraphTestsDefinitions } // namespace SubgraphTestsDefinitions

View File

@ -4,30 +4,30 @@
#pragma once #pragma once
#include <tuple>
#include <string> #include <string>
#include <tuple>
#include <vector> #include <vector>
#include "shared_test_classes/base/ov_subgraph.hpp"
#include "shared_test_classes/base/layer_test_utils.hpp" #include "shared_test_classes/base/layer_test_utils.hpp"
#include "shared_test_classes/base/ov_subgraph.hpp"
namespace SubgraphTestsDefinitions { namespace ov {
namespace test {
using SimpleIfParamsTuple = typename std::tuple< using SimpleIfParamsTuple = typename std::tuple<std::vector<ov::test::InputShape>, // Input shapes
std::vector<ov::test::InputShape>, // Input shapes ov::test::ElementType, // Network precision
ov::test::ElementType, // Network precision bool, // If condition
bool, // If condition std::string // Device name
std::string // Device name >;
>;
class SimpleIfTest: class SimpleIfTest : public testing::WithParamInterface<SimpleIfParamsTuple>,
public testing::WithParamInterface<SimpleIfParamsTuple>, virtual public ov::test::SubgraphBaseTest {
virtual public ov::test::SubgraphBaseTest {
public: public:
static std::string getTestCaseName(const testing::TestParamInfo<SimpleIfParamsTuple> &obj); static std::string getTestCaseName(const testing::TestParamInfo<SimpleIfParamsTuple>& obj);
protected: protected:
void SetUp() override; void SetUp() override;
void compare(const std::vector<ov::Tensor> &expected, const std::vector<ov::Tensor> &actual) override; void compare(const std::vector<ov::Tensor>& expected, const std::vector<ov::Tensor>& actual) override;
size_t inferNum = 0; size_t inferNum = 0;
}; };
@ -55,12 +55,12 @@ protected:
class SimpleIfNotConstConditionAndDimsIncreaseTest : public SimpleIfNotConstConditionTest { class SimpleIfNotConstConditionAndDimsIncreaseTest : public SimpleIfNotConstConditionTest {
protected: protected:
void SetUp() override; void SetUp() override;
void compare(const std::vector<ov::Tensor> &expected, const std::vector<ov::Tensor> &actual) override; void compare(const std::vector<ov::Tensor>& expected, const std::vector<ov::Tensor>& actual) override;
}; };
class SimpleIfNotConstConditionUnusedOutputPortsTest : public SimpleIfNotConstConditionTest { class SimpleIfNotConstConditionUnusedOutputPortsTest : public SimpleIfNotConstConditionTest {
protected: protected:
void SetUp() override; void SetUp() override;
}; };
} // namespace test
} // namespace SubgraphTestsDefinitions } // namespace ov

View File

@ -10,14 +10,12 @@
namespace ov { namespace ov {
namespace test { namespace test {
namespace subgraph {
using SplitConcatMemoryParamsTuple = typename std::tuple< using SplitConcatMemoryParamsTuple = typename std::tuple<ov::Shape, // input shapes
ov::Shape, // input shapes ov::element::Type, // precision
ov::element::Type, // precision int, // axis of split
int, // axis of split std::string // device name
std::string // device name >;
>;
class SplitConcatMemory : public testing::WithParamInterface<SplitConcatMemoryParamsTuple>, class SplitConcatMemory : public testing::WithParamInterface<SplitConcatMemoryParamsTuple>,
virtual public ov::test::SubgraphBaseTest { virtual public ov::test::SubgraphBaseTest {
@ -29,6 +27,5 @@ protected:
int axis; int axis;
}; };
} // namespace subgraph
} // namespace test } // namespace test
} // namespace ov } // namespace ov

View File

@ -2,27 +2,27 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include "transformations/common_optimizations/conv_mul_fusion.hpp" #include "shared_test_classes/subgraph/conv_eltwise_fusion.hpp"
#include "openvino/core/node.hpp" #include "openvino/core/node.hpp"
#include "openvino/opsets/opset11.hpp" #include "openvino/opsets/opset11.hpp"
#include "openvino/pass/constant_folding.hpp" #include "openvino/pass/constant_folding.hpp"
#include "shared_test_classes/subgraph/conv_eltwise_fusion.hpp" #include "ov_models/builders.hpp"
#include "transformations/common_optimizations/conv_mul_fusion.hpp"
using namespace ov; using namespace ov;
// #include <legacy/transformations/convert_opset1_to_legacy/conv_bias_fusion.hpp>
// #include <legacy/transformations/convert_opset1_to_legacy/convert_convolutions.hpp>
namespace SubgraphTestsDefinitions { namespace SubgraphTestsDefinitions {
std::string ConvEltwiseFusion::getTestCaseName(const testing::TestParamInfo<ConvEltwiseFusionParams> &obj) { std::string ConvEltwiseFusion::getTestCaseName(const testing::TestParamInfo<ConvEltwiseFusionParams>& obj) {
std::tuple<NodeTypeInfo, size_t> conv_params; std::tuple<NodeTypeInfo, size_t> conv_params;
NodeTypeInfo conv_type, eltwise_type; NodeTypeInfo conv_type, eltwise_type;
bool negative; bool negative;
Shape input_shape, weights_shape, const_shape; Shape input_shape, weights_shape, const_shape;
element::Type precision; element::Type precision;
std::string targetName; std::string targetName;
std::tie(conv_params, eltwise_type, negative, input_shape, weights_shape, const_shape, precision, targetName) = obj.param; std::tie(conv_params, eltwise_type, negative, input_shape, weights_shape, const_shape, precision, targetName) =
obj.param;
size_t num_inputs; size_t num_inputs;
std::tie(conv_type, num_inputs) = conv_params; std::tie(conv_type, num_inputs) = conv_params;
std::ostringstream results; std::ostringstream results;
@ -46,7 +46,8 @@ void ConvEltwiseFusion::SetUp() {
Shape input_shape, weights_shape, const_shape; Shape input_shape, weights_shape, const_shape;
element::Type precision; element::Type precision;
size_t num_inputs; size_t num_inputs;
std::tie(conv_params, eltwise_type, negative, input_shape, weights_shape, const_shape, precision, targetDevice) = this->GetParam(); std::tie(conv_params, eltwise_type, negative, input_shape, weights_shape, const_shape, precision, targetDevice) =
this->GetParam();
std::tie(conv_type, num_inputs) = conv_params; std::tie(conv_type, num_inputs) = conv_params;
pass::Manager manager; pass::Manager manager;
@ -56,8 +57,12 @@ void ConvEltwiseFusion::SetUp() {
Shape strides(spatial_dims, 1); Shape strides(spatial_dims, 1);
std::vector<ptrdiff_t> pad_begin(spatial_dims, 0), pad_end(spatial_dims, 0); std::vector<ptrdiff_t> pad_begin(spatial_dims, 0), pad_end(spatial_dims, 0);
auto weights = ngraph::builder::makeConstant<float>(precision, weights_shape, std::vector<float>(shape_size(weights_shape), 2)); auto weights = ngraph::builder::makeConstant<float>(precision,
auto eltwise_const = ngraph::builder::makeConstant<float>(precision, const_shape, std::vector<float>(shape_size(const_shape), 3)); weights_shape,
std::vector<float>(shape_size(weights_shape), 2));
auto eltwise_const = ngraph::builder::makeConstant<float>(precision,
const_shape,
std::vector<float>(shape_size(const_shape), 3));
std::shared_ptr<Node> conv; std::shared_ptr<Node> conv;
if (conv_type == opset11::Convolution::get_type_info_static()) { if (conv_type == opset11::Convolution::get_type_info_static()) {
conv = std::make_shared<opset11::Convolution>(param, weights, strides, pad_begin, pad_end, strides); conv = std::make_shared<opset11::Convolution>(param, weights, strides, pad_begin, pad_end, strides);
@ -65,19 +70,45 @@ void ConvEltwiseFusion::SetUp() {
conv = std::make_shared<opset11::GroupConvolution>(param, weights, strides, pad_begin, pad_end, strides); conv = std::make_shared<opset11::GroupConvolution>(param, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == opset11::ConvolutionBackpropData::get_type_info_static()) { } else if (conv_type == opset11::ConvolutionBackpropData::get_type_info_static()) {
if (num_inputs == 3) { if (num_inputs == 3) {
auto output_shape = std::make_shared<opset11::Constant>(element::u64, Shape{spatial_dims}, auto output_shape = std::make_shared<opset11::Constant>(
std::vector<size_t>(input_shape.begin() + 2, input_shape.end())); element::u64,
conv = std::make_shared<opset11::ConvolutionBackpropData>(param, weights, output_shape, strides, pad_begin, pad_end, strides); Shape{spatial_dims},
std::vector<size_t>(input_shape.begin() + 2, input_shape.end()));
conv = std::make_shared<opset11::ConvolutionBackpropData>(param,
weights,
output_shape,
strides,
pad_begin,
pad_end,
strides);
} else { } else {
conv = std::make_shared<opset11::ConvolutionBackpropData>(param, weights, strides, pad_begin, pad_end, strides); conv = std::make_shared<opset11::ConvolutionBackpropData>(param,
weights,
strides,
pad_begin,
pad_end,
strides);
} }
} else if (conv_type == opset11::GroupConvolutionBackpropData::get_type_info_static()) { } else if (conv_type == opset11::GroupConvolutionBackpropData::get_type_info_static()) {
if (num_inputs == 3) { if (num_inputs == 3) {
auto output_shape = std::make_shared<opset11::Constant>(element::u64, Shape{spatial_dims}, auto output_shape = std::make_shared<opset11::Constant>(
std::vector<size_t>(input_shape.begin() + 2, input_shape.end())); element::u64,
conv = std::make_shared<opset11::GroupConvolutionBackpropData>(param, weights, output_shape, strides, pad_begin, pad_end, strides); Shape{spatial_dims},
std::vector<size_t>(input_shape.begin() + 2, input_shape.end()));
conv = std::make_shared<opset11::GroupConvolutionBackpropData>(param,
weights,
output_shape,
strides,
pad_begin,
pad_end,
strides);
} else { } else {
conv = std::make_shared<opset11::GroupConvolutionBackpropData>(param, weights, strides, pad_begin, pad_end, strides); conv = std::make_shared<opset11::GroupConvolutionBackpropData>(param,
weights,
strides,
pad_begin,
pad_end,
strides);
} }
} else { } else {
OPENVINO_THROW("Unsupported type"); OPENVINO_THROW("Unsupported type");
@ -111,7 +142,9 @@ void ConvEltwiseFusion::SetUp() {
Shape strides(spatial_dims, 1); Shape strides(spatial_dims, 1);
std::vector<ptrdiff_t> pad_begin(spatial_dims, 0), pad_end(spatial_dims, 0); std::vector<ptrdiff_t> pad_begin(spatial_dims, 0), pad_end(spatial_dims, 0);
auto weights = ngraph::builder::makeConstant<float>(precision, weights_shape, std::vector<float>(shape_size(weights_shape), 6)); auto weights = ngraph::builder::makeConstant<float>(precision,
weights_shape,
std::vector<float>(shape_size(weights_shape), 6));
std::shared_ptr<Node> conv; std::shared_ptr<Node> conv;
if (conv_type == opset11::Convolution::get_type_info_static()) { if (conv_type == opset11::Convolution::get_type_info_static()) {
conv = std::make_shared<opset11::Convolution>(param, weights, strides, pad_begin, pad_end, strides); conv = std::make_shared<opset11::Convolution>(param, weights, strides, pad_begin, pad_end, strides);
@ -119,19 +152,45 @@ void ConvEltwiseFusion::SetUp() {
conv = std::make_shared<opset11::GroupConvolution>(param, weights, strides, pad_begin, pad_end, strides); conv = std::make_shared<opset11::GroupConvolution>(param, weights, strides, pad_begin, pad_end, strides);
} else if (conv_type == opset11::ConvolutionBackpropData::get_type_info_static()) { } else if (conv_type == opset11::ConvolutionBackpropData::get_type_info_static()) {
if (num_inputs == 3) { if (num_inputs == 3) {
auto output_shape = std::make_shared<opset11::Constant>(element::u64, Shape{spatial_dims}, auto output_shape = std::make_shared<opset11::Constant>(
std::vector<size_t>(input_shape.begin() + 2, input_shape.end())); element::u64,
conv = std::make_shared<opset11::ConvolutionBackpropData>(param, weights, output_shape, strides, pad_begin, pad_end, strides); Shape{spatial_dims},
std::vector<size_t>(input_shape.begin() + 2, input_shape.end()));
conv = std::make_shared<opset11::ConvolutionBackpropData>(param,
weights,
output_shape,
strides,
pad_begin,
pad_end,
strides);
} else { } else {
conv = std::make_shared<opset11::ConvolutionBackpropData>(param, weights, strides, pad_begin, pad_end, strides); conv = std::make_shared<opset11::ConvolutionBackpropData>(param,
weights,
strides,
pad_begin,
pad_end,
strides);
} }
} else if (conv_type == opset11::GroupConvolutionBackpropData::get_type_info_static()) { } else if (conv_type == opset11::GroupConvolutionBackpropData::get_type_info_static()) {
if (num_inputs == 3) { if (num_inputs == 3) {
auto output_shape = std::make_shared<opset11::Constant>(element::u64, Shape{spatial_dims}, auto output_shape = std::make_shared<opset11::Constant>(
std::vector<size_t>(input_shape.begin() + 2, input_shape.end())); element::u64,
conv = std::make_shared<opset11::GroupConvolutionBackpropData>(param, weights, output_shape, strides, pad_begin, pad_end, strides); Shape{spatial_dims},
std::vector<size_t>(input_shape.begin() + 2, input_shape.end()));
conv = std::make_shared<opset11::GroupConvolutionBackpropData>(param,
weights,
output_shape,
strides,
pad_begin,
pad_end,
strides);
} else { } else {
conv = std::make_shared<opset11::GroupConvolutionBackpropData>(param, weights, strides, pad_begin, pad_end, strides); conv = std::make_shared<opset11::GroupConvolutionBackpropData>(param,
weights,
strides,
pad_begin,
pad_end,
strides);
} }
} }
@ -146,4 +205,4 @@ void ConvEltwiseFusion::SetUp() {
auto res = compare_functions(cloned_function, function_ref); auto res = compare_functions(cloned_function, function_ref);
ASSERT_TRUE(res.first) << res.second; ASSERT_TRUE(res.first) << res.second;
} }
} // namespace SubgraphTestsDefinitions } // namespace SubgraphTestsDefinitions

View File

@ -4,7 +4,8 @@
#include "shared_test_classes/subgraph/parameter_result.hpp" #include "shared_test_classes/subgraph/parameter_result.hpp"
namespace SubgraphTestsDefinitions { namespace ov {
namespace test {
std::string ParameterResultSubgraphTestBase::getTestCaseName(const testing::TestParamInfo<parameterResultParams>& obj) { std::string ParameterResultSubgraphTestBase::getTestCaseName(const testing::TestParamInfo<parameterResultParams>& obj) {
ov::test::InputShape inShape; ov::test::InputShape inShape;
@ -29,15 +30,6 @@ std::shared_ptr<ov::Model> ParameterResultSubgraphTestBase::createModel(const ov
return model; return model;
} }
void ParameterResultSubgraphTestLegacyApi::SetUp() {
ov::test::InputShape inShape;
std::tie(inShape, targetDevice) = this->GetParam();
IE_ASSERT(inShape.first.is_static());
function = createModel(inShape.first);
}
void ParameterResultSubgraphTest::SetUp() { void ParameterResultSubgraphTest::SetUp() {
ov::test::InputShape inShape; ov::test::InputShape inShape;
std::tie(inShape, targetDevice) = this->GetParam(); std::tie(inShape, targetDevice) = this->GetParam();
@ -47,4 +39,17 @@ void ParameterResultSubgraphTest::SetUp() {
function = createModel(inShape.first); function = createModel(inShape.first);
} }
} // namespace test
} // namespace ov
namespace SubgraphTestsDefinitions {
void ParameterResultSubgraphTestLegacyApi::SetUp() {
ov::test::InputShape inShape;
std::tie(inShape, targetDevice) = this->GetParam();
OPENVINO_ASSERT(inShape.first.is_static());
function = createModel(inShape.first);
}
} // namespace SubgraphTestsDefinitions } // namespace SubgraphTestsDefinitions

View File

@ -3,16 +3,18 @@
// //
#include "shared_test_classes/subgraph/preprocess.hpp" #include "shared_test_classes/subgraph/preprocess.hpp"
#include "ov_models/preprocess/preprocess_builders.hpp"
#include "openvino/core/preprocess/pre_post_process.hpp" #include "openvino/core/preprocess/pre_post_process.hpp"
#include "ov_models/preprocess/preprocess_builders.hpp"
using namespace ov; using namespace ov;
using namespace ov::preprocess; using namespace ov::preprocess;
using namespace ov::builder::preprocess; using namespace ov::builder::preprocess;
namespace SubgraphTestsDefinitions { namespace ov {
std::string PrePostProcessTest::getTestCaseName( namespace test {
const testing::TestParamInfo<preprocessParamsTuple> &obj) {
std::string PrePostProcessTest::getTestCaseName(const testing::TestParamInfo<preprocessParamsTuple>& obj) {
std::string targetName; std::string targetName;
preprocess_func func; preprocess_func func;
@ -29,7 +31,7 @@ void PrePostProcessTest::SetUp() {
std::tie(func, targetDevice) = GetParam(); std::tie(func, targetDevice) = GetParam();
function = func.m_function(); function = func.m_function();
rel_threshold = func.m_accuracy; rel_threshold = func.m_accuracy;
functionRefs = ngraph::clone_function(*function); functionRefs = function->clone();
abs_threshold = func.m_accuracy; abs_threshold = func.m_accuracy;
if (func.m_shapes.empty()) { if (func.m_shapes.empty()) {
for (const auto& input : function->inputs()) { for (const auto& input : function->inputs()) {
@ -43,4 +45,5 @@ TEST_P(PrePostProcessTest, CompareWithRefs) {
run(); run();
} }
} // namespace SubgraphTestsDefinitions } // namespace test
} // namespace ov

View File

@ -3,11 +3,14 @@
// //
#include "shared_test_classes/subgraph/simple_if.hpp" #include "shared_test_classes/subgraph/simple_if.hpp"
#include "ov_models/builders.hpp"
#include <common_test_utils/ov_tensor_utils.hpp>
namespace SubgraphTestsDefinitions { #include "common_test_utils/ov_tensor_utils.hpp"
std::string SimpleIfTest::getTestCaseName(const testing::TestParamInfo<SimpleIfParamsTuple> &obj) { #include "ov_models/builders.hpp"
namespace ov {
namespace test {
std::string SimpleIfTest::getTestCaseName(const testing::TestParamInfo<SimpleIfParamsTuple>& obj) {
std::vector<ov::test::InputShape> shapes; std::vector<ov::test::InputShape> shapes;
ov::test::ElementType inType; ov::test::ElementType inType;
bool condition; bool condition;
@ -19,7 +22,7 @@ std::string SimpleIfTest::getTestCaseName(const testing::TestParamInfo<SimpleIfP
results << "Input" << i << "_"; results << "Input" << i << "_";
results << "IS=" << ov::test::utils::partialShape2str({shapes[i].first}) << "_"; results << "IS=" << ov::test::utils::partialShape2str({shapes[i].first}) << "_";
results << "TS="; results << "TS=";
for (const auto &item : shapes[i].second) { for (const auto& item : shapes[i].second) {
results << ov::test::utils::vec2str(item) << "_"; results << ov::test::utils::vec2str(item) << "_";
} }
} }
@ -29,11 +32,13 @@ std::string SimpleIfTest::getTestCaseName(const testing::TestParamInfo<SimpleIfP
return results.str(); return results.str();
} }
void SimpleIfTest::compare(const std::vector<ov::Tensor> &expected, const std::vector<ov::Tensor> &actual) { void SimpleIfTest::compare(const std::vector<ov::Tensor>& expected, const std::vector<ov::Tensor>& actual) {
// in bodies there aren't nodes that work with dimension 0. So we shouldn't call SubgraphBaseTest::compare // in bodies there aren't nodes that work with dimension 0. So we shouldn't call SubgraphBaseTest::compare
bool hasZero = false; bool hasZero = false;
for (auto shape : targetStaticShapes[inferNum]) { for (auto shape : targetStaticShapes[inferNum]) {
hasZero = hasZero || std::any_of(shape.begin(), shape.end(), [](size_t dim) { return dim == 0; }); hasZero = hasZero || std::any_of(shape.begin(), shape.end(), [](size_t dim) {
return dim == 0;
});
} }
if (!hasZero) { if (!hasZero) {
SubgraphBaseTest::compare(expected, actual); SubgraphBaseTest::compare(expected, actual);
@ -112,7 +117,8 @@ void SimpleIf2OutTest::SetUp() {
auto ifRes1 = ifOp->set_output(res1, res3); auto ifRes1 = ifOp->set_output(res1, res3);
auto ifRes2 = ifOp->set_output(res2, res4); auto ifRes2 = ifOp->set_output(res2, res4);
ov::ResultVector results{std::make_shared<ov::op::v0::Result>(ifRes1), std::make_shared<ov::op::v0::Result>(ifRes2)}; ov::ResultVector results{std::make_shared<ov::op::v0::Result>(ifRes1),
std::make_shared<ov::op::v0::Result>(ifRes2)};
function = std::make_shared<ov::Model>(results, params, "simpleIf2Out"); function = std::make_shared<ov::Model>(results, params, "simpleIf2Out");
} }
@ -122,7 +128,7 @@ void SimpleIfNotConstConditionTest::SetUp() {
std::tie(shapes, inType, condition, targetDevice) = this->GetParam(); std::tie(shapes, inType, condition, targetDevice) = this->GetParam();
init_input_shapes(shapes); init_input_shapes(shapes);
for (auto &target : targetStaticShapes) for (auto& target : targetStaticShapes)
target.emplace_back(ov::Shape{}); target.emplace_back(ov::Shape{});
ov::ParameterVector params; ov::ParameterVector params;
for (auto&& shape : inputDynamicShapes) { for (auto&& shape : inputDynamicShapes) {
@ -152,11 +158,12 @@ void SimpleIfNotConstConditionTest::SetUp() {
auto ifRes1 = ifOp->set_output(res1, res3); auto ifRes1 = ifOp->set_output(res1, res3);
auto ifRes2 = ifOp->set_output(res2, res4); auto ifRes2 = ifOp->set_output(res2, res4);
ov::ResultVector results{std::make_shared<ov::op::v0::Result>(ifRes1), std::make_shared<ov::op::v0::Result>(ifRes2)}; ov::ResultVector results{std::make_shared<ov::op::v0::Result>(ifRes1),
std::make_shared<ov::op::v0::Result>(ifRes2)};
function = std::make_shared<ov::Model>(results, params, "SimpleIfNotConstConditionTest"); function = std::make_shared<ov::Model>(results, params, "SimpleIfNotConstConditionTest");
} }
void SimpleIfNotConstConditionTest::generate_inputs(const std::vector<ngraph::Shape>& targetInputStaticShapes) { void SimpleIfNotConstConditionTest::generate_inputs(const std::vector<ov::Shape>& targetInputStaticShapes) {
inputs.clear(); inputs.clear();
const auto& funcInputs = function->inputs(); const auto& funcInputs = function->inputs();
for (size_t i = 0; i < funcInputs.size(); ++i) { for (size_t i = 0; i < funcInputs.size(); ++i) {
@ -165,10 +172,13 @@ void SimpleIfNotConstConditionTest::generate_inputs(const std::vector<ngraph::Sh
if (i + 1 == funcInputs.size()) { if (i + 1 == funcInputs.size()) {
tensor = ov::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i]); tensor = ov::Tensor(funcInput.get_element_type(), targetInputStaticShapes[i]);
auto *dataPtr = tensor.data<bool>(); auto* dataPtr = tensor.data<bool>();
dataPtr[0] = condition; dataPtr[0] = condition;
} else { } else {
tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(), targetInputStaticShapes[i], 10, -5); tensor = ov::test::utils::create_and_fill_tensor(funcInput.get_element_type(),
targetInputStaticShapes[i],
10,
-5);
} }
inputs.insert({funcInput.get_node_shared_ptr(), tensor}); inputs.insert({funcInput.get_node_shared_ptr(), tensor});
@ -181,7 +191,7 @@ void SimpleIfNotConstConditionAndInternalDynamismTest::SetUp() {
std::tie(shapes, inType, condition, targetDevice) = this->GetParam(); std::tie(shapes, inType, condition, targetDevice) = this->GetParam();
init_input_shapes(shapes); init_input_shapes(shapes);
for (auto &target : targetStaticShapes) for (auto& target : targetStaticShapes)
target.emplace_back(ov::Shape{}); target.emplace_back(ov::Shape{});
ov::ParameterVector params; ov::ParameterVector params;
for (auto&& shape : inputDynamicShapes) { for (auto&& shape : inputDynamicShapes) {
@ -200,7 +210,7 @@ void SimpleIfNotConstConditionAndInternalDynamismTest::SetUp() {
auto thenBody = std::make_shared<ov::Model>(ov::OutputVector{thenRes_0, thenRes_1}, ov::ParameterVector{p1}); auto thenBody = std::make_shared<ov::Model>(ov::OutputVector{thenRes_0, thenRes_1}, ov::ParameterVector{p1});
// else body // else body
auto add_const = std::make_shared<ov::op::v0::Constant>(inType, ov::Shape{}, std::vector<float>{ 2 }); auto add_const = std::make_shared<ov::op::v0::Constant>(inType, ov::Shape{}, std::vector<float>{2});
auto elseOp_0 = std::make_shared<ov::op::v1::Add>(p2, add_const); auto elseOp_0 = std::make_shared<ov::op::v1::Add>(p2, add_const);
auto elseOp_1 = std::make_shared<ov::op::v3::NonZero>(elseOp_0, ov::element::i32); auto elseOp_1 = std::make_shared<ov::op::v3::NonZero>(elseOp_0, ov::element::i32);
auto elseOp_2 = std::make_shared<ov::op::v0::Convert>(elseOp_1, inType); auto elseOp_2 = std::make_shared<ov::op::v0::Convert>(elseOp_1, inType);
@ -215,7 +225,8 @@ void SimpleIfNotConstConditionAndInternalDynamismTest::SetUp() {
auto ifRes_0 = ifOp->set_output(thenRes_0, elseRes_0); auto ifRes_0 = ifOp->set_output(thenRes_0, elseRes_0);
auto ifRes_1 = ifOp->set_output(thenRes_1, elseRes_1); auto ifRes_1 = ifOp->set_output(thenRes_1, elseRes_1);
ov::ResultVector results{std::make_shared<ov::op::v0::Result>(ifRes_0), std::make_shared<ov::op::v0::Result>(ifRes_1)}; ov::ResultVector results{std::make_shared<ov::op::v0::Result>(ifRes_0),
std::make_shared<ov::op::v0::Result>(ifRes_1)};
function = std::make_shared<ov::Model>(results, params, "SimpleIfNotConstConditionAndInternalDynamismTest"); function = std::make_shared<ov::Model>(results, params, "SimpleIfNotConstConditionAndInternalDynamismTest");
} }
@ -225,7 +236,7 @@ void SimpleIfNotConstConditionAndDimsIncreaseTest::SetUp() {
std::tie(shapes, inType, condition, targetDevice) = this->GetParam(); std::tie(shapes, inType, condition, targetDevice) = this->GetParam();
init_input_shapes(shapes); init_input_shapes(shapes);
for (auto &target : targetStaticShapes) for (auto& target : targetStaticShapes)
target.emplace_back(ov::Shape{}); target.emplace_back(ov::Shape{});
ov::ParameterVector params; ov::ParameterVector params;
for (auto&& shape : inputDynamicShapes) { for (auto&& shape : inputDynamicShapes) {
@ -253,12 +264,16 @@ void SimpleIfNotConstConditionAndDimsIncreaseTest::SetUp() {
auto ifRes = ifOp->set_output(thenRes, elseRes); auto ifRes = ifOp->set_output(thenRes, elseRes);
function = std::make_shared<ov::Model>(ov::ResultVector{std::make_shared<ov::op::v0::Result>(ifOp)}, function = std::make_shared<ov::Model>(ov::ResultVector{std::make_shared<ov::op::v0::Result>(ifOp)},
params, "SimpleIfNotConstConditionAndDimsIncreaseTest"); params,
"SimpleIfNotConstConditionAndDimsIncreaseTest");
} }
void SimpleIfNotConstConditionAndDimsIncreaseTest::compare(const std::vector<ov::Tensor> &expected, const std::vector<ov::Tensor> &actual) { void SimpleIfNotConstConditionAndDimsIncreaseTest::compare(const std::vector<ov::Tensor>& expected,
const std::vector<ov::Tensor>& actual) {
const auto shape = targetStaticShapes[inferNum++].front(); const auto shape = targetStaticShapes[inferNum++].front();
if (!condition && std::any_of(shape.begin(), shape.end(), [](size_t dim) { return dim == 0; })) { if (!condition && std::any_of(shape.begin(), shape.end(), [](size_t dim) {
return dim == 0;
})) {
return; return;
} }
@ -271,7 +286,7 @@ void SimpleIfNotConstConditionUnusedOutputPortsTest::SetUp() {
std::tie(shapes, inType, condition, targetDevice) = this->GetParam(); std::tie(shapes, inType, condition, targetDevice) = this->GetParam();
init_input_shapes(shapes); init_input_shapes(shapes);
for (auto &target : targetStaticShapes) for (auto& target : targetStaticShapes)
target.emplace_back(ov::Shape{}); target.emplace_back(ov::Shape{});
ov::ParameterVector params; ov::ParameterVector params;
for (auto&& shape : inputDynamicShapes) { for (auto&& shape : inputDynamicShapes) {
@ -303,4 +318,5 @@ void SimpleIfNotConstConditionUnusedOutputPortsTest::SetUp() {
function = std::make_shared<ov::Model>(results, params, "SimpleIfNotConstConditionUnusedOutputPortsTest"); function = std::make_shared<ov::Model>(results, params, "SimpleIfNotConstConditionUnusedOutputPortsTest");
} }
} // namespace SubgraphTestsDefinitions } // namespace test
} // namespace ov

View File

@ -6,7 +6,6 @@
namespace ov { namespace ov {
namespace test { namespace test {
namespace subgraph {
std::string SplitConcatMemory::getTestCaseName(const testing::TestParamInfo<ParamType>& obj) { std::string SplitConcatMemory::getTestCaseName(const testing::TestParamInfo<ParamType>& obj) {
ov::element::Type netPrecision; ov::element::Type netPrecision;
@ -47,46 +46,42 @@ void SplitConcatMemory::SetUp() {
* __|___ __|___ * __|___ __|___
* [_out1_] [_mem2_] * [_out1_] [_mem2_]
*/ */
ngraph::Shape ng_share_14(shape_14); ov::Shape ng_share_14(shape_14);
ngraph::Shape ng_share_34(shape_34); ov::Shape ng_share_34(shape_34);
auto input = std::make_shared<ov::op::v0::Parameter>(inType, ng_share_14); auto input = std::make_shared<ov::op::v0::Parameter>(inType, ng_share_14);
input->set_friendly_name("input"); input->set_friendly_name("input");
auto& tensor = input->get_output_tensor(0); auto& tensor = input->get_output_tensor(0);
tensor.set_names({"input_t"}); tensor.set_names({"input_t"});
//input->output(0).set_names({"input"}); // input->output(0).set_names({"input"});
auto mem_c = std::make_shared<ov::op::v0::Constant>(inType, ng_share_34, 0); auto mem_c = std::make_shared<ov::op::v0::Constant>(inType, ng_share_34, 0);
auto mem_r = std::make_shared<ov::op::v3::ReadValue>(mem_c, "id"); auto mem_r = std::make_shared<ov::op::v3::ReadValue>(mem_c, "id");
auto cnc = std::make_shared<ov::op::v0::Concat>(ngraph::NodeVector{mem_r, input}, axis); auto cnc = std::make_shared<ov::op::v0::Concat>(ov::NodeVector{mem_r, input}, axis);
std::vector<int64_t> chunks_val {static_cast<int64_t>(ng_share_14[axis]), static_cast<int64_t>(ng_share_34[axis])}; std::vector<int64_t> chunks_val{static_cast<int64_t>(ng_share_14[axis]), static_cast<int64_t>(ng_share_34[axis])};
auto chunk_c = std::make_shared<ov::op::v0::Constant>(::ngraph::element::i64, ngraph::Shape{chunks_val.size()}, chunks_val); auto chunk_c = std::make_shared<ov::op::v0::Constant>(::ov::element::i64, ov::Shape{chunks_val.size()}, chunks_val);
auto axis_c = std::make_shared<ov::op::v0::Constant>(::ngraph::element::i64, ngraph::Shape{}, axis); auto axis_c = std::make_shared<ov::op::v0::Constant>(::ov::element::i64, ov::Shape{}, axis);
auto spl = std::make_shared<ov::op::v1::VariadicSplit>(cnc, axis_c, chunk_c); auto spl = std::make_shared<ov::op::v1::VariadicSplit>(cnc, axis_c, chunk_c);
auto one = std::make_shared<ov::op::v0::Constant>(inType, ngraph::Shape{}, 1); auto one = std::make_shared<ov::op::v0::Constant>(inType, ov::Shape{}, 1);
auto plus = std::make_shared<ov::op::v1::Add>(cnc, one, ngraph::op::AutoBroadcastType::NUMPY); auto plus = std::make_shared<ov::op::v1::Add>(cnc, one, ov::op::AutoBroadcastType::NUMPY);
plus->set_friendly_name("plus_one"); plus->set_friendly_name("plus_one");
auto& o_tensor = plus->get_output_tensor(0); auto& o_tensor = plus->get_output_tensor(0);
o_tensor.set_names({"plus_one_t"}); o_tensor.set_names({"plus_one_t"});
//input->output(0).set_names({"plus_one"}); // input->output(0).set_names({"plus_one"});
auto mem_w = std::make_shared<ov::op::v3::Assign>(spl->output(1), "id"); auto mem_w = std::make_shared<ov::op::v3::Assign>(spl->output(1), "id");
// WA. Ngraph limitations. Assign should have control dependencies on read. // WA. OpenVINO limitations. Assign should have control dependencies on read.
// And someone should hold assign node. // And someone should hold assign node.
mem_w->add_control_dependency(mem_r); mem_w->add_control_dependency(mem_r);
plus->add_control_dependency(mem_w); plus->add_control_dependency(mem_w);
function = std::make_shared<ngraph::Function>( function = std::make_shared<ov::Model>(ov::NodeVector{plus}, ov::ParameterVector{input}, "CyclicBuffer4");
ngraph::NodeVector {plus},
ngraph::ParameterVector {input},
"CyclicBuffer4");
} }
} // namespace subgraph
} // namespace test } // namespace test
} // namespace ov } // namespace ov