【Hackathon 9th No.71】add test_weight_only.py by Echo-Nie · Pull Request #4109 · PaddlePaddle/FastDeploy (original) (raw)

Input shape: [2, 16]
Weight int8 shape: [16, 16]
Weight scale shape: [16]
Bias shape: [16]
Int32 accum stats: min=-430.19, max=523.19, mean=63.72
Scaled stats (after weight_scale): min=-7.14, max=9.53, mean=1.14
Final output (after bias) stats: min=-8.45, max=8.66, mean=1.37


=== Reference float output ===
[[ 2.6108642 -0.6497458  7.0613937  2.0976558  8.218029   4.234454
   2.2585444  0.29855    2.5939693 -3.258247   4.2500834  1.8264745
   2.0854921 -3.9599     8.660601   2.673855 ]
 [ 3.8692675  2.6785803 -2.6663718  5.2733607 -8.454243   1.9710996
  -2.3115897  3.712538  -0.7427913 -0.841658  -0.1247133  3.0144439
  -2.3901563  5.688132  -1.8924255 -3.824362 ]]
=== Quantized output ===
[[ 2.611  -0.65    7.062   2.098   8.22    4.234   2.258   0.2986  2.594
  -3.258   4.25    1.826   2.086  -3.959   8.664   2.674 ]
 [ 3.87    2.678  -2.666   5.273  -8.45    1.971  -2.312   3.713  -0.7427
  -0.842  -0.1247  3.014  -2.39    5.688  -1.893  -3.824 ]]
Max abs diff: 0.0034618378 , Mean abs diff: 0.00049396604
..
----------------------------------------------------------------------
Ran 4 tests in 0.127s

OK