Skip to content

Commit 51a8c59

Browse files
committed
Remove dynamic_shapes condition from ShapeEnv creation logic
Signed-off-by: Edward Z. Yang <ezyangmeta.com> ghstack-source-id: ff43307 Pull Request resolved: #103328
1 parent 67d4457 commit 51a8c59

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

torch/_dynamo/output_graph.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,15 +233,13 @@ def __init__(
233233
allow_dynamic_output_shape_ops=config.capture_dynamic_output_shape_ops,
234234
frame_id=frame_state["_id"],
235235
)
236-
if config.dynamic_shapes
237-
or config.automatic_dynamic_shapes
238-
or not config.assume_static_by_default
236+
if config.automatic_dynamic_shapes or not config.assume_static_by_default
239237
else None,
240238
# TODO (tmanlaibaatar) Remove this once we always lift params and buffers
241239
allow_non_fake_inputs=True if self.export else False,
242240
)
243241
self.tracing_context: TracingContext = TracingContext(fake_mode)
244-
if config.dynamic_shapes:
242+
if fake_mode.shape_env is not None:
245243
# Register a SHAPE_ENV guard to make sure we setup shape guards
246244
# that show up in ShapeEnv
247245
self.guards.add(ShapeEnvSource().make_guard(GuardBuilder.SHAPE_ENV))

0 commit comments

Comments
 (0)