apache / tvm

Open deep learning compiler stack for cpu, gpu and specialized accelerators
https://tvm.apache.org/
Apache License 2.0
11.67k stars 3.45k forks source link

[BUG][Relay][QNN] relay.qnn.op.conv2d failed with group > 1 and weight scale's length is [out_c] #8299

Closed junluan closed 2 weeks ago

junluan commented 3 years ago

For example:

When the input tensor with shape [1, 256, 56, 56], weight tensor with shape [256, 8, 3, 3], weight scale with shape [256], group is 32, then this can be failed because of this check: https://github.com/apache/tvm/blob/main/src/relay/qnn/op/convolution.cc#L81

This check needs weight scale's length is the same as out_c * in_c / group. But when I use a quantized pytorch pretrained model, such as torchvision.models.quantization.resnext101_32x8d, it's weight scale's length is [out_c]. I changed this requirement to out_c, it works fine.

Thank you.

masahi commented 3 years ago

Sounds like the same problem in https://github.com/apache/tvm/issues/7878?

Pinging @anijain2305 for the bug fix.