diff --git a/docs/template_plugin/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp b/docs/template_plugin/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp index 76ece4a8529..d15cbe97ed3 100644 --- a/docs/template_plugin/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp +++ b/docs/template_plugin/tests/functional/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp @@ -19,4 +19,52 @@ INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestIOTensorTest, ::testing::ValuesIn(configs)), OVInferRequestIOTensorTest::getTestCaseName); +std::vector prcs = { + ov::element::boolean, + ov::element::bf16, + ov::element::f16, + ov::element::f32, + ov::element::f64, + ov::element::i4, + ov::element::i8, + ov::element::i16, + ov::element::i32, + ov::element::i64, + ov::element::u1, + ov::element::u4, + ov::element::u8, + ov::element::u16, + ov::element::u32, + ov::element::u64, +}; + +const std::vector> emptyConfigs = {{}}; + +const std::vector> HeteroConfigs = { + {{"TARGET_FALLBACK", CommonTestUtils::DEVICE_TEMPLATE}}}; + +const std::vector> Multiconfigs = { + {{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_TEMPLATE}} +}; + +INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestCheckTensorPrecision, + ::testing::Combine( + ::testing::ValuesIn(prcs), + ::testing::Values(CommonTestUtils::DEVICE_TEMPLATE), + ::testing::ValuesIn(emptyConfigs)), + OVInferRequestCheckTensorPrecision::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_Hetero_BehaviorTests, OVInferRequestCheckTensorPrecision, + ::testing::Combine( + ::testing::ValuesIn(prcs), + ::testing::Values(CommonTestUtils::DEVICE_HETERO), + ::testing::ValuesIn(HeteroConfigs)), + OVInferRequestCheckTensorPrecision::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestCheckTensorPrecision, + ::testing::Combine( + ::testing::ValuesIn(prcs), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(Multiconfigs)), + OVInferRequestCheckTensorPrecision::getTestCaseName); } // namespace diff --git a/src/tests/functional/plugin/cpu/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp b/src/tests/functional/plugin/cpu/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp index be79d7a6c42..0d53baec1f6 100644 --- a/src/tests/functional/plugin/cpu/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp +++ b/src/tests/functional/plugin/cpu/shared_tests_instances/behavior/ov_infer_request/io_tensor.cpp @@ -23,6 +23,8 @@ const std::vector> Autoconfigs = { {{ MULTI_CONFIG_KEY(DEVICE_PRIORITIES) , CommonTestUtils::DEVICE_CPU}} }; +const std::vector> emptyConfigs = {{}}; + INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestIOTensorTest, ::testing::Combine( ::testing::Values(CommonTestUtils::DEVICE_CPU), @@ -81,4 +83,24 @@ INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestIOTensorSetPrec ::testing::ValuesIn(Autoconfigs)), OVInferRequestIOTensorSetPrecisionTest::getTestCaseName); +INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, OVInferRequestCheckTensorPrecision, + ::testing::Combine( + ::testing::ValuesIn(prcs), + ::testing::Values(CommonTestUtils::DEVICE_CPU), + ::testing::ValuesIn(emptyConfigs)), + OVInferRequestCheckTensorPrecision::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, OVInferRequestCheckTensorPrecision, + ::testing::Combine( + ::testing::ValuesIn(prcs), + ::testing::Values(CommonTestUtils::DEVICE_MULTI), + ::testing::ValuesIn(Multiconfigs)), + OVInferRequestCheckTensorPrecision::getTestCaseName); + +INSTANTIATE_TEST_SUITE_P(smoke_Auto_BehaviorTests, OVInferRequestCheckTensorPrecision, + ::testing::Combine( + ::testing::ValuesIn(prcs), + ::testing::Values(CommonTestUtils::DEVICE_AUTO), + ::testing::ValuesIn(Autoconfigs)), + OVInferRequestCheckTensorPrecision::getTestCaseName); } // namespace diff --git a/src/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp b/src/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp index f61db08e130..d1040016187 100644 --- a/src/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp +++ b/src/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp @@ -172,6 +172,8 @@ std::vector disabledTestPatterns() { R"(smoke_ConversionLayerTest/ConversionLayerTest.CompareWithRefs.*UNSPECIFIED.*)", // Issue: R"(.*smoke_VariadicSplit4D_CPU_zero_dims.*)", + // New API tensor tests + R"(.*OVInferRequestCheckTensorPrecision.*)", // Issue: 75022 R"(.*OVExecutableNetworkBaseTest.*LoadNetworkToDefaultDeviceNoThrow.*)", R"(.*IEClassBasicTest.*LoadNetworkToDefaultDeviceNoThrow.*)", diff --git a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/io_tensor.hpp b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/io_tensor.hpp index 87b0a9e02bd..6a5f4c43162 100644 --- a/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/io_tensor.hpp +++ b/src/tests/functional/plugin/shared/include/behavior/ov_infer_request/io_tensor.hpp @@ -41,6 +41,24 @@ struct OVInferRequestIOTensorSetPrecisionTest : public testing::WithParamInterfa runtime::ConfigMap config; element::Type element_type; }; + +using OVInferRequestCheckTensorPrecisionParams = OVInferRequestSetPrecisionParams; + +struct OVInferRequestCheckTensorPrecision : public testing::WithParamInterface, + public CommonTestUtils::TestsCommon { + static std::string getTestCaseName(const testing::TestParamInfo& obj); + void SetUp() override; + void TearDown() override; + + std::shared_ptr core = utils::PluginCache::get().core(); + std::shared_ptr model; + runtime::CompiledModel compModel; + runtime::InferRequest req; + runtime::ConfigMap config; + std::string target_device; + element::Type element_type; +}; + } // namespace behavior } // namespace test } // namespace ov diff --git a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/io_tensor.cpp b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/io_tensor.cpp index b078389aa8a..bb4f1a7d454 100644 --- a/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/io_tensor.cpp +++ b/src/tests/functional/plugin/shared/src/behavior/ov_infer_request/io_tensor.cpp @@ -8,6 +8,9 @@ #include "shared_test_classes/subgraph/basic_lstm.hpp" #include "behavior/ov_infer_request/io_tensor.hpp" #include "functional_test_utils/ov_tensor_utils.hpp" +#include "openvino/op/parameter.hpp" +#include "openvino/op/concat.hpp" +#include "openvino/op/result.hpp" namespace ov { namespace test { @@ -228,6 +231,50 @@ TEST_P(OVInferRequestIOTensorSetPrecisionTest, CanSetOutBlobWithDifferentPrecisi } } +std::string OVInferRequestCheckTensorPrecision::getTestCaseName(const testing::TestParamInfo& obj) { + element::Type type; + std::string targetDevice; + std::map configuration; + std::tie(type, targetDevice, configuration) = obj.param; + std::ostringstream result; + result << "type=" << type << "_"; + result << "targetDevice=" << targetDevice << "_"; + if (!configuration.empty()) { + using namespace CommonTestUtils; + for (auto &configItem : configuration) { + result << "configItem=" << configItem.first << "_" << configItem.second << "_"; + } + } + return result.str(); +} + +void OVInferRequestCheckTensorPrecision::SetUp() { + SKIP_IF_CURRENT_TEST_IS_DISABLED() + std::tie(element_type, target_device, config) = this->GetParam(); + { + auto parameter1 = std::make_shared(element_type, ov::PartialShape{1, 3, 2, 2}); + auto parameter2 = std::make_shared(element_type, ov::PartialShape{1, 3, 2, 2}); + auto concat = std::make_shared(ov::OutputVector{parameter1, parameter2}, 1); + auto result = std::make_shared(concat); + model = std::make_shared(ov::ResultVector{result}, ov::ParameterVector{parameter1, parameter2}); + } + compModel = core->compile_model(model, target_device, config); + req = compModel.create_infer_request(); +} + +void OVInferRequestCheckTensorPrecision::TearDown() { + compModel = {}; + req = {}; +} + +TEST_P(OVInferRequestCheckTensorPrecision, CheckInputsOutputs) { + EXPECT_EQ(element_type, compModel.input(0).get_element_type()); + EXPECT_EQ(element_type, compModel.input(1).get_element_type()); + EXPECT_EQ(element_type, compModel.output().get_element_type()); + EXPECT_EQ(element_type, req.get_input_tensor(0).get_element_type()); + EXPECT_EQ(element_type, req.get_input_tensor(1).get_element_type()); + EXPECT_EQ(element_type, req.get_output_tensor().get_element_type()); +} } // namespace behavior } // namespace test } // namespace ov