ONNX converter does not properly trace dynamic axis through graph
Labels: module: onnx, triaged

### 🐛 Describe the bug

When exporting a model that uses `TransformerEncoder` to onnx using the `dynamic_axes` parameter, the onnx converter appears to not trace this dynamic axis through the graph. It exports fine, but then on inference the model expects the shape of the input that was used to export, despite specifying that dimension as dynamic. 

```python
torch.onnx.export(model.cpu(), X.cpu().view(1536,1), "model.onnx", verbose=False, input_names=['model_inputs'], output_names=['model_outputs'], dynamic_axes={'model_inputs':[0], 'model_outputs':[0]}) # note dummy input has len 1536

# test seq len is only 1024
seq_len_test = 1024
data = np.random.randint(0,1000,1024)
x_test = np.array(data).reshape(-1,1)

sess = rt.InferenceSession(r"model.onnx", providers=['CPUExecutionProvider'])
output = sess.run(None, {'model_inputs': x_test})[0]
```
and the error:
```
Exception has occurred: RuntimeException       (note: full exception trace is shown but execution is paused at: <module>)
[ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Non-zero status code returned while running Reshape node. Name:'/transformer_encoder/layers.0/self_attn/Reshape_4' Status Message: C:\a\_work\2\s\onnxruntime\core\providers\cpu\tensor\reshape_helper.h:45 onnxruntime::ReshapeHelper::ReshapeHelper input_shape_size == size was false. The input tensor cannot be reshaped to the requested shape. Input shape:{1024,1,24}, requested shape:{1536,1,24}
```

I noticed another user reported similar error here https://github.com/onnx/onnx/issues/654#issuecomment-522181384 but it was never resolved

### Versions

Collecting environment information...
PyTorch version: 2.1.0+cu118
Is debug build: False
CUDA used to build PyTorch: 11.8
ROCM used to build PyTorch: N/A

OS: Microsoft Windows 10 Pro
GCC version: Could not collect
Clang version: Could not collect
CMake version: version 3.21.2
Libc version: N/A

Python version: 3.10.0 | packaged by conda-forge | (default, Nov 10 2021, 13:20:59) [MSC v.1916 64 bit (AMD64)] (64-bit runtime)
Python platform: Windows-10-10.0.19045-SP0
Is CUDA available: True
CUDA runtime version: 10.0.130
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: GeForce RTX 2070
Nvidia driver version: 457.51
cuDNN version: Could not collect
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture=9
CurrentClockSpeed=3800
DeviceID=CPU0
Family=107
L2CacheSize=6144
L2CacheSpeed=
Manufacturer=AuthenticAMD
MaxClockSpeed=3800
Name=AMD Ryzen 9 3900X 12-Core Processor
ProcessorType=3
Revision=28928

Versions of relevant libraries:
[pip3] numpy==1.24.1
[pip3] onnx==1.14.1
[pip3] onnxruntime==1.16.0
[pip3] onnxruntime-gpu==1.16.0
[pip3] torch==2.1.0+cu118
[pip3] torchaudio==2.1.0+cu118
[pip3] torchvision==0.16.0+cu118
[conda] numpy                     1.24.1                   pypi_0    pypi
[conda] torch                     2.1.0+cu118              pypi_0    pypi
[conda] torchaudio                2.1.0+cu118              pypi_0    pypi
[conda] torchvision               0.16.0+cu118             pypi_0    pypi