Implement FoldConvBatchnorm2d pass. (#25282)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/25282
For now it will be used in quantization, but it can be used as a
standalone pass too.
Couple of things are not finished at this moment:
- Batchnorm.eps value is hardcoded. This is bad and wrong, but we cannot
access fields listed in __constants__ from IR now. Once we fix this, we
should remove the hardcoded value.
- We do not remove Batchnorm submodules from the parent module even when
they were merged into a Conv. Once we figure out API for removing
attributes and modules, we should fix this.
Test Plan: Imported from OSS
Differential Revision: D17086611
Pulled By: ZolotukhinM
fbshipit-source-id: d58a947a3b2205d8f3629d693b70b9ad2b5a9102
Author
Mikhail Zolotukhin