[quant] Input-Weight Equalization - Conv prepare support (#61286)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/61286
Modifies the prepare step to support conv layers during input-weight equalization and adds tests to make sure that the results are as expected.
Initial:
```
w
|
x -> conv -> y
```
After prepare:
```
w
|
weight_quant_obs
|
weight_eq_obs
|
x -> input_quant_obs -> input_eq_obs -> conv -> out_quant_obs -> y
```
Test Plan:
`python test/test_quantization.py TestEqualizeFx.test_input_weight_equalization_prepare`
Initial:
```
ConvModel(
(conv): Conv2d(3, 5, kernel_size=(3, 3), stride=(1, 1), bias=False)
)
```
After prepare:
```
graph():
%x : [#users=1] = placeholder[target=x]
%x_activation_post_process_0 : [#users=1] = call_module[target=x_activation_post_process_0](args = (%x,), kwargs = {})
%x_activation_post_process_0_equalization_process_0 : [#users=1] = call_module[target=x_activation_post_process_0_equalization_process_0](args = (%x_activation_post_process_0,), kwargs = {})
%conv : [#users=1] = call_module[target=conv](args = (%x_activation_post_process_0_equalization_process_0,), kwargs = {})
%conv_activation_post_process_0 : [#users=1] = call_module[target=conv_activation_post_process_0](args = (%conv,), kwargs = {})
return conv_activation_post_process_0
```
Imported from OSS
Reviewed By: supriyar
Differential Revision: D29557051
fbshipit-source-id: 25d1531645dfaf565f5c615e2ee850fcf96c7eb9