Skip to content

Commit

Permalink
Merge pull request #432 from intel/preetha/fix_dynamic_bug
Browse files Browse the repository at this point in the history
Fix OVEP execution failure with dynamic shaped models
  • Loading branch information
sfatimar authored Aug 28, 2024
2 parents 323c76b + 176a99b commit 5e2fd79
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions onnxruntime/core/providers/openvino/backend_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,13 @@ BackendManager::BackendManager(const GlobalContext& global_context,

if (ModelHasSymbolicInputDims(subgraph)) {
subgraph_context_.has_dynamic_input_shape = true;

// Cache model_proto for all cases with dynamic shapes
model_proto_ = std::move(model_proto);

LOGS_DEFAULT(INFO) << "[OpenVINO-EP] Model has symbolic input dims";
ORT_ENFORCE(!global_context_.enable_qdq_optimizer,
"QDQ stripping should not be enabled for models with dynamic input shapes. "
"Set enable_qdq_optimizer to False");
if (GetGlobalContext().device_type.find("CPU") != std::string::npos ||
GetGlobalContext().device_type.find("GPU") != std::string::npos) {
if (!GetGlobalContext().disable_dynamic_shapes) {
if ((GetGlobalContext().device_type.find("CPU") != std::string::npos ||
GetGlobalContext().device_type.find("GPU") != std::string::npos) &&
!GetGlobalContext().disable_dynamic_shapes) {
LOGS_DEFAULT(INFO) << "[OpenVINO-EP] Starting backend initialization. "
<< "Creating backend Dynamic Shapes";
try {
Expand All @@ -92,7 +88,10 @@ BackendManager::BackendManager(const GlobalContext& global_context,
}
LOGS_DEFAULT(INFO) << "[OpenVINO-EP] "
<< "Backend created for graph " << subgraph_context_.subgraph_name;
}
} else {
// Only cache model_proto in global to rewrite the model with input shapes at runtime.
// For dynamic backend creation
model_proto_ = std::move(model_proto);
}
} else {
LOGS_DEFAULT(INFO) << "[OpenVINO-EP] Model has concrete input dims. "
Expand Down

0 comments on commit 5e2fd79

Please sign in to comment.