Commit 5bdcb24
committed
[Quantized DeConv Support] Enable Quantized Transposed Convs with groups==1
Supporting Quantized Transposed Convs with Groups being 1.
Previously, There was some added support for Quantized Transposed Convolutions but only when the channel axis is 1 and when the groups is 1. The current Quantizer didn't support this because it only allows quantizaing along the zero dim, which is generally the output channels. However for TransposedConvs, the dimension of the weights are:
```
[in_channels, out_channels/groups, h, w]
```
Since we want to keep quantization along the output channels, we now need to quantize along axis = 1.
The reason we require groups to be one is because XNNPACK takes in filters of the dimension:
```
[out_channels, H, W, in_channels/groups]
```
Since we are quantizing along the output channels, in pytorch we expect to have out_channels/groups scales, but in xnnpack we have out_channels scales! Realistically we would need to support this with some affine quantization, where we provide a scale for every group, every out_channel. However for now, we just ensure the constraint where groups == 1.
Differential Revision: [D76631781](https://our.internmc.facebook.com/intern/diff/D76631781/)
[ghstack-poisoned]1 parent f7cc72f commit 5bdcb24
File tree
2 files changed
+58
-100
lines changed- backends/xnnpack
- quantizer
- test/ops
2 files changed
+58
-100
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
241 | | - | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
242 | 254 | | |
243 | 255 | | |
244 | 256 | | |
| |||
311 | 323 | | |
312 | 324 | | |
313 | 325 | | |
314 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
315 | 339 | | |
316 | 340 | | |
317 | 341 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
224 | | - | |
225 | 224 | | |
226 | 225 | | |
227 | 226 | | |
| |||
240 | 239 | | |
241 | 240 | | |
242 | 241 | | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
256 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
257 | 245 | | |
258 | | - | |
259 | | - | |
260 | | - | |
261 | | - | |
262 | | - | |
263 | | - | |
264 | | - | |
265 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
266 | 256 | | |
267 | 257 | | |
268 | 258 | | |
| |||
325 | 315 | | |
326 | 316 | | |
327 | 317 | | |
328 | | - | |
329 | 318 | | |
330 | 319 | | |
331 | 320 | | |
| |||
485 | 474 | | |
486 | 475 | | |
487 | 476 | | |
488 | | - | |
489 | 477 | | |
490 | 478 | | |
491 | 479 | | |
| |||
537 | 525 | | |
538 | 526 | | |
539 | 527 | | |
540 | | - | |
541 | | - | |
542 | 528 | | |
543 | 529 | | |
544 | 530 | | |
| |||
593 | 579 | | |
594 | 580 | | |
595 | 581 | | |
596 | | - | |
| 582 | + | |
597 | 583 | | |
598 | 584 | | |
599 | 585 | | |
| |||
662 | 648 | | |
663 | 649 | | |
664 | 650 | | |
665 | | - | |
666 | | - | |
667 | | - | |
668 | | - | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
680 | | - | |
681 | | - | |
682 | | - | |
683 | | - | |
684 | | - | |
685 | | - | |
686 | | - | |
687 | | - | |
688 | | - | |
689 | | - | |
690 | | - | |
691 | | - | |
692 | | - | |
693 | | - | |
694 | | - | |
695 | | - | |
696 | | - | |
697 | | - | |
698 | | - | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
699 | 659 | | |
700 | | - | |
701 | | - | |
702 | | - | |
703 | | - | |
704 | | - | |
705 | | - | |
706 | | - | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
735 | 669 | | |
736 | 670 | | |
737 | 671 | | |
| |||
761 | 695 | | |
762 | 696 | | |
763 | 697 | | |
764 | | - | |
| 698 | + | |
765 | 699 | | |
766 | 700 | | |
767 | 701 | | |
| |||
0 commit comments