diff --git a/src/plugins/intel_gpu/tests/functional/behavior/hetero_gpu_query_network.cpp b/src/plugins/intel_gpu/tests/functional/behavior/hetero_gpu_query_network.cpp index fe4ae47541d178..54865d7273a752 100644 --- a/src/plugins/intel_gpu/tests/functional/behavior/hetero_gpu_query_network.cpp +++ b/src/plugins/intel_gpu/tests/functional/behavior/hetero_gpu_query_network.cpp @@ -4,19 +4,16 @@ #include "behavior/plugin/hetero_query_network.hpp" -using namespace HeteroTests; - namespace HeteroTests { - TEST_P(HeteroQueryNetworkTest, HeteroSinglePlugin) { std::string deviceName = GetParam(); RunTest(deviceName); } INSTANTIATE_TEST_CASE_P( - HeteroGpu, - HeteroQueryNetworkTest, - ::testing::Values( - std::string("HETERO:GPU"))); + HeteroGpu, + HeteroQueryNetworkTest, + ::testing::Values( + std::string("HETERO:GPU"))); } // namespace HeteroTests diff --git a/src/plugins/intel_gpu/tests/functional/behavior/infer_request.cpp b/src/plugins/intel_gpu/tests/functional/behavior/infer_request.cpp index 6262c366aec905..19631c5d1cbd3a 100644 --- a/src/plugins/intel_gpu/tests/functional/behavior/infer_request.cpp +++ b/src/plugins/intel_gpu/tests/functional/behavior/infer_request.cpp @@ -2,129 +2,98 @@ // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include - +#include "common_test_utils/test_common.hpp" +#include "common_test_utils/common_utils.hpp" +#include "common_test_utils/node_builders/activation.hpp" +#include "openvino/core/preprocess/pre_post_process.hpp" #include "openvino/runtime/core.hpp" - -#include #include "ov_models/subgraph_builders.hpp" -#include "functional_test_utils/blob_utils.hpp" -#include "openvino/core/preprocess/pre_post_process.hpp" #include "transformations/utils/utils.hpp" -#include "common_test_utils/common_utils.hpp" -#include "shared_test_classes/base/layer_test_utils.hpp" - -using namespace ::testing; - -const std::vector inputPrecisions = { - InferenceEngine::Precision::I16, - InferenceEngine::Precision::U16, - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16, - InferenceEngine::Precision::U8, - InferenceEngine::Precision::I8, - InferenceEngine::Precision::I32, - InferenceEngine::Precision::U32, - InferenceEngine::Precision::U64, - InferenceEngine::Precision::I64, - // Interpreter backend doesn't implement evaluate method for OP - // InferenceEngine::Precision::FP64, -}; +#include "shared_test_classes/base/ov_subgraph.hpp" +namespace { typedef std::tuple< - InferenceEngine::Precision, // Input/Output Precision - InferenceEngine::Layout, // Input layout - InferenceEngine::Layout, // Output layout - std::vector, // Input Shape + ov::element::Type, // Input/Output type + ov::Shape, // Input Shape std::string> newtworkParams; class InferRequestIOPrecision : public testing::WithParamInterface, - virtual public LayerTestsUtils::LayerTestsCommon { + virtual public ov::test::SubgraphBaseStaticTest { public: static std::string getTestCaseName(const testing::TestParamInfo &obj); - InferenceEngine::Blob::Ptr GenerateInput(const InferenceEngine::InputInfo &info) const override; protected: void SetUp() override; }; std::string InferRequestIOPrecision::getTestCaseName(const testing::TestParamInfo &obj) { - InferenceEngine::Precision netPrecision; - InferenceEngine::Layout inLayout, outLayout; - std::vector shape; + ov::element::Type model_type; + ov::Shape shape; std::string targetDevice; - std::tie(netPrecision, inLayout, outLayout, shape, targetDevice) = obj.param; + std::tie(model_type, shape, targetDevice) = obj.param; std::ostringstream result; const char separator = '_'; - result << "netPRC=" << netPrecision.name() << separator; - result << "inL=" << inLayout << separator; - result << "outL=" << outLayout << separator; + result << "netPRC=" << model_type.get_type_name() << separator; result << "trgDev=" << targetDevice; return result.str(); } void InferRequestIOPrecision::SetUp() { - InferenceEngine::Precision netPrecision; - std::vector shape; - std::tie(netPrecision, inLayout, outLayout, shape, targetDevice) = GetParam(); - inPrc = netPrecision; - outPrc = netPrecision; + ov::element::Type model_type; + ov::Shape shape; + std::tie(model_type, shape, targetDevice) = GetParam(); - float clamp_min = netPrecision.isSigned() ? -5.f : 0.0f; + float clamp_min = model_type.is_signed() ? -5.f : 0.0f; float clamp_max = 5.0f; - auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); - ov::ParameterVector params {std::make_shared(ngPrc, ov::Shape(shape))}; + ov::ParameterVector params {std::make_shared(model_type, ov::Shape(shape))}; params[0]->set_friendly_name("Input"); - auto activation = ngraph::builder::makeActivation(params[0], - ngPrc, - ngraph::helpers::ActivationTypes::Clamp, - {}, - {clamp_min, clamp_max}); + auto activation = ov::test::utils::make_activation(params[0], + model_type, + ov::test::utils::ActivationTypes::Clamp, + {}, + {clamp_min, clamp_max}); - function = std::make_shared(ngraph::NodeVector{activation}, params); + function = std::make_shared(ov::NodeVector{activation}, params); } -InferenceEngine::Blob::Ptr InferRequestIOPrecision::GenerateInput(const InferenceEngine::InputInfo &info) const { - bool inPrcSigned = function->get_parameters()[0]->get_element_type().is_signed(); - bool inPrcReal = function->get_parameters()[0]->get_element_type().is_real(); - - int32_t data_start_from = inPrcSigned ? -10 : 0; - uint32_t data_range = 20; - int32_t resolution = inPrcReal ? 32768 : 1; - - return FuncTestUtils::createAndFillBlob(info.getTensorDesc(), data_range, - data_start_from, - resolution); +TEST_P(InferRequestIOPrecision, Inference) { + run(); } -TEST_P(InferRequestIOPrecision, CompareWithRefs) { - Run(); -} +const std::vector input_types = { + ov::element::i16, + ov::element::u16, + ov::element::f32, + ov::element::f16, + ov::element::u8, + ov::element::i8, + ov::element::i32, + ov::element::u32, + ov::element::u64, + ov::element::i64, + // Interpreter backend doesn't implement evaluate method for OP + // ov::element::f64, +}; INSTANTIATE_TEST_SUITE_P(smoke_GPU_BehaviorTests, InferRequestIOPrecision, ::testing::Combine( - ::testing::ValuesIn(inputPrecisions), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(InferenceEngine::Layout::ANY), - ::testing::Values(std::vector{1, 50}), + ::testing::ValuesIn(input_types), + ::testing::Values(ov::Shape{1, 50}), ::testing::Values(ov::test::utils::DEVICE_GPU)), InferRequestIOPrecision::getTestCaseName); TEST(TensorTest, smoke_canSetShapeForPreallocatedTensor) { - auto ie = ov::Core(); + auto core = ov::Core(); using namespace ov::preprocess; auto p = PrePostProcessor(ngraph::builder::subgraph::makeSplitMultiConvConcat()); p.input().tensor().set_element_type(ov::element::i8); p.input().preprocess().convert_element_type(ov::element::f32); auto function = p.build(); - auto exec_net = ie.compile_model(function, ov::test::utils::DEVICE_GPU); + auto exec_net = core.compile_model(function, ov::test::utils::DEVICE_GPU); auto inf_req = exec_net.create_infer_request(); // Check set_shape call for pre-allocated input/output tensors @@ -144,27 +113,27 @@ TEST(TensorTest, smoke_canSetScalarTensor) { params.front()->output(0).get_tensor().set_names({"scalar1"}); std::vector const_shape = {1}; - auto const1 = ngraph::opset1::Constant::create(ngraph::element::i64, ngraph::Shape{1}, const_shape); + auto const1 = std::make_shared(ov::element::i64, ov::Shape{1}, const_shape); const1->set_friendly_name("Const_1"); const1->output(0).get_tensor().set_names({"const1"}); const1->fill_data(ov::element::i64, 0); - auto unsqueeze1 = std::make_shared(params.front(), const1); + auto unsqueeze1 = std::make_shared(params.front(), const1); - ngraph::ResultVector results{std::make_shared(unsqueeze1)}; - std::shared_ptr fnPtr = std::make_shared(results, params); + ov::ResultVector results{std::make_shared(unsqueeze1)}; + auto model = std::make_shared(results, params); - auto ie = ov::Core(); - auto compiled_model = ie.compile_model(fnPtr, ov::test::utils::DEVICE_GPU); + auto core = ov::Core(); + auto compiled_model = core.compile_model(model, ov::test::utils::DEVICE_GPU); auto request = compiled_model.create_infer_request(); double real_data = 1.0; - ov::Tensor input_data(ngraph::element::f64, {}, &real_data); + ov::Tensor input_data(ov::element::f64, {}, &real_data); request.set_tensor("scalar1", input_data); ASSERT_NO_THROW(request.infer()); } TEST(TensorTest, smoke_canSetTensorForDynamicInput) { - auto ie = ov::Core(); + auto core = ov::Core(); using namespace ov::preprocess; auto p = PrePostProcessor(ngraph::builder::subgraph::makeSplitMultiConvConcat()); p.input().tensor().set_element_type(ov::element::i8); @@ -173,7 +142,7 @@ TEST(TensorTest, smoke_canSetTensorForDynamicInput) { auto function = p.build(); std::map shapes = { {0, ov::PartialShape{-1, -1, -1, -1}} }; function->reshape(shapes); - auto exec_net = ie.compile_model(function, ov::test::utils::DEVICE_GPU); + auto exec_net = core.compile_model(function, ov::test::utils::DEVICE_GPU); auto inf_req = exec_net.create_infer_request(); ov::Tensor t1(ov::element::i8, {1, 4, 20, 20}); @@ -243,3 +212,4 @@ TEST(VariablesTest, smoke_canSetStateTensor) { ASSERT_NO_THROW(request.infer()); } +} // namespace \ No newline at end of file diff --git a/src/plugins/intel_gpu/tests/functional/behavior/inference_precision.cpp b/src/plugins/intel_gpu/tests/functional/behavior/inference_precision.cpp index ac4d17fb7739e2..5c7bfd8adb9b60 100644 --- a/src/plugins/intel_gpu/tests/functional/behavior/inference_precision.cpp +++ b/src/plugins/intel_gpu/tests/functional/behavior/inference_precision.cpp @@ -2,24 +2,13 @@ // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include - -#include "openvino/runtime/core.hpp" - -#include -#include "shared_test_classes/base/layer_test_utils.hpp" #include "base/ov_behavior_test_utils.hpp" -#include "functional_test_utils/ov_plugin_cache.hpp" - -using namespace ::testing; +#include "openvino/runtime/core.hpp" +namespace { using params = std::tuple; -class InferencePrecisionTests : public testing::WithParamInterface, - virtual public LayerTestsUtils::LayerTestsCommon { +class InferencePrecisionTests : public ::testing::TestWithParam { public: static std::string getTestCaseName(const testing::TestParamInfo &obj) { ov::element::Type model_precision; @@ -33,7 +22,7 @@ class InferencePrecisionTests : public testing::WithParamInterface, TEST_P(InferencePrecisionTests, smoke_canSetInferencePrecisionAndInfer) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - auto core = ov::test::utils::PluginCache::get().core(); + auto core = ov::test::utils::PluginCache::get().core(); ov::element::Type model_precision; ov::element::Type inference_precision; std::tie(model_precision, inference_precision) = GetParam(); @@ -84,3 +73,4 @@ TEST(ExecutionModeTest, SetCompileGetInferPrecisionAndExecMode) { ASSERT_EQ(ov::element::f16, compiled_model.get_property(ov::hint::inference_precision)); } } +} // namespace \ No newline at end of file diff --git a/src/plugins/intel_gpu/tests/functional/behavior/memory_dyn_batch.cpp b/src/plugins/intel_gpu/tests/functional/behavior/memory_dyn_batch.cpp index d502850e367027..9572a128e95424 100644 --- a/src/plugins/intel_gpu/tests/functional/behavior/memory_dyn_batch.cpp +++ b/src/plugins/intel_gpu/tests/functional/behavior/memory_dyn_batch.cpp @@ -2,23 +2,18 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "common_test_utils/test_common.hpp" +#include "common_test_utils/common_utils.hpp" +#include "common_test_utils/test_constants.hpp" +#include "functional_test_utils/skip_tests_config.hpp" +#include "functional_test_utils/ov_plugin_cache.hpp" #include "openvino/core/partial_shape.hpp" -#include "openvino/opsets/opset8.hpp" #include "openvino/runtime/compiled_model.hpp" #include "openvino/runtime/infer_request.hpp" #include "openvino/runtime/core.hpp" -#include "ov_models/subgraph_builders.hpp" -#include "shared_test_classes/base/ov_subgraph.hpp" -#include "functional_test_utils/skip_tests_config.hpp" -#include "functional_test_utils/ov_plugin_cache.hpp" -#include "common_test_utils/common_utils.hpp" - -#include - -#include - -using namespace ov::test; +#include "openvino/op/add.hpp" +namespace { using MemoryDynamicBatchParams = std::tuple< ov::PartialShape, // Partial shape for network initialization ov::Shape, // Actual shape to be passed to inference request @@ -57,9 +52,9 @@ class MemoryDynamicBatch : public ::testing::Test, infer_request = compiled_model.create_infer_request(); } - static std::shared_ptr build_model(ElementType precision, const ov::PartialShape& shape) { - auto param = std::make_shared(precision, shape); - const ov::op::util::VariableInfo variable_info { shape, precision, "v0" }; + static std::shared_ptr build_model(ov::element::Type type, const ov::PartialShape& shape) { + auto param = std::make_shared(type, shape); + const ov::op::util::VariableInfo variable_info { shape, type, "v0" }; auto variable = std::make_shared(variable_info); auto read_value = std::make_shared(param, variable); auto add = std::make_shared(read_value, param); @@ -169,3 +164,4 @@ INSTANTIATE_TEST_SUITE_P(smoke_MemoryDynamicBatch, MemoryDynamicBatch, ::testing::ValuesIn(iterations_num), ::testing::Values(ov::test::utils::DEVICE_GPU)), MemoryDynamicBatch::get_test_case_name); +} // namespace diff --git a/src/plugins/intel_gpu/tests/functional/concurrency/gpu_concurrency_tests.cpp b/src/plugins/intel_gpu/tests/functional/concurrency/gpu_concurrency_tests.cpp index 29b80e9759df2a..0e763f41919847 100644 --- a/src/plugins/intel_gpu/tests/functional/concurrency/gpu_concurrency_tests.cpp +++ b/src/plugins/intel_gpu/tests/functional/concurrency/gpu_concurrency_tests.cpp @@ -2,16 +2,9 @@ // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include "openvino/runtime/core.hpp" - -#include -#include -#include +#include "common_test_utils/test_common.hpp" +#include "functional_test_utils/plugin_cache.hpp" #include "ov_models/subgraph_builders.hpp" #include "functional_test_utils/blob_utils.hpp" #include "openvino/core/preprocess/pre_post_process.hpp" @@ -20,14 +13,17 @@ #include "openvino/runtime/intel_gpu/properties.hpp" #include "common_test_utils/ov_tensor_utils.hpp" #include "common_test_utils/data_utils.hpp" +#include "openvino/runtime/core.hpp" +#include "openvino/runtime/infer_request.hpp" +#include "openvino/runtime/compiled_model.hpp" +#include "functional_test_utils/ov_plugin_cache.hpp" -using namespace ::testing; - +namespace { using ConcurrencyTestParams = std::tuple; // number of requests class OVConcurrencyTest : public ov::test::TestsCommon, - public testing::WithParamInterface { + public testing::WithParamInterface { void SetUp() override { std::tie(num_streams, num_requests) = this->GetParam(); fn_ptrs = {ngraph::builder::subgraph::makeSplitMultiConvConcat(), @@ -43,7 +39,7 @@ class OVConcurrencyTest : public ov::test::TestsCommon, } void execute(bool is_caching_test = false) { - auto ie = ov::Core(); + auto core = ov::test::utils::PluginCache::get().core(); std::string cacheFolderName; if (is_caching_test) { @@ -53,80 +49,67 @@ class OVConcurrencyTest : public ov::test::TestsCommon, ov::test::utils::removeFilesWithExt(cacheFolderName, "blob"); ov::test::utils::removeFilesWithExt(cacheFolderName, "cl_cache"); ov::test::utils::removeDir(cacheFolderName); - ie.set_property(ov::cache_dir(cacheFolderName)); - ie.set_property(ov::intel_gpu::enable_loop_unrolling(false)); + core->set_property(ov::cache_dir(cacheFolderName)); + core->set_property(ov::test::utils::DEVICE_GPU, ov::intel_gpu::enable_loop_unrolling(false)); } - ov::ResultVector outputs; - std::vector irs; - std::vector> ref; - std::vector outElementsCount; + std::vector, ov::InferRequest>> irs; + std::vector irs_ref; for (size_t i = 0; i < fn_ptrs.size(); ++i) { auto fn = fn_ptrs[i]; - ov::CompiledModel exec_net; - if (is_caching_test) { { - auto _dummy_exec_net = ie.compile_model(fn_ptrs[i], ov::test::utils::DEVICE_GPU, + auto _dummy_exec_net = core->compile_model(fn, ov::test::utils::DEVICE_GPU, ov::num_streams(ov::streams::Num(num_streams)), ov::hint::inference_precision(ov::element::f32)); } { - exec_net = ie.compile_model(fn_ptrs[i], ov::test::utils::DEVICE_GPU, + exec_net = core->compile_model(fn, ov::test::utils::DEVICE_GPU, ov::num_streams(ov::streams::Num(num_streams)), ov::hint::inference_precision(ov::element::f32)); } } else { - exec_net = ie.compile_model(fn_ptrs[i], ov::test::utils::DEVICE_GPU, + exec_net = core->compile_model(fn, ov::test::utils::DEVICE_GPU, ov::num_streams(ov::streams::Num(num_streams)), ov::hint::inference_precision(ov::element::f32)); } - auto output = fn_ptrs[i]->get_results().at(0); - for (size_t j = 0; j < num_streams * num_requests; j++) { - outputs.push_back(output); - auto inf_req = exec_net.create_infer_request(); - irs.push_back(inf_req); + irs.push_back({fn, inf_req}); - std::vector> inputs; - for (size_t param_idx = 0; param_idx < fn_ptrs[i]->get_parameters().size(); ++param_idx) { - auto input = fn_ptrs[i]->get_parameters().at(param_idx); + auto compiled_model_ref = core->compile_model(fn, ov::test::utils::DEVICE_TEMPLATE); + auto inf_req_ref = compiled_model_ref.create_infer_request(); + irs_ref.push_back(inf_req_ref); + + std::vector input_tensors; + for (size_t param_idx = 0; param_idx < fn->get_parameters().size(); ++param_idx) { + auto input = fn->get_parameters().at(param_idx); auto tensor = ov::test::utils::create_and_fill_tensor(input->get_element_type(), input->get_shape()); inf_req.set_tensor(input, tensor); - - const auto in_tensor = inf_req.get_tensor(input); - const auto tensorSize = in_tensor.get_byte_size(); - const auto inBlobBuf = static_cast(in_tensor.data()); - std::vector inData(inBlobBuf, inBlobBuf + tensorSize); - inputs.emplace_back(inData); + inf_req_ref.set_tensor(input, tensor); } - - auto reOutData = ngraph::helpers::interpreterFunction(fn_ptrs[i], inputs).front().second; - ref.push_back(reOutData); - outElementsCount.push_back(ov::shape_size(fn_ptrs[i]->get_output_shape(0))); + inf_req_ref.infer(); } } const int niter = 10; for (int i = 0; i < niter; i++) { for (auto ir : irs) { - ir.start_async(); + ir.second.start_async(); } for (auto ir : irs) { - ir.wait(); + ir.second.wait(); } } - auto thr = FuncTestUtils::GetComparisonThreshold(InferenceEngine::Precision::FP32); for (size_t i = 0; i < irs.size(); ++i) { - const auto &refBuffer = ref[i].data(); - ASSERT_EQ(outElementsCount[i], irs[i].get_tensor(outputs[i]).get_size()); - FuncTestUtils::compareRawBuffers(irs[i].get_tensor(outputs[i]).data(), - reinterpret_cast(refBuffer), outElementsCount[i], - outElementsCount[i], - thr); + // TODO now it compares only 1st output + // When CVS-126856 is fixed, update to compare all outputs + auto output = irs[i].first->get_results().at(0); + auto out = irs[i].second.get_tensor(output); + auto out_ref = irs_ref[i].get_tensor(output); + ov::test::utils::compare(out_ref, out); } if (is_caching_test) { @@ -139,15 +122,15 @@ class OVConcurrencyTest : public ov::test::TestsCommon, protected: size_t num_streams; size_t num_requests; - std::vector> fn_ptrs; + std::vector> fn_ptrs; }; TEST_P(OVConcurrencyTest, canInferTwoExecNets) { - this->execute(false); + execute(false); } TEST_P(OVConcurrencyTest, canInferTwoExecNets_cached) { - this->execute(true); + execute(true); } const std::vector num_streams{ 1, 2 }; @@ -159,12 +142,12 @@ INSTANTIATE_TEST_SUITE_P(smoke_RemoteTensor, OVConcurrencyTest, OVConcurrencyTest::getTestCaseName); TEST(canSwapTensorsBetweenInferRequests, inputs) { - std::vector> ref; + std::vector ref; std::vector input_tensors; auto fn = ngraph::builder::subgraph::makeSplitMultiConvConcat(); - auto ie = ov::Core(); - auto compiled_model = ie.compile_model(fn, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f32)); + auto core = ov::test::utils::PluginCache::get().core(); + auto compiled_model = core->compile_model(fn, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f32)); const int infer_requests_num = 2; ov::InferRequest infer_request1 = compiled_model.create_infer_request(); @@ -174,20 +157,16 @@ TEST(canSwapTensorsBetweenInferRequests, inputs) { input_tensors.push_back(infer_request2.get_input_tensor()); auto calc_ref_results = [&](const ov::Tensor& tensor){ - const auto tensor_size = tensor.get_byte_size(); - const auto in_blob_buf = static_cast(tensor.data()); - std::vector inData(in_blob_buf, in_blob_buf + tensor_size); - auto ref_out_data = ngraph::helpers::interpreterFunction(fn, {inData}).front().second; - ref.push_back(ref_out_data); - }; + auto compiled_model_ref = core->compile_model(fn, ov::test::utils::DEVICE_TEMPLATE); + auto inf_req_ref = compiled_model_ref.create_infer_request(); - auto compare_results = [&](ov::Tensor& result, const uint8_t* refResult) { - auto thr = FuncTestUtils::GetComparisonThreshold(InferenceEngine::Precision::FP32); - ASSERT_EQ(ov::shape_size(fn->get_output_shape(0)), result.get_size()); - FuncTestUtils::compareRawBuffers(result.data(), - reinterpret_cast(refResult), ov::shape_size(fn->get_output_shape(0)), - ov::shape_size(fn->get_output_shape(0)), - thr); + auto input = fn->input(0); + inf_req_ref.set_tensor(input, tensor); + inf_req_ref.infer(); + + auto output = fn->get_result(); + auto out_ref = inf_req_ref.get_tensor(output); + ref.push_back(out_ref); }; for (int32_t i = 0; i < infer_requests_num; i++) { @@ -207,7 +186,7 @@ TEST(canSwapTensorsBetweenInferRequests, inputs) { } else { iter1++; ov::Tensor output_tensor = infer_request1.get_output_tensor(); - compare_results(output_tensor, ref[iter1 % 2].data()); + ov::test::utils::compare(ref[iter1 % 2], output_tensor); if (iter1 < niter_limit) { infer_request1.set_input_tensor(input_tensors[(iter1 + 1) % 2]); infer_request1.start_async(); @@ -221,7 +200,7 @@ TEST(canSwapTensorsBetweenInferRequests, inputs) { } else { iter2++; ov::Tensor output_tensor = infer_request2.get_output_tensor(); - compare_results(output_tensor, ref[(iter2 + 1) % 2].data()); + ov::test::utils::compare(ref[(iter2 + 1) % 2], output_tensor); if (iter2 < niter_limit) { infer_request2.set_input_tensor(input_tensors[iter2 % 2]); infer_request2.start_async(); @@ -239,10 +218,10 @@ TEST(canSwapTensorsBetweenInferRequests, inputs) { } TEST(smoke_InferRequestDeviceMemoryAllocation, usmHostIsNotChanged) { - auto fn = ngraph::builder::subgraph::makeDetectionOutput(ngraph::element::Type_t::f32); + auto fn = ngraph::builder::subgraph::makeDetectionOutput(ov::element::f32); - auto ie = ov::Core(); - auto compiled_model = ie.compile_model(fn, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f32)); + auto core = ov::test::utils::PluginCache::get().core(); + auto compiled_model = core->compile_model(fn, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f32)); ov::InferRequest infer_request1 = compiled_model.create_infer_request(); ov::InferRequest infer_request2 = compiled_model.create_infer_request(); @@ -278,10 +257,10 @@ TEST(smoke_InferRequestDeviceMemoryAllocation, usmHostIsNotChanged) { } TEST(smoke_InferRequestDeviceMemoryAllocation, canSetSystemHostTensor) { - auto fn = ngraph::builder::subgraph::makeDetectionOutput(ngraph::element::Type_t::f32); + auto fn = ngraph::builder::subgraph::makeDetectionOutput(ov::element::f32); - auto ie = ov::Core(); - auto compiled_model = ie.compile_model(fn, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f32)); + auto core = ov::test::utils::PluginCache::get().core(); + auto compiled_model = core->compile_model(fn, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f32)); ov::InferRequest infer_request1 = compiled_model.create_infer_request(); ov::InferRequest infer_request2 = compiled_model.create_infer_request(); @@ -301,13 +280,13 @@ TEST(smoke_InferRequestDeviceMemoryAllocation, canSetSystemHostTensor) { } TEST(canSwapTensorsBetweenInferRequests, outputs) { - std::vector> ref; + std::vector ref; std::vector input_tensors; std::vector output_tensors; auto fn = ngraph::builder::subgraph::makeSplitMultiConvConcat(); - auto ie = ov::Core(); - auto compiled_model = ie.compile_model(fn, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f32)); + auto core = ov::test::utils::PluginCache::get().core(); + auto compiled_model = core->compile_model(fn, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f32)); const int infer_requests_num = 2; ov::InferRequest infer_request1 = compiled_model.create_infer_request(); @@ -319,20 +298,16 @@ TEST(canSwapTensorsBetweenInferRequests, outputs) { output_tensors.push_back(infer_request2.get_output_tensor()); auto calc_ref_results = [&](const ov::Tensor& tensor){ - const auto tensor_size = tensor.get_byte_size(); - const auto in_blob_buf = static_cast(tensor.data()); - std::vector inData(in_blob_buf, in_blob_buf + tensor_size); - auto ref_out_data = ngraph::helpers::interpreterFunction(fn, {inData}).front().second; - ref.push_back(ref_out_data); - }; + auto compiled_model_ref = core->compile_model(fn, ov::test::utils::DEVICE_TEMPLATE); + auto inf_req_ref = compiled_model_ref.create_infer_request(); + + auto input = fn->input(0); + inf_req_ref.set_tensor(input, tensor); + inf_req_ref.infer(); - auto compare_results = [&](ov::Tensor& result, const uint8_t* refResult) { - auto thr = FuncTestUtils::GetComparisonThreshold(InferenceEngine::Precision::FP32); - ASSERT_EQ(ov::shape_size(fn->get_output_shape(0)), result.get_size()); - FuncTestUtils::compareRawBuffers(result.data(), - reinterpret_cast(refResult), ov::shape_size(fn->get_output_shape(0)), - ov::shape_size(fn->get_output_shape(0)), - thr); + auto output = fn->get_result(); + auto out_ref = inf_req_ref.get_tensor(output); + ref.push_back(out_ref); }; for (int32_t i = 0; i < infer_requests_num; i++) { @@ -352,7 +327,7 @@ TEST(canSwapTensorsBetweenInferRequests, outputs) { } else { iter1++; ov::Tensor output_tensor = infer_request1.get_output_tensor(); - compare_results(output_tensor, ref[0].data()); + ov::test::utils::compare(ref[0], output_tensor); if (iter1 < niter_limit) { infer_request1.set_output_tensor(output_tensors[(iter1 + 1) % 2]); infer_request1.start_async(); @@ -366,7 +341,7 @@ TEST(canSwapTensorsBetweenInferRequests, outputs) { } else { iter2++; ov::Tensor output_tensor = infer_request2.get_output_tensor(); - compare_results(output_tensor, ref[1].data()); + ov::test::utils::compare(ref[1], output_tensor); if (iter2 < niter_limit) { infer_request2.set_output_tensor(output_tensors[iter2 % 2]); infer_request2.start_async(); @@ -382,3 +357,4 @@ TEST(canSwapTensorsBetweenInferRequests, outputs) { infer_request2.wait(); } } +} // namespace \ No newline at end of file diff --git a/src/plugins/intel_gpu/tests/functional/dynamic_tests/gpu_dyn_batch_shape_tests.cpp b/src/plugins/intel_gpu/tests/functional/dynamic_tests/gpu_dyn_batch_shape_tests.cpp index 9f4c18ef5d2ce4..880e401bc1acb3 100644 --- a/src/plugins/intel_gpu/tests/functional/dynamic_tests/gpu_dyn_batch_shape_tests.cpp +++ b/src/plugins/intel_gpu/tests/functional/dynamic_tests/gpu_dyn_batch_shape_tests.cpp @@ -2,42 +2,41 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "openvino/runtime/core.hpp" -#include -#include "common_test_utils/common_utils.hpp" +#include "common_test_utils/test_common.hpp" #include "common_test_utils/file_utils.hpp" #include "functional_test_utils/skip_tests_config.hpp" #include "functional_test_utils/ov_plugin_cache.hpp" +#include "openvino/runtime/core.hpp" #include "ov_models/subgraph_builders.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -using namespace ::testing; -using namespace ov::test; +namespace { +using ov::test::InputShape; using OVDynamicBatchParams = std::tuple< - std::vector, // dynamic and static case sizes - ElementType, // Network precision + std::vector, // dynamic and static case sizes + ov::element::Type, // Model type std::string, // Device name ov::AnyMap // Config >; -class OVDynamicBatchShape_Tests : public WithParamInterface, - virtual public ov::test::SubgraphBaseTest { +class OVDynamicBatchShape_Tests : public ::testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { public: - static std::string getTestCaseName(TestParamInfo obj) { - std::vector inputShapes; - ElementType netPrecision; - std::string targetDevice; + static std::string getTestCaseName(::testing::TestParamInfo obj) { + std::vector input_shapes; + ov::element::Type model_type; + std::string target_device; ov::AnyMap configuration; - std::tie(inputShapes, netPrecision, targetDevice, configuration) = obj.param; + std::tie(input_shapes, model_type, target_device, configuration) = obj.param; std::ostringstream result; result << "IS="; - for (const auto& shape : inputShapes) { + for (const auto& shape : input_shapes) { result << ov::test::utils::partialShape2str({ shape.first }) << "_"; } result << "TS="; - for (const auto& shape : inputShapes) { + for (const auto& shape : input_shapes) { result << "("; if (!shape.second.empty()) { for (const auto& itr : shape.second) { @@ -46,8 +45,8 @@ class OVDynamicBatchShape_Tests : public WithParamInterface input_shape; - std::tie(inputShape, netPrecision, targetDevice, configuration) = this->GetParam(); + std::tie(input_shape, model_type, targetDevice, configuration) = this->GetParam(); - init_input_shapes(inputShape); + init_input_shapes(input_shape); //TODO: think how we can switch between several input topologies in the future - // function = ngraph::builder::subgraph::makeSplitConvConcat(inputShape.front().first.get_min_shape(), netPrecision); - function = ngraph::builder::subgraph::makeSplitMultiConvConcat(inputShape.front().first.get_min_shape(), netPrecision); + // function = ngraph::builder::subgraph::makeSplitConvConcat(input_shape.front().first.get_min_shape(), model_type); + function = ngraph::builder::subgraph::makeSplitMultiConvConcat(input_shape.front().first.get_min_shape(), model_type); // make topology dynamic std::map dynShape; - dynShape["input_tensor"] = inputShape.front().first; + dynShape["input_tensor"] = input_shape.front().first; function->reshape(dynShape); } - std::shared_ptr src_func; - // std::map configuration; - std::vector inputShape; - ElementType netPrecision; + ov::element::Type model_type; }; TEST_P(OVDynamicBatchShape_Tests, InferDynamicBatchBound) { @@ -94,7 +91,7 @@ TEST_P(OVDynamicBatchShape_Tests, InferDynamicBatchBound_cached) { std::string cacheFolderName; { std::stringstream ss; - ss << "InferDynamicBatchBound_cached_" << netPrecision << "_" << targetDevice; + ss << "InferDynamicBatchBound_cached_" << model_type << "_" << targetDevice; cacheFolderName = ss.str(); ov::test::utils::removeFilesWithExt(cacheFolderName, "blob"); @@ -116,7 +113,6 @@ TEST_P(OVDynamicBatchShape_Tests, InferDynamicBatchBound_cached) { } } -namespace { auto config = []() { return ov::AnyMap{}; }; @@ -125,27 +121,27 @@ auto hetero_config = []() { return ov::AnyMap{{"TARGET_FALLBACK", ov::test::utils::DEVICE_GPU}}; }; -const std::vector inputShapes = { +const std::vector input_shapes = { { { {1, 19}, 4, 20, 20}, { {1, 4, 20, 20}, {7, 4, 20, 20}, {17, 4, 20, 20} } } }; -const std::vector netPrecisions = { - ElementType::f16, - ElementType::f32 +const std::vector model_types = { + ov::element::f16, + ov::element::f32 }; INSTANTIATE_TEST_SUITE_P(smoke_GPU_DynBatch, OVDynamicBatchShape_Tests, ::testing::Combine( - ::testing::Values(inputShapes), - ::testing::ValuesIn(netPrecisions), + ::testing::Values(input_shapes), + ::testing::ValuesIn(model_types), ::testing::Values(ov::test::utils::DEVICE_GPU), ::testing::Values(config())), OVDynamicBatchShape_Tests::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_GPU_DynBatchHetero, OVDynamicBatchShape_Tests, ::testing::Combine( - ::testing::Values(inputShapes), - ::testing::ValuesIn(netPrecisions), + ::testing::Values(input_shapes), + ::testing::ValuesIn(model_types), ::testing::Values(ov::test::utils::DEVICE_HETERO), ::testing::Values(hetero_config())), OVDynamicBatchShape_Tests::getTestCaseName); diff --git a/src/plugins/intel_gpu/tests/functional/dynamic_tests/gpu_dyn_huge_input_range.cpp b/src/plugins/intel_gpu/tests/functional/dynamic_tests/gpu_dyn_huge_input_range.cpp index 62eb867df971fa..f852a378f26048 100644 --- a/src/plugins/intel_gpu/tests/functional/dynamic_tests/gpu_dyn_huge_input_range.cpp +++ b/src/plugins/intel_gpu/tests/functional/dynamic_tests/gpu_dyn_huge_input_range.cpp @@ -1,18 +1,16 @@ // Copyright (C) 2022 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // - +#include "common_test_utils/test_constants.hpp" +#include "common_test_utils/ov_tensor_utils.hpp" +#include "common_test_utils/test_enums.hpp" +#include "ov_models/builders.hpp" #include "shared_test_classes/single_layer/strided_slice.hpp" #include "shared_test_classes/single_layer/shape_of.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -#include "ov_models/builders.hpp" -#include "common_test_utils/test_constants.hpp" -#include "common_test_utils/ov_tensor_utils.hpp" - -using namespace InferenceEngine; -using namespace ov::test; -namespace GPULayerTestsDefinitions { +namespace { +using ov::test::InputShape; struct StridedSliceParams { std::vector begin; @@ -28,22 +26,21 @@ struct StridedSliceParams { typedef std::tuple< InputShape, // Input shapes StridedSliceParams, - ElementType, // Element type - std::vector, // begin/end/stride input type + ov::element::Type, // Element type + std::vector, // begin/end/stride input type std::map // Additional network configuration > StridedSliceLayerParamSet; class DynamicShapeHugeRangeGPUTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest { + virtual public ov::test::SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { InputShape shapes; StridedSliceParams params; - ElementType elementType; - std::vector restInputType; - TargetDevice targetDevice; + ov::element::Type model_type; + std::vector restInputType; std::map additionalConfig; - std::tie(shapes, params, elementType, restInputType, additionalConfig) = obj.param; + std::tie(shapes, params, model_type, restInputType, additionalConfig) = obj.param; std::ostringstream results; results << "IS=" << ov::test::utils::partialShape2str({shapes.first}) << "_"; @@ -51,7 +48,7 @@ class DynamicShapeHugeRangeGPUTest : public testing::WithParamInterface& targetInputStaticShapes) override { + void generate_inputs(const std::vector& targetInputStaticShapes) override { inputs.clear(); const auto& funcInputs = function->inputs(); ov::Tensor tensor; @@ -83,7 +80,7 @@ class DynamicShapeHugeRangeGPUTest : public testing::WithParamInterface(); @@ -94,7 +91,7 @@ class DynamicShapeHugeRangeGPUTest : public testing::WithParamInterface(); @@ -105,7 +102,7 @@ class DynamicShapeHugeRangeGPUTest : public testing::WithParamInterface(); @@ -122,7 +119,7 @@ class DynamicShapeHugeRangeGPUTest : public testing::WithParamInterface begin; std::vector end; std::vector stride; - std::vector restInputType; + std::vector restInputType; size_t inferRequestNum = 0; void SetUp() override { @@ -139,11 +136,11 @@ class DynamicShapeHugeRangeGPUTest : public testing::WithParamInterface inputShapes; inputShapes.push_back(shapes); - if (restInputType[0] == ngraph::helpers::InputLayerType::PARAMETER) + if (restInputType[0] == ov::test::utils::InputLayerType::PARAMETER) inputShapes.push_back(InputShape({static_cast(begin.size())}, std::vector(shapes.second.size(), {begin.size()}))); - if (restInputType[1] == ngraph::helpers::InputLayerType::PARAMETER) + if (restInputType[1] == ov::test::utils::InputLayerType::PARAMETER) inputShapes.push_back(InputShape({static_cast(end.size())}, std::vector(shapes.second.size(), {end.size()}))); - if (restInputType[2] == ngraph::helpers::InputLayerType::PARAMETER) + if (restInputType[2] == ov::test::utils::InputLayerType::PARAMETER) inputShapes.push_back(InputShape({static_cast(stride.size())}, std::vector(shapes.second.size(), {stride.size()}))); init_input_shapes(inputShapes); @@ -151,67 +148,65 @@ class DynamicShapeHugeRangeGPUTest : public testing::WithParamInterface(inType, inputDynamicShapes.front())}; std::shared_ptr beginInput, endInput, strideInput; - if (restInputType[0] == ngraph::helpers::InputLayerType::PARAMETER) { - auto beginNode = std::make_shared(ngraph::element::Type_t::i64, ov::Shape{begin.size()}); + if (restInputType[0] == ov::test::utils::InputLayerType::PARAMETER) { + auto beginNode = std::make_shared(ov::element::i64, ov::Shape{begin.size()}); params.push_back(beginNode); beginInput = beginNode; } else { - beginInput = std::make_shared(ngraph::element::Type_t::i64, ov::Shape{begin.size()}, begin); + beginInput = std::make_shared(ov::element::i64, ov::Shape{begin.size()}, begin); } - if (restInputType[1] == ngraph::helpers::InputLayerType::PARAMETER) { - auto endNode = std::make_shared(ngraph::element::Type_t::i64, ov::Shape{end.size()}); + if (restInputType[1] == ov::test::utils::InputLayerType::PARAMETER) { + auto endNode = std::make_shared(ov::element::i64, ov::Shape{end.size()}); params.push_back(endNode); endInput = endNode; } else { - endInput = std::make_shared(ngraph::element::Type_t::i64, ov::Shape{end.size()}, end); + endInput = std::make_shared(ov::element::i64, ov::Shape{end.size()}, end); } - if (restInputType[2] == ngraph::helpers::InputLayerType::PARAMETER) { - auto strideNode = std::make_shared(ngraph::element::Type_t::i64, ov::Shape{stride.size()}); + if (restInputType[2] == ov::test::utils::InputLayerType::PARAMETER) { + auto strideNode = std::make_shared(ov::element::i64, ov::Shape{stride.size()}); params.push_back(strideNode); strideInput = strideNode; } else { - strideInput = std::make_shared(ngraph::element::Type_t::i64, ov::Shape{stride.size()}, stride); + strideInput = std::make_shared(ov::element::i64, ov::Shape{stride.size()}, stride); } - auto stridedSliceOp = std::make_shared(params[0], beginInput, endInput, strideInput, ssParams.beginMask, ssParams.endMask, + auto stridedSliceOp = std::make_shared(params[0], beginInput, endInput, strideInput, ssParams.beginMask, ssParams.endMask, ssParams.newAxisMask, ssParams.shrinkAxisMask, ssParams.ellipsisAxisMask); - auto shapeOfOp = std::make_shared(stridedSliceOp, ov::element::Type_t::i32); + auto shapeOfOp = std::make_shared(stridedSliceOp, ov::element::i32); - ngraph::ResultVector results; + ov::ResultVector results; for (size_t i = 0; i < shapeOfOp->get_output_size(); i++) { - results.push_back(std::make_shared(shapeOfOp->output(i))); + results.push_back(std::make_shared(shapeOfOp->output(i))); } - function = std::make_shared(results, params, "result"); + function = std::make_shared(results, params, "result"); } }; -TEST_P(DynamicShapeHugeRangeGPUTest, CompareWithRefs) { +TEST_P(DynamicShapeHugeRangeGPUTest, Inference) { SKIP_IF_CURRENT_TEST_IS_DISABLED() run(); } -namespace { - std::map emptyAdditionalConfig; -const std::vector inputPrecisions = { - ElementType::f32 +const std::vector model_types = { + ov::element::f32 }; -const std::vector> restInputTypes = { - {ngraph::helpers::InputLayerType::CONSTANT, ngraph::helpers::InputLayerType::CONSTANT, ngraph::helpers::InputLayerType::CONSTANT}, - {ngraph::helpers::InputLayerType::PARAMETER, ngraph::helpers::InputLayerType::PARAMETER, ngraph::helpers::InputLayerType::PARAMETER}, - {ngraph::helpers::InputLayerType::PARAMETER, ngraph::helpers::InputLayerType::CONSTANT, ngraph::helpers::InputLayerType::CONSTANT}, - {ngraph::helpers::InputLayerType::CONSTANT, ngraph::helpers::InputLayerType::PARAMETER, ngraph::helpers::InputLayerType::CONSTANT}, - {ngraph::helpers::InputLayerType::CONSTANT, ngraph::helpers::InputLayerType::CONSTANT, ngraph::helpers::InputLayerType::PARAMETER}, - {ngraph::helpers::InputLayerType::CONSTANT, ngraph::helpers::InputLayerType::PARAMETER, ngraph::helpers::InputLayerType::PARAMETER}, - {ngraph::helpers::InputLayerType::PARAMETER, ngraph::helpers::InputLayerType::CONSTANT, ngraph::helpers::InputLayerType::PARAMETER}, - {ngraph::helpers::InputLayerType::PARAMETER, ngraph::helpers::InputLayerType::PARAMETER, ngraph::helpers::InputLayerType::CONSTANT}, +const std::vector> restInputTypes = { + {ov::test::utils::InputLayerType::CONSTANT, ov::test::utils::InputLayerType::CONSTANT, ov::test::utils::InputLayerType::CONSTANT}, + {ov::test::utils::InputLayerType::PARAMETER, ov::test::utils::InputLayerType::PARAMETER, ov::test::utils::InputLayerType::PARAMETER}, + {ov::test::utils::InputLayerType::PARAMETER, ov::test::utils::InputLayerType::CONSTANT, ov::test::utils::InputLayerType::CONSTANT}, + {ov::test::utils::InputLayerType::CONSTANT, ov::test::utils::InputLayerType::PARAMETER, ov::test::utils::InputLayerType::CONSTANT}, + {ov::test::utils::InputLayerType::CONSTANT, ov::test::utils::InputLayerType::CONSTANT, ov::test::utils::InputLayerType::PARAMETER}, + {ov::test::utils::InputLayerType::CONSTANT, ov::test::utils::InputLayerType::PARAMETER, ov::test::utils::InputLayerType::PARAMETER}, + {ov::test::utils::InputLayerType::PARAMETER, ov::test::utils::InputLayerType::CONSTANT, ov::test::utils::InputLayerType::PARAMETER}, + {ov::test::utils::InputLayerType::PARAMETER, ov::test::utils::InputLayerType::PARAMETER, ov::test::utils::InputLayerType::CONSTANT}, }; const std::vector inputShapesDynamic2D_excessive_uppper_boundary = { @@ -227,9 +222,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_CompareWithRefs_Dynamic_2D_excessive_uppper_bound ::testing::Combine( ::testing::ValuesIn(inputShapesDynamic2D_excessive_uppper_boundary), ::testing::ValuesIn(paramsPlain2D_excessive_uppper_boundary), - ::testing::ValuesIn(inputPrecisions), + ::testing::ValuesIn(model_types), ::testing::Values(restInputTypes[0]), ::testing::Values(emptyAdditionalConfig)), DynamicShapeHugeRangeGPUTest::getTestCaseName); } // namespace -} // namespace GPULayerTestsDefinitions diff --git a/src/plugins/intel_gpu/tests/functional/single_layer_tests/loop.cpp b/src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/loop.cpp similarity index 100% rename from src/plugins/intel_gpu/tests/functional/single_layer_tests/loop.cpp rename to src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/loop.cpp diff --git a/src/plugins/intel_gpu/tests/functional/single_layer_tests/convolution.cpp b/src/plugins/intel_gpu/tests/functional/single_layer_tests/convolution.cpp index ca0c19bd3f3c54..458b5fffd76d50 100644 --- a/src/plugins/intel_gpu/tests/functional/single_layer_tests/convolution.cpp +++ b/src/plugins/intel_gpu/tests/functional/single_layer_tests/convolution.cpp @@ -1,47 +1,40 @@ // Copyright (C) 2018-2023 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include "ov_models/utils/ov_helpers.hpp" -#include "ov_models/builders.hpp" -#include "shared_test_classes/base/ov_subgraph.hpp" -#include "shared_test_classes/single_layer/convolution.hpp" -#include "common_test_utils/test_constants.hpp" +#include "common_test_utils/ov_tensor_utils.hpp" +#include "common_test_utils/file_utils.hpp" +#include "shared_test_classes/single_op/convolution.hpp" +#include "common_test_utils/node_builders/convolution.hpp" -// using namespace LayerTestsDefinitions; -using namespace InferenceEngine; -using namespace ov::test; +#include "openvino/op/parameter.hpp" +#include "openvino/op/result.hpp" -namespace GPULayerTestsDefinitions { - -using LayerTestsDefinitions::convSpecificParams; +namespace { +using ov::test::InputShape; +using ov::test::convSpecificParams; typedef std::tuple< convSpecificParams, - ElementType, // Net precision - ElementType, // Input precision - ElementType, // Output precision - InputShape, // Input shape - LayerTestsUtils::TargetDevice // Device name + ov::element::Type, // Net precision + ov::element::Type, // Input precision + ov::element::Type, // Output precision + InputShape, // Input shape + std::string // Device name > convLayerTestParamsSet; - class ConvolutionLayerGPUTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest { + virtual public ov::test::SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { convSpecificParams convParams; - ElementType netType; - ElementType inType, outType; + ov::element::Type netType; + ov::element::Type inType, outType; InputShape inputShape; std::string targetDevice; std::tie(convParams, netType, inType, outType, inputShape, targetDevice) = obj.param; - ngraph::op::PadType padType; - InferenceEngine::SizeVector kernel, stride, dilation; + ov::op::PadType padType; + std::vector kernel, stride, dilation; std::vector padBegin, padEnd; size_t convOutChannels; std::tie(kernel, stride, padBegin, padEnd, dilation, convOutChannels, padType) = convParams; @@ -73,13 +66,13 @@ class ConvolutionLayerGPUTest : public testing::WithParamInterfaceGetParam(); init_input_shapes({inputShape}); - ngraph::op::PadType padType; - InferenceEngine::SizeVector kernel, stride, dilation; + ov::op::PadType padType; + std::vector kernel, stride, dilation; std::vector padBegin, padEnd; size_t convOutChannels; std::tie(kernel, stride, padBegin, padEnd, dilation, convOutChannels, padType) = convParams; @@ -88,40 +81,36 @@ class ConvolutionLayerGPUTest : public testing::WithParamInterface(inType, shape)); - auto convolutionNode = ngraph::builder::makeConvolution(inputParams.front(), netType, kernel, stride, padBegin, - padEnd, dilation, padType, convOutChannels); + auto convolutionNode = ov::test::utils::make_convolution(inputParams.front(), netType, kernel, stride, padBegin, + padEnd, dilation, padType, convOutChannels); - ngraph::ResultVector results; + ov::ResultVector results; for (size_t i = 0; i < convolutionNode->get_output_size(); i++) - results.push_back(std::make_shared(convolutionNode->output(i))); + results.push_back(std::make_shared(convolutionNode->output(i))); - function = std::make_shared(results, inputParams, "Convolution"); + function = std::make_shared(results, inputParams, "Convolution"); } }; -TEST_P(ConvolutionLayerGPUTest, CompareWithRefs) { - SKIP_IF_CURRENT_TEST_IS_DISABLED() +TEST_P(ConvolutionLayerGPUTest, Inference) { run(); } -namespace { -// Check 3D input tensor for convolution is handled properly and its output is correct comparing with ngraph runtime. +// Check 3D input tensor for convolution is handled properly and its output is correct comparing with ov runtime. INSTANTIATE_TEST_SUITE_P(smoke_ConvolutionLayerGPUTest_3D_tensor_basic, ConvolutionLayerGPUTest, ::testing::Combine( ::testing::Combine( - ::testing::Values(SizeVector{3}), - ::testing::Values(SizeVector{1}), + ::testing::Values(std::vector{3}), + ::testing::Values(std::vector{1}), ::testing::Values(std::vector{0}), ::testing::Values(std::vector{0}), - ::testing::Values(SizeVector{1}), + ::testing::Values(std::vector{1}), ::testing::Values(13), - ::testing::Values(ngraph::op::PadType::SAME_UPPER)), - ::testing::Values(ElementType::f16), - ::testing::Values(ElementType::f16), - ::testing::Values(ElementType::undefined), + ::testing::Values(ov::op::PadType::SAME_UPPER)), + ::testing::Values(ov::element::f16), + ::testing::Values(ov::element::f16), + ::testing::Values(ov::element::undefined), ::testing::Values(InputShape{{}, {{1, 13, 30}}}), ::testing::Values(ov::test::utils::DEVICE_GPU)), ConvolutionLayerGPUTest::getTestCaseName); } // namespace - -} // namespace GPULayerTestsDefinitions diff --git a/src/plugins/intel_gpu/tests/functional/single_layer_tests/tensor_iterator.cpp b/src/plugins/intel_gpu/tests/functional/single_layer_tests/tensor_iterator.cpp index 4bd41f87cd51a6..97b98da4d66633 100644 --- a/src/plugins/intel_gpu/tests/functional/single_layer_tests/tensor_iterator.cpp +++ b/src/plugins/intel_gpu/tests/functional/single_layer_tests/tensor_iterator.cpp @@ -2,26 +2,17 @@ // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "common_test_utils/test_constants.hpp" -#include "ie_api.h" -#include "shared_test_classes/base/layer_test_utils.hpp" -#include "ov_models/builders.hpp" -#include "ov_models/utils/ov_helpers.hpp" - -using namespace InferenceEngine; -using Config = std::pair>; - -namespace LayerTestsDefinitions { +// +#include "common_test_utils/ov_tensor_utils.hpp" +#include "common_test_utils/file_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "common_test_utils/node_builders/convolution.hpp" +#include "common_test_utils/test_enums.hpp" +#include "common_test_utils/node_builders/gru_cell.hpp" +#include "common_test_utils/node_builders/lstm_cell.hpp" +#include "common_test_utils/node_builders/rnn_cell.hpp" +namespace { using TensorIteratorWithConfigParams = typename std::tuple< size_t, // seq_lengths size_t, // batch @@ -30,13 +21,13 @@ using TensorIteratorWithConfigParams = typename std::tuple< //size_t, // input size size_t, // sequence axis float, // clip - ngraph::helpers::TensorIteratorBody, // body type - ngraph::op::RecurrentSequenceDirection, // direction - InferenceEngine::Precision, // Network precision - Config>; // Target device name & Configuration + ov::test::utils::TensorIteratorBody, // body type + ov::op::RecurrentSequenceDirection, // direction + ov::element::Type, // Model type + std::string>; // Device class TensorIteratorWithConfigTest : public testing::WithParamInterface, - virtual public LayerTestsUtils::LayerTestsCommon { + virtual public ov::test::SubgraphBaseStaticTest { public: static std::string getTestCaseName(const testing::TestParamInfo &obj) { size_t seq_lengths; @@ -44,29 +35,28 @@ class TensorIteratorWithConfigTest : public testing::WithParamInterface> config; - std::tie(seq_lengths, batch, hidden_size, sequence_axis, clip, ti_body, direction, netPrecision, - config) = obj.param; + ov::op::RecurrentSequenceDirection direction; + ov::element::Type model_type; + std::string target_device; + std::tie(seq_lengths, batch, hidden_size, sequence_axis, clip, ti_body, direction, model_type, target_device) = obj.param; std::vector> inputShapes = {}; switch (ti_body) { - case ngraph::helpers::TensorIteratorBody::LSTM: + case ov::test::utils::TensorIteratorBody::LSTM: inputShapes = { {{batch, input_size}, {batch, hidden_size}, {batch, hidden_size}, {4 * hidden_size, input_size}, {4 * hidden_size, hidden_size}, {4 * hidden_size}}, }; break; - case ngraph::helpers::TensorIteratorBody::GRU: + case ov::test::utils::TensorIteratorBody::GRU: inputShapes = { {{batch, input_size}, {batch, hidden_size}, {3 * hidden_size, input_size}, {3 * hidden_size, hidden_size}, {3 * hidden_size}}, }; break; - case ngraph::helpers::TensorIteratorBody::RNN: + case ov::test::utils::TensorIteratorBody::RNN: inputShapes = {{batch, input_size}, {batch, hidden_size}, {hidden_size, input_size}, {hidden_size, hidden_size}, {hidden_size}}; break; @@ -82,17 +72,8 @@ class TensorIteratorWithConfigTest : public testing::WithParamInterface(lstm_cell->output(0), axis); - ngraph::ResultVector results{std::make_shared(unsqueeze), - std::make_shared(lstm_cell->output(0)), - std::make_shared(lstm_cell->output(1))}; - auto body = std::make_shared(results, body_params, "lstm_cell"); + ov::ParameterVector body_params{std::make_shared(model_type, ov::Shape(inputShapes[0])), + std::make_shared(model_type, ov::Shape(inputShapes[1])), + std::make_shared(model_type, ov::Shape(inputShapes[2]))}; + auto squeeze = std::make_shared(body_params[0], axis); + std::vector WRB = {inputShapes[3], inputShapes[4], inputShapes[5]}; + ov::OutputVector out_vector = {squeeze, body_params[1], body_params[2]}; + auto lstm_cell = ov::test::utils::make_lstm(out_vector, WRB, hidden_size, {"sigmoid", "tanh", "tanh"}, {}, {}, clip); + auto unsqueeze = std::make_shared(lstm_cell->output(0), axis); + ov::ResultVector results{std::make_shared(unsqueeze), + std::make_shared(lstm_cell->output(0)), + std::make_shared(lstm_cell->output(1))}; + auto body = std::make_shared(results, body_params, "lstm_cell"); tensor_iterator->set_function(body); // 2. Set PortMap - if (direction == ngraph::op::RecurrentSequenceDirection::FORWARD) { + if (direction == ov::op::RecurrentSequenceDirection::FORWARD) { tensor_iterator->set_sliced_input(body_params[0], outer_params[0], 0, 1, 1, -1, sequence_axis); tensor_iterator->get_concatenated_slices(results[0], 0, 1, 1, -1, sequence_axis); - } else if (direction == ngraph::op::RecurrentSequenceDirection::REVERSE) { + } else if (direction == ov::op::RecurrentSequenceDirection::REVERSE) { tensor_iterator->set_sliced_input(body_params[0], outer_params[0], -1, -1, 1, 0, sequence_axis); tensor_iterator->get_concatenated_slices(results[0], -1, -1, 1, 0, sequence_axis); } else { - NGRAPH_CHECK(false, "Bidirectional case is not supported."); + OPENVINO_THROW("Bidirectional case is not supported."); } tensor_iterator->set_merged_input(body_params[1], outer_params[1], results[1]); @@ -169,11 +146,11 @@ class TensorIteratorWithConfigTest : public testing::WithParamInterfaceget_iter_value(results[2]); // 3. Outer function - function = std::make_shared(ngraph::OutputVector{tensor_iterator->output(0), tensor_iterator->output(1), + function = std::make_shared(ov::OutputVector{tensor_iterator->output(0), tensor_iterator->output(1), tensor_iterator->output(2)}, outer_params); break; } - case ngraph::helpers::TensorIteratorBody::GRU: { + case ov::test::utils::TensorIteratorBody::GRU: { inputShapes = { {{batch, seq_lengths, input_size}, {batch, hidden_size}, {3 * hidden_size, input_size}, {3 * hidden_size, hidden_size}, {3 * hidden_size}}, @@ -182,43 +159,43 @@ class TensorIteratorWithConfigTest : public testing::WithParamInterface(ngPrc, ov::Shape(inputShapes[0])), - std::make_shared(ngPrc, ov::Shape(inputShapes[1]))}; + ov::ParameterVector outer_params{std::make_shared(model_type, ov::Shape(inputShapes[0])), + std::make_shared(model_type, ov::Shape(inputShapes[1]))}; // 1. Create TensorIterator body. inputShapes[0][sequence_axis] = 1; // sliced dimension - ov::ParameterVector body_params{std::make_shared(ngPrc, ov::Shape(inputShapes[0])), - std::make_shared(ngPrc, ov::Shape(inputShapes[1]))}; - std::vector WRB = {inputShapes[2], inputShapes[3], inputShapes[4]}; - auto squeeze = std::make_shared(body_params[0], axis); - ngraph::OutputVector out_vector = {squeeze, body_params[1]}; - auto gru_cell = ngraph::builder::makeGRU(out_vector, WRB, hidden_size, {"sigmoid", "tanh"}, - {}, {}, clip, false); - auto unsqueeze = std::make_shared(gru_cell->output(0), axis); - ngraph::ResultVector results{std::make_shared(gru_cell->output(0)), - std::make_shared(unsqueeze)}; - auto body = std::make_shared(results, body_params, "gru_cell"); + ov::ParameterVector body_params{std::make_shared(model_type, ov::Shape(inputShapes[0])), + std::make_shared(model_type, ov::Shape(inputShapes[1]))}; + std::vector WRB = {inputShapes[2], inputShapes[3], inputShapes[4]}; + auto squeeze = std::make_shared(body_params[0], axis); + ov::OutputVector out_vector = {squeeze, body_params[1]}; + auto gru_cell = ov::test::utils::make_gru(out_vector, WRB, hidden_size, {"sigmoid", "tanh"}, + {}, {}, clip, false); + auto unsqueeze = std::make_shared(gru_cell->output(0), axis); + ov::ResultVector results{std::make_shared(gru_cell->output(0)), + std::make_shared(unsqueeze)}; + auto body = std::make_shared(results, body_params, "gru_cell"); tensor_iterator->set_function(body); // 2. Set PortMap - if (direction == ngraph::op::RecurrentSequenceDirection::FORWARD) { + if (direction == ov::op::RecurrentSequenceDirection::FORWARD) { tensor_iterator->set_sliced_input(body_params[0], outer_params[0], 0, 1, 1, -1, sequence_axis); tensor_iterator->get_concatenated_slices(results[1], 0, 1, 1, -1, sequence_axis); - } else if (direction == ngraph::op::RecurrentSequenceDirection::REVERSE) { + } else if (direction == ov::op::RecurrentSequenceDirection::REVERSE) { tensor_iterator->set_sliced_input(body_params[0], outer_params[0], -1, -1, 1, 0, sequence_axis); tensor_iterator->get_concatenated_slices(results[1], -1, -1, 1, 0, sequence_axis); } else { - NGRAPH_CHECK(false, "Bidirectional case is not supported."); + OPENVINO_THROW("Bidirectional case is not supported."); } tensor_iterator->set_merged_input(body_params[1], outer_params[1], results[0]); tensor_iterator->get_iter_value(results[0]); // 3. Outer function - function = std::make_shared(ngraph::OutputVector{tensor_iterator->output(0), tensor_iterator->output(1)}, outer_params); + function = std::make_shared(ov::OutputVector{tensor_iterator->output(0), tensor_iterator->output(1)}, outer_params); break; } - case ngraph::helpers::TensorIteratorBody::RNN: { + case ov::test::utils::TensorIteratorBody::RNN: { inputShapes = {{batch, seq_lengths, input_size}, {batch, hidden_size}, {hidden_size, input_size}, @@ -228,77 +205,69 @@ class TensorIteratorWithConfigTest : public testing::WithParamInterface(ngPrc, ov::Shape(inputShapes[0])), - std::make_shared(ngPrc, ov::Shape(inputShapes[1]))}; + ov::ParameterVector outer_params{std::make_shared(model_type, ov::Shape(inputShapes[0])), + std::make_shared(model_type, ov::Shape(inputShapes[1]))}; // 1. Create TensorIterator body. inputShapes[0][sequence_axis] = 1; // sliced dimension - ov::ParameterVector body_params{std::make_shared(ngPrc, ov::Shape(inputShapes[0])), - std::make_shared(ngPrc, ov::Shape(inputShapes[1]))}; - std::vector WRB = {inputShapes[2], inputShapes[3], inputShapes[4]}; - auto squeeze = std::make_shared(body_params[0], axis); - ngraph::OutputVector out_vector = {squeeze, body_params[1]}; - auto rnn_cell = ngraph::builder::makeRNN(out_vector, WRB, hidden_size, {"tanh"}, {}, {}, clip); - auto unsqueeze = std::make_shared(rnn_cell->output(0), axis); - ngraph::ResultVector results{std::make_shared(rnn_cell), - std::make_shared(unsqueeze)}; - auto body = std::make_shared(results, body_params, "rnn_cell"); + ov::ParameterVector body_params{std::make_shared(model_type, ov::Shape(inputShapes[0])), + std::make_shared(model_type, ov::Shape(inputShapes[1]))}; + std::vector WRB = {inputShapes[2], inputShapes[3], inputShapes[4]}; + auto squeeze = std::make_shared(body_params[0], axis); + ov::OutputVector out_vector = {squeeze, body_params[1]}; + auto rnn_cell = ov::test::utils::make_rnn(out_vector, WRB, hidden_size, {"tanh"}, {}, {}, clip); + auto unsqueeze = std::make_shared(rnn_cell->output(0), axis); + ov::ResultVector results{std::make_shared(rnn_cell), + std::make_shared(unsqueeze)}; + auto body = std::make_shared(results, body_params, "rnn_cell"); tensor_iterator->set_function(body); // 2. Set PortMap - if (direction == ngraph::op::RecurrentSequenceDirection::FORWARD) { + if (direction == ov::op::RecurrentSequenceDirection::FORWARD) { tensor_iterator->set_sliced_input(body_params[0], outer_params[0], 0, 1, 1, -1, sequence_axis); tensor_iterator->get_concatenated_slices(results[1], 0, 1, 1, -1, sequence_axis); - } else if (direction == ngraph::op::RecurrentSequenceDirection::REVERSE) { + } else if (direction == ov::op::RecurrentSequenceDirection::REVERSE) { tensor_iterator->set_sliced_input(body_params[0], outer_params[0], -1, -1, 1, 0, sequence_axis); tensor_iterator->get_concatenated_slices(results[1], -1, -1, 1, 0, sequence_axis); } else { - NGRAPH_CHECK(false, "Bidirectional case is not supported."); + OPENVINO_THROW("Bidirectional case is not supported."); } tensor_iterator->set_merged_input(body_params[1], outer_params[1], results[0]); tensor_iterator->get_iter_value(results[0]); // 3. Outer function - function = std::make_shared(ngraph::OutputVector{tensor_iterator->output(0), tensor_iterator->output(1)}, outer_params); + function = std::make_shared(ov::OutputVector{tensor_iterator->output(0), tensor_iterator->output(1)}, outer_params); break; } } } }; -TEST_P(TensorIteratorWithConfigTest, CompareWithRefs) { - Run(); +TEST_P(TensorIteratorWithConfigTest, Inference) { + run(); }; -} // namespace LayerTestsDefinitions - -using namespace LayerTestsDefinitions; - -namespace { - INSTANTIATE_TEST_SUITE_P(smoke_TensorIteratorCommon, TensorIteratorWithConfigTest, - ::testing::Combine( - ::testing::ValuesIn(std::vector {2, 4}), // seq lengths - ::testing::ValuesIn(std::vector {1}), // only single batch supported - ::testing::ValuesIn(std::vector {2, 4}), // hidden size - ::testing::ValuesIn(std::vector {0, 1}), // seq axis - ::testing::ValuesIn(std::vector {0.f}), // clip - not used - ::testing::ValuesIn(std::vector { - ngraph::helpers::TensorIteratorBody::LSTM, - ngraph::helpers::TensorIteratorBody::RNN, - ngraph::helpers::TensorIteratorBody::GRU, - }), // body type - ::testing::ValuesIn(std::vector{ - ngraph::op::RecurrentSequenceDirection::FORWARD, - ngraph::op::RecurrentSequenceDirection::REVERSE, - }), - ::testing::ValuesIn(std::vector { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16, - }), // precision - ::testing::ValuesIn(std::vector { - {ov::test::utils::DEVICE_GPU, {{GPUConfigParams::KEY_GPU_ENABLE_LOOP_UNROLLING, PluginConfigParams::YES}}}, - {ov::test::utils::DEVICE_GPU, {{GPUConfigParams::KEY_GPU_ENABLE_LOOP_UNROLLING, PluginConfigParams::NO}}} - })), // configuration - TensorIteratorWithConfigTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_TensorIteratorCommon, TensorIteratorWithConfigTest, + ::testing::Combine( + ::testing::ValuesIn(std::vector {2, 4}), // seq lengths + ::testing::ValuesIn(std::vector {1}), // only single batch supported + ::testing::ValuesIn(std::vector {2, 4}), // hidden size + ::testing::ValuesIn(std::vector {0, 1}), // seq axis + ::testing::ValuesIn(std::vector {0.f}), // clip - not used + ::testing::ValuesIn(std::vector { + ov::test::utils::TensorIteratorBody::LSTM, + ov::test::utils::TensorIteratorBody::RNN, + ov::test::utils::TensorIteratorBody::GRU, + }), // body type + ::testing::ValuesIn(std::vector{ + ov::op::RecurrentSequenceDirection::FORWARD, + ov::op::RecurrentSequenceDirection::REVERSE, + }), + ::testing::ValuesIn(std::vector { + ov::element::f32, + ov::element::f16, + }), + ::testing::Values(ov::test::utils::DEVICE_GPU)), + TensorIteratorWithConfigTest::getTestCaseName); } // namespace diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/condition.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/condition.cpp index 99359ba07aa6ba..dbb6cef94c8072 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/condition.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/condition.cpp @@ -2,26 +2,27 @@ // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include "ov_models/utils/ov_helpers.hpp" -#include "shared_test_classes/base/layer_test_utils.hpp" -#include "ov_models/builders.hpp" -#include "shared_test_classes/base/ov_subgraph.hpp" #include "common_test_utils/test_constants.hpp" -#include "shared_test_classes/base/utils/ranges.hpp" -#include -#include "shared_test_classes/base/utils/compare_results.hpp" +#include "common_test_utils/ov_tensor_utils.hpp" +#include "shared_test_classes/base/ov_subgraph.hpp" #include "openvino/pass/constant_folding.hpp" - - -using namespace InferenceEngine; -using namespace ov::test; - -namespace GPULayerTestsDefinitions { - +#include "ov_models/utils/ov_helpers.hpp" +#include "common_test_utils/node_builders/reduce.hpp" + +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/add.hpp" +#include "openvino/op/multiply.hpp" +#include "openvino/op/greater_eq.hpp" +#include "openvino/op/if.hpp" +#include "openvino/op/shape_of.hpp" +#include "openvino/op/reshape.hpp" +#include "openvino/op/convert.hpp" +#include "openvino/op/max_pool.hpp" +#include "openvino/op/avg_pool.hpp" + +namespace { class InnerBodyGenerator { public: using ptr = std::shared_ptr; @@ -65,140 +66,143 @@ enum InnerBodyType { public: InnerBodyGenerator() { } - virtual std::shared_ptr get_function() { return _func; } - virtual std::shared_ptr get_input() { return _param; } - virtual std::shared_ptr get_result() { return _result; } + virtual std::shared_ptr get_function() { return _func; } + virtual std::shared_ptr get_input() { return _param; } + virtual std::shared_ptr get_result() { return _result; } - // virtual void create_body(ngraph::Shape input_shape, ngraph::element::Type prc) { - virtual void create_body(ov::PartialShape& input_shape, ngraph::element::Type prc) { + // virtual void create_body(ov::Shape input_shape, ov::element::Type prc) { + virtual void create_body(ov::PartialShape& input_shape, ov::element::Type prc) { _func = generate(input_shape, prc); _param = (_func->get_parameters().size() > 0)? _func->get_parameters().front() : nullptr; _result = _func->get_results().front(); } protected: - virtual std::shared_ptr generate(ov::PartialShape& input_shape, ngraph::element::Type prc) = 0; + virtual std::shared_ptr generate(ov::PartialShape& input_shape, ov::element::Type prc) = 0; - std::shared_ptr _func; - std::shared_ptr _param; - std::shared_ptr _result; + std::shared_ptr _func; + std::shared_ptr _param; + std::shared_ptr _result; }; class InnerBodyType01 : public InnerBodyGenerator { protected: - std::shared_ptr generate(ov::PartialShape& input_shape, ngraph::element::Type prc) override { - auto constantA = ngraph::opset9::Constant::create(prc, ov::Shape(input_shape.rank().get_length(), 2), {2.0f}); + std::shared_ptr generate(ov::PartialShape& input_shape, ov::element::Type prc) override { + auto constantA = ov::op::v0::Constant::create(prc, ov::Shape(input_shape.rank().get_length(), 2), {2.0f}); constantA->set_friendly_name("body1_constantA"); - auto constantB = ngraph::opset9::Constant::create(prc, ov::Shape(input_shape.rank().get_length(), 2), {12.0f}); + + auto constantB = ov::op::v0::Constant::create(prc, ov::Shape(input_shape.rank().get_length(), 2), {12.0f}); constantB->set_friendly_name("body1_constantB"); - auto add = std::make_shared(constantA, constantB); + + auto add = std::make_shared(constantA, constantB); add->set_friendly_name("body1_add"); - auto result = std::make_shared(add); - auto o_layout = result->get_layout(); + + auto result = std::make_shared(add); result->set_friendly_name("body1_result"); - auto body = std::make_shared( - ngraph::OutputVector {result}, - ngraph::ParameterVector{}, - "constant"); + + auto body = std::make_shared(ov::OutputVector{result}, ov::ParameterVector{}, "constant"); return body; } }; class InnerBodyType02 : public InnerBodyGenerator { protected: - std::shared_ptr generate(ov::PartialShape& input_shape, ngraph::element::Type prc) override { - auto constant = std::make_shared(prc, ngraph::Shape{}, 10.0f); + std::shared_ptr generate(ov::PartialShape& input_shape, ov::element::Type prc) override { + auto constant = std::make_shared(prc, ov::Shape{}, 10.0f); constant->set_friendly_name("body2_const"); - auto data = std::make_shared(prc, input_shape); + + auto data = std::make_shared(prc, input_shape); data->set_friendly_name("body2_data"); - auto sum = std::make_shared(data, constant); + + auto sum = std::make_shared(data, constant); sum->set_friendly_name("body2_mul"); - auto result = std::make_shared(sum); + + auto result = std::make_shared(sum); result->set_friendly_name("body2_result"); - auto body = std::make_shared( - ngraph::OutputVector {result}, - ngraph::ParameterVector{data}, - "eltwise_mul"); + + auto body = std::make_shared(ov::OutputVector{result}, ov::ParameterVector{data}, "eltwise_mul"); return body; } }; class InnerBodyType03 : public InnerBodyGenerator { protected: - std::shared_ptr generate(ov::PartialShape& input_shape, ngraph::element::Type prc) override { - auto constant = std::make_shared(prc, ngraph::Shape{}, 2.0f); + std::shared_ptr generate(ov::PartialShape& input_shape, ov::element::Type prc) override { + auto constant = std::make_shared(prc, ov::Shape{}, 2.0f); constant->set_friendly_name("body3_constant"); - auto data = std::make_shared(prc, input_shape); + + auto data = std::make_shared(prc, input_shape); data->set_friendly_name("body3_data"); - auto add = std::make_shared(data, constant); + + auto add = std::make_shared(data, constant); add->set_friendly_name("body3_add"); - auto result = std::make_shared(add); + + auto result = std::make_shared(add); result->set_friendly_name("body3_result"); - auto body = std::make_shared( - ngraph::OutputVector {result}, - ngraph::ParameterVector{data}, - "eltwise_sum"); + + auto body = std::make_shared(ov::OutputVector{result}, ov::ParameterVector{data}, "eltwise_sum"); return body; } }; class InnerBodyType04 : public InnerBodyGenerator { protected: - std::shared_ptr generate(ov::PartialShape& input_shape, ngraph::element::Type prc) override { - auto scale = std::make_shared(prc, ngraph::Shape{}, 2.0f); + std::shared_ptr generate(ov::PartialShape& input_shape, ov::element::Type prc) override { + auto scale = std::make_shared(prc, ov::Shape{}, 2.0f); scale->set_friendly_name("body4_scale"); - auto data = std::make_shared(prc, input_shape); + + auto data = std::make_shared(prc, input_shape); data->set_friendly_name("body4_data"); - auto mul = std::make_shared(data, scale); + + auto mul = std::make_shared(data, scale); mul->set_friendly_name("body4_mul"); - auto pooling = generate_pooling(mul, input_shape); + + auto pooling = generate_pooling(mul, input_shape); pooling->set_friendly_name("body4_pool"); - auto result = std::make_shared(pooling); + + auto result = std::make_shared(pooling); result->set_friendly_name("body4_result"); - auto body = std::make_shared( - ngraph::OutputVector {result}, - ngraph::ParameterVector{data}, - "eltwise_mul_pooling"); + + auto body = std::make_shared(ov::OutputVector{result}, ov::ParameterVector{data}, "eltwise_mul_pooling"); return body; } - struct poolSpecificParams { - ngraph::helpers::PoolingTypes pooling_type; // Pooling type, max or avg - std::vector kernel_size; // Kernel size - std::vector stride; // Stride - std::vector pad_begin; // Pad begin - std::vector pad_end; // Pad end - ngraph::op::RoundingType rounding_type; // Rounding type - ngraph::op::PadType pad_type; // Pad type - bool exclued_pad; // Exclude pad + ov::test::utils::PoolingTypes pooling_type; // Pooling type, max or avg + std::vector kernel_size; // Kernel size + std::vector stride; // Stride + std::vector pad_begin; // Pad begin + std::vector pad_end; // Pad end + ov::op::RoundingType rounding_type; // Rounding type + ov::op::PadType pad_type; // Pad type + bool exclued_pad; // Exclude pad }; - std::shared_ptr generate_pooling(const ngraph::Output &in, ov::PartialShape& input_shape) { + std::shared_ptr generate_pooling(const ov::Output &in, ov::PartialShape& input_shape) { poolSpecificParams params; switch (input_shape.rank().get_length()) { case 5: { - params = poolSpecificParams{ ngraph::helpers::PoolingTypes::MAX, + params = poolSpecificParams{ ov::test::utils::PoolingTypes::MAX, {2, 2, 2}, {1, 1, 1}, {0, 0, 0}, {0, 0, 0}, - ngraph::op::RoundingType::CEIL, - ngraph::op::PadType::SAME_LOWER, true }; + ov::op::RoundingType::CEIL, + ov::op::PadType::SAME_LOWER, true }; break; } case 4: { - params = poolSpecificParams{ ngraph::helpers::PoolingTypes::MAX, + params = poolSpecificParams{ ov::test::utils::PoolingTypes::MAX, {2, 2}, {2, 2}, {0, 0}, {0, 0}, - ngraph::op::RoundingType::CEIL, - ngraph::op::PadType::SAME_LOWER, true }; + ov::op::RoundingType::CEIL, + ov::op::PadType::SAME_LOWER, true }; break; } case 3: { - params = poolSpecificParams{ ngraph::helpers::PoolingTypes::MAX, + params = poolSpecificParams{ ov::test::utils::PoolingTypes::MAX, {2}, {2}, {0}, {0}, - ngraph::op::RoundingType::CEIL, - ngraph::op::PadType::SAME_LOWER, true }; + ov::op::RoundingType::CEIL, + ov::op::PadType::SAME_LOWER, true }; break; } default: @@ -229,29 +233,33 @@ class InnerBodyType04 : public InnerBodyGenerator { class InnerBodyType05 : public InnerBodyGenerator { protected: - std::shared_ptr generate(ov::PartialShape& input_shape, ngraph::element::Type prc) override { - auto constant = std::make_shared(prc, ngraph::Shape{}, 2.0f); + std::shared_ptr generate(ov::PartialShape& input_shape, ov::element::Type prc) override { + auto constant = std::make_shared(prc, ov::Shape{}, 2.0f); constant->set_friendly_name("body5_constant"); - auto data = std::make_shared(prc, input_shape); + + auto data = std::make_shared(prc, input_shape); data->set_friendly_name("body5_data"); - auto add = std::make_shared(data, constant); + + auto add = std::make_shared(data, constant); add->set_friendly_name("body5_add"); + std::vector axes; for (int i = 0, r = 0; i < input_shape.rank().get_length(); i++) { axes.push_back(r--); } + std::vector shapeAxes; shapeAxes.push_back(axes.size()); - auto reductionAxesNode = std::dynamic_pointer_cast( - std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape(shapeAxes), axes)); + std::shared_ptr reductionAxesNode = std::make_shared(ov::element::i64, ov::Shape(shapeAxes), axes); - const auto reduce = ngraph::builder::makeReduce(add, reductionAxesNode, false, ngraph::helpers::ReductionType::Min); + const auto reduce = ov::test::utils::make_reduce(add, reductionAxesNode, false, ov::test::utils::ReductionType::Min); reduce->set_friendly_name("body5_reduce"); - auto constant_ref = std::make_shared(prc, ngraph::Shape{}, 10.0f); + + auto constant_ref = std::make_shared(prc, ov::Shape{}, 10.0f); constant_ref->set_friendly_name("body5_ref_constant"); - auto pred = std::make_shared(reduce, constant_ref); + auto pred = std::make_shared(reduce, constant_ref); pred->set_friendly_name("nested_pred"); auto nested_body_then_generator = std::make_shared(); @@ -263,68 +271,62 @@ class InnerBodyType05 : public InnerBodyGenerator { nested_body_then_generator->get_function()->set_friendly_name("nested_then_inner_body"); nested_body_else_generator->get_function()->set_friendly_name("nested_else_inner_body"); - auto cond_nested = std::make_shared(pred); + auto cond_nested = std::make_shared(pred); cond_nested->set_friendly_name("if_operator_nested"); cond_nested->set_else_body(nested_body_else_generator->get_function()); cond_nested->set_then_body(nested_body_then_generator->get_function()); cond_nested->set_input(add, nested_body_then_generator->get_input(), nested_body_else_generator->get_input()); cond_nested->set_output(nested_body_then_generator->get_result(), nested_body_else_generator->get_result()); - auto result = std::make_shared(cond_nested); + auto result = std::make_shared(cond_nested); result->set_friendly_name("body5_result"); - auto body = std::make_shared( - ngraph::OutputVector {result}, - ngraph::ParameterVector{data}, - "eltwise_sum"); + + auto body = std::make_shared(ov::OutputVector {result}, ov::ParameterVector{data}, "eltwise_sum"); return body; } }; class InnerBodyType06 : public InnerBodyGenerator { protected: - std::shared_ptr generate(ov::PartialShape& input_shape, ngraph::element::Type prc) override { - auto constant = ngraph::opset9::Constant::create(prc, ov::Shape(input_shape.rank().get_length(), 1), {2.0f}); + std::shared_ptr generate(ov::PartialShape& input_shape, ov::element::Type prc) override { + auto constant = ov::op::v0::Constant::create(prc, ov::Shape(input_shape.rank().get_length(), 1), {2.0f}); constant->set_friendly_name("body6_constant"); - auto result = std::make_shared(constant); - auto o_layout = result->get_layout(); + + auto result = std::make_shared(constant); result->set_friendly_name("body6_result"); - auto body = std::make_shared( - ngraph::OutputVector {result}, - ngraph::ParameterVector{}, - "constant_only"); + + auto body = std::make_shared(ov::OutputVector{result}, ov::ParameterVector{}, "constant_only"); return body; } }; class InnerBodyType07 : public InnerBodyGenerator { protected: - std::shared_ptr generate(ov::PartialShape& input_shape, ngraph::element::Type prc) override { - auto constant = ngraph::opset9::Constant::create(prc, input_shape.to_shape(), {2.0f}); + std::shared_ptr generate(ov::PartialShape& input_shape, ov::element::Type prc) override { + auto constant = ov::op::v0::Constant::create(prc, input_shape.to_shape(), {2.0f}); constant->set_friendly_name("body7_constant"); - auto result = std::make_shared(constant); - auto o_layout = result->get_layout(); + + auto result = std::make_shared(constant); result->set_friendly_name("body7_result"); - auto body = std::make_shared( - ngraph::OutputVector {result}, - ngraph::ParameterVector{}, - "constant_to_result"); + + auto body = std::make_shared(ov::OutputVector{result}, ov::ParameterVector{}, "constant_to_result"); return body; } }; class InnerBodyType08 : public InnerBodyGenerator { protected: - std::shared_ptr generate(ov::PartialShape& input_shape, ngraph::element::Type prc) override { - auto constant = std::make_shared(prc, ngraph::Shape{}, 10.0f); + std::shared_ptr generate(ov::PartialShape& input_shape, ov::element::Type prc) override { + auto constant = std::make_shared(prc, ov::Shape{}, 10.0f); constant->set_friendly_name("body8_const"); - auto data = std::make_shared(prc, input_shape); + + auto data = std::make_shared(prc, input_shape); data->set_friendly_name("body8_data"); - auto result = std::make_shared(data); + + auto result = std::make_shared(data); result->set_friendly_name("body8_result"); - auto body = std::make_shared( - ngraph::OutputVector {result}, - ngraph::ParameterVector{data}, - "parameter_to_result"); + + auto body = std::make_shared(ov::OutputVector{result}, ov::ParameterVector{data}, "parameter_to_result"); return body; } }; @@ -380,66 +382,69 @@ class TestModelGenerator { public: TestModelGenerator(InnerBodyGenerator::InnerBodyType then_body_type, - InnerBodyGenerator::InnerBodyType else_body_type, - PredicateTypes pred_type, - ngraph::element::Type prc, - ov::PartialShape input_shape, - bool cond_execution_value = false) { - body_then_generator = get_inner_body_generator(then_body_type); - body_else_generator = get_inner_body_generator(else_body_type); - - body_then_generator->create_body(input_shape, prc); - body_else_generator->create_body(input_shape, prc); - body_else_generator->get_function()->set_friendly_name("else_inner_body"); - body_then_generator->get_function()->set_friendly_name("then_inner_body"); - - ngraph::ParameterVector params{}; - auto predicate = create_cond_execution(pred_type, params, ngraph::element::boolean, ngraph::Shape{}); - predicate->set_friendly_name("if_predicate"); - auto data = create_condition_input(params, prc, input_shape); - data->set_friendly_name("input_data"); - auto cond = std::make_shared(predicate); - cond->set_friendly_name("if_operator"); - cond->set_else_body(body_else_generator->get_function()); - cond->set_then_body(body_then_generator->get_function()); - cond->set_input(data, body_then_generator->get_input(), body_else_generator->get_input()); - cond->set_output(body_then_generator->get_result(), body_else_generator->get_result()); - if (then_body_type == InnerBodyGenerator::InnerBodyType::Type06 || else_body_type == InnerBodyGenerator::InnerBodyType::Type06) { - auto constant = create_condition_input(params, prc, ngraph::Shape{1}, 0, true); - auto addition = std::make_shared(cond, constant); - auto shapeof1 = std::make_shared(addition); - auto convert = std::make_shared(shapeof1, prc); - auto mul = std::make_shared(convert, constant); - auto shapePatternsNode = create_condition_input(params, ov::element::Type_t::i64, ngraph::Shape{1}, 0, true); - auto reshapeOp = std::make_shared(mul, shapePatternsNode, true); - auto result = std::make_shared(reshapeOp); - result->set_friendly_name("outer_result"); - function = std::make_shared(ngraph::OutputVector {result}, params); - } else { - auto result = std::make_shared(cond); - result->set_friendly_name("outer_result"); - function = std::make_shared(ngraph::OutputVector {result}, params); - } - } - std::shared_ptr get_function() { return function; } + InnerBodyGenerator::InnerBodyType else_body_type, + PredicateTypes pred_type, + ov::element::Type prc, + ov::PartialShape input_shape, + bool cond_execution_value = false) { + body_then_generator = get_inner_body_generator(then_body_type); + body_else_generator = get_inner_body_generator(else_body_type); + + body_then_generator->create_body(input_shape, prc); + body_else_generator->create_body(input_shape, prc); + body_else_generator->get_function()->set_friendly_name("else_inner_body"); + body_then_generator->get_function()->set_friendly_name("then_inner_body"); + + ov::ParameterVector params{}; + auto predicate = create_cond_execution(pred_type, params, ov::element::boolean, ov::Shape{}); + predicate->set_friendly_name("if_predicate"); + + auto data = create_condition_input(params, prc, input_shape); + data->set_friendly_name("input_data"); + + auto cond = std::make_shared(predicate); + cond->set_friendly_name("if_operator"); + cond->set_else_body(body_else_generator->get_function()); + cond->set_then_body(body_then_generator->get_function()); + cond->set_input(data, body_then_generator->get_input(), body_else_generator->get_input()); + cond->set_output(body_then_generator->get_result(), body_else_generator->get_result()); + + if (then_body_type == InnerBodyGenerator::InnerBodyType::Type06 || else_body_type == InnerBodyGenerator::InnerBodyType::Type06) { + auto constant = create_condition_input(params, prc, ov::Shape{1}, 0, true); + auto addition = std::make_shared(cond, constant); + auto shapeof1 = std::make_shared(addition); + auto convert = std::make_shared(shapeof1, prc); + auto mul = std::make_shared(convert, constant); + auto shapePatternsNode = create_condition_input(params, ov::element::i64, ov::Shape{1}, 0, true); + auto reshapeOp = std::make_shared(mul, shapePatternsNode, true); + auto result = std::make_shared(reshapeOp); + result->set_friendly_name("outer_result"); + function = std::make_shared(ov::OutputVector {result}, params); + } else { + auto result = std::make_shared(cond); + result->set_friendly_name("outer_result"); + function = std::make_shared(ov::OutputVector {result}, params); + } + } + std::shared_ptr get_function() { return function; } private: - std::shared_ptr create_condition_input(ngraph::ParameterVector& params, - const ngraph::element::Type prc, const ov::PartialShape& shape, + std::shared_ptr create_condition_input(ov::ParameterVector& params, + const ov::element::Type prc, const ov::PartialShape& shape, int value = 0, bool is_static = false) { if (is_static) - return std::make_shared(prc, shape.to_shape(), value); + return std::make_shared(prc, shape.to_shape(), value); - auto input = std::make_shared(prc, shape); + auto input = std::make_shared(prc, shape); params.push_back(input); return input; } - std::shared_ptr create_cond_execution(PredicateTypes pred_type, - ngraph::ParameterVector& params, - const ngraph::element::Type prc = ngraph::element::u8, - const ngraph::Shape shape = ngraph::Shape{}) { - std::shared_ptr pred; + std::shared_ptr create_cond_execution(PredicateTypes pred_type, + ov::ParameterVector& params, + const ov::element::Type prc = ov::element::u8, + const ov::Shape shape = ov::Shape{}) { + std::shared_ptr pred; switch (pred_type) { case PredicateTypes::PARAM: { @@ -450,9 +455,9 @@ class TestModelGenerator { { auto param_cond = create_condition_input(params, prc, shape); param_cond->set_friendly_name("param_cond"); - auto const_cond = create_condition_input(params, prc, ngraph::Shape{}, 1, true); + auto const_cond = create_condition_input(params, prc, ov::Shape{}, 1, true); const_cond->set_friendly_name("const_cond"); - pred = std::make_shared(param_cond, const_cond); + pred = std::make_shared(param_cond, const_cond); pred->set_friendly_name("pred"); break; } @@ -465,7 +470,7 @@ class TestModelGenerator { } private: - std::shared_ptr function; + std::shared_ptr function; InnerBodyGenerator::ptr body_then_generator; InnerBodyGenerator::ptr body_else_generator; }; @@ -543,25 +548,25 @@ static std::ostream& operator<<(std::ostream& os, const TestModelGenerator::Pred } using ConditionParams = typename std::tuple< - InferenceEngine::SizeVector, // Shape - InferenceEngine::Precision, // Precision + ov::Shape, // Shape + ov::element::Type, // Precision TestModelGenerator::PredicateTypes, // if predicate type - LayerTestsUtils::TargetDevice // Device name ->; + std::string>; // Device name + class StaticConditionLayerGPUTest : public testing::WithParamInterface, - virtual public LayerTestsUtils::LayerTestsCommon { + virtual public ov::test::SubgraphBaseStaticTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { - InferenceEngine::SizeVector data_shape; - InferenceEngine::Precision data_prc; + ov::Shape data_shape; + ov::element::Type model_type; TestModelGenerator::PredicateTypes pred; std::string targetDevice; - std::tie(data_shape, data_prc, pred, targetDevice) = obj.param; + std::tie(data_shape, model_type, pred, targetDevice) = obj.param; std::ostringstream result; result << "IS=" << ov::test::utils::vec2str(data_shape) << "_"; - result << "netPRC=" << std::to_string(data_prc) << "_"; + result << "netPRC=" << model_type << "_"; result << "ifCond=" << pred << "_"; result << "targetDevice=" << targetDevice << "_"; auto res_str = result.str(); @@ -573,60 +578,53 @@ class StaticConditionLayerGPUTest : public testing::WithParamInterfaceallocate(); - - if (tensor_desc.getLayout() == InferenceEngine::SCALAR) { - auto prc = tensor_desc.getPrecision(); - auto scalar_1d = ov::test::utils::make_reshape_view(blob, {1}); - if (prc == InferenceEngine::Precision::BOOL) { - auto mem_blob = dynamic_cast(blob.get()); - auto mem = mem_blob->rwmap(); - auto data_ptr = mem.as(); - *data_ptr = false; + void generate_inputs(const std::vector& target_input_static_shapes) override { + inputs.clear(); + const auto& model_inputs = function->inputs(); + for (size_t i = 0; i < model_inputs.size(); ++i) { + const auto& model_input = model_inputs[i]; + auto type = model_input.get_element_type(); + ov::Tensor tensor; + if (ov::element::boolean == type) { + tensor = ov::test::utils::create_and_fill_tensor(model_input.get_element_type(), target_input_static_shapes[i], 0, 0); } else { - ov::test::utils::fill_data_with_broadcast(scalar_1d, 0, {20.f}); + tensor = ov::test::utils::create_and_fill_tensor(model_input.get_element_type(), target_input_static_shapes[i], 0, 20); } - } else { - ov::test::utils::fill_data_with_broadcast(blob, 0, {20.f}); + inputs.insert({model_input.get_node_shared_ptr(), tensor}); } - return blob; } - InferenceEngine::SizeVector data_shape; - InferenceEngine::Precision data_prc; + ov::Shape data_shape; + ov::element::Type model_type; }; TEST_P(StaticConditionLayerGPUTest, CompareWithRefs) { - SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Run(); + run(); } -std::vector netPrecisions_static = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16, - InferenceEngine::Precision::I8 +std::vector netPrecisions_static = { + ov::element::f32, + ov::element::f16, + ov::element::i8 }; -std::vector inputs_shape = { +std::vector inputs_shape = { {3, 6} }; -std::vector if_cond_types = { - GPULayerTestsDefinitions::TestModelGenerator::PredicateTypes::PARAM +std::vector if_cond_types = { + TestModelGenerator::PredicateTypes::PARAM }; INSTANTIATE_TEST_SUITE_P(smoke_ConditionGPUTest_static, StaticConditionLayerGPUTest, @@ -640,18 +638,18 @@ INSTANTIATE_TEST_SUITE_P(smoke_ConditionGPUTest_static, StaticConditionLayerGPUT /// Static shape single layer test class StaticConditionSingleLayerGPUTest : public testing::WithParamInterface, - virtual public LayerTestsUtils::LayerTestsCommon { + virtual public ov::test::SubgraphBaseStaticTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { - InferenceEngine::SizeVector data_shape; - InferenceEngine::Precision data_prc; + ov::Shape data_shape; + ov::element::Type model_type; TestModelGenerator::PredicateTypes pred; std::string targetDevice; - std::tie(data_shape, data_prc, pred, targetDevice) = obj.param; + std::tie(data_shape, model_type, pred, targetDevice) = obj.param; std::ostringstream result; result << "IS=" << ov::test::utils::vec2str(data_shape) << "_"; - result << "netPRC=" << std::to_string(data_prc) << "_"; + result << "netPRC=" << model_type << "_"; result << "ifCond=" << pred << "_"; result << "targetDevice=" << targetDevice << "_"; auto res_str = result.str(); @@ -663,62 +661,55 @@ class StaticConditionSingleLayerGPUTest : public testing::WithParamInterfaceallocate(); - - if (tensor_desc.getLayout() == InferenceEngine::SCALAR) { - auto prc = tensor_desc.getPrecision(); - auto scalar_1d = ov::test::utils::make_reshape_view(blob, {1}); - if (prc == InferenceEngine::Precision::BOOL) { - auto mem_blob = dynamic_cast(blob.get()); - auto mem = mem_blob->rwmap(); - auto data_ptr = mem.as(); - *data_ptr = false; + void generate_inputs(const std::vector& target_input_static_shapes) override { + inputs.clear(); + const auto& model_inputs = function->inputs(); + for (size_t i = 0; i < model_inputs.size(); ++i) { + const auto& model_input = model_inputs[i]; + auto type = model_input.get_element_type(); + ov::Tensor tensor; + if (ov::element::boolean == type) { + tensor = ov::test::utils::create_and_fill_tensor(model_input.get_element_type(), target_input_static_shapes[i], 0, 0); } else { - ov::test::utils::fill_data_with_broadcast(scalar_1d, 0, {20.f}); + tensor = ov::test::utils::create_and_fill_tensor(model_input.get_element_type(), target_input_static_shapes[i], 0, 20); } - } else { - ov::test::utils::fill_data_with_broadcast(blob, 0, {20.f}); + inputs.insert({model_input.get_node_shared_ptr(), tensor}); } - return blob; } - InferenceEngine::SizeVector data_shape; - InferenceEngine::Precision data_prc; + ov::Shape data_shape; + ov::element::Type model_type; }; -TEST_P(StaticConditionSingleLayerGPUTest, CompareWithRefs) { - SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Run(); +TEST_P(StaticConditionSingleLayerGPUTest, Inference) { + run(); } -std::vector netPrecisions_static_single = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::FP16, - InferenceEngine::Precision::I8 +std::vector model_types_static_single = { + ov::element::f32, + ov::element::f16, + ov::element::i8 }; -std::vector inputs_shape_single = { +std::vector inputs_shape_single = { {64} }; INSTANTIATE_TEST_SUITE_P(smoke_ConditionGPUTest_static, StaticConditionSingleLayerGPUTest, testing::Combine( testing::ValuesIn(inputs_shape_single), - testing::ValuesIn(netPrecisions_static_single), + testing::ValuesIn(model_types_static_single), testing::ValuesIn(if_cond_types), testing::Values(ov::test::utils::DEVICE_GPU)), StaticConditionLayerGPUTest::getTestCaseName); @@ -730,25 +721,26 @@ struct InnerBodyTypeParams { InnerBodyGenerator::InnerBodyType else_body_type; }; +using ov::test::InputShape; + using ConditionGPUParams = typename std::tuple< InputShape, // Input Shapes InnerBodyTypeParams, // Inner body type - InferenceEngine::Precision, // Precision + ov::element::Type, // Type TestModelGenerator::PredicateTypes, // if predicate type - LayerTestsUtils::TargetDevice // Device name ->; + std::string>; // Device name class DynamicConditionLayerGPUTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest { + virtual public ov::test::SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { InputShape inputShapes; InnerBodyTypeParams bodyParams; - InferenceEngine::Precision dataPrc; + ov::element::Type model_type; TestModelGenerator::PredicateTypes condType; std::string targetDevice; - std::tie(inputShapes, bodyParams, dataPrc, condType, targetDevice) = obj.param; + std::tie(inputShapes, bodyParams, model_type, condType, targetDevice) = obj.param; std::ostringstream result; result << "IS=("; result << ov::test::utils::partialShape2str({inputShapes.first}) << "_"; @@ -759,7 +751,7 @@ class DynamicConditionLayerGPUTest : public testing::WithParamInterface condSecondVec; for (size_t i = 0; i < num_second; i++) { @@ -782,11 +774,10 @@ class DynamicConditionLayerGPUTest : public testing::WithParamInterfaceset_friendly_name("if_operator_outer"); @@ -816,13 +807,7 @@ class DynamicConditionLayerGPUTest : public testing::WithParamInterfaceget_element_type(), input_shape, inGenData.range, - inGenData.start_from, inGenData.resolution, inGenData.seed); + auto tensor = ov::test::utils::create_and_fill_tensor(param->get_element_type(), input_shape, 10, 0, 128); inputs.insert({param, tensor}); } } @@ -832,18 +817,9 @@ class DynamicConditionLayerGPUTest : public testing::WithParamInterface netPrecisions_f32 = { - InferenceEngine::Precision::FP32 -}; - -const std::vector netPrecisions_f16 = { - InferenceEngine::Precision::FP16 -}; - const std::vector dynamicInputShapes_f32 = { ov::test::InputShape(ov::PartialShape({-1, -1, -1, -1, -1}), {{4, 1, 1, 64, 32}, {6, 1, 1, 8, 4}, {8, 1, 1, 24, 16}}), ov::test::InputShape(ov::PartialShape({1, 1, -1, -1}), {{1, 1, 64, 32}, {1, 1, 8, 4}, {1, 1, 24, 16}}) @@ -900,7 +876,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_ConditionGPUTest_dynamic_f32, DynamicConditionLay testing::Combine( testing::ValuesIn(dynamicInputShapes_f32), // input shapes testing::ValuesIn(innerBodyTypes_f32), // inner body type - testing::ValuesIn(netPrecisions_f32), // network precision + testing::Values(ov::element::f32), // network precision testing::ValuesIn(condTypes), // cond type testing::Values(ov::test::utils::DEVICE_GPU)), // device type DynamicConditionLayerGPUTest::getTestCaseName); @@ -910,7 +886,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_ConditionGPUTest_dynamic_f16, DynamicConditionLay testing::Combine( testing::ValuesIn(dynamicInputShapes_f16), // input shapes testing::ValuesIn(innerBodyTypes_f16), // inner body type - testing::ValuesIn(netPrecisions_f16), // network precision + testing::Values(ov::element::f16), // network precision testing::ValuesIn(condTypes), // cond type testing::Values(ov::test::utils::DEVICE_GPU)), // device type DynamicConditionLayerGPUTest::getTestCaseName); @@ -919,8 +895,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_ConditionGPUTest_zero_dims, DynamicConditionLayer testing::Combine( testing::ValuesIn(dynamicInputShapes_zero_dims), // input shapes testing::ValuesIn(innerBodyTypes_zero_dims), // inner body type - testing::ValuesIn(netPrecisions_f32), // network precision + testing::Values(ov::element::f32), // network precision testing::ValuesIn(condTypes_zero_dims), // cond type testing::Values(ov::test::utils::DEVICE_GPU)), // device type DynamicConditionLayerGPUTest::getTestCaseName); -} // namespace GPULayerTestsDefinitions +} // namespace diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/broadcast_eltwise.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/broadcast_eltwise.cpp index 9030ea1129313d..65373ff1d76ff9 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/broadcast_eltwise.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/broadcast_eltwise.cpp @@ -2,36 +2,35 @@ // SPDX-License-Identifier: Apache-2.0 // -#include -#include - -#include "ov_models/builders.hpp" -#include "ov_models/utils/ov_helpers.hpp" -#include "shared_test_classes/base/layer_test_utils.hpp" +#include "common_test_utils/ov_tensor_utils.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -#include "openvino/pass/serialize.hpp" -using namespace ngraph; -using namespace ov::test; -using namespace InferenceEngine; +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/add.hpp" +#include "openvino/op/broadcast.hpp" + +namespace { +using ov::test::InputShape; -namespace GPULayerTestsDefinitions { using BroadcastEltwiseParams = std::tuple< - ElementType, // input precision - InputShape, // input shape - ov::Shape // target broadcast shape + ov::element::Type, // input type + InputShape, // input shape + ov::Shape // target broadcast shape >; -class BroadcastEltwise : virtual public SubgraphBaseTest, public testing::WithParamInterface { +class BroadcastEltwise : virtual public ov::test::SubgraphBaseTest, + public testing::WithParamInterface { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { - ElementType input_precision; + ov::element::Type model_type; InputShape input_shape; ov::Shape target_shape; - std::tie(input_precision, input_shape, target_shape) = obj.param; + std::tie(model_type, input_shape, target_shape) = obj.param; std::ostringstream result; - result << "precision=" << input_precision << "IS=(" << ov::test::utils::partialShape2str({input_shape.first}) << ")_TS=("; + result << "precision=" << model_type << "IS=(" << ov::test::utils::partialShape2str({input_shape.first}) << ")_TS=("; for (const auto& item : input_shape.second) { result << ov::test::utils::vec2str(item) << "_"; } @@ -41,23 +40,23 @@ class BroadcastEltwise : virtual public SubgraphBaseTest, public testing::WithPa protected: void SetUp() override { - ElementType input_precision; + ov::element::Type model_type; InputShape input_shape; - std::tie(input_precision, input_shape, target_shape) = GetParam(); + std::tie(model_type, input_shape, target_shape) = GetParam(); targetDevice = ov::test::utils::DEVICE_GPU; std::vector input_shapes{input_shape, {{}, {{target_shape.size()}}}}; init_input_shapes(input_shapes); - ov::element::TypeVector input_precisions{input_precision, ov::element::i64}; + ov::element::TypeVector model_types{model_type, ov::element::i64}; ov::ParameterVector params; - for (size_t i = 0; i < input_precisions.size(); i++) { - auto param_node = std::make_shared(input_precisions[i], inputDynamicShapes[i]); + for (size_t i = 0; i < model_types.size(); i++) { + auto param_node = std::make_shared(model_types[i], inputDynamicShapes[i]); params.push_back(param_node); } - const auto bcast_data = ov::opset10::Constant::create(input_precision, {}, {1.f}); - const auto bcast = std::make_shared(bcast_data, params[1]); - const auto add = std::make_shared(params[0], bcast); + const auto bcast_data = ov::op::v0::Constant::create(model_type, {}, {1.f}); + const auto bcast = std::make_shared(bcast_data, params[1]); + const auto add = std::make_shared(params[0], bcast); function = std::make_shared(add, params); } @@ -95,7 +94,6 @@ TEST_P(BroadcastEltwise, smoke_CompareWithRefs) { EXPECT_EQ(last_input_layer_type, "broadcast"); } -namespace { const std::vector input_shapes = { {{-1, -1, -1, -1}, {{1, 3, 16, 16}}}, {{-1, -1}, {{16, 16}}}, @@ -113,4 +111,4 @@ INSTANTIATE_TEST_SUITE_P(smoke_BroadcastEltwise, ::testing::ValuesIn(target_shapes)), BroadcastEltwise::getTestCaseName); } // namespace -} // namespace GPULayerTestsDefinitions + diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_model_static_split_layer.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_model_static_split_layer.cpp index 658102694142a9..4f94d1a8dc2583 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_model_static_split_layer.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_model_static_split_layer.cpp @@ -1,45 +1,39 @@ // Copyright (C) 2023 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include "ov_models/utils/ov_helpers.hpp" -#include "ov_models/builders.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -#include "shared_test_classes/single_layer/split.hpp" -#include +#include "common_test_utils/ov_tensor_utils.hpp" +#include "common_test_utils/node_builders/eltwise.hpp" -using namespace ngraph; -using namespace InferenceEngine; -using namespace ov::test; +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/variadic_split.hpp" -namespace GPULayerTestsDefinitions { +namespace { +using ov::test::InputShape; typedef std::tuple< - std::vector, // input shapes - ElementType, // Network precision - TargetDevice, // Device name - std::map // Additional network configuration + std::vector, // input shapes + ov::element::Type, // Model type + std::string // Device name > DynamicModelStaticSplitLayerGPUTestParamsSet; -const std::vector netPrecisions = { - ElementType::f16 +const std::vector model_types = { + ov::element::f16 }; class DynamicModelStaticSplitLayerGPUTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest { + virtual public ov::test::SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { DynamicModelStaticSplitLayerGPUTestParamsSet basicParamsSet = obj.param; std::ostringstream result; std::vector inputShapes; - ElementType netType; - TargetDevice targetDevice; - std::map additionalConfig; + ov::element::Type model_type; + std::string targetDevice; - std::tie(inputShapes, netType, targetDevice, additionalConfig) = basicParamsSet; + std::tie(inputShapes, model_type, targetDevice) = basicParamsSet; result << "IS="; for (const auto& shape : inputShapes) { result << ov::test::utils::partialShape2str({shape.first}) << "_"; @@ -47,13 +41,13 @@ class DynamicModelStaticSplitLayerGPUTest : public testing::WithParamInterfaceset_friendly_name("split_sizes"); - auto variadicSplitOp = std::make_shared(params[0], axis, split_sizes); + auto variadicSplitOp = std::make_shared(params[0], axis, split_sizes); variadicSplitOp->set_friendly_name("variadicSplit"); - auto addOp = ngraph::builder::makeEltwise(params[1], variadicSplitOp->output(1), ngraph::helpers::EltwiseTypes::ADD); + auto addOp = ov::test::utils::makeEltwise(params[1], variadicSplitOp->output(1), ov::test::utils::EltwiseTypes::ADD); addOp->set_friendly_name("add"); - ngraph::ResultVector results = {std::make_shared(addOp)}; - function = std::make_shared(results, params, "eltwise_add_out"); + ov::ResultVector results = {std::make_shared(addOp)}; + function = std::make_shared(results, params, "eltwise_add_out"); } }; - -TEST_P(DynamicModelStaticSplitLayerGPUTest, CompareWithRefs) { - SKIP_IF_CURRENT_TEST_IS_DISABLED() +TEST_P(DynamicModelStaticSplitLayerGPUTest, Inference) { run(); } -namespace { -std::map emptyAdditionalConfig; const std::vector> dynInputShapes = { { // Input for static VariadicSplit @@ -124,11 +113,9 @@ const std::vector> dynInputShapes = { const auto testParams_smoke = ::testing::Combine(::testing::ValuesIn(dynInputShapes), - ::testing::ValuesIn(netPrecisions), // netprec - ::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::Values(emptyAdditionalConfig)); + ::testing::ValuesIn(model_types), // netprec + ::testing::Values(ov::test::utils::DEVICE_GPU)); INSTANTIATE_TEST_SUITE_P(smoke_dynamic_model_static_split, DynamicModelStaticSplitLayerGPUTest, testParams_smoke, DynamicModelStaticSplitLayerGPUTest::getTestCaseName); } // namespace -} // namespace GPULayerTestsDefinitions diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_gen_impl_key.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_gen_impl_key.cpp index 66c8ebe1426ef9..8daf22f14d06d3 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_gen_impl_key.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_gen_impl_key.cpp @@ -1,47 +1,43 @@ // Copyright (C) 2018-2023 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include "ov_models/utils/ov_helpers.hpp" -#include "ov_models/builders.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -#include "shared_test_classes/single_layer/shape_of.hpp" -#include "shared_test_classes/single_layer/strided_slice.hpp" -#include -#include +#include "common_test_utils/ov_tensor_utils.hpp" +#include "common_test_utils/node_builders/eltwise.hpp" +#include "common_test_utils/node_builders/reduce.hpp" -using namespace ngraph; -using namespace InferenceEngine; -using namespace ov::test; +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/reshape.hpp" +#include "openvino/op/shape_of.hpp" -namespace GPULayerTestsDefinitions { +namespace { +using ov::test::InputShape; typedef std::tuple< std::vector, // input shapes - ElementType, // Network precision - TargetDevice, // Device name + ov::element::Type, // Model type + std::string, // Device name std::map // Additional network configuration > genImplKeyDynamicGPUTestParamsSet; -const std::vector netPrecisions = { - ElementType::f16, - ElementType::f32, - ElementType::i32, - ElementType::i64, +const std::vector model_types = { + ov::element::f16, + ov::element::f32, + ov::element::i32, + ov::element::i64, }; class GenlImplKeyDynamicGPUTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest { + virtual public ov::test::SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { genImplKeyDynamicGPUTestParamsSet basicParamsSet = obj.param; std::ostringstream result; std::vector inputShapes; - ElementType netType; - TargetDevice targetDevice; + ov::element::Type netType; + std::string targetDevice; std::map additionalConfig; std::tie(inputShapes, netType, targetDevice, additionalConfig) = basicParamsSet; @@ -58,7 +54,7 @@ class GenlImplKeyDynamicGPUTest : public testing::WithParamInterface& targetInputStaticShapes) override { + void generate_inputs(const std::vector& targetInputStaticShapes) override { inputs.clear(); const auto& funcInputs = function->inputs(); for (size_t i = 0; i < funcInputs.size(); ++i) { @@ -66,9 +62,7 @@ class GenlImplKeyDynamicGPUTest : public testing::WithParamInterfaceGetParam(); std::vector inputShapes; - ElementType netType; + ov::element::Type netType; std::map additionalConfig; std::tie(inputShapes, netType, targetDevice, additionalConfig) = basicParamsSet; @@ -87,64 +81,60 @@ class GenlImplKeyDynamicGPUTest : public testing::WithParamInterface(netType, shape)); - auto addOp1 = ngraph::builder::makeEltwise(params[1], params[1], ngraph::helpers::EltwiseTypes::ADD); + auto addOp1 = ov::test::utils::makeEltwise(params[1], params[1], ov::test::utils::EltwiseTypes::ADD); addOp1->set_friendly_name("add1"); - auto shapeOfOp1 = std::make_shared(addOp1, ElementType::i64); + auto shapeOfOp1 = std::make_shared(addOp1, ov::element::i64); shapeOfOp1->set_friendly_name("shapeof1"); std::vector reduce_axes = {0}; - auto reduceAxesNode1 = std::dynamic_pointer_cast( - std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape({1}), reduce_axes)); - auto reduceOp1 = ngraph::builder::makeReduce(shapeOfOp1, reduceAxesNode1, true, ngraph::helpers::ReductionType::Prod); + auto reduceAxesNode1 = std::dynamic_pointer_cast( + std::make_shared(ov::element::i64, ov::Shape({1}), reduce_axes)); + auto reduceOp1 = ov::test::utils::make_reduce(shapeOfOp1, reduceAxesNode1, true, ov::test::utils::ReductionType::Prod); reduceOp1->set_friendly_name("reduce1"); std::vector shapePatternFill = {-1}; - auto reshapePatternComp1 = std::make_shared(ngraph::element::Type_t::i64, - ngraph::Shape{1}, shapePatternFill); + auto reshapePatternComp1 = std::make_shared(ov::element::i64, + ov::Shape{1}, shapePatternFill); auto concatOp1 = std::make_shared(ov::NodeVector{reduceOp1, reshapePatternComp1}, 0); concatOp1->set_friendly_name("concat1"); - auto reshapeOp1 = std::make_shared(addOp1, concatOp1, false); + auto reshapeOp1 = std::make_shared(addOp1, concatOp1, false); reshapeOp1->set_friendly_name("reshapeOp1"); - auto addOp2 = ngraph::builder::makeEltwise(params[1], params[1], ngraph::helpers::EltwiseTypes::ADD); + auto addOp2 = ov::test::utils::makeEltwise(params[1], params[1], ov::test::utils::EltwiseTypes::ADD); addOp2->set_friendly_name("add2"); - auto shapeOfOp2 = std::make_shared(addOp2, ElementType::i64); + auto shapeOfOp2 = std::make_shared(addOp2, ov::element::i64); shapeOfOp2->set_friendly_name("shapeof2"); - auto reduceAxesNode2 = std::dynamic_pointer_cast( - std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape({1}), reduce_axes)); - auto reduceOp2 = ngraph::builder::makeReduce(shapeOfOp2, reduceAxesNode2, true, ngraph::helpers::ReductionType::Prod); + auto reduceAxesNode2 = std::make_shared(ov::element::i64, ov::Shape({1}), reduce_axes); + auto reduceOp2 = ov::test::utils::make_reduce(shapeOfOp2, reduceAxesNode2, true, ov::test::utils::ReductionType::Prod); reduceOp2->set_friendly_name("reduce2"); - auto reshapePatternComp2 = std::make_shared(ngraph::element::Type_t::i64, - ngraph::Shape{1}, shapePatternFill); + auto reshapePatternComp2 = std::make_shared(ov::element::i64, + ov::Shape{1}, shapePatternFill); auto concatOp2 = std::make_shared(ov::NodeVector{reduceOp2, reshapePatternComp2}, 0); concatOp2->set_friendly_name("concat2"); - auto reshapeOp2 = std::make_shared(addOp2, concatOp2, false); + auto reshapeOp2 = std::make_shared(addOp2, concatOp2, false); reshapeOp2->set_friendly_name("reshapeOp2"); - auto addOp3 = ngraph::builder::makeEltwise(reshapeOp1, reshapeOp2, ngraph::helpers::EltwiseTypes::ADD); + auto addOp3 = ov::test::utils::makeEltwise(reshapeOp1, reshapeOp2, ov::test::utils::EltwiseTypes::ADD); addOp3->set_friendly_name("add3"); - auto shapeOf3 = std::make_shared(addOp3, ElementType::i64); + auto shapeOf3 = std::make_shared(addOp3, ov::element::i64); shapeOf3->set_friendly_name("shapeof3"); - ngraph::ResultVector results = {std::make_shared(shapeOf3)}; - function = std::make_shared(results, params, "shapeof_out"); + ov::ResultVector results = {std::make_shared(shapeOf3)}; + function = std::make_shared(results, params, "shapeof_out"); } }; - -TEST_P(GenlImplKeyDynamicGPUTest, CompareWithRefs) { - SKIP_IF_CURRENT_TEST_IS_DISABLED() +TEST_P(GenlImplKeyDynamicGPUTest, Inference) { run(); } -namespace { std::map emptyAdditionalConfig; const std::vector> dynInputShapes = { // 1D @@ -177,13 +167,11 @@ const std::vector> dynInputShapes = { } }; - const auto testParams_smoke = ::testing::Combine(::testing::ValuesIn(dynInputShapes), - ::testing::ValuesIn(netPrecisions), // netprec + ::testing::ValuesIn(model_types), ::testing::Values(ov::test::utils::DEVICE_GPU), ::testing::Values(emptyAdditionalConfig)); INSTANTIATE_TEST_SUITE_P(smoke_dynamic_impl_key, GenlImplKeyDynamicGPUTest, testParams_smoke, GenlImplKeyDynamicGPUTest::getTestCaseName); } // namespace -} // namespace GPULayerTestsDefinitions diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_reduce_deconvolution_concat.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_reduce_deconvolution_concat.cpp index 8a76b155c1359c..83eb58eb77712b 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_reduce_deconvolution_concat.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_reduce_deconvolution_concat.cpp @@ -1,48 +1,42 @@ // Copyright (C) 2018-2023 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include "ov_models/utils/ov_helpers.hpp" -#include "ov_models/builders.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -#include "shared_test_classes/single_layer/reduce_ops.hpp" -#include "shared_test_classes/single_layer/convolution_backprop_data.hpp" -#include -#include +#include "common_test_utils/ov_tensor_utils.hpp" +#include "common_test_utils/node_builders/reduce.hpp" +#include "common_test_utils/node_builders/convolution_backprop_data.hpp" -using namespace ngraph; -using namespace InferenceEngine; -using namespace ov::test; +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/concat.hpp" +#include "openvino/op/transpose.hpp" -namespace GPULayerTestsDefinitions { +namespace { +using ov::test::InputShape; typedef std::tuple< std::vector, // input shapes - ElementType, // Network precision - TargetDevice, // Device name - std::map // Additional network configuration + ov::element::Type, // Network precision + std::string // Device name > reduceDeconvConcatDynamicGPUTestParamsSet; -const std::vector netPrecisions = { - ElementType::f16, +const std::vector netPrecisions = { + ov::element::f16, }; // Reduce should have preferred format for ouput layout class ReduceDeconvConcatDynamicGPUTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest { + virtual public ov::test::SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { reduceDeconvConcatDynamicGPUTestParamsSet basicParamsSet = obj.param; std::ostringstream result; std::vector inputShapes; - ElementType netType; - TargetDevice targetDevice; - std::map additionalConfig; + ov::element::Type model_type; + std::string targetDevice; - std::tie(inputShapes, netType, targetDevice, additionalConfig) = basicParamsSet; + std::tie(inputShapes, model_type, targetDevice) = basicParamsSet; result << "IS="; for (const auto& shape : inputShapes) { result << ov::test::utils::partialShape2str({shape.first}) << "_"; @@ -50,13 +44,13 @@ class ReduceDeconvConcatDynamicGPUTest : public testing::WithParamInterface reduce_axes = {5}; - auto reduceAxesNode = std::dynamic_pointer_cast( - std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape({1}), reduce_axes)); - auto reduceOp = ngraph::builder::makeReduce(params[1], reduceAxesNode, false, ngraph::helpers::ReductionType::Max); + auto reduceAxesNode = std::make_shared(ov::element::i64, ov::Shape({1}), reduce_axes); + auto reduceOp = ov::test::utils::make_reduce(params[1], reduceAxesNode, false, ov::test::utils::ReductionType::Max); reduceOp->set_friendly_name("reduce"); auto concatOp = std::make_shared(ov::NodeVector{deconvOp, reduceOp}, 1); concatOp->set_friendly_name("concat"); std::vector transpose_order = {0, 1, 2, 4, 3}; - auto transposeOrderNode = std::dynamic_pointer_cast( - std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape({5}), transpose_order)); - auto transposeOp = std::make_shared(concatOp, transposeOrderNode); + auto transposeOrderNode = std::make_shared(ov::element::i64, ov::Shape({5}), transpose_order); + auto transposeOp = std::make_shared(concatOp, transposeOrderNode); transposeOp->set_friendly_name("transpose"); - ngraph::ResultVector results = {std::make_shared(transposeOp)}; - function = std::make_shared(results, params, "transpose_out"); + ov::ResultVector results = {std::make_shared(transposeOp)}; + function = std::make_shared(results, params, "transpose_out"); } }; - -TEST_P(ReduceDeconvConcatDynamicGPUTest, CompareWithRefs) { - SKIP_IF_CURRENT_TEST_IS_DISABLED() +TEST_P(ReduceDeconvConcatDynamicGPUTest, Inference) { run(); } -namespace { -std::map emptyAdditionalConfig; const std::vector> dynInputShapes = { { // Input for Deconv @@ -128,10 +113,8 @@ const std::vector> dynInputShapes = { const auto testParams_smoke = ::testing::Combine(::testing::ValuesIn(dynInputShapes), ::testing::ValuesIn(netPrecisions), // netprec - ::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::Values(emptyAdditionalConfig)); + ::testing::Values(ov::test::utils::DEVICE_GPU)); INSTANTIATE_TEST_SUITE_P(smoke_dynamic_reduce_deconv_concat, ReduceDeconvConcatDynamicGPUTest, testParams_smoke, ReduceDeconvConcatDynamicGPUTest::getTestCaseName); } // namespace -} // namespace GPULayerTestsDefinitions diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_shape_of_activation.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_shape_of_activation.cpp index 1a611f1f3060e2..3e35dc0023937b 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_shape_of_activation.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_shape_of_activation.cpp @@ -1,55 +1,47 @@ // Copyright (C) 2018-2023 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include "ov_models/utils/ov_helpers.hpp" -#include "ov_models/builders.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -#include "shared_test_classes/single_layer/shape_of.hpp" -#include "shared_test_classes/single_layer/reshape.hpp" -#include "shared_test_classes/single_layer/gather.hpp" -#include "shared_test_classes/single_layer/activation.hpp" -#include +#include "common_test_utils/ov_tensor_utils.hpp" +#include "common_test_utils/node_builders/activation.hpp" -using namespace ngraph; -using namespace InferenceEngine; -using namespace ov::test; +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/reshape.hpp" +#include "openvino/op/shape_of.hpp" -namespace GPULayerTestsDefinitions { +namespace { +using ov::test::InputShape; typedef std::tuple< InputShape, // input shapes - ElementType, // Network precision - TargetDevice, // Device name - ngraph::helpers::ActivationTypes, // Activation type + ov::element::Type, // Network precision + std::string, // Device name + ov::test::utils::ActivationTypes, // Activation type std::vector, //inShape - std::vector, //constantValue - std::map // Additional network configuration + std::vector //constantValue > shapeofActivationDynamicGPUTestParamsSet; -const std::vector netPrecisions = { - ElementType::f16, - ElementType::f32, +const std::vector model_types = { + ov::element::f16, + ov::element::f32, }; class shapeofActivationDynamicGPUTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest { + virtual public ov::test::SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { shapeofActivationDynamicGPUTestParamsSet basicParamsSet = obj.param; std::ostringstream result; InputShape inputShape; - ElementType netType; - TargetDevice targetDevice; - ngraph::helpers::ActivationTypes activationType; + ov::element::Type netType; + std::string targetDevice; + ov::test::utils::ActivationTypes activationType; std::vector inShape; std::vector constantValue; - std::map additionalConfig; - std::tie(inputShape, netType, targetDevice, activationType, inShape, constantValue, additionalConfig) = basicParamsSet; + std::tie(inputShape, netType, targetDevice, activationType, inShape, constantValue) = basicParamsSet; result << "IS="; result << ov::test::utils::partialShape2str({inputShape.first}) << "_"; for (const auto& actual_shape : inputShape.second) { @@ -64,7 +56,7 @@ class shapeofActivationDynamicGPUTest : public testing::WithParamInterface& targetInputStaticShapes) override { + void generate_inputs(const std::vector& targetInputStaticShapes) override { inputs.clear(); const auto& funcInputs = function->inputs(); for (size_t i = 0; i < funcInputs.size(); ++i) { @@ -82,12 +74,11 @@ class shapeofActivationDynamicGPUTest : public testing::WithParamInterfaceGetParam(); InputShape inputShape; - ElementType netType; - ngraph::helpers::ActivationTypes activationType; + ov::element::Type netType; + ov::test::utils::ActivationTypes activationType; std::vector inShape; std::vector constantValue; - std::map additionalConfig; - std::tie(inputShape, netType, targetDevice, activationType, inShape, constantValue, additionalConfig) = basicParamsSet; + std::tie(inputShape, netType, targetDevice, activationType, inShape, constantValue) = basicParamsSet; init_input_shapes({inputShape}); @@ -96,46 +87,40 @@ class shapeofActivationDynamicGPUTest : public testing::WithParamInterface(netType, shape)); std::vector shape_pattern = {0, 1, -1, 0}; - auto shapePatternsNode = std::dynamic_pointer_cast( - std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape({4}), shape_pattern)); - auto reshapeOp = std::make_shared(params[0], shapePatternsNode, true); + auto shapePatternsNode = std::make_shared(ov::element::i64, ov::Shape({4}), shape_pattern); + auto reshapeOp = std::make_shared(params[0], shapePatternsNode, true); reshapeOp->set_friendly_name("reshape"); - auto shapeOfOp = std::make_shared(reshapeOp, ElementType::i32); + auto shapeOfOp = std::make_shared(reshapeOp, ov::element::i32); shapeOfOp->set_friendly_name("shapeof"); std::vector indices = {0}; - auto indicesNode = std::dynamic_pointer_cast( - std::make_shared(ngraph::element::Type_t::i32, ngraph::Shape({1}), indices)); + auto indicesNode = std::make_shared(ov::element::i32, ov::Shape({1}), indices); std::vector axis = {-1}; - auto axisNode = std::dynamic_pointer_cast( - std::make_shared(ngraph::element::Type_t::i32, ngraph::Shape({1}), axis)); + auto axisNode = std::make_shared(ov::element::i32, ov::Shape({1}), axis); auto gatherOp = std::make_shared(shapeOfOp, indicesNode, axisNode, 0); gatherOp->set_friendly_name("gather"); - auto convertOp = std::make_shared(gatherOp, ElementType::f32); + auto convertOp = std::make_shared(gatherOp, ov::element::f32); convertOp->set_friendly_name("convert"); - auto activationOp = ngraph::builder::makeActivation(convertOp, - netType, - activationType, - inShape, - constantValue); + auto activationOp = ov::test::utils::make_activation(convertOp, + netType, + activationType, + inShape, + constantValue); activationOp->set_friendly_name("sqrt"); - ngraph::ResultVector results = {std::make_shared(activationOp)}; - function = std::make_shared(results, params, "result"); + ov::ResultVector results = {std::make_shared(activationOp)}; + function = std::make_shared(results, params, "result"); } }; -TEST_P(shapeofActivationDynamicGPUTest, CompareWithRefs) { - SKIP_IF_CURRENT_TEST_IS_DISABLED() +TEST_P(shapeofActivationDynamicGPUTest, Inference) { run(); } -namespace { -std::map emptyAdditionalConfig; std::vector inShapesDynamic4d = { { {-1, -1, 1, 64}, @@ -159,15 +144,13 @@ std::vector inShape_sqrt = {}; std::vector constantValue_sqrt = {}; const auto testParams_sqrt = ::testing::Combine(::testing::ValuesIn(inShapesDynamic4d), - ::testing::ValuesIn(netPrecisions), // netprec + ::testing::ValuesIn(model_types), // netprec ::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::Values(ngraph::helpers::ActivationTypes::Sqrt), + ::testing::Values(ov::test::utils::ActivationTypes::Sqrt), ::testing::Values(inShape_sqrt), - ::testing::Values(constantValue_sqrt), - ::testing::Values(emptyAdditionalConfig)); + ::testing::Values(constantValue_sqrt)); // Activation type Sqrt should be supported in activation cpu_impl whic is selected after shapeOf INSTANTIATE_TEST_SUITE_P(smoke_dynamic_shapeof_activation_sqrt, shapeofActivationDynamicGPUTest, testParams_sqrt, shapeofActivationDynamicGPUTest::getTestCaseName); -} // namespace -} // namespace GPULayerTestsDefinitions +} // namespace \ No newline at end of file diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_shape_of_reduce_reshape.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_shape_of_reduce_reshape.cpp index 456c627c38facb..9965777b79896b 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_shape_of_reduce_reshape.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_shape_of_reduce_reshape.cpp @@ -1,50 +1,44 @@ // Copyright (C) 2018-2023 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include "ov_models/utils/ov_helpers.hpp" -#include "ov_models/builders.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -#include "shared_test_classes/single_layer/shape_of.hpp" -#include "shared_test_classes/single_layer/strided_slice.hpp" -#include -#include +#include "common_test_utils/ov_tensor_utils.hpp" +#include "common_test_utils/node_builders/eltwise.hpp" +#include "common_test_utils/node_builders/reduce.hpp" -using namespace ngraph; -using namespace InferenceEngine; -using namespace ov::test; +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/reshape.hpp" +#include "openvino/op/shape_of.hpp" -namespace GPULayerTestsDefinitions { +namespace { +using ov::test::InputShape; typedef std::tuple< std::vector, // input shapes - ElementType, // Network precision - TargetDevice, // Device name - std::map // Additional network configuration + ov::element::Type, // Network precision + std::string // Device name > shapeOfReshapeReduceDynamicGPUTestParamsSet; -const std::vector netPrecisions = { - ElementType::f16, - ElementType::f32, - ElementType::i32, - ElementType::i64, +const std::vector model_types = { + ov::element::f16, + ov::element::f32, + ov::element::i32, + ov::element::i64, }; class ShapeOfReshapeReduceDynamicGPUTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest { + virtual public ov::test::SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { shapeOfReshapeReduceDynamicGPUTestParamsSet basicParamsSet = obj.param; std::ostringstream result; std::vector inputShapes; - ElementType netType; - TargetDevice targetDevice; - std::map additionalConfig; + ov::element::Type model_type; + std::string targetDevice; - std::tie(inputShapes, netType, targetDevice, additionalConfig) = basicParamsSet; + std::tie(inputShapes, model_type, targetDevice) = basicParamsSet; result << "IS="; for (const auto& shape : inputShapes) { result << ov::test::utils::partialShape2str({shape.first}) << "_"; @@ -52,13 +46,13 @@ class ShapeOfReshapeReduceDynamicGPUTest : public testing::WithParamInterface(params[0], ElementType::i64); + auto shapeOfOp1 = std::make_shared(params[0], ov::element::i64); shapeOfOp1->set_friendly_name("shapeof1"); std::vector reduce_axes = {0}; - auto reduceAxesNode = std::dynamic_pointer_cast( - std::make_shared(ngraph::element::Type_t::i64, ngraph::Shape({1}), reduce_axes)); - auto reduceOp = ngraph::builder::makeReduce(shapeOfOp1, reduceAxesNode, true, ngraph::helpers::ReductionType::Prod); + auto reduceAxesNode = std::make_shared(ov::element::i64, ov::Shape({1}), reduce_axes); + auto reduceOp = ov::test::utils::make_reduce(shapeOfOp1, reduceAxesNode, true, ov::test::utils::ReductionType::Prod); reduceOp->set_friendly_name("reduce"); std::vector shapePatternFill = {-1}; - auto reshapePatternComp = std::make_shared(ngraph::element::Type_t::i64, - ngraph::Shape{1}, shapePatternFill); + auto reshapePatternComp = std::make_shared(ov::element::i64, ov::Shape{1}, shapePatternFill); auto concatOp = std::make_shared(ov::NodeVector{reduceOp, reshapePatternComp}, 0); concatOp->set_friendly_name("concat"); - auto reshapeOp = std::make_shared(addOp, concatOp, false); + auto reshapeOp = std::make_shared(addOp, concatOp, false); - auto shapeOf2 = std::make_shared(reshapeOp, ElementType::i64); + auto shapeOf2 = std::make_shared(reshapeOp, ov::element::i64); shapeOf2->set_friendly_name("shapeof2"); - ngraph::ResultVector results = {std::make_shared(shapeOf2)}; - function = std::make_shared(results, params, "shapeof_out"); + ov::ResultVector results = {std::make_shared(shapeOf2)}; + function = std::make_shared(results, params, "shapeof_out"); } }; - -TEST_P(ShapeOfReshapeReduceDynamicGPUTest, CompareWithRefs) { - SKIP_IF_CURRENT_TEST_IS_DISABLED() +TEST_P(ShapeOfReshapeReduceDynamicGPUTest, Inference) { run(); } -namespace { -std::map emptyAdditionalConfig; const std::vector> dynInputShapes = { // 1D { @@ -152,13 +137,10 @@ const std::vector> dynInputShapes = { } }; - const auto testParams_smoke = ::testing::Combine(::testing::ValuesIn(dynInputShapes), - ::testing::ValuesIn(netPrecisions), // netprec - ::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::Values(emptyAdditionalConfig)); + ::testing::ValuesIn(model_types), // netprec + ::testing::Values(ov::test::utils::DEVICE_GPU)); INSTANTIATE_TEST_SUITE_P(smoke_dynamic_shapeof_reshape, ShapeOfReshapeReduceDynamicGPUTest, testParams_smoke, ShapeOfReshapeReduceDynamicGPUTest::getTestCaseName); } // namespace -} // namespace GPULayerTestsDefinitions diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_with_empty_tensor.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_with_empty_tensor.cpp index a85c6089461430..398eb1ab8ee429 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_with_empty_tensor.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/dynamic_smoke_test_with_empty_tensor.cpp @@ -1,48 +1,41 @@ // Copyright (C) 2023 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include "ov_models/utils/ov_helpers.hpp" -#include "ov_models/builders.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -#include "shared_test_classes/single_layer/shape_of.hpp" -#include "shared_test_classes/single_layer/strided_slice.hpp" -#include -#include "shared_test_classes/single_layer/gather.hpp" -#include +#include "common_test_utils/ov_tensor_utils.hpp" -using namespace ngraph; -using namespace InferenceEngine; -using namespace ov::test; +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/shape_of.hpp" +#include "openvino/op/non_zero.hpp" +#include "openvino/op/squeeze.hpp" +#include "openvino/op/gather.hpp" -namespace GPULayerTestsDefinitions { +namespace { +using ov::test::InputShape; typedef std::tuple< std::vector, // input shapes - ElementType, // Network precision - TargetDevice, // Device name - std::map // Additional network configuration + ov::element::Type, // Network precision + std::string // Device name > emptyTensorTestParamsSet; -const std::vector netPrecisions = { - ElementType::i32, +const std::vector netPrecisions = { + ov::element::i32, }; class EmptyTensorDynamicGPUTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest { + virtual public ov::test::SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { emptyTensorTestParamsSet basicParamsSet = obj.param; std::ostringstream result; std::vector inputShapes; - ElementType netType; - TargetDevice targetDevice; - std::map additionalConfig; + ov::element::Type netType; + std::string targetDevice; - std::tie(inputShapes, netType, targetDevice, additionalConfig) = basicParamsSet; + std::tie(inputShapes, netType, targetDevice) = basicParamsSet; result << "IS="; for (const auto& shape : inputShapes) { result << ov::test::utils::partialShape2str({shape.first}) << "_"; @@ -56,7 +49,7 @@ class EmptyTensorDynamicGPUTest : public testing::WithParamInterface& targetInputStaticShapes) override { + void generate_inputs(const std::vector& targetInputStaticShapes) override { inputs.clear(); const auto& funcInputs = function->inputs(); for (size_t i = 0; i < funcInputs.size(); ++i) { @@ -72,9 +65,7 @@ class EmptyTensorDynamicGPUTest : public testing::WithParamInterfaceGetParam(); std::vector inputShapes; - ElementType netType; - std::map additionalConfig; - std::tie(inputShapes, netType, targetDevice, additionalConfig) = basicParamsSet; + ov::element::Type netType; + std::tie(inputShapes, netType, targetDevice) = basicParamsSet; init_input_shapes(inputShapes); const auto AllZeroData = inputDynamicShapes[0]; @@ -94,10 +84,9 @@ class EmptyTensorDynamicGPUTest : public testing::WithParamInterface(netType, shape)); - const ElementType intInputsPrecision = ElementType::i32; - auto nonzeroEmptyResultOp = std::make_shared(params[0]); + auto nonzeroEmptyResultOp = std::make_shared(params[0]); - auto convertEmptyInputOp = std::make_shared(nonzeroEmptyResultOp, ElementType::i32); + auto convertEmptyInputOp = std::make_shared(nonzeroEmptyResultOp, ov::element::i32); auto concatPartialInputEmptyOp = std::make_shared(ov::NodeVector{convertEmptyInputOp, params[1], convertEmptyInputOp}, 1); // partially empty input / non empty output @@ -106,32 +95,28 @@ class EmptyTensorDynamicGPUTest : public testing::WithParamInterface squeezeDims = {0}; - auto squeezeDimsConst = - std::make_shared(ngraph::element::Type_t::i32, ngraph::Shape{1}, squeezeDims); + auto squeezeDimsConst = std::make_shared(ov::element::i32, ov::Shape{1}, squeezeDims); + + auto squeezeEmptyInputOp = std::make_shared(nonzeroEmptyResultOp, squeezeDimsConst); + + auto axisNode = std::make_shared(ov::element::i32, ov::Shape({1}), std::vector{0}); + auto gatherEmptyIndicesOp = std::make_shared(params[0], squeezeEmptyInputOp, axisNode, 0); - auto squeezeEmptyInputOp = std::make_shared(nonzeroEmptyResultOp, squeezeDimsConst); + auto shapeofEmptyInputOp = std::make_shared(gatherEmptyIndicesOp, ov::element::i32); - auto axisNode = ngraph::builder::makeConstant(intInputsPrecision, ov::Shape({1}), {0}); - auto gatherEmptyIndicesOp = - std::make_shared(params[0], squeezeEmptyInputOp, axisNode, 0); - auto shapeofEmptyInputOp = std::make_shared(gatherEmptyIndicesOp, ElementType::i32); - ngraph::ResultVector results = {std::make_shared(shapeofEmptyInputOp), - std::make_shared(concatPartialInputEmptyOp), - std::make_shared(concatEmptyInputEmptyOutputOp)}; - function = std::make_shared(results, params, "result"); + ov::ResultVector results = {std::make_shared(shapeofEmptyInputOp), + std::make_shared(concatPartialInputEmptyOp), + std::make_shared(concatEmptyInputEmptyOutputOp)}; + function = std::make_shared(results, params, "result"); - auto nonzero = std::make_shared(params[0]); + auto nonzero = std::make_shared(params[0]); } }; - -TEST_P(EmptyTensorDynamicGPUTest, CompareWithRefs) { - SKIP_IF_CURRENT_TEST_IS_DISABLED() +TEST_P(EmptyTensorDynamicGPUTest, Inference) { run(); } -namespace { -std::map emptyAdditionalConfig; const std::vector> dynInputShapes = { { // Input for NonZero @@ -141,13 +126,10 @@ const std::vector> dynInputShapes = { }, }; - const auto testParams_smoke = ::testing::Combine(::testing::ValuesIn(dynInputShapes), ::testing::ValuesIn(netPrecisions), // netprec - ::testing::Values(ov::test::utils::DEVICE_GPU), - ::testing::Values(emptyAdditionalConfig)); + ::testing::Values(ov::test::utils::DEVICE_GPU)); INSTANTIATE_TEST_SUITE_P(smoke_empty_tensor, EmptyTensorDynamicGPUTest, testParams_smoke, EmptyTensorDynamicGPUTest::getTestCaseName); } // namespace -} // namespace GPULayerTestsDefinitions diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache.cpp index d3fea8828b2bd0..a347261d756d12 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/kv_cache.cpp @@ -2,37 +2,31 @@ // SPDX-License-Identifier: Apache-2.0 // +#include "shared_test_classes/base/ov_subgraph.hpp" #include "common_test_utils/ov_tensor_utils.hpp" #include "common_test_utils/file_utils.hpp" -#include "openvino/core/node_vector.hpp" -#include "openvino/core/partial_shape.hpp" -#include "openvino/core/preprocess/pre_post_process.hpp" -#include "openvino/op/concat.hpp" -#include "openvino/op/matmul.hpp" -#include "openvino/op/parameter.hpp" -#include "openvino/op/transpose.hpp" -#include "shared_test_classes/base/layer_test_utils.hpp" -#include "shared_test_classes/base/ov_subgraph.hpp" -#include "shared_test_classes/base/utils/compare_results.hpp" -#include "transformations/rt_info/decompression.hpp" #include "subgraphs_builders.hpp" +#include "ov_models/utils/ov_helpers.hpp" +#include "shared_test_classes/base/utils/compare_results.hpp" -using namespace ov::test; +#include "openvino/op/parameter.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/convert.hpp" -namespace SubgraphTestsDefinitions { +namespace { +using ov::test::InputShape; using KVCacheTestParams = std::tuple, // input shapes - ov::element::Type, // in/out precision - std::map>; // additional config + ov::element::Type>; // in/out type -class KVCacheTest : public testing::WithParamInterface, public SubgraphBaseTest { +class KVCacheTest : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { public: static std::string get_test_case_name(testing::TestParamInfo obj) { std::vector input_shapes; ov::element::Type element_type; - std::map additional_config; - std::tie(input_shapes, element_type, additional_config) = obj.param; + std::tie(input_shapes, element_type) = obj.param; std::ostringstream result; for (const auto& shape : input_shapes) { @@ -49,13 +43,7 @@ class KVCacheTest : public testing::WithParamInterface, publi } result << ")_"; } - result << "precision=" << element_type << "_"; - result << "config=("; - for (const auto& configEntry : additional_config) { - result << configEntry.first << ", " << configEntry.second << ":"; - } - result << ")"; - + result << "precision=" << element_type; return result.str(); } @@ -65,11 +53,9 @@ class KVCacheTest : public testing::WithParamInterface, publi std::vector input_shapes; ov::element::Type element_type; - std::map additional_config; - std::tie(input_shapes, element_type, additional_config) = GetParam(); + std::tie(input_shapes, element_type) = GetParam(); - configuration.insert(additional_config.begin(), additional_config.end()); init_input_shapes(input_shapes); inType = outType = element_type; @@ -78,14 +64,11 @@ class KVCacheTest : public testing::WithParamInterface, publi } }; -TEST_P(KVCacheTest, CompareWithRefs) { - SKIP_IF_CURRENT_TEST_IS_DISABLED() +TEST_P(KVCacheTest, Inference) { run(); } -TEST_P(KVCacheTest, CompareWithRefs_cached) { - SKIP_IF_CURRENT_TEST_IS_DISABLED() - +TEST_P(KVCacheTest, Inference_cached) { std::stringstream ss; ss << "gpu_model_cache_" << std::hash{}( std::string(::testing::UnitTest::GetInstance()->current_test_info()->test_suite_name()) + @@ -106,8 +89,6 @@ TEST_P(KVCacheTest, CompareWithRefs_cached) { } } -namespace { - const std::vector precisions = {ov::element::f32, ov::element::f16}; const std::vector> input_shapes_basic = { @@ -121,10 +102,8 @@ const std::vector> input_shapes_basic = { INSTANTIATE_TEST_SUITE_P(smoke_GPU_Dynamic, KVCacheTest, ::testing::Combine(::testing::ValuesIn(input_shapes_basic), - ::testing::ValuesIn(precisions), - ::testing::Values(std::map())), + ::testing::ValuesIn(precisions)), KVCacheTest::get_test_case_name); -} // namespace class KVCacheTests: public ::testing::Test { public: @@ -132,7 +111,7 @@ class KVCacheTests: public ::testing::Test { #if defined(ANDROID) GTEST_SKIP(); #endif - auto core = ov::Core(); + auto core = ov::test::utils::PluginCache::get().core(); std::string cacheDirName; if (is_caching_test) { @@ -144,7 +123,7 @@ class KVCacheTests: public ::testing::Test { ov::test::utils::removeFilesWithExt(cacheDirName, "blob"); ov::test::utils::removeFilesWithExt(cacheDirName, "cl_cache"); ov::test::utils::removeDir(cacheDirName); - core.set_property(ov::cache_dir(cacheDirName)); + core->set_property(ov::cache_dir(cacheDirName)); } const size_t batch = 1; @@ -157,9 +136,9 @@ class KVCacheTests: public ::testing::Test { auto model = tests::make_llm_kv_cache_pattern(batch, n_heads, n_features, element_type); if (is_caching_test) { - core.compile_model(model, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f16)); + core->compile_model(model, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f16)); } - auto compiled_model = core.compile_model(model, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f16)); + auto compiled_model = core->compile_model(model, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f16)); auto input0 = model->get_parameters().at(0); auto input1 = model->get_parameters().at(1); @@ -167,13 +146,24 @@ class KVCacheTests: public ::testing::Test { auto output0 = model->get_results().at(0); auto output1 = model->get_results().at(1); - auto get_ref_results = [&model, &input0, &input1, &input2](const ov::Tensor& kv_cache, const ov::Tensor& new_token_data, + auto get_ref_results = [&](const ov::Tensor& kv_cache, const ov::Tensor& new_token_data, const ov::Tensor& matmul_data) { auto ref_model = model->clone(); ov::Tensor kv_cache_copy(kv_cache.get_element_type(), kv_cache.get_shape()); kv_cache.copy_to(kv_cache_copy); ngraph::helpers::resize_function(ref_model, {kv_cache_copy.get_shape(), new_token_data.get_shape(), matmul_data.get_shape()}); - return ngraph::helpers::interpretFunction(ref_model, {{input0, kv_cache_copy}, {input1, new_token_data}, {input2, matmul_data}}); + + auto compiled_model_ref = core->compile_model(ref_model, ov::test::utils::DEVICE_TEMPLATE); + auto inf_req_ref = compiled_model_ref.create_infer_request(); + inf_req_ref.set_tensor(input0, kv_cache_copy); + inf_req_ref.set_tensor(input1, new_token_data); + inf_req_ref.set_tensor(input2, matmul_data); + inf_req_ref.infer(); + std::vector results_ref; + for (auto&& output : ref_model->get_results()) { + results_ref.push_back(inf_req_ref.get_tensor(output)); + } + return results_ref; }; auto compare_tensors = [&model](const std::vector expected, const std::vector& actual) { @@ -187,7 +177,7 @@ class KVCacheTests: public ::testing::Test { std::shared_ptr inputNode = result->get_input_node_shared_ptr(i); if (std::dynamic_pointer_cast(inputNode)) { std::shared_ptr nextNodePtr = inputNode->get_input_node_shared_ptr(0); - if (!ngraph::is_type(nextNodePtr)) { + if (!ov::is_type(nextNodePtr)) { inputNode = nextNodePtr; } } @@ -263,7 +253,7 @@ class KVCacheTests: public ::testing::Test { #if defined(ANDROID) GTEST_SKIP(); #endif - auto core = ov::Core(); + auto core = ov::test::utils::PluginCache::get().core(); std::string cacheDirName; if (is_caching_test) { @@ -275,7 +265,7 @@ class KVCacheTests: public ::testing::Test { ov::test::utils::removeFilesWithExt(cacheDirName, "blob"); ov::test::utils::removeFilesWithExt(cacheDirName, "cl_cache"); ov::test::utils::removeDir(cacheDirName); - core.set_property(ov::cache_dir(cacheDirName)); + core->set_property(ov::cache_dir(cacheDirName)); } const size_t batch = 1; @@ -289,20 +279,31 @@ class KVCacheTests: public ::testing::Test { auto model = tests::make_llm_kv_cache_pattern(batch, n_heads, n_features, element_type, true); auto ref_model = tests::make_llm_kv_cache_pattern(batch, n_heads, n_features, element_type, false); if (is_caching_test) { - core.compile_model(model, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f16)); + core->compile_model(model, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f16)); } - auto compiled_model = core.compile_model(model, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f16)); + auto compiled_model = core->compile_model(model, ov::test::utils::DEVICE_GPU, ov::hint::inference_precision(ov::element::f16)); auto input0 = model->get_parameters().at(0); auto input1 = model->get_parameters().at(1); auto output0 = model->get_results().at(0); - auto get_ref_results = [&ref_model](const ov::Tensor& kv_cache, const ov::Tensor& new_token_data, const ov::Tensor& matmul_data) { + auto get_ref_results = [&](const ov::Tensor& kv_cache, const ov::Tensor& new_token_data, const ov::Tensor& matmul_data) { auto input0 = ref_model->get_parameters().at(0); auto input1 = ref_model->get_parameters().at(1); auto input2 = ref_model->get_parameters().at(2); ngraph::helpers::resize_function(ref_model, {kv_cache.get_shape(), new_token_data.get_shape(), matmul_data.get_shape()}); - return ngraph::helpers::interpretFunction(ref_model, {{input0, kv_cache}, {input1, new_token_data}, {input2, matmul_data}}); + + auto compiled_model_ref = core->compile_model(ref_model, ov::test::utils::DEVICE_TEMPLATE); + auto inf_req_ref = compiled_model_ref.create_infer_request(); + inf_req_ref.set_tensor(input0, kv_cache); + inf_req_ref.set_tensor(input1, new_token_data); + inf_req_ref.set_tensor(input2, matmul_data); + inf_req_ref.infer(); + std::vector results_ref; + for (auto&& output : ref_model->get_results()) { + results_ref.push_back(inf_req_ref.get_tensor(output)); + } + return results_ref; }; auto compare_tensors = [&model](const std::vector expected, const std::vector& actual) { @@ -316,7 +317,7 @@ class KVCacheTests: public ::testing::Test { std::shared_ptr inputNode = result->get_input_node_shared_ptr(i); if (std::dynamic_pointer_cast(inputNode)) { std::shared_ptr nextNodePtr = inputNode->get_input_node_shared_ptr(0); - if (!ngraph::is_type(nextNodePtr)) { + if (!ov::is_type(nextNodePtr)) { inputNode = nextNodePtr; } } @@ -407,4 +408,4 @@ TEST_F(KVCacheTests, smoke_multipleIterations_stateful) { TEST_F(KVCacheTests, smoke_multipleIterations_stateful_cached) { this->test_smoke_multipleIterations_stateful(true); } -} // namespace SubgraphTestsDefinitions +} // namespace diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/matmul_weights_decompression.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/matmul_weights_decompression.cpp index 1830e07cda9a8a..d6c5dbe7353403 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/matmul_weights_decompression.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/matmul_weights_decompression.cpp @@ -3,16 +3,21 @@ // #include "common_test_utils/ov_tensor_utils.hpp" -#include "openvino/op/constant.hpp" -#include "openvino/op/matmul.hpp" -#include "shared_test_classes/base/layer_test_utils.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" #include "transformations/rt_info/decompression.hpp" -using namespace ov; -using namespace ov::test; +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/matmul.hpp" +#include "openvino/op/reshape.hpp" +#include "openvino/op/convert.hpp" +#include "openvino/op/subtract.hpp" +#include "openvino/op/transpose.hpp" + +namespace { +using ov::test::InputShape; -namespace SubgraphTestsDefinitions { /* * Subtract_const(U8/NF4/U4/I4) * / @@ -44,26 +49,26 @@ struct ShapeParams { // Decompression group size. If the value is equal to -1, ordinary decompression is used int weights_group_size; }; + using MatmulWeightsDecompressionParams = std::tuple>; // additional config + bool>; // per-tensor zero-point -class MatmulWeightsDecompression : public testing::WithParamInterface, public SubgraphBaseTest { +class MatmulWeightsDecompression : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { public: static std::string get_test_case_name(testing::TestParamInfo obj) { ShapeParams shape_params; - ov::test::ElementType weights_precision; - ov::test::ElementType activations_precision; + ov::element::Type weights_precision; + ov::element::Type activations_precision; bool transpose; bool decompression_sub; bool reshape_on_decompression; bool per_tensor_zp; - std::map additional_config; std::tie(shape_params, weights_precision, @@ -71,25 +76,22 @@ class MatmulWeightsDecompression : public testing::WithParamInterface(ov::NodeVector{mat_mul}, params, "MatmulWeightsDecompression"); } std::shared_ptr init_compressed_weights_subgraph(const ov::Shape& weights_shape, @@ -155,7 +157,7 @@ class MatmulWeightsDecompression : public testing::WithParamInterface(weights_tensor); weights->set_friendly_name("Compressed_weights"); - auto weights_convert = std::make_shared(weights, data_precision); + auto weights_convert = std::make_shared(weights, data_precision); std::shared_ptr mul_parent = weights_convert; auto output_channels = *weights_shape.rbegin(); @@ -181,13 +183,13 @@ class MatmulWeightsDecompression : public testing::WithParamInterface(shift_tensor.data())[0] = 0x88; } auto shift_const = std::make_shared(shift_tensor); - std::shared_ptr shift_convert = std::make_shared(shift_const, data_precision); + std::shared_ptr shift_convert = std::make_shared(shift_const, data_precision); if (reshape_on_decompression_constant && !per_tensor_zp) { - auto shift_reshape_const = ov::opset10::Constant::create(ov::element::i32, {scaleshift_target_shape.size()}, scaleshift_target_shape); - auto shift_reshape = std::make_shared(shift_convert, shift_reshape_const, false); + auto shift_reshape_const = ov::op::v0::Constant::create(ov::element::i32, {scaleshift_target_shape.size()}, scaleshift_target_shape); + auto shift_reshape = std::make_shared(shift_convert, shift_reshape_const, false); shift_convert = shift_reshape; } - mul_parent = std::make_shared(weights_convert, shift_convert); + mul_parent = std::make_shared(weights_convert, shift_convert); } auto scale_tensor = ov::test::utils::create_and_fill_tensor(data_precision, scaleshift_const_shape, 1, -0.5, 30000); @@ -199,25 +201,25 @@ class MatmulWeightsDecompression : public testing::WithParamInterface scale_const = std::make_shared(scale_tensor); if (reshape_on_decompression_constant) { - auto scale_reshape_const = ov::opset10::Constant::create(ov::element::i32, {scaleshift_target_shape.size()}, scaleshift_target_shape); - auto scale_reshape = std::make_shared(scale_const, scale_reshape_const, false); + auto scale_reshape_const = ov::op::v0::Constant::create(ov::element::i32, {scaleshift_target_shape.size()}, scaleshift_target_shape); + auto scale_reshape = std::make_shared(scale_const, scale_reshape_const, false); scale_const = scale_reshape; } - std::shared_ptr last_node = std::make_shared(mul_parent, scale_const); + std::shared_ptr last_node = std::make_shared(mul_parent, scale_const); if (group_decompression) { auto reshape_target_shape = transpose_weights ? std::vector{-1, static_cast(weights_shape[0])} : std::vector{static_cast(weights_shape[0]), -1}; - auto target_shape_node = ov::opset10::Constant::create(ov::element::i32, {reshape_target_shape.size()}, reshape_target_shape); - last_node = std::make_shared(last_node, target_shape_node, false); + auto target_shape_node = ov::op::v0::Constant::create(ov::element::i32, {reshape_target_shape.size()}, reshape_target_shape); + last_node = std::make_shared(last_node, target_shape_node, false); } if (transpose_weights) { const size_t rank = last_node->get_output_partial_shape(0).size(); std::vector order(rank); std::iota(order.begin(), order.end(), 0); std::swap(*order.rbegin(), *(order.rbegin() + 1)); - auto transpose_constant = ov::opset10::Constant::create(ov::element::i32, {rank}, order); - last_node = std::make_shared(last_node, transpose_constant); + auto transpose_constant = ov::op::v0::Constant::create(ov::element::i32, {rank}, order); + last_node = std::make_shared(last_node, transpose_constant); } return last_node; } @@ -226,13 +228,12 @@ class MatmulWeightsDecompression : public testing::WithParamInterface additional_config; std::tie(shape_params, weights_precision, @@ -240,10 +241,8 @@ class MatmulWeightsDecompression : public testing::WithParamInterface& target_input_static_shapes) override { + void generate_inputs(const std::vector& target_input_static_shapes) override { inputs.clear(); const auto& model_inputs = function->inputs(); for (size_t i = 0; i < model_inputs.size(); ++i) { const auto& model_input = model_inputs[i]; ov::Tensor tensor = ov::test::utils::create_and_fill_tensor(model_input.get_element_type(), target_input_static_shapes[i], - 2, - -1, - 10000); + 2, -1, 10000); inputs.insert({model_input.get_node_shared_ptr(), tensor}); } } void check_results() { const auto& test_param = GetParam(); - ov::test::ElementType weights_precision = std::get<1>(test_param); + ov::element::Type weights_precision = std::get<1>(test_param); for (const auto& n : compiledModel.get_runtime_model()->get_ordered_ops()) { if (n->get_friendly_name() == "Compressed_weights") { ASSERT_EQ(n->get_output_element_type(0), weights_precision); @@ -291,16 +288,13 @@ class MatmulWeightsDecompression : public testing::WithParamInterface activations_precisions = {ov::element::f32, ov::element::f16}; -const std::vector weights_precisions = {ov::element::u8, ov::element::u4, ov::element::i4}; +const std::vector activations_precisions = {ov::element::f32, ov::element::f16}; +const std::vector weights_precisions = {ov::element::u8, ov::element::u4, ov::element::i4}; const std::vector transpose_weights = {true, false}; const std::vector input_shapes_basic = { {{{-1, -1, -1}, {{1, 4, 16}, {10, 16, 16}}}, {16, 32}}, @@ -318,8 +312,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_MatMulCompressedWeights_basic, ::testing::ValuesIn(transpose_weights), ::testing::Values(true), ::testing::Values(true), - ::testing::Values(false), - ::testing::Values(std::map())), + ::testing::Values(false)), MatmulWeightsDecompression::get_test_case_name); const std::vector input_shapes_corner_cases_basic = { @@ -347,8 +340,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_MatMulCompressedWeights_corner_cases_basic, ::testing::ValuesIn(transpose_weights), ::testing::ValuesIn(add_decompression_sub), ::testing::ValuesIn(reshape_on_decompression), - ::testing::ValuesIn(per_tensor_zp), - ::testing::Values(std::map{})), + ::testing::ValuesIn(per_tensor_zp)), MatmulWeightsDecompression::get_test_case_name); INSTANTIATE_TEST_SUITE_P(MatMulCompressedWeights_corner_cases_big, @@ -359,9 +351,6 @@ INSTANTIATE_TEST_SUITE_P(MatMulCompressedWeights_corner_cases_big, ::testing::ValuesIn(transpose_weights), ::testing::ValuesIn(add_decompression_sub), ::testing::ValuesIn(reshape_on_decompression), - ::testing::ValuesIn(per_tensor_zp), - ::testing::Values(std::map{})), + ::testing::ValuesIn(per_tensor_zp)), MatmulWeightsDecompression::get_test_case_name); } // namespace - -} // namespace SubgraphTestsDefinitions diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/read_value_assign.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/read_value_assign.cpp index 25a6b3c23c1412..f45009a5365167 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/read_value_assign.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/read_value_assign.cpp @@ -2,30 +2,30 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "openvino/opsets/opset1.hpp" -#include "common_test_utils/ov_tensor_utils.hpp" #include "common_test_utils/file_utils.hpp" -#include "ov_models/builders.hpp" -#include "ov_models/utils/ov_helpers.hpp" -#include "shared_test_classes/base/layer_test_utils.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -using namespace ngraph; -using namespace ov::test; -using namespace InferenceEngine; +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/add.hpp" +#include "openvino/op/read_value.hpp" +#include "openvino/op/assign.hpp" -namespace GPULayerTestsDefinitions { +namespace { +using ov::test::InputShape; using ReadValueAssignParams = std::tuple< - InputShape, // input shapes - ElementType // input precision + InputShape, // input shapes + ov::element::Type // input precision >; -class ReadValueAssignGPUTest : virtual public SubgraphBaseTest, public testing::WithParamInterface { +class ReadValueAssignGPUTest : virtual public ov::test::SubgraphBaseTest, + public testing::WithParamInterface { public: static std::string getTestCaseName(const testing::TestParamInfo& obj) { InputShape input_shapes; - ElementType input_precision; + ov::element::Type input_precision; std::tie(input_shapes, input_precision) = obj.param; std::ostringstream result; @@ -41,7 +41,7 @@ class ReadValueAssignGPUTest : virtual public SubgraphBaseTest, public testing:: protected: void SetUp() override { InputShape input_shapes; - ElementType input_precision; + ov::element::Type input_precision; std::tie(input_shapes, input_precision) = GetParam(); targetDevice = ov::test::utils::DEVICE_GPU; @@ -55,7 +55,7 @@ class ReadValueAssignGPUTest : virtual public SubgraphBaseTest, public testing:: auto add = std::make_shared(read_value, params.at(0)); auto assign = std::make_shared(add, "v0"); auto res = std::make_shared(add); - function = std::make_shared(ResultVector { res }, SinkVector { assign }, params); + function = std::make_shared(ov::ResultVector { res }, ov::SinkVector { assign }, params); } void generate_inputs(const std::vector& targetInputStaticShapes) override { @@ -71,14 +71,11 @@ class ReadValueAssignGPUTest : virtual public SubgraphBaseTest, public testing:: } }; -TEST_P(ReadValueAssignGPUTest, CompareWithRefs) { - SKIP_IF_CURRENT_TEST_IS_DISABLED() +TEST_P(ReadValueAssignGPUTest, Inference) { run(); } -TEST_P(ReadValueAssignGPUTest, CompareWithRefs_cached) { - SKIP_IF_CURRENT_TEST_IS_DISABLED() - +TEST_P(ReadValueAssignGPUTest, Inference_cached) { std::stringstream ss; ss << "gpu_model_cache_" << std::hash{}( std::string(::testing::UnitTest::GetInstance()->current_test_info()->test_suite_name()) + @@ -99,13 +96,12 @@ TEST_P(ReadValueAssignGPUTest, CompareWithRefs_cached) { } } -namespace { const std::vector input_shapes_dyn = { {{-1, -1, -1, -1}, {{7, 4, 20, 20}, {19, 4, 20, 20}}} }; INSTANTIATE_TEST_SUITE_P(smoke_ReadValueAssign_Static, ReadValueAssignGPUTest, - ::testing::Combine(::testing::ValuesIn(static_shapes_to_test_representation({{7, 4, 20, 20}})), + ::testing::Combine(::testing::ValuesIn(ov::test::static_shapes_to_test_representation({{7, 4, 20, 20}})), ::testing::Values(ov::element::i32)), ReadValueAssignGPUTest::getTestCaseName); @@ -114,4 +110,3 @@ INSTANTIATE_TEST_SUITE_P(smoke_ReadValueAssign_Dynamic, ReadValueAssignGPUTest, ::testing::Values(ov::element::i32)), ReadValueAssignGPUTest::getTestCaseName); } // namespace -} // namespace GPULayerTestsDefinitions diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/rms_norm_decomposition.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/rms_norm_decomposition.cpp index 60cc72020732f8..bf515ed78fec5a 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/rms_norm_decomposition.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/dynamic/rms_norm_decomposition.cpp @@ -2,16 +2,24 @@ // SPDX-License-Identifier: Apache-2.0 // -#include "ov_models/builders.hpp" +#include "common_test_utils/ov_tensor_utils.hpp" #include "common_test_utils/file_utils.hpp" -#include "random_generator.hpp" -#include "shared_test_classes/base/layer_test_utils.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -using namespace ngraph; -using namespace ov::test; +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/convert.hpp" +#include "openvino/op/add.hpp" +#include "openvino/op/sqrt.hpp" +#include "openvino/op/divide.hpp" +#include "openvino/op/multiply.hpp" +#include "openvino/op/power.hpp" +#include "openvino/op/reduce_mean.hpp" + +namespace { +using ov::test::InputShape; -namespace SubgraphTestsDefinitions { /* * Input(F32) Const(F32) * | \ / @@ -33,17 +41,16 @@ namespace SubgraphTestsDefinitions { * Convert(F16) */ using RMSNormDecompositionParams = std::tuple, // input shapes - ov::test::ElementType, // input precision - std::map>; // additional config + ov::element::Type>; // input precision -class RMSNormDecomposition : public testing::WithParamInterface, public SubgraphBaseTest { +class RMSNormDecomposition : public testing::WithParamInterface, + virtual public ov::test::SubgraphBaseTest { public: static std::string getTestCaseName(testing::TestParamInfo obj) { std::vector input_shapes; - ElementType input_precision; - std::map additional_config; + ov::element::Type input_precision; - std::tie(input_shapes, input_precision, additional_config) = obj.param; + std::tie(input_shapes, input_precision) = obj.param; std::ostringstream result; result << "IS=("; @@ -61,14 +68,7 @@ class RMSNormDecomposition : public testing::WithParamInterface(mul2, ov::element::f16); + + return std::make_shared(ov::NodeVector{comp}, params, "RMSNormDecomposition"); } void SetUp() override { targetDevice = ov::test::utils::DEVICE_GPU; std::vector input_shapes; - ElementType input_precision; - std::map additional_config; + ov::element::Type input_precision; - std::tie(input_shapes, input_precision, additional_config) = GetParam(); + std::tie(input_shapes, input_precision) = GetParam(); - configuration.insert(additional_config.begin(), additional_config.end()); init_input_shapes(input_shapes); inType = outType = input_precision; @@ -128,14 +128,11 @@ class RMSNormDecomposition : public testing::WithParamInterface{}( std::string(::testing::UnitTest::GetInstance()->current_test_info()->test_suite_name()) + @@ -156,9 +153,7 @@ TEST_P(RMSNormDecomposition, CompareWithRefs_cached) { } } -namespace { - -const std::vector input_precisions = {ov::element::f32, ov::element::f16}; +const std::vector input_precisions = {ov::element::f32, ov::element::f16}; const std::vector> input_shapes_basic = { {{{-1, -1, 96}, {{1, 4, 96}}}}, @@ -170,9 +165,6 @@ const std::vector> input_shapes_basic = { INSTANTIATE_TEST_SUITE_P(smoke_RMSNormDecomposition_basic, RMSNormDecomposition, ::testing::Combine(::testing::ValuesIn(input_shapes_basic), - ::testing::ValuesIn(input_precisions), - ::testing::Values(std::map())), + ::testing::ValuesIn(input_precisions)), RMSNormDecomposition::getTestCaseName); } // namespace - -} // namespace SubgraphTestsDefinitions diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/loop.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/loop.cpp index 1ca60efa2ff1e6..8200700e0bd902 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/loop.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/loop.cpp @@ -2,25 +2,19 @@ // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include "ov_models/utils/ov_helpers.hpp" -#include "shared_test_classes/base/layer_test_utils.hpp" -#include "ov_models/builders.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -#include "common_test_utils/test_constants.hpp" -#include "shared_test_classes/base/utils/ranges.hpp" -#include -#include "shared_test_classes/base/utils/compare_results.hpp" -#include "openvino/pass/constant_folding.hpp" -#include -using namespace InferenceEngine; -using namespace ov::test; +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/add.hpp" +#include "openvino/op/multiply.hpp" +#include "openvino/op/convert.hpp" +#include "openvino/op/loop.hpp" +#include "openvino/op/less.hpp" -namespace GPULayerTestsDefinitions { +namespace { +using ov::test::InputShape; using DynamicShapeLoopParams = typename std::tuple< bool, @@ -32,17 +26,15 @@ using DynamicShapeLoopParams = typename std::tuple< >, int64_t, InputShape, - InferenceEngine::Precision, - std::string, - ov::AnyMap - >; + ov::element::Type, + std::string>; /** * Test case with Dynamic SHAPE version of loop operation. * Total iteration count is dynamic. */ class DynamicShapeLoopTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest { + virtual public ov::test::SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo &obj) { bool static_iter_num; @@ -52,18 +44,16 @@ class DynamicShapeLoopTest : public testing::WithParamInterface std::shared_ptr { + ov::ParameterVector params{}; + auto cond_input_create = [¶ms] (ov::element::Type model_type, + const ov::PartialShape &shape, + int value = 0, + bool is_static = false) -> std::shared_ptr { if (is_static) - return std::make_shared(prc, shape.to_shape(), value); + return std::make_shared(model_type, shape.to_shape(), value); - auto input = std::make_shared(prc, shape); + auto input = std::make_shared(model_type, shape); params.push_back(input); return input; }; - auto start_add = cond_input_create(prc, inputShape, start_value); + auto start_add = cond_input_create(model_type, inputShape, start_value); start_add->set_friendly_name("start_add"); - auto start_mul = cond_input_create(prc, inputShape, 1); + auto start_mul = cond_input_create(model_type, inputShape, 1); start_mul->set_friendly_name("start_mul"); - auto count = cond_input_create(ngraph::element::i64, scalarShape, max_iter_num, static_iter_num); + auto count = cond_input_create(ov::element::i64, scalarShape, max_iter_num, static_iter_num); count->set_friendly_name("count"); - auto skip = cond_input_create(ngraph::element::boolean, scalarShape, true, static_continue_cond); + auto skip = cond_input_create(ov::element::boolean, scalarShape, true, static_continue_cond); skip->set_friendly_name("skip"); - auto b_indx = std::make_shared(ngraph::element::i64, ngraph::Shape{}); + auto b_indx = std::make_shared(ov::element::i64, ov::Shape{}); b_indx->set_friendly_name("body_index"); - auto b_data_add = std::make_shared(prc, inputShape); + auto b_data_add = std::make_shared(model_type, inputShape); b_data_add->set_friendly_name("b_data_add"); - auto b_data_mul = std::make_shared(prc, inputShape); + auto b_data_mul = std::make_shared(model_type, inputShape); b_data_mul->set_friendly_name("b_data_mul"); - auto b_indx_cast = std::make_shared(b_indx, prc); + auto b_indx_cast = std::make_shared(b_indx, model_type); b_indx_cast->set_friendly_name("body_index_cast"); - auto b_add = std::make_shared(b_data_add, b_indx_cast); + auto b_add = std::make_shared(b_data_add, b_indx_cast); b_add->set_friendly_name("body_add"); - auto b_mul = std::make_shared(b_data_mul, b_indx_cast); + auto b_mul = std::make_shared(b_data_mul, b_indx_cast); b_mul->set_friendly_name("body_mul"); - std::shared_ptr b_cond; + std::shared_ptr b_cond; if (dynamic_exit == -1) { - b_cond = std::make_shared(ngraph::element::boolean, ngraph::Shape{}, true); + b_cond = std::make_shared(ov::element::boolean, ov::Shape{}, true); b_cond->set_friendly_name("body_condition"); } else { - auto b_exit_value = std::make_shared(ngraph::element::i64, scalarShape, dynamic_exit); + auto b_exit_value = std::make_shared(ov::element::i64, scalarShape, dynamic_exit); b_exit_value->set_friendly_name("body_exit_value"); - b_cond = std::make_shared(b_indx, b_exit_value); + b_cond = std::make_shared(b_indx, b_exit_value); b_cond->set_friendly_name("body_condition_with_exit_value"); } - auto body = std::make_shared( - ngraph::OutputVector {b_cond, b_add, b_mul}, // TODO: check with reverse - ngraph::ParameterVector {b_indx, b_data_add, b_data_mul}); // TODO: check with reverse + auto body = std::make_shared( + ov::OutputVector {b_cond, b_add, b_mul}, // TODO: check with reverse + ov::ParameterVector {b_indx, b_data_add, b_data_mul}); // TODO: check with reverse body->set_friendly_name("body_network"); - auto loop = std::make_shared(count, skip); + auto loop = std::make_shared(count, skip); loop->set_friendly_name("loop"); loop->set_function(body); loop->set_special_body_ports({0, 0}); @@ -180,13 +169,13 @@ class DynamicShapeLoopTest : public testing::WithParamInterfaceget_concatenated_slices(b_mul, 0, 1, 1, -1, axis); } - ngraph::ResultVector results; + ov::ResultVector results; for (size_t i = 0; i < loop->get_output_size(); i++) { - auto res = std::make_shared(loop->output(i)); + auto res = std::make_shared(loop->output(i)); res->set_friendly_name("loop_output_" + std::to_string(i)); results.push_back(res); } - function = std::make_shared( + function = std::make_shared( results, params); function->set_friendly_name("outer_body_network"); @@ -194,18 +183,13 @@ class DynamicShapeLoopTest : public testing::WithParamInterface netPrecisions = { - InferenceEngine::Precision::FP32, - InferenceEngine::Precision::I32 -}; - -ov::AnyMap netConfigurations = { - {GPUConfigParams::KEY_GPU_ENABLE_LOOP_UNROLLING, PluginConfigParams::NO} +std::vector model_types = { + ov::element::f32, + ov::element::i32 }; static const std::vector> dynamic_loop_types_axis_0 { @@ -224,9 +208,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_DynamicShapeLoop_axis_0, DynamicShapeLoopTest, /* args_pack */ testing::ValuesIn(dynamic_loop_types_axis_0), /* start_value */ testing::Values(0), /* data_shape */ testing::ValuesIn(inputs_0), - /* data_prc */ testing::ValuesIn(netPrecisions), - /* device */ testing::Values(ov::test::utils::DEVICE_GPU), - /* configuration */ testing::Values(netConfigurations)), + /* model_type */ testing::ValuesIn(model_types), + /* device */ testing::Values(ov::test::utils::DEVICE_GPU)), DynamicShapeLoopTest::getTestCaseName); static const std::vector> dynamic_loop_types_1 { @@ -245,9 +228,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_DynamicShapeLoop_axis_1, DynamicShapeLoopTest, /* args_pack */ testing::ValuesIn(dynamic_loop_types_1), /* start_value */ testing::Values(0), /* data_shape */ testing::ValuesIn(inputs_1), - /* data_prc */ testing::ValuesIn(netPrecisions), - /* device */ testing::Values(ov::test::utils::DEVICE_GPU), - /* configuration */ testing::Values(netConfigurations)), + /* model_type */ testing::ValuesIn(model_types), + /* device */ testing::Values(ov::test::utils::DEVICE_GPU)), DynamicShapeLoopTest::getTestCaseName); static const std::vector> dynamic_loop_types_2 { @@ -266,9 +248,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_DynamicShapeLoop_axis_2, DynamicShapeLoopTest, /* args_pack */ testing::ValuesIn(dynamic_loop_types_2), /* start_value */ testing::Values(0), /* data_shape */ testing::ValuesIn(inputs_2), - /* data_prc */ testing::ValuesIn(netPrecisions), - /* device */ testing::Values(ov::test::utils::DEVICE_GPU), - /* configuration */ testing::Values(netConfigurations)), + /* model_type */ testing::ValuesIn(model_types), + /* device */ testing::Values(ov::test::utils::DEVICE_GPU)), DynamicShapeLoopTest::getTestCaseName); static const std::vector> dynamic_loop_types_no_auto_concat { @@ -287,9 +268,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_DynamicShapeLoop_no_auto_concat, DynamicShapeLoop /* args_pack */ testing::ValuesIn(dynamic_loop_types_no_auto_concat), /* start_value */ testing::Values(0), /* data_shape */ testing::ValuesIn(inputs_no_auto_concat), - /* data_prc */ testing::ValuesIn(netPrecisions), - /* device */ testing::Values(ov::test::utils::DEVICE_GPU), - /* configuration */ testing::Values(netConfigurations)), + /* model_type */ testing::ValuesIn(model_types), + /* device */ testing::Values(ov::test::utils::DEVICE_GPU)), DynamicShapeLoopTest::getTestCaseName); static const std::vector> dynamic_loop_types_dynamic_exit { @@ -310,9 +290,8 @@ INSTANTIATE_TEST_SUITE_P(smoke_DynamicShapeLoop_dynamic_exit, DynamicShapeLoopTe /* args_pack */ testing::ValuesIn(dynamic_loop_types_dynamic_exit), /* start_value */ testing::Values(0), /* data_shape */ testing::ValuesIn(inputs_dynamic_exit), - /* data_prc */ testing::ValuesIn(netPrecisions), - /* device */ testing::Values(ov::test::utils::DEVICE_GPU), - /* configuration */ testing::Values(netConfigurations)), + /* model_type */ testing::ValuesIn(model_types), + /* device */ testing::Values(ov::test::utils::DEVICE_GPU)), DynamicShapeLoopTest::getTestCaseName); -} // namespace GPULayerTestsDefinitions \ No newline at end of file +} // namespace \ No newline at end of file diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/shared_constant.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/shared_constant.cpp index 55e69e6d32ff4d..aed8fe5672987e 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/shared_constant.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/shared_constant.cpp @@ -2,47 +2,52 @@ // SPDX-License-Identifier: Apache-2.0 // -#include -#include +#include "shared_test_classes/base/ov_subgraph.hpp" +#include "openvino/core/coordinate_diff.hpp" +#include "openvino/core/strides.hpp" -namespace { - -using namespace ngraph; +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/convolution.hpp" +#include "openvino/op/group_conv.hpp" +#include "openvino/op/multiply.hpp" +namespace { // Validate scenario where a single Constant has multiple users (like one constant is used for Convolution, ConvolutionBackpropData, Multiply, etc.) -class SharedConstant : virtual public LayerTestsUtils::LayerTestsCommon { +class SharedConstant : virtual public ov::test::SubgraphBaseStaticTest { protected: void SetUp() override { targetDevice = ov::test::utils::DEVICE_GPU; - auto type = element::f32; - Shape constShape{4, 1, 3, 3}; - Shape convInputShape{1, 1, 5, 5}; - Shape convBackpropInputShape{1, 4, 5, 5}; - Shape constGroupConvBackpropShape{2, 2, 3, 3, 3}; - auto constant = opset8::Constant::create(type, constShape, {1}); - auto input1 = std::make_shared(type, convInputShape); - auto conv = std::make_shared(input1, constant, Strides{1, 1}, CoordinateDiff{0, 0}, CoordinateDiff{0, 0}, Strides{1, 1}); - auto input2 = std::make_shared(type, convBackpropInputShape); - auto convBprop = std::make_shared(input2, constant, Strides{1, 1}, - CoordinateDiff{0, 0}, CoordinateDiff{0, 0}, Strides{1, 1}); - auto input3 = std::make_shared(type, convBackpropInputShape); - auto constantGroupConv = opset8::Constant::create(type, constGroupConvBackpropShape, {1}); - auto groupConvBprop = std::make_shared(input3, constantGroupConv, Strides{1, 1}, - CoordinateDiff{0, 0}, CoordinateDiff{0, 0}, Strides{1, 1}); - auto input4 = std::make_shared(type, constShape); - auto mul = std::make_shared(input4, constant); - auto input5 = std::make_shared(type, constGroupConvBackpropShape); - auto mul2 = std::make_shared(input5, constantGroupConv); + auto type = ov::element::f32; + ov::Shape constShape{4, 1, 3, 3}; + ov::Shape convInputShape{1, 1, 5, 5}; + ov::Shape convBackpropInputShape{1, 4, 5, 5}; + ov::Shape constGroupConvBackpropShape{2, 2, 3, 3, 3}; + auto constant = ov::op::v0::Constant::create(type, constShape, {1}); + auto input1 = std::make_shared(type, convInputShape); + auto conv = std::make_shared( + input1, constant, ov::Strides{1, 1}, ov::CoordinateDiff{0, 0}, ov::CoordinateDiff{0, 0}, ov::Strides{1, 1}); + auto input2 = std::make_shared(type, convBackpropInputShape); + auto convBprop = std::make_shared(input2, constant, ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, ov::CoordinateDiff{0, 0}, ov::Strides{1, 1}); + auto input3 = std::make_shared(type, convBackpropInputShape); + auto constantGroupConv = ov::op::v0::Constant::create(type, constGroupConvBackpropShape, {1}); + auto groupConvBprop = std::make_shared(input3, constantGroupConv, ov::Strides{1, 1}, + ov::CoordinateDiff{0, 0}, ov::CoordinateDiff{0, 0}, ov::Strides{1, 1}); + auto input4 = std::make_shared(type, constShape); + auto mul = std::make_shared(input4, constant); + auto input5 = std::make_shared(type, constGroupConvBackpropShape); + auto mul2 = std::make_shared(input5, constantGroupConv); // explicitly set the output name, to avoid global conflict mul2->set_friendly_name("Multiply_0"); mul->set_friendly_name("Multiply_1"); - function = std::make_shared(NodeVector{convBprop, conv, groupConvBprop, mul2, mul}, - ParameterVector{input1, input2, input3, input4, input5}); + function = std::make_shared(ov::NodeVector{convBprop, conv, groupConvBprop, mul2, mul}, + ov::ParameterVector{input1, input2, input3, input4, input5}); } }; -TEST_F(SharedConstant, smoke_SharedConstant) { - Run(); +TEST_F(SharedConstant, Inference) { + run(); } - } // namespace diff --git a/src/plugins/intel_gpu/tests/functional/subgraph_tests/tensor_iterator.cpp b/src/plugins/intel_gpu/tests/functional/subgraph_tests/tensor_iterator.cpp index 628e26320f4087..dff05c614bb4fb 100644 --- a/src/plugins/intel_gpu/tests/functional/subgraph_tests/tensor_iterator.cpp +++ b/src/plugins/intel_gpu/tests/functional/subgraph_tests/tensor_iterator.cpp @@ -2,66 +2,55 @@ // SPDX-License-Identifier: Apache-2.0 // -#include -#include -#include -#include -#include "ov_models/utils/ov_helpers.hpp" -#include "shared_test_classes/base/layer_test_utils.hpp" -#include "ov_models/builders.hpp" #include "shared_test_classes/base/ov_subgraph.hpp" -#include "common_test_utils/test_constants.hpp" -#include "shared_test_classes/base/utils/ranges.hpp" -#include -#include "shared_test_classes/base/utils/compare_results.hpp" -#include "openvino/pass/constant_folding.hpp" -#include #include "shared_test_classes/base/utils/generate_inputs.hpp" -using namespace InferenceEngine; -using namespace ov::test; - -namespace GPULayerTestsDefinitions { +#include "openvino/op/parameter.hpp" +#include "openvino/op/constant.hpp" +#include "openvino/op/result.hpp" +#include "openvino/op/tensor_iterator.hpp" +namespace { +using ov::test::InputShape; /* * Generate TensorIterator with LSTMCell -* @param ngPrc precision of model +* @param model_type precision of model * @param initShape initial shape {N, L(sequence length), I} * @param N batch size * @param I input size * @param H hidden layer */ -static std::shared_ptr makeTIwithLSTMcell(ov::element::Type_t ngPRC, ov::PartialShape initShape, +static std::shared_ptr makeTIwithLSTMcell(ov::element::Type_t model_type, ov::PartialShape initShape, size_t N, size_t I, size_t H, size_t sequence_axis, - ngraph::op::RecurrentSequenceDirection seq_direction) { - auto SENT = std::make_shared(ngPRC, initShape); + ov::op::RecurrentSequenceDirection seq_direction) { + auto SENT = std::make_shared(model_type, initShape); SENT->set_friendly_name("SENT"); // initial_hidden_state - auto H_init = std::make_shared(ngPRC, ov::Shape{N, 1, H}); + auto H_init = std::make_shared(model_type, ov::Shape{N, 1, H}); H_init->set_friendly_name("H_init"); // initial_cell_state - auto C_init = std::make_shared(ngPRC, ov::Shape{N, 1, H}); + auto C_init = std::make_shared(model_type, ov::Shape{N, 1, H}); C_init->set_friendly_name("C_init"); - auto H_t = std::make_shared(ngPRC, ov::Shape{N, 1, H}); + auto H_t = std::make_shared(model_type, ov::Shape{N, 1, H}); H_t->set_friendly_name("H_t"); - auto C_t = std::make_shared(ngPRC, ov::Shape{N, 1, H}); + auto C_t = std::make_shared(model_type, ov::Shape{N, 1, H}); C_t->set_friendly_name("C_t"); // Body // input data - auto X = std::make_shared(ngPRC, ov::Shape{N, 1, I}); + auto X = std::make_shared(model_type, ov::Shape{N, 1, I}); X->set_friendly_name("X"); // the weights for matrix multiplication, gate order: fico std::vector dataW(4 * H * I, 0); - auto W_body = std::make_shared(ngPRC, ov::Shape{4 * H, I}, dataW); + auto W_body = std::make_shared(model_type, ov::Shape{4 * H, I}, dataW); W_body->set_friendly_name("W_body"); // the recurrence weights for matrix multiplication, gate order: fico std::vector dataR(4 * H * H, 0); - auto R_body = std::make_shared(ngPRC, ov::Shape{4 * H, H}, dataR); + auto R_body = std::make_shared(model_type, ov::Shape{4 * H, H}, dataR); R_body->set_friendly_name("R_body"); std::vector inShape = {N, H}; @@ -100,9 +89,9 @@ static std::shared_ptr makeTIwithLSTMcell(ov::element::Type_t ngPRC, tensor_iterator->set_merged_input(C_t, C_init, C_o); // Set PortMap - if (seq_direction == ngraph::op::RecurrentSequenceDirection::FORWARD) { + if (seq_direction == ov::op::RecurrentSequenceDirection::FORWARD) { tensor_iterator->set_sliced_input(X, SENT, 0, 1, 1, -1, sequence_axis); - } else if (seq_direction == ngraph::op::RecurrentSequenceDirection::REVERSE) { + } else if (seq_direction == ov::op::RecurrentSequenceDirection::REVERSE) { tensor_iterator->set_sliced_input(X, SENT, -1, -1, 1, 0, sequence_axis); } else { OPENVINO_THROW("Bidirectional case is not supported."); @@ -115,25 +104,25 @@ static std::shared_ptr makeTIwithLSTMcell(ov::element::Type_t ngPRC, auto results = ov::ResultVector{std::make_shared(out0), std::make_shared(out1)}; - auto fn_ptr = std::make_shared(results, ov::ParameterVector{SENT, H_init, C_init}); - fn_ptr->set_friendly_name("TIwithLSTMcell"); - return fn_ptr; + auto model = std::make_shared(results, ov::ParameterVector{SENT, H_init, C_init}); + model->set_friendly_name("TIwithLSTMcell"); + return model; } /* * Generate LSTMSequence -* @param ngPrc precision of model +* @param model_type precision of model * @param initShape initial shape {N, L(sequence length), I} * @param N batch size * @param I input size * @param H hidden layer */ -static std::shared_ptr makeLSTMSequence(ov::element::Type_t ngPRC, ov::PartialShape initShape, +static std::shared_ptr makeLSTMSequence(ov::element::Type_t model_type, ov::PartialShape initShape, size_t N, size_t I, size_t H, size_t sequence_axis, - ngraph::op::RecurrentSequenceDirection seq_direction) { - auto X = std::make_shared(ngPRC, initShape); - auto Y = std::make_shared(ngPRC, ov::Shape{N, 1, H}); - auto Z = std::make_shared(ngPRC, ov::Shape{N, 1, H}); + ov::op::RecurrentSequenceDirection seq_direction) { + auto X = std::make_shared(model_type, initShape); + auto Y = std::make_shared(model_type, ov::Shape{N, 1, H}); + auto Z = std::make_shared(model_type, ov::Shape{N, 1, H}); auto shape_of = std::make_shared(X); auto indices = ov::op::v0::Constant::create(ov::element::i32, {1}, {1}); auto axis = ov::op::v0::Constant::create(ov::element::i32, {}, {0}); @@ -142,9 +131,9 @@ static std::shared_ptr makeLSTMSequence(ov::element::Type_t ngPRC, ov auto w_val = std::vector(4 * H * I, 0); auto r_val = std::vector(4 * H * H, 0); auto b_val = std::vector(4 * H, 0); - auto W = ov::op::v0::Constant::create(ngPRC, ov::Shape{N, 4 * H, I}, w_val); - auto R = ov::op::v0::Constant::create(ngPRC, ov::Shape{N, 4 * H, H}, r_val); - auto B = ov::op::v0::Constant::create(ngPRC, ov::Shape{N, 4 * H}, b_val); + auto W = ov::op::v0::Constant::create(model_type, ov::Shape{N, 4 * H, I}, w_val); + auto R = ov::op::v0::Constant::create(model_type, ov::Shape{N, 4 * H, H}, r_val); + auto B = ov::op::v0::Constant::create(model_type, ov::Shape{N, 4 * H}, b_val); auto rnn_sequence = std::make_shared(X, Y, @@ -176,33 +165,29 @@ using DynamicTensorIteratorParams = typename std::tuple< LSTMType, // LSTM type (LSTMCell, LSTMSequence) InputShape, // input shapes (N[batch], L[seq_length], I[input_size]) int32_t, // hidden size - ngraph::op::RecurrentSequenceDirection, // sequence direction + ov::op::RecurrentSequenceDirection, // sequence direction std::string, // device name - InferenceEngine::Precision, // precision - ov::AnyMap // configuration - >; + ov::element::Type>; // type /** * Test case with Dynamic SHAPE version of loop operation. * Total iteration count is dynamic. */ class DynamicTensorIteratorTest : public testing::WithParamInterface, - virtual public SubgraphBaseTest { + virtual public ov::test::SubgraphBaseTest { public: static std::string getTestCaseName(const testing::TestParamInfo &obj) { LSTMType type; InputShape data_shapes; int32_t hidden_size; - ngraph::op::RecurrentSequenceDirection seq_direction; + ov::op::RecurrentSequenceDirection seq_direction; std::string target_device; - InferenceEngine::Precision data_precision; - ov::Any configuration; + ov::element::Type model_type; std::tie(type, data_shapes, hidden_size, seq_direction, target_device, - data_precision, - configuration) = obj.param; + model_type) = obj.param; std::ostringstream result; result << "TestType=" << (type == LSTMType::LSTMCell? "LSTMCell" : "LSTMSequence") << "_"; result << "IS=("; @@ -211,15 +196,15 @@ class DynamicTensorIteratorTest : public testing::WithParamInterface(init_shape[0].get_length()); input_size = static_cast(init_shape[init_shape.size()-1].get_length()); if (type == LSTMType::LSTMCell) - function = makeTIwithLSTMcell(ngPrc, init_shape, batch_size, input_size, hidden_size, sequence_axis, seq_direction); + function = makeTIwithLSTMcell(model_type, init_shape, batch_size, input_size, hidden_size, sequence_axis, seq_direction); else - function = makeLSTMSequence(ngPrc, init_shape, batch_size, input_size, hidden_size, sequence_axis, seq_direction); + function = makeLSTMSequence(model_type, init_shape, batch_size, input_size, hidden_size, sequence_axis, seq_direction); } - void generate_inputs(const std::vector& targetInputStaticShapes) override { + void generate_inputs(const std::vector& targetInputStaticShapes) override { inputs.clear(); ov::Shape default_shape{batch_size, 1, hidden_size}; auto inputMap = ov::test::utils::getInputMap(); @@ -283,8 +260,7 @@ class DynamicTensorIteratorTest : public testing::WithParamInterface hidden_sizes = { 128 }; -ov::AnyMap net_configuration = { - {GPUConfigParams::KEY_GPU_ENABLE_LOOP_UNROLLING, PluginConfigParams::NO} -}; - -std::vector net_precision = { - InferenceEngine::Precision::FP32, +std::vector model_types = { + ov::element::f32, }; -std::vector reccurent_sequence_direction = { - ngraph::op::RecurrentSequenceDirection::FORWARD, - ngraph::op::RecurrentSequenceDirection::REVERSE, +std::vector reccurent_sequence_direction = { + ov::op::RecurrentSequenceDirection::FORWARD, + ov::op::RecurrentSequenceDirection::REVERSE, }; INSTANTIATE_TEST_SUITE_P(smoke_DynamicTensorIterator_LSTMCell, DynamicTensorIteratorTest, @@ -320,8 +292,7 @@ INSTANTIATE_TEST_SUITE_P(smoke_DynamicTensorIterator_LSTMCell, DynamicTensorIter /* hidden_size */ testing::ValuesIn(hidden_sizes), /* direction */ testing::ValuesIn(reccurent_sequence_direction), /* device */ testing::Values(ov::test::utils::DEVICE_GPU), - /* data_prc */ testing::ValuesIn(net_precision), - /* configuration */ testing::Values(net_configuration)), + /* model_type */ testing::ValuesIn(model_types)), DynamicTensorIteratorTest::getTestCaseName); INSTANTIATE_TEST_SUITE_P(smoke_DynamicTensorIterator_LSTMSequence, DynamicTensorIteratorTest, @@ -331,7 +302,6 @@ INSTANTIATE_TEST_SUITE_P(smoke_DynamicTensorIterator_LSTMSequence, DynamicTensor /* hidden_size */ testing::ValuesIn(hidden_sizes), /* direction */ testing::ValuesIn(reccurent_sequence_direction), /* device */ testing::Values(ov::test::utils::DEVICE_GPU), - /* data_prc */ testing::ValuesIn(net_precision), - /* configuration */ testing::Values(net_configuration)), + /* model_type */ testing::ValuesIn(model_types)), DynamicTensorIteratorTest::getTestCaseName); -} // namespace GPULayerTestsDefinitions +} // namespace