Cannot export a quantized model that permutes a quantized tensor to ONNX
Labels: module: onnx, oncall: quantization, triaged

### 🐛 Describe the bug

I'm attempting to export a quantized model to ONNX that contains a number of tensor permutations. The input (and expected output) of these permutations are quantized tensors.
I can successfully quantize the model via `prepare_fx` and `convert_fx`, and generate a ScriptModule via `torch.jit.script`. However, attempts to export the quantized model to ONNX fail. ONNX (and ONNX Runtime) support permutation (they call it transpose) of quantized tensors, but it appears the symbolic function itself doesn't support the quantized version of the base operator.

This simple model reproduces the error.
```
import io
import torch
from torch.ao.quantization import (
    get_default_qconfig_mapping,
    get_default_qconfig,
)
from torch.ao.quantization.quantize_fx import (
    prepare_fx,
    convert_fx,
)


class TransposeModel(torch.nn.Module):
    def __init__(self, dims: torch.types._size):
        super().__init__()

        self.dims = dims

    def forward(self, x: torch.Tensor) -> torch.Tensor:
        # x = torch.permute(x, self.dims)
        x = x.permute(self.dims)

        return x


if __name__ == "__main__":
    model = TransposeModel(dims=(0, 2, 1))
    qconfig = get_default_qconfig("qnnpack")
    qconfig_mapping = get_default_qconfig_mapping("qnnpack") \
        .set_global(qconfig)

    inputs = {
        "x": torch.reshape(torch.arange(0, 99, dtype=torch.float32), (1, 3, 33)),
    }

    prepared = prepare_fx(
        model=model,
        qconfig_mapping=qconfig_mapping,
        example_inputs=tuple((v for v in inputs.values())),
    )

    quantized = convert_fx(
        graph_module=prepared,
        qconfig_mapping=qconfig_mapping,
    )

    quantized.graph.print_tabular()

    script_module = torch.jit.script(
        obj=quantized,
        example_inputs=[tuple((v for v in inputs.values()))],
    )

    with io.BytesIO() as f:
        torch.onnx.export(
            f=f,
            model=script_module,
            args=[v for v in inputs.values()],
            input_names=["x"],
            output_names=["x"],
            verbose=True,
        )
```

The error itself:
```
torch.onnx.errors.SymbolicValueError: ONNX symbolic expected the output of `%permute : Tensor(*, *, *) = onnx::Transpose[perm=[0, 2, 1]](%quantize_per_tensor), scope: torch.fx.graph_module.GraphModule:: # <eval_with_key>.6:8:14
` to be a quantized tensor. Is this likely due to missing support for quantized `onnx::Transpose`. Please create an issue on https://github.com/pytorch/pytorch/issues  [Caused by the value 'permute defined in (%permute : Tensor(*, *, *) = onnx::Transpose[perm=[0, 2, 1]](%quantize_per_tensor), scope: torch.fx.graph_module.GraphModule:: # <eval_with_key>.6:8:14
)' (type 'Tensor') in the TorchScript graph. The containing node has kind 'onnx::Transpose'.] 
    (node defined in   File "<eval_with_key>.6", line 8
    _input_zero_point_0 = self._input_zero_point_0
    quantize_per_tensor = torch.quantize_per_tensor(x, _input_scale_0, _input_zero_point_0, torch.quint8);  x = _input_scale_0 = _input_zero_point_0 = None
    permute = quantize_per_tensor.permute((0, 2, 1));  quantize_per_tensor = None
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~ <--- HERE
    dequantize_1 = permute.dequantize();  permute = None
    return dequantize_1
)

    Inputs:
        #0: quantize_per_tensor defined in (%quantize_per_tensor : Tensor = prim::TupleConstruct(%7, %6, %5), scope: torch.fx.graph_module.GraphModule:: # <eval_with_key>.6:7:26
    )  (type 'Tensor')
    Outputs:
        #0: permute defined in (%permute : Tensor(*, *, *) = onnx::Transpose[perm=[0, 2, 1]](%quantize_per_tensor), scope: torch.fx.graph_module.GraphModule:: # <eval_with_key>.6:8:14
    )  (type 'Tensor')
```

### Versions

PyTorch version: 2.0.1+cu117
Is debug build: False
CUDA used to build PyTorch: 11.7
ROCM used to build PyTorch: N/A

OS: Ubuntu 22.04.2 LTS (x86_64)
GCC version: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Clang version: Could not collect
CMake version: version 3.27.4
Libc version: glibc-2.35

Python version: 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] (64-bit runtime)
Python platform: Linux-5.15.0-83-generic-x86_64-with-glibc2.35
Is CUDA available: True
CUDA runtime version: Could not collect
CUDA_MODULE_LOADING set to: LAZY
GPU models and configuration: GPU 0: NVIDIA GeForce RTX 4090
Nvidia driver version: 525.125.06
cuDNN version: Probably one of the following:
/usr/lib/x86_64-linux-gnu/libcudnn.so.8.9.3
/usr/lib/x86_64-linux-gnu/libcudnn_adv_infer.so.8.9.3
/usr/lib/x86_64-linux-gnu/libcudnn_adv_train.so.8.9.3
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_infer.so.8.9.3
/usr/lib/x86_64-linux-gnu/libcudnn_cnn_train.so.8.9.3
/usr/lib/x86_64-linux-gnu/libcudnn_ops_infer.so.8.9.3
/usr/lib/x86_64-linux-gnu/libcudnn_ops_train.so.8.9.3
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True

CPU:
Architecture:                       x86_64
CPU op-mode(s):                     32-bit, 64-bit
Address sizes:                      48 bits physical, 48 bits virtual
Byte Order:                         Little Endian
CPU(s):                             32
On-line CPU(s) list:                0-31
Vendor ID:                          AuthenticAMD
Model name:                         AMD Ryzen 9 7950X 16-Core Processor
CPU family:                         25
Model:                              97
Thread(s) per core:                 2
Core(s) per socket:                 16
Socket(s):                          1
Stepping:                           2
Frequency boost:                    enabled
CPU max MHz:                        5879.8818
CPU min MHz:                        3000.0000
BogoMIPS:                           8982.37
Flags:                              fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt pdpe1gb rdtscp lm constant_tsc rep_good nopl nonstop_tsc cpuid extd_apicid aperfmperf rapl pni pclmulqdq monitor ssse3 fma cx16 sse4_1 sse4_2 x2apic movbe popcnt aes xsave avx f16c rdrand lahf_lm cmp_legacy svm extapic cr8_legacy abm sse4a misalignsse 3dnowprefetch osvw ibs skinit wdt tce topoext perfctr_core perfctr_nb bpext perfctr_llc mwaitx cpb cat_l3 cdp_l3 hw_pstate ssbd mba ibrs ibpb stibp vmmcall fsgsbase bmi1 avx2 smep bmi2 erms invpcid cqm rdt_a avx512f avx512dq rdseed adx smap avx512ifma clflushopt clwb avx512cd sha_ni avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local avx512_bf16 clzero irperf xsaveerptr rdpru wbnoinvd cppc arat npt lbrv svm_lock nrip_save tsc_scale vmcb_clean flushbyasid decodeassists pausefilter pfthreshold avic v_vmsave_vmload vgif v_spec_ctrl avx512vbmi umip pku ospke avx512_vbmi2 gfni vaes vpclmulqdq avx512_vnni avx512_bitalg avx512_vpopcntdq rdpid overflow_recov succor smca fsrm flush_l1d
Virtualization:                     AMD-V
L1d cache:                          512 KiB (16 instances)
L1i cache:                          512 KiB (16 instances)
L2 cache:                           16 MiB (16 instances)
L3 cache:                           64 MiB (2 instances)
NUMA node(s):                       1
NUMA node0 CPU(s):                  0-31
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit:        Not affected
Vulnerability L1tf:                 Not affected
Vulnerability Mds:                  Not affected
Vulnerability Meltdown:             Not affected
Vulnerability Mmio stale data:      Not affected
Vulnerability Retbleed:             Not affected
Vulnerability Spec store bypass:    Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:           Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:           Mitigation; Retpolines, IBPB conditional, IBRS_FW, STIBP always-on, RSB filling, PBRSB-eIBRS Not affected
Vulnerability Srbds:                Not affected
Vulnerability Tsx async abort:      Not affected

Versions of relevant libraries:
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.25.2
[pip3] torch==2.0.1
[pip3] triton==2.0.0
[conda] Could not collect

cc @jerryzh168 @jianyuh @raghuramank100 @jamesr66a @vkuzo @jgong5 @Xia-Weiwen @leslie-fang-intel