Skip to content

Commit

Permalink
Add runtime assert to non-strict export (#2226)
Browse files Browse the repository at this point in the history
Summary:

X-link: pytorch/pytorch#123681

Differential Revision: D55944267
  • Loading branch information
BoyuanFeng authored and facebook-github-bot committed Apr 10, 2024
1 parent fc72ed4 commit ef600ec
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions userbenchmark/dynamo/dynamobench/_dynamo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
from torch._dispatch.python import enable_python_dispatcher
from torch._utils_internal import log_compilation_event

from torch.fx.utils import _format_graph_code, lazy_format_graph_code
from torch.nn.modules.lazy import LazyModuleMixin
from torch.utils._triton import has_triton, has_triton_package

Expand Down Expand Up @@ -1996,26 +1997,6 @@ def tensor_always_has_static_shape(
return False, None


def lazy_format_graph_code(name, gm, maybe_id=None):
def format_name():
if maybe_id is not None:
return f"{name} {maybe_id}"
else:
return name

return LazyString(
lambda: _format_graph_code(
f"===== {format_name()} =====\n",
gm.forward.__code__.co_filename,
gm.print_readable(print_output=False),
)
)


def _format_graph_code(name, filename, graph_str):
return f"TRACED GRAPH\n {name} {filename} {graph_str}\n"


def lazy_format_graph_tabular(fn_name, gm):
def inner():
try:
Expand Down

0 comments on commit ef600ec

Please sign in to comment.