convbn fusion: add backwards compatibility support (#38820)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/38820
Missed this on https://github.com/pytorch/pytorch/pull/38478/ -
the conv BN refactor was not backwards compatible because it
changed the state dict keys.
This PR adds logic to load the state dict from the old format.
Test Plan:
create ConvBn2d module instance and save state dict:
https://gist.github.com/vkuzo/5ed4701c122f629a51988d0748a3223e
load ConvBn2d from state dict:
https://gist.github.com/vkuzo/f97cb52057b6c7792920b8ae407f646b
verify that all valid permutations of above between v1 and v2 work correctly
Imported from OSS
Differential Revision: D21671329
fbshipit-source-id: 91b9ce88f99500bf4f1868ba638f1c90a594f0da