Add memory format support to the `resize_` op. (#28292)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/28292
Allows to simplify patterns like:
1.
output.resize_({sizeB, sizeC, osizeH, osizeW}).as_strided_({sizeB, sizeC, osizeH, osizeW}, {sizeC*osizeH*osizeW, 1, osizeW*sizeC, sizeC});
2.
output.resize_({nbatch, nInputPlane, outputHeight, outputWidth});
indices.resize_({nbatch, nInputPlane, outputHeight, outputWidth});
output.unsafeGetTensorImpl()->empty_tensor_restride(memory_format);
indices.unsafeGetTensorImpl()->empty_tensor_restride(memory_format);
3.
gradInput.resize_as_(input);
gradInput.unsafeGetTensorImpl()->empty_tensor_restride(memory_format);
Test Plan: Imported from OSS
Differential Revision: D18044978
Pulled By: VitalyFedyunin
fbshipit-source-id: bbf67c25f9cf88bc6e949089a3b247df50f86dc4