From ec35e3f5da08587249d83248762236d711d19f9b Mon Sep 17 00:00:00 2001 From: Jie Hua Date: Thu, 1 Feb 2024 14:11:06 -0800 Subject: [PATCH] Revert D53296779: Some minor type stub improvements (#118529) Differential Revision: D53296779 Original commit changeset: 95799914350e Original Phabricator Diff: D53296779 fbshipit-source-id: 18022511a4f8f27a41836109c0477db44e64721d --- .../dynamo/dynamobench/_dynamo/utils.py | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/userbenchmark/dynamo/dynamobench/_dynamo/utils.py b/userbenchmark/dynamo/dynamobench/_dynamo/utils.py index 7d2e822f20..10b3c92520 100644 --- a/userbenchmark/dynamo/dynamobench/_dynamo/utils.py +++ b/userbenchmark/dynamo/dynamobench/_dynamo/utils.py @@ -2066,18 +2066,18 @@ def defake(x): size: "torch._prims_common.ShapeType" stride: "torch._prims_common.StrideType" if x._has_symbolic_sizes_strides: - size = [] - for s in x.size(): - if isinstance(s, torch.SymInt): - size.append(s.node.shape_env.size_hint(s.node.expr)) - else: - size.append(s) - stride = [] - for s in x.stride(): - if isinstance(s, torch.SymInt): - stride.append(s.node.shape_env.size_hint(s.node.expr)) - else: - stride.append(s) + size = [ + s.node.shape_env.size_hint(s.node.expr) + if isinstance(s, torch.SymInt) + else s + for s in x.size() + ] + stride = [ + s.node.shape_env.size_hint(s.node.expr) + if isinstance(s, torch.SymInt) + else s + for s in x.stride() + ] else: size = x.size() stride = x.stride()