This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: The Model Converted From QAT ONNX model runs different result with model run using XNN

Part Number: TDA4VM

We are using QAT ONNX model for developing in TDA4 which is sample resnet18 for example, part of onnx is as follows.

 .  

When try to convert above model to TIDL model, I found two problem.

Firstly, Maxpool and GlobalAvgPool will still use ptq for collect tensor range, it is resonable for GlobalAvgPool, because  GlobalAvgPool Layer is not added Clip Layer using XNN quantized converterxnn.quantize.QuantTrainModule. But the Clip is added after Maxpool, but I see that Clip is transformed into BatchNorm Layer and Pooling need to recollect tensor from PTQ. So it is hard to understand.

Secondly, I run model using TIDL inference, and I can only get int format result even if i set writeOut=2, and I get the result from origin pytorch, xnn model and TIDL inference result.

Pytorch: tensor([[-5.1596, -0.8653, -3.6556, 14.2688, -8.3482, 10.9232, 2.4652, -5.4396, -2.9282, -3.8955]], grad_fn=<AddmmBackward>) 

XNN Model: tensor([[-5.5000, -1.0000, -3.5000, 15.0000, -8.5000, 11.0000, 3.0000, -5.5000, -3.5000, -4.0000]], grad_fn=<CloneBackward>) 

TIDL Inference: [ -5.0 -1.0 -4.0 14.0 -8.0 12.0 2.0 -5.0 -3.0 -4.0]

I Try to locate this error and I found that In last layer of tidl, the output tensorScale is set into 1, but from range -64, 64 the tensorScale should be 2. So I think it Scale is the reason for only returning int value, and How can I fix this problem.

Meanwhile, How can i upload onnx model and tidl svg file as attach file.