diff --git a/src/inference/dev_api/openvino/runtime/icompiled_model.hpp b/src/inference/dev_api/openvino/runtime/icompiled_model.hpp index 0e77072f787..50cc6f0ac79 100644 --- a/src/inference/dev_api/openvino/runtime/icompiled_model.hpp +++ b/src/inference/dev_api/openvino/runtime/icompiled_model.hpp @@ -183,6 +183,8 @@ protected: const std::shared_ptr& get_plugin() const; const std::shared_ptr get_task_executor() const; const std::shared_ptr get_callback_executor() const; + void set_task_executor(const std::shared_ptr task_executor); + void set_callback_executor(const std::shared_ptr callback_executor); }; } // namespace ov diff --git a/src/inference/src/dev/icompiled_model.cpp b/src/inference/src/dev/icompiled_model.cpp index 08d70581448..81b55f27f99 100644 --- a/src/inference/src/dev/icompiled_model.cpp +++ b/src/inference/src/dev/icompiled_model.cpp @@ -102,6 +102,14 @@ const std::shared_ptr ov::ICompiledModel::get_call return m_callback_executor; } +void ov::ICompiledModel::set_task_executor(const std::shared_ptr task_executor) { + m_task_executor = task_executor; +} + +void ov::ICompiledModel::set_callback_executor(const std::shared_ptr callback_executor) { + m_callback_executor = callback_executor; +} + std::shared_ptr ov::ICompiledModel::get_context() const { if (auto wrapper = dynamic_cast(this)) { return ov::legacy_convert::convert_remote_context(wrapper->get_executable_network()->GetContext()); diff --git a/src/inference/src/dev/preprocessing/preprocessing.cpp b/src/inference/src/dev/preprocessing/preprocessing.cpp index 515b1e4b720..7d062221ee9 100644 --- a/src/inference/src/dev/preprocessing/preprocessing.cpp +++ b/src/inference/src/dev/preprocessing/preprocessing.cpp @@ -33,9 +33,12 @@ bool ov::pass::AddPreprocessing::run_on_model(const std::shared_ptr& preproc.input(i).tensor().set_element_type( InferenceEngine::details::convertPrecision(input_info->getPrecision())); - std::stringstream stream; - stream << input_info->getLayout(); - preproc.input(i).tensor().set_layout(ov::Layout{stream.str()}); + if (input_info->getLayout() != InferenceEngine::Layout::BLOCKED && + input_info->getLayout() != InferenceEngine::Layout::SCALAR) { + std::stringstream stream; + stream << input_info->getLayout(); + preproc.input(i).tensor().set_layout(ov::Layout{stream.str()}); + } // Resize switch (legacy_preproc.getResizeAlgorithm()) { diff --git a/src/inference/tests/unit/add_preprocessing.cpp b/src/inference/tests/unit/add_preprocessing.cpp new file mode 100644 index 00000000000..5f3337cd609 --- /dev/null +++ b/src/inference/tests/unit/add_preprocessing.cpp @@ -0,0 +1,58 @@ +// Copyright (C) 2018-2023 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include +#include +#include +#include + +#include "common_test_utils/ngraph_test_utils.hpp" +#include "common_test_utils/test_common.hpp" +#include "dev/preprocessing/preprocessing.hpp" +#include "openvino/runtime/common.hpp" + +using namespace testing; + +using AddPreprocessingTests = ::testing::Test; + +TEST_F(AddPreprocessingTests, AddPreprocessingNCDHW) { + auto shape = ov::Shape{3, 2, 3, 1, 2}; + auto input = std::make_shared(ov::element::f32, shape); + auto constant = ov::op::v0::Constant::create(ov::element::f32, shape, {1}); + auto add = std::make_shared(input, constant); + + auto model = std::make_shared(ov::NodeVector{add}, ov::ParameterVector{input}); + + ov::pass::Manager manager; + manager.register_pass(); + ASSERT_NO_THROW(manager.run_passes(model)); +} + +TEST_F(AddPreprocessingTests, AddPreprocessingBlocked) { + auto shape = ov::Shape{3, 2, 3, 1, 2, 3}; + auto input = std::make_shared(ov::element::f32, shape); + auto constant = ov::op::v0::Constant::create(ov::element::f32, shape, {1}); + auto add = std::make_shared(input, constant); + + auto model = std::make_shared(ov::NodeVector{add}, ov::ParameterVector{input}); + + ov::pass::Manager manager; + manager.register_pass(); + ASSERT_NO_THROW(manager.run_passes(model)); +} + +TEST_F(AddPreprocessingTests, AddPreprocessingScalar) { + auto shape = ov::Shape{}; + auto input = std::make_shared(ov::element::f32, shape); + auto constant = ov::op::v0::Constant::create(ov::element::f32, shape, {1}); + auto add = std::make_shared(input, constant); + + auto model = std::make_shared(ov::NodeVector{add}, ov::ParameterVector{input}); + + ov::pass::Manager manager; + manager.register_pass(); + ASSERT_NO_THROW(manager.run_passes(model)); +}