jit compilation returns an int rather than a bool when using math.isnan()
Labels: oncall: jit

### 🐛 Describe the bug

When using pytorch version 2.0.1+cu117 I'm finding that running jit compilation over a function which uses `math.isnan()` causes `math.isnan()` to return an int rather than a bool. This seems to cause some cascading issues because the compiler makes assumptions that it is dealing with boolean rather than an integer. This can be fairly straight forward to reproduce:

# Example 1

```
import torch
import math

@torch.jit.script
def test_nan(num: float) -> bool:
    return math.isnan(num)

print(test_nan(13.))
print(type(test_nan(13.)))
```
## Expected Result
```
> False
> <class 'bool'>
```
## Actual Result
```
> 0
> <class 'int'>
```

# Example 2
If I try using this in an if statement, I then get an additional error telling me to make a bug report:
```
import torch
import math

@torch.jit.script
def test_nan(num: float) -> bool:
    if math.isnan(num):
        print('foo')
    return math.isnan(num)

print(test_nan(13.))
print(type(test_nan(13.)))
```

## Error message
```
RuntimeError                              Traceback (most recent call last)
<command-3648418541638725> in <module>
      8     return math.isnan(num)
      9 
---> 10 print(test_nan(13.))
     11 print(type(test_nan(13.)))

RuntimeError: The following operation failed in the TorchScript interpreter.
Traceback of TorchScript (most recent call last):
  File "<command-3648418541638725>", line 6, in test_nan
@torch.jit.script
def test_nan(num: float) -> bool:
    if math.isnan(num):
    ~~~~~~~~~~~~~~~~~~~
        print('foo')
        ~~~~~~~~~~ <--- HERE
    return math.isnan(num)
RuntimeError: isBool() INTERNAL ASSERT FAILED at "../aten/src/ATen/core/ivalue.h":645, please report a bug to PyTorch. 
```

### Versions

Collecting environment information...
PyTorch version: 2.0.1+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Ubuntu 20.04.6 LTS (x86_64)
GCC version: (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
Clang version: Could not collect
CMake version: version 3.27.2
Libc version: glibc-2.31

Python version: 3.8.10 (default, May 26 2023, 14:05:08)  [GCC 9.4.0] (64-bit runtime)
Python platform: Linux-5.15.0-1039-aws-x86_64-with-glibc2.29
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   46 bits physical, 48 bits virtual
CPU(s):                          8
On-line CPU(s) list:             0-7
Thread(s) per core:              2
Core(s) per socket:              4
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           79
Model name:                      Intel(R) Xeon(R) CPU E5-2686 v4 @ 2.30GHz
Stepping:                        1
CPU MHz:                         3000.000
CPU max MHz:                     3000.0000
CPU min MHz:                     1200.0000
BogoMIPS:                        4600.03
Hypervisor vendor:               Xen
Virtualization type:             full
L1d cache:                       128 KiB
L1i cache:                       128 KiB
L2 cache:                        1 MiB
L3 cache:                        45 MiB
NUMA node0 CPU(s):               0-7
Vulnerability Itlb multihit:     KVM: Mitigation: VMX unsupported
Vulnerability L1tf:              Mitigation; PTE Inversion
Vulnerability Mds:               Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Mmio stale data:   Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Vulnerability Retbleed:          Not affected
Vulnerability Spec store bypass: Vulnerable
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Retpolines, STIBP disabled, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:             Not affected
Vulnerability Tsx async abort:   Vulnerable: Clear CPU buffers attempted, no microcode; SMT Host state unknown
Flags:                           fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid aperfmperf tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single pti fsgsbase bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx xsaveopt

Versions of relevant libraries:
[pip3] numpy==1.20.1
[pip3] torch==2.0.1
[pip3] triton==2.0.0
[conda] Could not collect

cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel