Api2.0 fixes (#17475)
* Fix exception for BLOCKED layout * Add set_task_executor/set_callback_executor methods for compiled model * Fix inccorrect version * Add SCALAR * Clear extension in FrontEnd destructor
This commit is contained in:
@@ -183,6 +183,8 @@ protected:
|
||||
const std::shared_ptr<const ov::IPlugin>& get_plugin() const;
|
||||
const std::shared_ptr<ov::threading::ITaskExecutor> get_task_executor() const;
|
||||
const std::shared_ptr<ov::threading::ITaskExecutor> get_callback_executor() const;
|
||||
void set_task_executor(const std::shared_ptr<ov::threading::ITaskExecutor> task_executor);
|
||||
void set_callback_executor(const std::shared_ptr<ov::threading::ITaskExecutor> callback_executor);
|
||||
};
|
||||
|
||||
} // namespace ov
|
||||
|
||||
@@ -102,6 +102,14 @@ const std::shared_ptr<ov::threading::ITaskExecutor> ov::ICompiledModel::get_call
|
||||
return m_callback_executor;
|
||||
}
|
||||
|
||||
void ov::ICompiledModel::set_task_executor(const std::shared_ptr<ov::threading::ITaskExecutor> task_executor) {
|
||||
m_task_executor = task_executor;
|
||||
}
|
||||
|
||||
void ov::ICompiledModel::set_callback_executor(const std::shared_ptr<ov::threading::ITaskExecutor> callback_executor) {
|
||||
m_callback_executor = callback_executor;
|
||||
}
|
||||
|
||||
std::shared_ptr<ov::IRemoteContext> ov::ICompiledModel::get_context() const {
|
||||
if (auto wrapper = dynamic_cast<const InferenceEngine::ICompiledModelWrapper*>(this)) {
|
||||
return ov::legacy_convert::convert_remote_context(wrapper->get_executable_network()->GetContext());
|
||||
|
||||
@@ -33,9 +33,12 @@ bool ov::pass::AddPreprocessing::run_on_model(const std::shared_ptr<ov::Model>&
|
||||
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()) {
|
||||
|
||||
58
src/inference/tests/unit/add_preprocessing.cpp
Normal file
58
src/inference/tests/unit/add_preprocessing.cpp
Normal file
@@ -0,0 +1,58 @@
|
||||
// Copyright (C) 2018-2023 Intel Corporation
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#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::op::v0::Parameter>(ov::element::f32, shape);
|
||||
auto constant = ov::op::v0::Constant::create(ov::element::f32, shape, {1});
|
||||
auto add = std::make_shared<ov::op::v1::Add>(input, constant);
|
||||
|
||||
auto model = std::make_shared<ov::Model>(ov::NodeVector{add}, ov::ParameterVector{input});
|
||||
|
||||
ov::pass::Manager manager;
|
||||
manager.register_pass<ov::pass::AddPreprocessing>();
|
||||
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::op::v0::Parameter>(ov::element::f32, shape);
|
||||
auto constant = ov::op::v0::Constant::create(ov::element::f32, shape, {1});
|
||||
auto add = std::make_shared<ov::op::v1::Add>(input, constant);
|
||||
|
||||
auto model = std::make_shared<ov::Model>(ov::NodeVector{add}, ov::ParameterVector{input});
|
||||
|
||||
ov::pass::Manager manager;
|
||||
manager.register_pass<ov::pass::AddPreprocessing>();
|
||||
ASSERT_NO_THROW(manager.run_passes(model));
|
||||
}
|
||||
|
||||
TEST_F(AddPreprocessingTests, AddPreprocessingScalar) {
|
||||
auto shape = ov::Shape{};
|
||||
auto input = std::make_shared<ov::op::v0::Parameter>(ov::element::f32, shape);
|
||||
auto constant = ov::op::v0::Constant::create(ov::element::f32, shape, {1});
|
||||
auto add = std::make_shared<ov::op::v1::Add>(input, constant);
|
||||
|
||||
auto model = std::make_shared<ov::Model>(ov::NodeVector{add}, ov::ParameterVector{input});
|
||||
|
||||
ov::pass::Manager manager;
|
||||
manager.register_pass<ov::pass::AddPreprocessing>();
|
||||
ASSERT_NO_THROW(manager.run_passes(model));
|
||||
}
|
||||
Reference in New Issue
Block a user