[PyTorch 2.1 regression] TorchScript behavior changed from 2.0.1 (and older) to 2.1
Labels: high priority, triage review, oncall: jit, module: regression

### 🐛 Describe the bug

The ONNX export caught a behavior change on TorchScript API after PyTorch 2.1 was released. Before, a `Torch._C.Value.node.mustBeNone()` returned `False` for a model with `aten::new_zeros` ops while after PyTorch 2.1 it returns `True`, changing the execution path of the ONNX model export.

There is nothing in the [Pytorch 2.1 Release Notes](https://github.com/pytorch/pytorch/releases/tag/v2.1.0) that mentions a behavior change of this nature

Reproduction:
```
import torch.nn as nn
import torch
import onnxruntime as ort

class MyModel(nn.Module):
    def __init__(self):
        super().__init__()
        self.emb = nn.Embedding(50, 64)
    
    def forward(self, x):
        inp = x.new_zeros(x.shape)
        
        return self.emb(inp)

model = MyModel()
inp = torch.Tensor([[2, 5, 6], [3, 2, 5]]).to(torch.int64)

torch.onnx.export(model, (inp,), "model.onnx", opset_version=9)
```

The repro uses `torch.onnx.export` because it calls `torch.jit.trace` and provides an easy entry point to print `new_zeros` arguments. 

The ONNX error is as shown:

```bash
/opt/pytorch/torch/onnx/utils.py:1703: UserWarning: The exported ONNX model failed ONNX shape inference. The model will not be executable by the ONNX Runtime. If this is unintended and you believe there is a bug, please report an issue at https://github.com/pytorch/pytorch/issues. Error reported by strict ONNX shape inference: [ShapeInferenceError] (op_type:Gather, node name: /emb/Gather): indices typestr: Tind, has unsupported type: tensor(float) (Triggered internally at /opt/pytorch/torch/csrc/jit/serialization/export.cpp:1445.)
  _C._check_onnx_proto(proto)
Traceback (most recent call last):
  File "repro_jit_type.py", line 18, in <module>
    torch.onnx.export(model, (inp,), "model.onnx", opset_version=9)
  File "/opt/conda/envs/ptca/lib/python3.8/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 419, in __init__
    self._create_inference_session(providers, provider_options, disabled_optimizers)
  File "/opt/conda/envs/ptca/lib/python3.8/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 460, in _create_inference_session
    sess = C.InferenceSession(session_options, self._model_path, True, self._read_config_from_model)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidGraph: [ONNXRuntimeError] : 10 : INVALID_GRAPH : Load model from model.onnx failed:This is an invalid model. Type Error: Type 'tensor(float)' of input parameter (/Constant_output_0) of operator (Gather) in node (/emb/Gather) is invalid.
```

The error above doesn't point to TorchScript, but shows the execution path has changed for ONNX exporter.
Looking into it further and printing the `new_zeros`'s `dtype` argument (from within the [ONNX exporter code](https://github.com/pytorch/pytorch/blob/144cda7f068854dd870c9567781aa2aca6d5e4cf/torch/onnx/symbolic_opset9.py#L388) which has an easy entry point to the `new_zeros` TorchScript node), we can see that on PyTorch 2.1, the `dtype` arg of `new_zeros` is captured as:

```python
> /opt/pytorch/torch/onnx/symbolic_opset9.py(3889)new_zeros()
-> self_dtype = symbolic_helper._try_get_scalar_type(self)
(Pdb) dtype
15 defined in (%15 : NoneType = prim::Constant(), scope: __main__.MyModel::
)
```

However, in PyTorch 2.0.1 and older, it was:

```python
> /opt/conda/envs/ptca/lib/python3.8/site-packages/torch/onnx/symbolic_opset9.py(3708)new_zeros()
-> self_dtype = symbolic_helper._try_get_scalar_type(self)
(Pdb) dtype
15 defined in (%15 : Long(device=cpu) = onnx::Constant[value={4}](), scope: __main__.MyModel::
)
```

### Versions

PyTorch 2.1

cc @ezyang @gchanan @zou3519 @kadeng @EikanWang @jgong5 @wenzhe-nrv @sanchitintel