Added correct isinf handling for Integral tensors (#15489)
authorFrank Zhang <frankz@fb.com>
Wed, 26 Dec 2018 14:32:44 +0000 (06:32 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 26 Dec 2018 14:36:09 +0000 (06:36 -0800)
commitd4712ee218cd6af3c2096ca7a76fef350173b703
tree3cf96292e3a3b4a5885184d2db182e781396027e
parentd602ddcda37d99cc2bb63cadb6c49dc9f42aa478
Added correct isinf handling for Integral tensors (#15489)

Summary:
Currently torch.isinf on integral tensor will raise RuntimeError: value cannot be converted to type int16_t without overflow: inf.
This pr will suppress the error and return false(0) for all integral tensors. The behavior will also be consistent with np.isinf
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15489

Reviewed By: zou3519

Differential Revision: D13540786

Pulled By: flashhack

fbshipit-source-id: e730dea849da6a59f3752d347bcfbadfd12c6483
test/test_cuda.py
test/test_torch.py
torch/functional.py