Skip to content

Commit 7f9d1ca

Browse files
angelayipytorchmergebot
authored andcommitted
[export] Minor fixes to contrain_as_size (pytorch#106737)
Fixed some minor issues with constraint APIs while I was helping enable some other model Pull Request resolved: pytorch#106737 Approved by: https://github.com/tugsbayasgalan
1 parent 99a10da commit 7f9d1ca

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

torch/_meta_registrations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,12 +397,12 @@ def make_dep_token(
397397

398398

399399
@register_meta(aten.sym_constrain_range.default)
400-
def sym_constrain_range(size, min, max):
400+
def sym_constrain_range(size, min=None, max=None):
401401
constrain_range(size, min=min, max=max)
402402

403403

404404
@register_meta(aten._functional_sym_constrain_range.default)
405-
def functional_sym_constrain_range(size, min, max, dep_token):
405+
def functional_sym_constrain_range(size, min=None, max=None, dep_token=None):
406406
aten.sym_constrain_range(size, min=min, max=max)
407407
return dep_token
408408

torch/fx/experimental/symbolic_shapes.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,10 @@ def constrain_range_int(a, *, min, max):
374374
- During tracing the traced symbol is resolved as a static integer (see
375375
PR #101655 for more details).
376376
"""
377+
if min is None:
378+
min = -sympy.oo
379+
if max is None:
380+
max = sympy.oo
377381

378382
assert not isinstance(a, SymInt)
379383
if not (min <= a <= max):

0 commit comments

Comments
 (0)