From 73f56e1e81d2842bacd58d3be340bd099f45b575 Mon Sep 17 00:00:00 2001 From: IvanKobzarev Date: Fri, 19 Apr 2024 05:01:05 -0700 Subject: [PATCH] [sym_shapes][perf] Do not calculate hint in advice_is_size (#124472) Differential Revision: [D56352412](https://our.internmc.facebook.com/intern/diff/D56352412) Pull Request resolved: https://github.com/pytorch/pytorch/pull/124472 Approved by: https://github.com/ezyang --- torch/fx/experimental/symbolic_shapes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/torch/fx/experimental/symbolic_shapes.py b/torch/fx/experimental/symbolic_shapes.py index 4d2f19bee9a..c400596ee0c 100644 --- a/torch/fx/experimental/symbolic_shapes.py +++ b/torch/fx/experimental/symbolic_shapes.py @@ -556,8 +556,8 @@ def _advise_is_size(a): if ( isinstance(a, SymInt) and isinstance(a.node, SymNode) - and not a.node.has_hint() and isinstance(a.node.expr, sympy.Symbol) + and a.node.shape_env.is_unbacked_symint(a.node.expr) ): _constrain_range_for_size(a)