OpenVINO™ is an open source toolkit for optimizing and deploying AI inference
C++ aicomputer-visiondeep-learningdeploy-aidiffusion-modelsgenerative-aigood-first-issueinferencellm-inferencenatural-language-processingnlpopenvinooptimize-aiperformance-boostrecommendation-systemspeech-recognitionstable-diffusiontransformersyolo
Add support for shape and data_shape parameters (#27314)
Artemy Skrebkov272843d81ad2
diff --git a/src/plugins/intel_npu/tools/common/include/tools_helpers.hpp b/src/plugins/intel_npu/tools/common/include/tools_helpers.hppnew file mode 100644index 00000000000..e9743594ad8--- /dev/null+++ b/src/plugins/intel_npu/tools/common/include/tools_helpers.hpp@@ -0,0 +1,181 @@+// Copyright (C) 2024 Intel Corporation+// SPDX-License-Identifier: Apache-2.0+//++#include <algorithm>+#include <cstdlib>+#include <map>+#include <string>+#include <vector>++#include "openvino/openvino.hpp"++struct InputInfo {+ ov::element::Type type;+ ov::PartialShape partialShape;+ ov::Shape dataShape;+ ov::Layout layout;+};+using InputsInfo = std::map<std::string, InputInfo>;++std::string parameterNameToTensorName(std::string& name, std::vector<ov::Output<ov::Node>>& inputs_info) {+ auto count_name = std::any_of(inputs_info.begin(), inputs_info.end(), [name](ov::Output<ov::Node>& port) {+ return port.get_names().count(name) > 0;+ });+ if (count_name) {+ return name;+ } else {+ auto inputInfo = std::find_if(inputs_info.begin(), inputs_info.end(), [name](ov::Output<ov::Node>& port) {+ return name == port.get_node()->get_friendly_name();+ });+ if (inputInfo == inputs_info.end()) {+ throw std::runtime_error("Provided I/O name \"" + name ++ "\" is not found neither in tensor names nor in nodes names.");+ }+ return inputInfo->get_any_name();+ }+}++std::map<std::string, std::vector<std::string>> parseInputParameters(std::string& parameter_string,+ std::vector<ov::Output<ov::Node>>& input_info) {+ // Parse parameter string like "input0[value0],input1[value1]" or "[value]" (applied to all+ // inputs)+ std::map<std::string, std::vector<std::string>> return_value;+ std::string search_string = parameter_string;+ auto start_pos = search_string.find_first_of('[');+ auto input_name = search_string.substr(0, start_pos);+ while (start_pos != std::string::npos) {+ auto end_pos = search_string.find_first_of(']');+ if (end_pos == std::string::npos)+ break;+ input_name = search_string.substr(0, start_pos);+ auto input_value = search_string.substr(start_pos + 1, end_pos - start_pos - 1);+ if (!input_name.empty()) {+ return_value[parameterNameToTensorName(input_name, input_info)].push_back(input_value);+ } else {+ for (auto& item : input_info) {+ return_value[item.get_any_name()].push_back(input_value);+ }+ }+ search_string = search_string.substr(end_pos + 1);+ if (search_string.empty() || (search_string.front() != ',' && search_string.front() != '['))+ break;+ if (search_string.front() == ',') {+ if (search_string.length() > 1)+ search_string = search_string.substr(1);+ else+ throw std::logic_error("Can't parse input parameter string, there is nothing after the comma " ++ parameter_string);+ }+ start_pos = search_string.find_first_of('[');+ }+ if (!search_string.empty())+ throw std::logic_error("Can't parse input parameter string: " + parameter_string);+ return return_value;+}++void boundDynamicShape(std::shared_ptr<ov::Model>& model) {+ for (auto&& item : model->get_parameters()) {+ auto shape = item->get_partial_shape();+ if (shape.is_static()) {+ continue;+ }+ auto rank = shape.rank();+ if (rank.is_dynamic()) {+ throw std::logic_error("Rank \"" + rank.to_string() + "\" of the shape \"" + shape.to_string() ++ "\" is dynamic which is not supported by NPU");+ }+ auto layout = item->get_layout();+ if (!ov::layout::has_batch(layout)) {+ item->set_layout(ov::Layout(layout.to_string().insert(1, "N,")));+ layout = item->get_layout();+ }+ if (shape[ov::layout::batch_idx(layout)].is_dynamic()) {+ std::cout << "WARNING: Shape \"" + shape.to_string() + "\"" ++ " has dynamic batch size which is not supported by NPU\n"+ " Setting batch to 1 forcibly"+ << std::endl;+ ov::set_batch(model, 1);+ }+ shape = item->get_partial_shape();+ if (shape.is_dynamic()) {+ throw std::logic_error("Model's input shape \"" + shape.to_string() + "\"" ++ " is dynamic which is not supported by NPU");+ }+ }+}++void setModelBatch(std::shared_ptr<ov::Model>& model, uint32_t batch = 1) {+ if (batch == 1) {+ return;+ }+ for (auto&& item : model->get_parameters()) {+ auto shape = item->get_partial_shape();+ auto rank = shape.rank();+ if (rank.is_dynamic()) {+ throw std::logic_error("Rank \"" + rank.to_string() + "\" of the shape \"" + shape.to_string() ++ "\" is dynamic which is not supported by NPU");+ }+ auto layout = item->get_layout();+ if (!ov::layout::has_batch(layout)) {+ item->set_layout(ov::Layout(layout.to_string().insert(1, "N,")));+ layout = item->get_layout();+ }+ if (shape[ov::layout::batch_idx(layout)].is_dynamic()) {+ throw std::logic_error("ERROR: Shape \"" + shape.to_string() + "\"" ++ " has dynamic batch size which is not supported by NPU\n"+ "Cannot apply fixed batch: " ++ std::to_string(batch) ++ ". Please remove the parameter from config: \"override_model_batch_size\"");+ }+ ov::set_batch(model, batch);+ }+}++void reshape(ov::OutputVector inputsInfo, InputsInfo& infoMap, std::shared_ptr<ov::Model>& model,+ std::string& shapeString, int overrideModelBatchSize, std::string_view device) {+ std::vector<InputsInfo> infoMaps;+ if (!shapeString.empty()) {+ std::map<std::string, std::vector<std::string>> shapesMap = parseInputParameters(shapeString, inputsInfo);++ if (overrideModelBatchSize != 1) {+ throw std::logic_error(R"(Incompatible params: "shape" and "override_model_batch_size")");+ }+ for (auto& item : inputsInfo) {+ InputInfo info;+ auto name = item.get_any_name();++ if (!shapesMap.empty()) {+ if (shapesMap.count(name)) {+ if (shapesMap.at(name).size() > 1) {+ // Example: -shape input1[..][..]+ throw std::logic_error("shape command line parameter doesn't support multiple "+ "shapes for one input.");+ }+ info.partialShape = shapesMap.at(name)[0];+ } else {+ info.partialShape = item.get_partial_shape();+ }+ }+ infoMap[name] = std::move(info);+ infoMaps.push_back(infoMap);+ }+ std::map<std::string, ov::PartialShape> newShapes;+ for (auto& item : infoMaps) {+ for (auto& map : item) {+ if (!newShapes.count(map.first)) {+ newShapes[map.first] = map.second.partialShape;+ }+ }+ }+ model->reshape(newShapes);+ } else {+ if (device.find("NPU") != std::string::npos ||+ // FIXME: SIT on CPU also requires to bound dynamic shapes+ device.find("CPU") != std::string::npos || device.find("TEMPLATE") != std::string::npos) {+ boundDynamicShape(model);+ }++ setModelBatch(model, overrideModelBatchSize);+ }+}diff --git a/src/plugins/intel_npu/tools/compile_tool/CMakeLists.txt b/src/plugins/intel_npu/tools/compile_tool/CMakeLists.txtindex 66ff751b9f5..fc485030359 100644--- a/src/plugins/intel_npu/tools/compile_tool/CMakeLists.txt+++ b/src/plugins/intel_npu/tools/compile_tool/CMakeLists.txt@@ -24,7 +24,8 @@ ov_add_target(ADD_CPPLINTPRIVATEopenvino::runtimegflags- Threads::Threads)+ Threads::Threads+ npu_tools_utils)set_target_properties(${TARGET_NAME} PROPERTIESFOLDER ${CMAKE_CURRENT_SOURCE_DIR}diff --git a/src/plugins/intel_npu/tools/compile_tool/main.cpp b/src/plugins/intel_npu/tools/compile_tool/main.cppindex 471fd55bb82..7a088d1afc6 100644--- a/src/plugins/intel_npu/tools/compile_tool/main.cpp+++ b/src/plugins/intel_npu/tools/compile_tool/main.cpp@@ -14,11 +14,12 @@#include <gflags/gflags.h>-#include "openvino/core/partial_shape.hpp"-#include "openvino/openvino.hpp"+#include <openvino/core/partial_shape.hpp>+#include <openvino/openvino.hpp>#include "tools_helpers.hpp"+static constexpr char help_message[] = "Optional. Print the usage message.";static constexpr char model_message[] = "Required. Path to the XML model.";@@ -168,64 +169,6 @@ bool isFP32(const ov::element::Type& type) {return type == ov::element::f32;}-void boundDynamicShape(std::shared_ptr<ov::Model>& model) {- for (auto&& item : model->get_parameters()) {- auto shape = item->get_partial_shape();- if (shape.is_static()) {- continue;- }- auto rank = shape.rank();- if (rank.is_dynamic()) {- throw std::logic_error("Rank \"" + rank.to_string() + "\" of the shape \"" + shape.to_string() +- "\" is dynamic which is not supported by NPU");- }- auto layout = item->get_layout();- if (!ov::layout::has_batch(layout)) {- item->set_layout(ov::Layout(layout.to_string().insert(1, "N,")));- layout = item->get_layout();- }- if (shape[ov::layout::batch_idx(layout)].is_dynamic()) {- std::cout << "WARNING: Shape \"" + shape.to_string() + "\"" +- " has dynamic batch size which is not supported by NPU\n"- " Setting batch to 1 forcibly"- << std::endl;- ov::set_batch(model, 1);- }- shape = item->get_partial_shape();- if (shape.is_dynamic()) {- throw std::logic_error("Model's input shape \"" + shape.to_string() + "\"" +- " is dynamic which is not supported by NPU");- }- }-}--void setModelBatch(std::shared_ptr<ov::Model>& model, uint32_t batch = 1) {- if (batch == 1) {- return;- }- for (auto&& item : model->get_parameters()) {- auto shape = item->get_partial_shape();- auto rank = shape.rank();- if (rank.is_dynamic()) {- throw std::logic_error("Rank \"" + rank.to_string() + "\" of the shape \"" + shape.to_string() +- "\" is dynamic which is not supported by NPU");- }- auto layout = item->get_layout();- if (!ov::layout::has_batch(layout)) {- item->set_layout(ov::Layout(layout.to_string().insert(1, "N,")));- layout = item->get_layout();- }- if (shape[ov::layout::batch_idx(layout)].is_dynamic()) {- throw std::logic_error("ERROR: Shape \"" + shape.to_string() + "\"" +- " has dynamic batch size which is not supported by NPU\n"- "Cannot apply fixed batch: " +- std::to_string(batch) +- ". Please remove the parameter from config: \"override_model_batch_size\"");- }- ov::set_batch(model, batch);- }-}-void configurePrePostProcessing(std::shared_ptr<ov::Model>& model, const std::string& ip, const std::string& op,const std::string& iop, const std::string& il, const std::string& ol,const std::string& iol, const std::string& iml, const std::string& oml,@@ -475,50 +418,6 @@ std::string getFileNameFromPath(const std::string& path,using TimeDiff = std::chrono::milliseconds;-void reshape(ov::OutputVector inputs_info, InputsInfo& info_map, std::shared_ptr<ov::Model>& model) {- std::vector<InputsInfo> info_maps;- if (!FLAGS_shape.empty()) {- std::map<std::string, std::vector<std::string>> shapes_map = parseInputParameters(FLAGS_shape, inputs_info);-- if (FLAGS_override_model_batch_size != 1) {- throw std::logic_error("Incompatible params: \"shape\" and \"override_model_batch_size\"");- }- for (auto& item : inputs_info) {- InputInfo info;- auto name = item.get_any_name();-- if (!shapes_map.empty()) {- if (shapes_map.count(name)) {- if (shapes_map.at(name).size() > 1) {- // Example: -shape input1[..][..]- throw std::logic_error("shape command line parameter doesn't support multiple "- "shapes for one input.");- }- info.partialShape = shapes_map.at(name)[0];- } else {- info.partialShape = item.get_partial_shape();- }- }- info_map[name] = std::move(info);- info_maps.push_back(info_map);- }- std::map<std::string, ov::PartialShape> newShapes;- for (auto& item : info_maps) {- for (auto& map : item) {- if (!newShapes.count(map.first)) {- newShapes[map.first] = map.second.partialShape;- }- }- }- model->reshape(newShapes);- } else {- if (FLAGS_d.find("NPU") != std::string::npos) {- boundDynamicShape(model);- }-- setModelBatch(model, FLAGS_override_model_batch_size);- }-}int main(int argc, char* argv[]) {try {@@ -552,7 +451,7 @@ int main(int argc, char* argv[]) {InputsInfo info_map;std::cout << "Performing reshape" << std::endl;- reshape(std::move(inputs_info), info_map, model);+ reshape(std::move(inputs_info), info_map, model, FLAGS_shape, FLAGS_override_model_batch_size, FLAGS_d);std::cout << "Configuring model pre & post processing" << std::endl;configurePrePostProcessing(model, FLAGS_ip, FLAGS_op, FLAGS_iop, FLAGS_il, FLAGS_ol, FLAGS_iol, FLAGS_iml,diff --git a/src/plugins/intel_npu/tools/compile_tool/tools_helpers.hpp b/src/plugins/intel_npu/tools/compile_tool/tools_helpers.hppdeleted file mode 100644index 6d42fd142b8..00000000000--- a/src/plugins/intel_npu/tools/compile_tool/tools_helpers.hpp+++ /dev/null@@ -1,81 +0,0 @@-// Copyright (C) 2024 Intel Corporation-// SPDX-License-Identifier: Apache-2.0-//--#include <algorithm>-#include <chrono>-#include <cstdlib>-#include <fstream>-#include <iostream>-#include <map>-#include <string>-#include <unordered_map>-#include <vector>--#include <gflags/gflags.h>--#include "openvino/openvino.hpp"--struct InputInfo {- ov::element::Type type;- ov::PartialShape partialShape;- ov::Shape dataShape;- ov::Layout layout;-};-using InputsInfo = std::map<std::string, InputInfo>;--std::string parameterNameToTensorName(std::string& name, std::vector<ov::Output<ov::Node>>& inputs_info) {- auto count_name = std::any_of(inputs_info.begin(), inputs_info.end(), [name](ov::Output<ov::Node>& port) {- return port.get_names().count(name) > 0;- });- if (count_name) {- return name;- } else {- auto inputInfo = std::find_if(inputs_info.begin(), inputs_info.end(), [name](ov::Output<ov::Node>& port) {- return name == port.get_node()->get_friendly_name();- });- if (inputInfo == inputs_info.end()) {- throw std::runtime_error("Provided I/O name \"" + name +- "\" is not found neither in tensor names nor in nodes names.");- }- return inputInfo->get_any_name();- }-}--std::map<std::string, std::vector<std::string>> parseInputParameters(std::string& parameter_string,- std::vector<ov::Output<ov::Node>>& input_info) {- // Parse parameter string like "input0[value0],input1[value1]" or "[value]" (applied to all- // inputs)- std::map<std::string, std::vector<std::string>> return_value;- std::string search_string = parameter_string;- auto start_pos = search_string.find_first_of('[');- auto input_name = search_string.substr(0, start_pos);- while (start_pos != std::string::npos) {- auto end_pos = search_string.find_first_of(']');- if (end_pos == std::string::npos)- break;- input_name = search_string.substr(0, start_pos);- auto input_value = search_string.substr(start_pos + 1, end_pos - start_pos - 1);- if (!input_name.empty()) {- return_value[parameterNameToTensorName(input_name, input_info)].push_back(input_value);- } else {- for (auto& item : input_info) {- return_value[item.get_any_name()].push_back(input_value);- }- }- search_string = search_string.substr(end_pos + 1);- if (search_string.empty() || (search_string.front() != ',' && search_string.front() != '['))- break;- if (search_string.front() == ',') {- if (search_string.length() > 1)- search_string = search_string.substr(1);- else- throw std::logic_error("Can't parse input parameter string, there is nothing after the comma " +- parameter_string);- }- start_pos = search_string.find_first_of('[');- }- if (!search_string.empty())- throw std::logic_error("Can't parse input parameter string: " + parameter_string);- return return_value;-}diff --git a/src/plugins/intel_npu/tools/single-image-test/main.cpp b/src/plugins/intel_npu/tools/single-image-test/main.cppindex 4018982b022..5658c186502 100644--- a/src/plugins/intel_npu/tools/single-image-test/main.cpp+++ b/src/plugins/intel_npu/tools/single-image-test/main.cpp@@ -4,9 +4,11 @@//#include "image_quality_helper.hpp"+#include "openvino/core/partial_shape.hpp"#include "semantic_segmentation_helpers.hpp"#include "tensor_utils.hpp"#include "yolo_helpers.hpp"+#include "tools_helpers.hpp"#include <openvino/core/parallel.hpp>#include <openvino/openvino.hpp>@@ -31,7 +33,8 @@ using TensorMap = std::map<std::string, ov::Tensor>;struct TensorDescriptor {ov::element::Type precision;- ov::Shape shape;+ ov::PartialShape shape;+ ov::Shape dataShape;ov::Layout layout;};@@ -83,6 +86,15 @@ DEFINE_string(oml, "","<output> is supported");DEFINE_bool(img_as_bin, false, "Force binary input even if network expects an image");DEFINE_bool(pc, false, "Report performance counters");+DEFINE_string(+ shape, "",+ "Optional. Set shape for model input. For example, \"input1[1,3,224,224],input2[1,4]\" or \"[1,3,224,224]\""+ " in case of one input size. This parameter affects model input shape and can be dynamic."+ " For dynamic dimensions use symbol `?` or '-1'. Ex. [?,3,?,?]."+ " For bounded dimensions specify range 'min..max'. Ex. [1..10,3,?,?].");+DEFINE_string(data_shape, "",+ "Required for models with dynamic shapes. Set shape for input blobs. Only one shape can be set."+ "In case of one input size: \"[1,3,224,224]\"");// for using input image mean and scalestatic constexpr char mean_values_message[] =@@ -1450,65 +1462,6 @@ std::pair<TensorMap, ProfVec> runInfer(ov::InferRequest& inferRequest, ov::Compireturn std::make_pair(out, profData);}-void boundDynamicShape(std::shared_ptr<ov::Model>& model) {- for (auto&& item : model->get_parameters()) {- auto shape = item->get_partial_shape();- if (shape.is_static()) {- continue;- }- auto rank = shape.rank();- if (rank.is_dynamic()) {- throw std::logic_error("Rank \"" + rank.to_string() + "\" of the shape \"" + shape.to_string() +- "\" is dynamic which is not supported by SIT");- }- auto layout = item->get_layout();- if (!ov::layout::has_batch(layout)) {- item->set_layout(ov::Layout(layout.to_string().insert(1, "N,")));- layout = item->get_layout();- }- if (shape[ov::layout::batch_idx(layout)].is_dynamic()) {- std::cout << "WARNING: Shape \"" + shape.to_string() + "\"" +- " has dynamic batch size which is not supported by SIT\n"- " Setting batch to 1 forcibly"- << std::endl;- ov::set_batch(model, 1);- }- shape = item->get_partial_shape();- if (shape.is_dynamic()) {- throw std::logic_error("Model's input shape \"" + shape.to_string() + "\"" +- " is dynamic which is not supported by SIT");- }- }-}--void setModelBatch(std::shared_ptr<ov::Model>& model, uint32_t batch) {- if (batch == 1) {- return;- }-- // New batch value is applicable if the model has non dynamic inputs/outputs only- // Amend layout by adding N if it has no batch dimension- for (auto&& item : model->get_parameters()) {- auto shape = item->get_partial_shape();- auto rank = shape.rank();- if (rank.is_dynamic()) {- throw std::logic_error("Rank \"" + rank.to_string() + "\" of the shape \"" + shape.to_string() +- "\" is dynamic which is not supported by SIT");- }- auto layout = item->get_layout();- if (!ov::layout::has_batch(layout)) {- item->set_layout(ov::Layout(layout.to_string().insert(1, "N,")));- }-- shape = item->get_partial_shape();- if (shape.is_dynamic()) {- throw std::logic_error("Model's input shape \"" + shape.to_string() + "\"" +- " is dynamic which is not supported by SIT");- }- }- ov::set_batch(model, batch);-}-// FIXME: User must provide layout explicitly.// No "default" layout for IRv11 models.static ov::Layout getLayoutByRank(const size_t rank) {@@ -1558,8 +1511,8 @@ bool testSSDDetection(const TensorMap& outputs, const TensorMap& references,const ov::Tensor& reference = references.begin()->second;const TensorDescriptor& inputDescriptor = inputDescriptors.begin()->second;- const auto imgWidth = inputDescriptor.shape.at(ov::layout::width_idx(inputDescriptor.layout));- const auto imgHeight = inputDescriptor.shape.at(ov::layout::height_idx(inputDescriptor.layout));+ const auto imgWidth = inputDescriptor.dataShape.at(ov::layout::width_idx(inputDescriptor.layout));+ const auto imgHeight = inputDescriptor.dataShape.at(ov::layout::height_idx(inputDescriptor.layout));auto confThresh = FLAGS_confidence_threshold;auto probTolerance = FLAGS_prob_tolerance;@@ -1592,8 +1545,8 @@ bool testYoloV2(const TensorMap& outputs, const TensorMap& references, const Tenconst TensorDescriptor& inputDescriptor = inputDescriptors.begin()->second;- const auto imgWidth = inputDescriptor.shape.at(ov::layout::width_idx(inputDescriptor.layout));- const auto imgHeight = inputDescriptor.shape.at(ov::layout::height_idx(inputDescriptor.layout));+ const auto imgWidth = inputDescriptor.dataShape.at(ov::layout::width_idx(inputDescriptor.layout));+ const auto imgHeight = inputDescriptor.dataShape.at(ov::layout::height_idx(inputDescriptor.layout));double confThresh = FLAGS_confidence_threshold;double probTolerance = FLAGS_prob_tolerance;double boxTolerance = FLAGS_box_tolerance;@@ -1624,8 +1577,8 @@ bool testYoloV3(const TensorMap& outputs, const TensorMap& references, const Ten"Mismatch between the number of model outputs and the number of references");const TensorDescriptor& inputDescriptor = inputDescriptors.begin()->second;- const auto imgWidth = inputDescriptor.shape.at(ov::layout::width_idx(inputDescriptor.layout));- const auto imgHeight = inputDescriptor.shape.at(ov::layout::height_idx(inputDescriptor.layout));+ const auto imgWidth = inputDescriptor.dataShape.at(ov::layout::width_idx(inputDescriptor.layout));+ const auto imgHeight = inputDescriptor.dataShape.at(ov::layout::height_idx(inputDescriptor.layout));double confThresh = FLAGS_confidence_threshold;double probTolerance = FLAGS_prob_tolerance;@@ -1663,8 +1616,8 @@ bool testYoloV4(const TensorMap& outputs, const TensorMap& references, const Ten"Mismatch between the number of model outputs and the number of references");const TensorDescriptor& inputDescriptor = inputDescriptors.begin()->second;- const auto imgWidth = inputDescriptor.shape.at(ov::layout::width_idx(inputDescriptor.layout));- const auto imgHeight = inputDescriptor.shape.at(ov::layout::height_idx(inputDescriptor.layout));+ const auto imgWidth = inputDescriptor.dataShape.at(ov::layout::width_idx(inputDescriptor.layout));+ const auto imgHeight = inputDescriptor.dataShape.at(ov::layout::height_idx(inputDescriptor.layout));double confThresh = FLAGS_confidence_threshold;double probTolerance = FLAGS_prob_tolerance;@@ -1733,6 +1686,16 @@ bool testMeanIoU(const TensorMap& outputs, const TensorMap& references, const Lareturn compare_mean_IoU(iou, semSegThreshold, classes);}+static ov::Shape parseDataShape(const std::string& dataShapeStr) {+ std::vector<size_t> dataShape;+ std::istringstream ss(dataShapeStr);+ std::string token;+ while (std::getline(ss, token, ',')) {+ dataShape.push_back(std::stoul(token));+ }+ return ov::Shape(dataShape);+}+static int runSingleImageTest() {std::cout << "Run single image test" << std::endl;try {@@ -1814,12 +1777,12 @@ static int runSingleImageTest() {auto model = core.read_model(FLAGS_network);nameIOTensors(model);- setModelBatch(model, FLAGS_override_model_batch_size);- if (FLAGS_device.find("NPU") != std::string::npos ||- // FIXME: SIT on CPU also requires to bound dynamic shapes- FLAGS_device.find("CPU") != std::string::npos || FLAGS_device.find("TEMPLATE") != std::string::npos) {- boundDynamicShape(model);- }+ auto inputs_info = std::const_pointer_cast<ov::Model>(model)->inputs();+ InputsInfo info_map;++ std::cout << "Performing reshape" << std::endl;+ reshape(std::move(inputs_info), info_map, model, FLAGS_shape,+ FLAGS_override_model_batch_size, FLAGS_device);ov::preprocess::PrePostProcessor ppp(model);@@ -1856,11 +1819,11 @@ static int runSingleImageTest() {inModelLayout.has_value()) {inLayerModelLayout = inModelLayout.value();} else {- const auto shape = inputInfo[i].get_shape();+ const auto shape = inputInfo[i].get_partial_shape();inLayerModelLayout = getLayoutByRank(shape.size());std::cout << "WARNING: Configuring preprocessing. Since --iml option isn't set, input model ""layout for layer \""- << inputInfo[i].get_any_name() << "\" is infered from shape: " << toString(shape)+ << inputInfo[i].get_any_name() << "\" is infered from shape: " << shape.to_string()<< " rank (" << shape.size() << ") as " << inLayerModelLayout.to_string()<< std::endl;}@@ -1917,11 +1880,11 @@ static int runSingleImageTest() {outModelLayout.has_value()) {outLayerModelLayout = outModelLayout.value();} else {- const auto shape = outputInfo[i].get_shape();+ const auto shape = outputInfo[i].get_partial_shape();outLayerModelLayout = getLayoutByRank(shape.size());std::cout << "WARNING: Configuring preprocessing. Since --oml option isn't set, output model ""layout for layer \""- << outputInfo[i].get_any_name() << "\" is infered from shape: " << toString(shape)+ << outputInfo[i].get_any_name() << "\" is infered from shape: " << shape.to_shape()<< " rank (" << shape.size() << ") as " << outLayerModelLayout.to_string()<< std::endl;}@@ -1933,6 +1896,7 @@ static int runSingleImageTest() {}}+ std::cout << "Compile model" << std::endl;compiledModel = core.compile_model(ppp.build(), FLAGS_device);} else {std::cout << "Import network " << FLAGS_network << std::endl;@@ -1994,7 +1958,8 @@ static int runSingleImageTest() {// Load the input datafor (const auto& inputInfo : inputsInfo) {- const ov::Shape& shape = inputInfo.get_shape();+ const auto& shape = inputInfo.get_partial_shape();+ const auto dataShape = shape.is_static() ? shape.get_shape() : parseDataShape(FLAGS_data_shape);const ov::element::Type& precision = inputInfo.get_element_type();// Determine the input layout@@ -2012,19 +1977,20 @@ static int runSingleImageTest() {inputLayout = getLayoutByRank(shape.size());std::cout << "WARNING: Loading input data. Since --iml option isn't set, input model layout for ""layer \""- << inputInfo.get_any_name() << "\" is infered from shape: " << toString(shape)+ << inputInfo.get_any_name() << "\" is infered from shape: " << shape.to_shape()<< " rank (" << shape.size() << ") as " << inputLayout.to_string() << std::endl;}- inputDescriptors.emplace(inputInfo.get_any_name(), TensorDescriptor{precision, shape, inputLayout});+ inputDescriptors.emplace(inputInfo.get_any_name(), TensorDescriptor{precision, shape,+ dataShape, inputLayout});std::cout << "Load input #" << inputInd << " from " << inputFiles[inputInd] << " as " << precision<< " " << inputLayout.to_string() << " " << shape << std::endl;const ov::Tensor tensor =!FLAGS_img_as_bin- ? loadInput(precision, shape, inputLayout, inputFiles[inputInd], FLAGS_color_format)- : loadInput(precision, shape, inputLayout, inputFiles[inputInd], FLAGS_color_format,+ ? loadInput(precision, dataShape, inputLayout, inputFiles[inputInd], FLAGS_color_format)+ : loadInput(precision, dataShape, inputLayout, inputFiles[inputInd], FLAGS_color_format,inputBinPrecisionForOneInfer[numberOfTestCase][inputInd]);std::ostringstream ostr;ostr << netFileName << "_input_" << inputInd << "_case_" << numberOfTestCase << ".blob";