diff --git a/inference-engine/thirdparty/clDNN/src/program.cpp b/inference-engine/thirdparty/clDNN/src/program.cpp index 5b9ef6583b9879..1e954cb4b388b8 100644 --- a/inference-engine/thirdparty/clDNN/src/program.cpp +++ b/inference-engine/thirdparty/clDNN/src/program.cpp @@ -831,7 +831,9 @@ void program_impl::swap_names(program_node& node1, program_node& node2) { } void program_impl::replace_all_usages(program_node& old_node, program_node& new_node) { - for (auto& user : old_node.users) { + auto itr = old_node.users.begin(); + while (itr != old_node.users.end()) { + auto user = *(itr++); user->replace_dependency(old_node, new_node); } }