Fix cudnn channels_last descriptors problem (#31952)
Summary:
This is to append fixes to https://github.com/pytorch/pytorch/issues/31783 so we can pull the fixes in without breaking tests.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31952
Differential Revision: D19433839
Pulled By: ngimel
fbshipit-source-id: 5b3d2f0b2a86aacd1d100dd86996ee0d63e5ee92