Skip to content

[Bug][FQ2I] Failed to run FakeQuantizationToInteger on QDQ ONNX model #13545

@Nullkooland

Description

@Nullkooland

Actual behavior

When I try to apply FakeQuantizationToInteger pass on a Relay IRModule imported from an ONNX model with QDQ quantization representation, it failed with this error message:

  ......
        at .../tvm/include/tvm/runtime/packed_func.h:1646
  1: tvm::relay::qnn::QnnBroadcastRel(tvm::runtime::Array<tvm::Type, void> const&, int, tvm::Attrs const&, tvm::TypeReporter const&)
        at .../tvm/src/relay/qnn/op/op_common.h:310
  0: tvm::relay::qnn::IsScalarType(tvm::Type const&, tvm::runtime::DataType const&)
        at .../tvm/src/relay/qnn/op/../utils.h:225
  File ".../tvm/src/relay/analysis/type_solver.cc", line 624
TVMError: 
---------------------------------------------------------------
An error occurred during the execution of TVM.
For more information, please see: https://tvm.apache.org/docs/errors.html
---------------------------------------------------------------
  Check failed: (false) is false: [16:42:40] .../tvm/src/relay/qnn/op/../utils.h:225: 
---------------------------------------------------------------
An error occurred during the execution of TVM.
For more information, please see: https://tvm.apache.org/docs/errors.html
---------------------------------------------------------------

  Check failed: tensor_type->shape.size() == 0 (1 vs. 0) : 

Environment

TVM v0.10.0

Steps to reproduce

Here is the code to reproduce the BUG:

model_onnx = onnx.load(onnx_path)
ir_mod, _ = relay.frontend.from_onnx(
    model_onnx,
    shape={"input": (1, 3, 224, 224)},
    freeze_params=True
)

passes = tvm.transform.Sequential([
    relay.transform.InferType(),
    relay.transform.FakeQuantizationToInteger(),
])
ir_mod = passes(ir_mod)

Here is the quantized ONNX model with QDQ representation.
regnet_x_400mf_qint8.onnx.tar.gz

Triage

Please refer to the list of label tags here to find the relevant tags and add them below in a bullet format (example below).

  • relay:qnn
  • frontend:onnx

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triagePRs or issues that need to be investigated by maintainers to find the right assignees to address ittype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions