Commit fb90480
committed
Arm backend: Set fixed qparams for acos, asin and atanh
acos, asin and atanh have shown to be problematic to quantize properly
due to their limited input range between [-1, 1] (inclusively for asin
and acos and exclusively for atanh). Before this patch, the approach for
quantizing these ops was to use the quantization spec from the
quantization config (typically a HistogramObserver if using deafult
symmetric quantization config). This caused problems when calibrating
the model with inputs close to -1 or 1, because they could land outside
the valid range of the operator. When this happened, the resulting TABLE
op set the output of these outliers to zero, which is not ideal.
To mitigate this problem, use fixed quantization params for these ops by
statically defining them in quantization_annotator.py. With this
solution, we potentially lose a bit of numerical precision because the
ops won't be affected by quantization calibration at all, but the
resulting TABLE ops won't set any zeros since there is no input that
can be outside the [-1, 1] interval anymore.
Signed-off-by: Martin Lindström <Martin.Lindstroem@arm.com>
Change-Id: Id55156be5ca7fcfbf9f9c3f8ae88fb075509ce0c1 parent e5be6d5 commit fb90480
4 files changed
Lines changed: 56 additions & 12 deletions
File tree
- backends/arm
- quantizer
- test/ops
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
| 24 | + | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| |||
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
81 | 88 | | |
82 | 89 | | |
83 | 90 | | |
| |||
443 | 450 | | |
444 | 451 | | |
445 | 452 | | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
446 | 476 | | |
447 | 477 | | |
448 | 478 | | |
| |||
474 | 504 | | |
475 | 505 | | |
476 | 506 | | |
477 | | - | |
478 | | - | |
479 | 507 | | |
480 | 508 | | |
481 | | - | |
482 | 509 | | |
483 | 510 | | |
484 | 511 | | |
| |||
784 | 811 | | |
785 | 812 | | |
786 | 813 | | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
787 | 833 | | |
788 | 834 | | |
789 | 835 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | 68 | | |
70 | 69 | | |
71 | 70 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | 58 | | |
61 | 59 | | |
62 | 60 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
33 | | - | |
| 32 | + | |
34 | 33 | | |
35 | 34 | | |
36 | 35 | | |
| |||
58 | 57 | | |
59 | 58 | | |
60 | 59 | | |
61 | | - | |
62 | | - | |
63 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
64 | 65 | | |
65 | 66 | | |
66 | 67 | | |
| |||
0 commit comments