Commit 40312b5
[converter] Fix negative axis in quantize/dequantize lowering (#24)
* [converter] Fix negative axis in quantize/dequantize lowering
The quantize/dequantize lowering normalized a negative axis as
axis + rank - 1, off by one from the eager op, which resolves it as
axis + rank. A per-channel axis=-1 was applied one dimension early, so
the converted model used the wrong channel; when the channel and a
neighbor dim share a size this is silent, with no shape error.
Normalize a negative axis as axis + rank, matching the eager op. Add
per-channel negative-axis numerical tests for both ops. They use a
(2, 4, 4) shape with equal middle and channel dims so a wrong axis
surfaces as a numerical mismatch rather than a reshape error.
* Parametrize negative-axis tests over equal and distinct dims
---------
Co-authored-by: Henry Tao <55294647+jakesabathia2@users.noreply.github.com>1 parent a43cc84 commit 40312b5
2 files changed
Lines changed: 56 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
| 302 | + | |
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
411 | 411 | | |
412 | 412 | | |
413 | 413 | | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
414 | 438 | | |
415 | 439 | | |
416 | 440 | | |
| |||
540 | 564 | | |
541 | 565 | | |
542 | 566 | | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
543 | 597 | | |
544 | 598 | | |
545 | 599 | | |
| |||
0 commit comments