Repository: pytorch
Issue: Conv2d will crash by using `jit.trace`
Labels: oncall: jit,module: crash

### 🐛 Describe the bug

Conv2d will crash by using `jit.trace` but work normally without it when `weight` tensor is processed by some operation

```py
import torch

class M(torch.nn.Module):
    def __init__(self):
        super().__init__()
        self.stride = [1, 1]
        self.padding = [1, 1]
        self.dilation = [1, 1]
        self.groups = 1

    def forward(self, input, weight, bias):
        stride = self.stride
        padding = self.padding
        dilation = self.dilation
        groups = self.groups

        weight = torch.sin(weight)
        return torch.nn.functional.conv2d(input, weight, bias=bias, stride=stride, padding=padding, dilation=dilation, groups=groups, )

fn = M().to('cpu')

torch.random.manual_seed(57461)
input = torch.empty([1, 1, 1, 32], dtype=torch.float32, memory_format=torch.contiguous_format)
input.uniform_(-2, 3)
weight = torch.empty([1, 1, 3, 3], dtype=torch.float32, memory_format=torch.contiguous_format)
weight.uniform_(-2, 31)
bias = torch.empty([1], dtype=torch.float32, memory_format=torch.contiguous_format)
bias.uniform_(-2, 1)

inputs = (input, weight, bias)

print('normal')
print(fn(*inputs))

jit_fn = torch.jit.trace(fn, inputs)
print('jitted')
print(jit_fn(*inputs))
```

```
normal
tensor([[[[-0.1752, -2.4198, -0.3692,  0.7270,  1.5662,  2.2545, -1.0823,
            2.6698,  1.4883, -1.6568,  0.8448,  1.9900,  0.7963,  1.2628,
            0.2481, -1.7248, -0.0482, -0.3879, -0.5180,  2.2316, -0.7775,
            2.9247,  0.9076, -0.7647,  2.5395, -2.3155,  1.9133,  0.4259,
            2.3740,  1.0395, -2.2315,  2.5118]]]])
jitted
[1]    3965638 segmentation fault (core dumped)  python ../buglists/conv2d.py
```

### Versions

```
PyTorch version: 1.13.0.dev20221001
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.1 LTS (x86_64)
GCC version: (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.35

Python version: 3.9.13 (main, Aug 25 2022, 23:26:10)  [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-5.19.5-051905-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: 11.7.99
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 3060
Nvidia driver version: 515.65.01
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] numpy==1.23.3
[pip3] torch==1.13.0.dev20221001
[pip3] torchaudio==0.13.0.dev20221001
[pip3] torchvision==0.14.0.dev20221001
[conda] blas                      1.0                         mkl  
[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.23.3                   pypi_0    pypi
[conda] numpy-base                1.23.1           py39ha15fc14_0  
[conda] pytorch                   1.13.0.dev20221001 py3.9_cuda11.7_cudnn8.5.0_0    pytorch-nightly
[conda] pytorch-cuda              11.7                 h67b0de4_0    pytorch-nightly
[conda] pytorch-mutex             1.0                        cuda    pytorch-nightly
[conda] torch                     1.13.0.dev20220923+cu116          pypi_0    pypi
[conda] torchaudio                0.13.0.dev20220923+cu116          pypi_0    pypi
[conda] torchvision               0.14.0.dev20220923+cu116          pypi_0    pypi
```