File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/common/transformations/src/transformations/utils Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -499,9 +499,14 @@ bool is_on_constant_path(const ov::Output<ov::Node>& output) {
499499 }
500500 std::deque<ov::Node*> nodes_to_calculate = {root_node};
501501
502+ std::unordered_set<ov::Node*> visited;
502503 while (status && !nodes_to_calculate.empty ()) {
503504 auto current_node = nodes_to_calculate.front ();
504505 nodes_to_calculate.pop_front ();
506+ if (visited.count (current_node)) {
507+ continue ;
508+ }
509+ visited.insert (current_node);
505510 // RandomUniform output changes during runtime, so we should not consider it as a constant
506511 if (current_node->get_type_info () == ov::op::v8::RandomUniform::get_type_info_static ()) {
507512 return false ;
@@ -513,7 +518,9 @@ bool is_on_constant_path(const ov::Output<ov::Node>& output) {
513518 // not a leaf - continue to search
514519 for (const auto & input_value : current_node->input_values ()) {
515520 const auto & input_node = input_value.get_node ();
516- nodes_to_calculate.push_front (input_node);
521+ if (!visited.count (input_node)) {
522+ nodes_to_calculate.push_front (input_node);
523+ }
517524 }
518525 }
519526 }
You can’t perform that action at this time.
0 commit comments