mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
refuse to generate a symbolic variable if a float input is inf (#139846)
Fixes `PYTORCH_TEST_WITH_INDUCTOR=1 tlp python test/test_torch.py TestTorchDeviceTypeCPU.test_cauchy_cpu_float64` when `specialize_float=False` Pull Request resolved: https://github.com/pytorch/pytorch/pull/139846 Approved by: https://github.com/ruidazeng, https://github.com/ezyang ghstack dependencies: #139569, #139457, #139568, #139572
This commit is contained in:
parent
c4a323ed05
commit
a4e7b8001c
|
|
@ -435,7 +435,7 @@ class FakeTensorConverter:
|
|||
|
||||
with no_dispatch():
|
||||
value = t.item()
|
||||
if not math.isnan(value):
|
||||
if not math.isnan(value) and not math.isinf(value):
|
||||
# Peephole strip out unnecessary torch.as_tensor(x).item()
|
||||
if isinstance(source, FloatTensorSource):
|
||||
item_source = source.base
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user