Refactored the duplicate code into a function in _ConvNd (#43525)
Summary:
Fixes #{issue number}
Pull Request resolved: https://github.com/pytorch/pytorch/pull/43525
Reviewed By: ngimel
Differential Revision: D23306593
Pulled By: jerryzh168
fbshipit-source-id: 3427cd2b9132a203858477b6c858d59b00e1282e