Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7e5243a

Browse filesBrowse files
avikchaudhurifacebook-github-bot
authored andcommitted
remove constraints from aot_compile
Differential Revision: D54405986
1 parent 77ef9d4 commit 7e5243a
Copy full SHA for 7e5243a

File tree

Expand file treeCollapse file tree

1 file changed

+13
-16
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-16
lines changed

‎torch/_export/__init__.py

Copy file name to clipboardExpand all lines: torch/_export/__init__.py
+13-16Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,6 @@ def aot_compile(
327327
args: Tuple[Any],
328328
kwargs: Optional[Dict[str, Any]] = None,
329329
*,
330-
constraints: Optional[List[Constraint]] = None,
331330
dynamic_shapes: Optional[Dict[str, Any]] = None,
332331
options: Optional[Dict[str, Any]] = None,
333332
remove_runtime_assertions: bool = False,
@@ -347,14 +346,19 @@ def aot_compile(
347346
348347
kwargs: optional example keyword inputs.
349348
350-
constraints: A optional list of constraints on the dynamic arguments specifying
351-
their possible range of their shapes
349+
dynamic_shapes: Should either be:
350+
1) a dict from argument names of ``f`` to their dynamic shape specifications,
351+
2) a tuple that specifies dynamic shape specifications for each input in original order.
352+
If you are specifying dynamism on keyword args, you will need to pass them in the order that
353+
is defined in the original function signature.
352354
353-
dynamic_shapes: An experimental new feature designed to subsume ``constraints``.
354-
A dict mapping argument names of ``f`` to their dynamic shape
355-
specifications, as follows. Dynamic shape specifications can be a
356-
dict from dynamic dimensions to ``Dim`` types, or a tuple/list of
357-
``Optional[Dim]`` corresponding to each input dimension.
355+
The dynamic shape of a tensor argument can be specified as either
356+
(1) a dict from dynamic dimension indices to :func:`Dim` types, where it is
357+
not required to include static dimension indices in this dict, but when they are,
358+
they should be mapped to None; or (2) a tuple / list of :func:`Dim` types or None,
359+
where the :func:`Dim` types correspond to dynamic dimensions, and static dimensions
360+
are denoted by None. Arguments that are dicts or tuples / lists of tensors are
361+
recursively specified by using mappings or sequences of contained specifications.
358362
359363
options: A dictionary of options to control inductor
360364
@@ -363,17 +367,10 @@ def aot_compile(
363367
Returns:
364368
Path to the generated shared library
365369
"""
366-
if constraints is not None:
367-
warnings.warn(
368-
"The constraints field is deprecated. "
369-
"Please use dynamic_shapes instead."
370-
)
371-
372370
from torch.export._trace import _export_to_torch_ir
373371
from torch._inductor.decomposition import select_decomp_table
374372

375-
if constraints is None:
376-
constraints = _process_dynamic_shapes(f, args, kwargs, dynamic_shapes)
373+
constraints = _process_dynamic_shapes(f, args, kwargs, dynamic_shapes)
377374

378375
if config.is_predispatch:
379376
gm = torch.export._trace._export(f, args, kwargs, constraints, pre_dispatch=True).module()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.