Hello,
Trying to put an ONNX model through relay.frontend.from_onnx
to get an IRModule results in
the following error:
The Relay type checker is unable to show the following types match.
In particular dimension 0 conflicts: 1 does not match 96.
The Relay type checker is unable to show the following types match.
In particular `Tensor[(96), float32]` does not match `Tensor[(1), float32]`
This error was encountered with the quantized ONNX CaffeNet-int8 model that can be
found here: https://github.com/onnx/models/tree/master/vision/classification/caffenet
import onnx
from tvm import relay
model_path = "/path/to/caffenet-12-int8.onnx"
onnx_model = onnx.load(model_path)
shape_dict = {'data_0': (1, 3, 224, 224)}
mod, params = relay.frontend.from_onnx(onnx_model, shape_dict)
The error seems to be emitted when calling infer_shape
from here:
The input to the pooling operation is the output of the QLinearConv which can be seen from the image above and the same
error can be generated if infer_shape
is called with the output of _qnn.op.requantize
as its argument here:
The reference to Tensor[(96), float32]
is most likely pointing to w_scale
and
the subsequently generated requantize_scale
since their TensorType is of the value
TensorType([96], float32)
.