File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 51
51
from torch .fx .experimental import symbolic_shapes
52
52
from torch .utils import _pytree as pytree
53
53
from torch .utils ._pytree import treespec_dumps , treespec_loads
54
+ from torch .utils ._sympy .numbers import int_oo
54
55
from torch .utils ._sympy .value_ranges import ValueRanges
55
56
56
57
# pyre-ignore
@@ -332,9 +333,9 @@ def deserialize_torch_artifact(
332
333
333
334
def _sympy_int_to_int (val : sympy .Expr , adjust : str ):
334
335
# Convert simple sympy Integers into concrete int
335
- if val == sympy .oo :
336
+ if val in ( sympy .oo , int_oo ) :
336
337
return math .inf
337
- if val == - sympy .oo :
338
+ if val in ( - sympy .oo , - int_oo ) :
338
339
return - math .inf
339
340
if isinstance (val , sympy .Integer ):
340
341
return int (val )
@@ -360,9 +361,9 @@ def _sympy_int_to_int(val: sympy.Expr, adjust: str):
360
361
def _int_to_sympy_int (val ) -> sympy .Expr :
361
362
# Convert concrete int into simple sympy Integers
362
363
if val == math .inf :
363
- return sympy . oo
364
+ return int_oo
364
365
if val == - math .inf :
365
- return - sympy . oo
366
+ return - int_oo
366
367
return sympy .Integer (val )
367
368
368
369
You can’t perform that action at this time.
0 commit comments