torch1.13  quantized model export onnx error
Labels: module: onnx, triaged

### 🐛 Describe the bug

model_quantized = model_quantized.cpu()

torch.onnx.export(
model_quantized,
inp,
file_onnx,
export_params = True,
opset_version=13,
verbose = True,
)

Traceback (most recent call last):
  File "test2.py", line 18, in <module>
    torch.onnx.export(
  File "/opt/conda/envs/torch13/lib/python3.8/site-packages/torch/onnx/utils.py", line 504, in export
    _export(
  File "/opt/conda/envs/torch13/lib/python3.8/site-packages/torch/onnx/utils.py", line 1568, in _export
    ) = graph._export_onnx(  # type: ignore[attr-defined]
RuntimeError: !node->kind().is_aten() && !node->kind().is_prim() && !node->kind().is_attr() INTERNAL ASSERT FAILED at "../torch/csrc/jit/serialization/export.cpp":891, please report a bug to PyTorch. 

### Versions

PyTorch version: 1.13.0+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Ubuntu 18.04.5 LTS (x86_64)
GCC version: (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Clang version: Could not collect
CMake version: Could not collect
Libc version: glibc-2.31

Python version: 3.8.8 (default, Feb 24 2021, 21:46:12)  [GCC 7.3.0] (64-bit runtime)
Python platform: Linux-5.15.0-53-generic-x86_64-with-glibc2.10
Is CUDA available: True
CUDA runtime version: 11.1.105
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
GPU 3: NVIDIA GeForce RTX 3090

Nvidia driver version: 470.141.03
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.0.5
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.0.5
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
[pip3] torch-pruning==0.2.8
[pip3] torch-summary==1.4.5
[pip3] torchelastic==0.2.2
[pip3] torchreid==1.4.0
[pip3] torchstat==0.0.6
[pip3] torchsummaryX==1.3.0
[pip3] torchtext==0.9.0
[pip3] torchvision==0.14.0
[conda] autotorch                 0.0.1                    pypi_0    pypi
[conda] blas                      1.0                         mkl  
[conda] cudatoolkit               11.1.74              h6bb024c_0    nvidia
[conda] ffmpeg                    4.3                  hf484d3e_0    pytorch
[conda] mkl                       2020.2                      256  
[conda] mkl-service               2.3.0            py38he904b0f_0  
[conda] mkl_fft                   1.3.0            py38h54f3939_0  
[conda] mkl_random                1.1.1            py38h0573a6f_0  
[conda] numpy                     1.23.3                   pypi_0    pypi
[conda] numpy-base                1.19.2           py38hfa32c7d_0  
[conda] torch                     1.13.0                   pypi_0    pypi
[conda] torch-pruning             0.2.8                    pypi_0    pypi
[conda] torch-summary             1.4.5                    pypi_0    pypi
[conda] torchelastic              0.2.2                    pypi_0    pypi
[conda] torchreid                 1.4.0                    pypi_0    pypi
[conda] torchstat                 0.0.6                    pypi_0    pypi
[conda] torchsummaryx             1.3.0                    pypi_0    pypi
[conda] torchtext                 0.9.0                      py38    pytorch
[conda] torchvision               0.14.0                   pypi_0    pypi