After trying multiple quantized models the schedule is finally produced. For 
testing purposes I am using the quantized models for MobileNetV2 from 
https://www.tensorflow.org/lite/guide/hosted_models However,  now I get at 
least two kinds of errors when generating the binary:
```
an internal invariant was violated while typechecking your program [09:34:19] 
/Users/alopez/Documents/Code/tvm/src/relay/qnn/op/convolution.cc:50: Check 
failed: data->dtype == DataType::Int(8) || data->dtype == DataType::UInt(8): 
Expected qnn conv2d type(int8, uint8) for input but was float32
```
This is part of the Relay code:
```
  %0 = layout_transform(%input, src_layout="NHWC", dst_layout="NCHW");
  %1 = layout_transform(%v_param_1, src_layout="HWIO", dst_layout="OIHW");
  %2 = qnn.conv2d(%0, %1, 128, 122, 0.0078125f, 0.0339689f, strides=[2, 2], 
padding=[0, 0, 1, 1], channels=32, kernel_size=[3, 3], out_dtype="int32") an 
internal invariant was violated while typechecking your program [09:34:19] 
/Users/alopez/Documents/Code/tvm/src/relay/qnn/op/convolution.cc:50: Check 
failed: data->dtype == DataType::Int(8) || data->dtype == DataType::UInt(8): 
Expected qnn conv2d type(int8, uint8) for input but was float32
  %3 = expand_dims(%v_param_2, axis=0, num_newaxis=3);
  %4 = layout_transform(%3, src_layout="NHWC", dst_layout="NCHW");
  %5 = add(%2, %4);
  %6 = qnn.requantize(%5, 0.000265382f, 0, 0.0235285f, 0, axis=1, 
out_dtype="uint8") an internal invariant was violated while typechecking your 
program [09:34:19] 
/Users/alopez/Documents/Code/tvm/src/relay/qnn/op/requantize.cc:250: Check 
failed: data != nullptr: 
```
I see two problems:

1. `qnn.conv2d` is listing two float values as inputs, which considering that 
the model is quantized it seems strange. I think its getting confused by the 
scale/zero point in the quantization parameters?
2. `qnn.requantize` is returning a null pointer?

I'll continue looking, but wanted to ask if anyone has seen similar problems 
with optimizing quantized models.

Regards...





---
[Visit 
Topic](https://discuss.tvm.ai/t/autotvm-task-extract-from-program-in-tflite/6578/7)
 to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.tvm.ai/email/unsubscribe/3c194db58deb5bb424b58e78afef0ab28f252375111ed65ef325f8f55dfb6ad4).

Reply via email to