From b4844d48262563b9eac24b8b8dc9714f5e13a05f Mon Sep 17 00:00:00 2001 From: Hansong Zhang Date: Wed, 15 Nov 2023 14:51:14 -0800 Subject: [PATCH] Increase recursion limit in tree validation to pass mobilebert test (#1211) Summary: This should fix https://github.com/pytorch/executorch/actions/runs/6868472363/job/18679119617 Pull Request resolved: https://github.com/pytorch/executorch/pull/1211 Test Plan: OSS CI Reviewed By: mcr229 Differential Revision: D51322163 Pulled By: kirklandsign fbshipit-source-id: 9194e550da3597fd63cc73d48297eb8262ed063d --- exir/backend/utils.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/exir/backend/utils.py b/exir/backend/utils.py index c955e860a3..7949d7f7ba 100644 --- a/exir/backend/utils.py +++ b/exir/backend/utils.py @@ -11,6 +11,7 @@ from typing import Dict, Iterable, List, Optional, Set, Tuple, Union import torch +from executorch.exir.common import setting_python_recursive_limit from executorch.exir.delegate import executorch_call_delegate from executorch.exir.dialects._ops import ops as exir_ops @@ -62,9 +63,12 @@ def is_identical_graph( # is not the same. if len(list(graph_left.graph.nodes)) != len(list(graph_right.graph.nodes)): return False - for node_left, node_right in zip(graph_left.graph.nodes, graph_right.graph.nodes): - if not (is_same_node(node_left, node_right)): - return False + with setting_python_recursive_limit(30000): + for node_left, node_right in zip( + graph_left.graph.nodes, graph_right.graph.nodes + ): + if not (is_same_node(node_left, node_right)): + return False return True