torch.onnx.export failed: torch.onnx.errors.SymbolicValueError: Unsupported: ONNX export of convolution for kernel of unknown shape
Labels: module: onnx, triaged

### 🐛 Describe the bug

torch.onnx.export failed with custom autograd function.
If return quant in symbolic directly, torch.onnx.export successfully.

```py
import torch


class FakeQuantizeFunction(torch.autograd.Function):
    @staticmethod
    def forward(ctx, x, scale, axis):
        return (x / scale).round().clamp(-127, 127) * scale

    @staticmethod
    def symbolic(g, x, scale, axis):
        zero_point = g.op("Constant", value_t=torch.zeros(1, dtype=torch.int32))
        quant = g.op("Horizon::QuantizeLinear", x, scale, zero_point, axis_i=axis).setType(x.type())
        # return quant
        dequant = g.op("Horizon::DeQuantizeLinear", quant, scale, zero_point, axis_i=axis).setType(x.type())
        return dequant


class Net(torch.nn.Module):
    def __init__(self):
        super(Net, self).__init__()

    def forward(self, x):
        weight = torch.randn(1, 3, 1, 1)
        weight = FakeQuantizeFunction.apply(weight, torch.ones(1), 0)
        return torch.nn.functional.conv2d(input=x, weight=weight, bias=None)


with torch.no_grad():
    net = Net()
    net.eval()
    x = torch.zeros(1, 3, 10, 10)
    print(net(x))
    onnx = torch.onnx.export(net, x, "test.onnx", verbose=True)
```

full traceback:
```sh
Torch IR graph at exception: graph(%0 : Float(1, 3, 10, 10, strides=[300, 100, 10, 1], requires_grad=0, device=cpu)):
  %100 : int[] = prim::Constant[value=[1, 3, 1, 1]]()
  %53 : NoneType = prim::Constant(), scope: __main__.Net::
  %55 : Device = prim::Constant[value="cpu"](), scope: __main__.Net:: # test.py:23:0
  %107 : Bool(device=cpu) = prim::Constant[value={0}](), scope: __main__.Net::
  %weight.3 : Float(1, 3, 1, 1, strides=[3, 1, 1, 1], requires_grad=0, device=cpu) = aten::randn(%100, %53, %53, %55, %107), scope: __main__.Net:: # test.py:23:0
  %102 : Float(1, strides=[1], requires_grad=0, device=cpu) = prim::Constant[value={1}]()
  %65 : Float(1, 3, 1, 1, strides=[3, 1, 1, 1], requires_grad=0, device=cpu) = ^FakeQuantizeFunction[inplace=0, module="__main__"](0)(%weight.3, %102), scope: __main__.Net:: # /home/users/yushu.gao/miniconda3/envs/torch20/lib/python3.8/site-packages/torch/autograd/function.py:506:0
    block0(%weight : Float(1, 3, 1, 1, strides=[3, 1, 1, 1], requires_grad=0, device=cpu), %93 : Float(1, strides=[1], requires_grad=0, device=cpu)):
      %94 : Float(1, 3, 1, 1, strides=[3, 1, 1, 1], requires_grad=0, device=cpu) = aten::div(%weight, %93), scope: __main__.Net:: # test.py:7:0
      %95 : Float(1, 3, 1, 1, strides=[3, 1, 1, 1], requires_grad=0, device=cpu) = aten::round(%94), scope: __main__.Net:: # test.py:7:0
      %108 : Long(device=cpu) = prim::Constant[value={-127}](), scope: __main__.Net::
      %109 : Long(device=cpu) = prim::Constant[value={127}](), scope: __main__.Net::
      %98 : Float(1, 3, 1, 1, strides=[3, 1, 1, 1], requires_grad=0, device=cpu) = aten::clamp(%95, %108, %109), scope: __main__.Net:: # test.py:7:0
      %99 : Float(1, 3, 1, 1, strides=[3, 1, 1, 1], requires_grad=0, device=cpu) = aten::mul(%98, %93), scope: __main__.Net:: # test.py:7:0
      -> (%99)
  %103 : int[] = prim::Constant[value=[1, 1]]()
  %104 : int[] = prim::Constant[value=[0, 0]]()
  %110 : Long(device=cpu) = prim::Constant[value={1}](), scope: __main__.Net::
  %111 : Bool(device=cpu) = prim::Constant[value={1}](), scope: __main__.Net::
  %91 : Float(1, 1, 10, 10, strides=[100, 100, 10, 1], requires_grad=0, device=cpu) = aten::_convolution(%0, %65, %53, %103, %104, %103, %107, %104, %110, %107, %107, %111, %111), scope: __main__.Net:: # test.py:25:0
  return (%91)

============= Diagnostic Run torch.onnx.export version 2.0.1+cu117 =============
verbose: False, log level: Level.ERROR
======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================

Traceback (most recent call last):
  File "test.py", line 32, in <module>
    onnx = torch.onnx.export(net, x, "test.onnx", verbose=True)
  File "/home/users/yushu.gao/miniconda3/envs/torch20/lib/python3.8/site-packages/torch/onnx/utils.py", line 506, in export
    _export(
  File "/home/users/yushu.gao/miniconda3/envs/torch20/lib/python3.8/site-packages/torch/onnx/utils.py", line 1548, in _export
    graph, params_dict, torch_out = _model_to_graph(
  File "/home/users/yushu.gao/miniconda3/envs/torch20/lib/python3.8/site-packages/torch/onnx/utils.py", line 1117, in _model_to_graph
    graph = _optimize_graph(
  File "/home/users/yushu.gao/miniconda3/envs/torch20/lib/python3.8/site-packages/torch/onnx/utils.py", line 665, in _optimize_graph
    graph = _C._jit_pass_onnx(graph, operator_export_type)
  File "/home/users/yushu.gao/miniconda3/envs/torch20/lib/python3.8/site-packages/torch/onnx/utils.py", line 1891, in _run_symbolic_function
    return symbolic_fn(graph_context, *inputs, **attrs)
  File "/home/users/yushu.gao/miniconda3/envs/torch20/lib/python3.8/site-packages/torch/onnx/symbolic_helper.py", line 306, in wrapper
    return fn(g, *args, **kwargs)
  File "/home/users/yushu.gao/miniconda3/envs/torch20/lib/python3.8/site-packages/torch/onnx/symbolic_opset9.py", line 2451, in _convolution
    raise errors.SymbolicValueError(
torch.onnx.errors.SymbolicValueError: Unsupported: ONNX export of convolution for kernel of unknown shape.  [Caused by the value '0 defined in (%0 : Float(1, 3, 10, 10, strides=[300, 100, 10, 1], requires_grad=0, device=cpu) = prim::Param()
)' (type 'Tensor') in the TorchScript graph. The containing node has kind 'prim::Param'.]

    Inputs:
        Empty
    Outputs:
        #0: 0 defined in (%0 : Float(1, 3, 10, 10, strides=[300, 100, 10, 1], requires_grad=0, device=cpu) = prim::Param()
    )  (type 'Tensor')
```

### Versions

```sh
Collecting environment information...
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: CentOS Linux 7 (Core) (x86_64)
GCC version: (GCC) 7.3.1 20180303 (Red Hat 7.3.1-5)
Clang version: Could not collect
CMake version: version 3.26.4
Libc version: glibc-2.17

Python version: 3.8.17 (default, Jul  5 2023, 21:04:15)  [GCC 11.2.0] (64-bit runtime)
Python platform: Linux-3.10.0-1160.el7.x86_64-x86_64-with-glibc2.17
Is CUDA available: True
CUDA runtime version: 11.6.55
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: 515.76
cuDNN version: Could not collect
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
Byte Order:            Little Endian
CPU(s):                96
On-line CPU(s) list:   0-95
Thread(s) per core:    2
Core(s) per socket:    24
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 85
Model name:            Intel(R) Xeon(R) Gold 6248R CPU @ 3.00GHz
Stepping:              7
CPU MHz:               3599.853
CPU max MHz:           4000.0000
CPU min MHz:           1200.0000
BogoMIPS:              6000.00
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              1024K
L3 cache:              36608K
NUMA node0 CPU(s):     0-23,48-71
NUMA node1 CPU(s):     24-47,72-95
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb cat_l3 cdp_l3 invpcid_single intel_ppin intel_pt ssbd mba ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke avx512_vnni md_clear spec_ctrl intel_stibp flush_l1d arch_capabilities

Versions of relevant libraries:
[pip3] flake8==3.9.2
[pip3] flake8-polyfill==1.0.2
[pip3] horizon-plugin-pytorch==1.8.1.dev20230712+cu117.torch201.29fc3
[pip3] mypy-extensions==1.0.0
[pip3] numpy==1.24.4
[pip3] torch==2.0.1+cu117
[pip3] torchvision==0.15.2+cu117
[pip3] triton==2.0.0
[conda] horizon-plugin-pytorch    1.8.1.dev20230712+cu117.torch201.29fc3           dev_0    <develop>
[conda] numpy                     1.24.4                   pypi_0    pypi
[conda] torch                     2.0.1+cu117              pypi_0    pypi
[conda] torchvision               0.15.2+cu117             pypi_0    pypi
[conda] triton                    2.0.0                    pypi_0    pypi
```