@@ -327,7 +327,6 @@ def aot_compile(
327
327
args : Tuple [Any ],
328
328
kwargs : Optional [Dict [str , Any ]] = None ,
329
329
* ,
330
- constraints : Optional [List [Constraint ]] = None ,
331
330
dynamic_shapes : Optional [Dict [str , Any ]] = None ,
332
331
options : Optional [Dict [str , Any ]] = None ,
333
332
remove_runtime_assertions : bool = False ,
@@ -347,14 +346,19 @@ def aot_compile(
347
346
348
347
kwargs: optional example keyword inputs.
349
348
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.
352
354
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.
358
362
359
363
options: A dictionary of options to control inductor
360
364
@@ -363,17 +367,10 @@ def aot_compile(
363
367
Returns:
364
368
Path to the generated shared library
365
369
"""
366
- if constraints is not None :
367
- warnings .warn (
368
- "The constraints field is deprecated. "
369
- "Please use dynamic_shapes instead."
370
- )
371
-
372
370
from torch .export ._trace import _export_to_torch_ir
373
371
from torch ._inductor .decomposition import select_decomp_table
374
372
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 )
377
374
378
375
if config .is_predispatch :
379
376
gm = torch .export ._trace ._export (f , args , kwargs , constraints , pre_dispatch = True ).module ()
0 commit comments