diff --git a/torch/fx/experimental/symbolic_shapes.py b/torch/fx/experimental/symbolic_shapes.py index 30a6d47b8f726..0de674d3c6cb8 100644 --- a/torch/fx/experimental/symbolic_shapes.py +++ b/torch/fx/experimental/symbolic_shapes.py @@ -6492,11 +6492,8 @@ def go(x: Any) -> Optional[str]: for s in x.node.expr.free_symbols: if str(s) in frame_symbols: # type: ignore[operator] continue - frame_symbols[str(s)] = ( # type: ignore[index] - self.var_to_sources[s][0].name() # type: ignore[assignment] - if s in self.var_to_sources - else None # unbacked - ) + if s in self.var_to_sources: + frame_symbols[str(s)] = self.var_to_sources[s][0].name() # type: ignore[assignment] return str(x) return None