[ONNX] Produce error message for incorrect number of dummy inputs instead of Internal assert failure
Labels: needs reproduction, module: onnx, triaged, onnx-triaged

### 🐛 Describe the bug

I've included a minimal repro script below. The key point to observe is that the module expects two arguments, `x` and `y`, whereas we provide only `x` as the dummy input to the ONNX export call.

Instead of an internal assertion failure, I expect to see an error message stating that I provided an incorrect number of dummy inputs to `torch.onnx.export`.

```python
import torch
import torch.nn as nn


class M(nn.Module):
  def __init__(self):
    super().__init__()
    self.transformer = nn.Transformer(
      d_model=128,
      nhead=8,
      num_encoder_layers=6,
      num_decoder_layers=6,
      dim_feedforward=4*128,
      dropout=0.1)

  def forward(self, x, y):
    output = self.transformer(
        x, y,
        self.transformer.generate_square_subsequent_mask(x.shape[0]),
        self.transformer.generate_square_subsequent_mask(y.shape[0]),
        None,  # memory mask
        None,  # src padding mask
        None,  # dest padding mask
        None)  # memory padding mask
    return output


module = M()
module = torch.jit.script(module)
x = torch.randn([1, 10, 128])
dummy_input = x
torch.onnx.export(module, dummy_input, 'test.onnx', verbose=True)
```

### Versions

```
Collecting environment information...
PyTorch version: 1.12.1+cu113
Is debug build: False
CUDA used to build PyTorch: 11.3
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.6 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: Could not collect
CMake version: version 3.19.6
Libc version: glibc-2.27

Python version: 3.9.12 (main, Apr  5 2022, 06:56:58)  [GCC 7.5.0] (64-bit runtime)
Python platform: Linux-4.15.0-118-generic-x86_64-with-glibc2.27
Is CUDA available: True
CUDA runtime version: 11.3.58
GPU models and configuration: 
GPU 0: NVIDIA GeForce RTX 3090
GPU 1: NVIDIA GeForce GTX 1080 Ti
GPU 2: NVIDIA GeForce RTX 3090

Nvidia driver version: 465.19.01
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.7.5.1
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn.so.8.1.0
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_adv_infer.so.8.1.0
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_adv_train.so.8.1.0
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_cnn_infer.so.8.1.0
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_cnn_train.so.8.1.0
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_ops_infer.so.8.1.0
/usr/local/cuda-11.2/targets/x86_64-linux/lib/libcudnn_ops_train.so.8.1.0
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

Versions of relevant libraries:
[pip3] mypy==0.942
[pip3] mypy-extensions==0.4.3
[pip3] numpy==1.22.4
[pip3] pytest-mypy==0.9.1
[pip3] torch==1.12.1+cu113
[pip3] torch-tb-profiler==0.3.1
[pip3] torch-tensorrt==1.1.0
[pip3] torchtext==0.11.0a0+d697db5
[conda] libblas                   3.9.0            12_linux64_mkl    conda-forge
[conda] libcblas                  3.9.0            12_linux64_mkl    conda-forge
[conda] liblapack                 3.9.0            12_linux64_mkl    conda-forge
[conda] magma-cuda112             2.5.2                         1    pytorch
[conda] mkl                       2021.4.0           h8d4b97c_729    conda-forge
[conda] mkl-include               2021.3.0           h06a4308_520  
[conda] numpy                     1.22.4                   pypi_0    pypi
[conda] torch                     1.12.1+cu113             pypi_0    pypi
[conda] torch-tb-profiler         0.3.1                    pypi_0    pypi
[conda] torch-tensorrt            1.1.0                    pypi_0    pypi
[conda] torchtext                 0.11.0a0+d697db5          pypi_0    pypi
```