Skip to content

Commit 1490d74

Browse files
authored
[ET] Fix serde handling of inf
Differential Revision: D65848116 Pull Request resolved: #6799
1 parent dc41596 commit 1490d74

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

exir/serde/export_serialize.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,13 @@ def deserialize(
18471847
self.symbol_name_to_range = {}
18481848
if symbol_name_to_range:
18491849
for k, vr in symbol_name_to_range.items():
1850-
lower = int(vr.lower)
1850+
if math.isinf(vr.lower) and vr.lower < 0:
1851+
lower = -math.inf
1852+
elif math.isinf(vr.lower):
1853+
lower = math.inf
1854+
else:
1855+
lower = int(vr.lower)
1856+
18511857
if vr.upper >= 2: # max is >= 2, not sym bool range
18521858
lower = max(2, lower)
18531859
self.symbol_name_to_range[k] = symbolic_shapes.ValueRanges(

0 commit comments

Comments
 (0)