Repository: pytorch
Issue: [JIT] INTERNAL ASSERT FAILED when `Conv2d` and `clamp` used together
Labels: oncall: jit

### 🐛 Describe the bug

The following model works for eager mode but triggers an INTERNAL ASSERT FAILED error in `torch.jit.optimize_for_inference()`.
```python
import torch

class Model(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.m = torch.nn.Conv2d(1, 4, kernel_size=(1, 1))

    def forward(self, input):
        v = self.m(input)
        return torch.clamp(v, min=0, max=1)  # works w/o this line
        """
        The error is triggered by combined use of "Conv2d" and "clamp", 
        without any of which it works fine.
        """


x = torch.ones(1, 1, 1, 1)
fn = Model().eval()

fn(x)
print("Eager mode works")

exported = torch.jit.trace(fn, (x,))
exported = torch.jit.optimize_for_inference(exported)
exported(x)
print("JIT works")

"""
Eager mode works
Traceback (most recent call last):
  File "model.py", line 20, in <module>
    exported = torch.jit.optimize_for_inference(exported)
  File "python3.10/site-packages/torch/jit/_freeze.py", line 217, in optimize_for_inference
    torch._C._jit_pass_optimize_for_inference(mod._c, other_methods)
RuntimeError: isDouble() INTERNAL ASSERT FAILED at "pytorch/aten/src/ATen/core/ivalue.h":524, please report a bug to PyTorch. 
"""
```
The error is triggered by combined use of `Conv2d` and `clamp`, without any of which it works fine.

### Versions

<details><summary><b>Environment </b> <i>[click to expand]</i></summary>

```
PyTorch version: 1.14.0a0+gitbdc9911
Is debug build: False
CUDA used to build PyTorch: 11.6
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
Clang version: 11.1.0-6
CMake version: version 3.22.1
Libc version: glibc-2.35

Python version: 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] (64-bit runtime)
Python platform: Linux-5.15.0-56-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 11.6.124
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: 
GPU 0: NVIDIA GeForce RTX 3090
GPU 1: NVIDIA GeForce RTX 3090
GPU 2: NVIDIA GeForce RTX 3090

Nvidia driver version: 515.86.01
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.4.1
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.4.1
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.4.1
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.4.1
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.4.1
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.4.1
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.4.1
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.21.5
[pip3] torch==1.14.0a0+gitbdc9911
[conda] blas                      1.0                         mkl  
[conda] cudatoolkit               11.3.1               h2bc3f7f_2  
[conda] mkl                       2021.4.0           h06a4308_640  
[conda] mkl-service               2.4.0            py39h7f8727e_0  
[conda] mkl_fft                   1.3.1            py39hd3c417c_0  
[conda] mkl_random                1.2.2            py39h51133e4_0  
[conda] numpy                     1.21.5           py39he7a7128_1  
[conda] numpy-base                1.21.5           py39hf524024_1  
[conda] numpydoc                  1.2                pyhd3eb1b0_0  
[conda] torch                     1.14.0a0+gitce2f870          pypi_0    pypi
```

</details>

cc @EikanWang @jgong5 @wenzhe-nrv @sanchitintel