Fix torch.cdist backward CUDA error due to illegal gridDim setting (#51569)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/49928
Pull Request resolved: https://github.com/pytorch/pytorch/pull/51569
Reviewed By: mruberry
Differential Revision: D26215694
Pulled By: ngimel
fbshipit-source-id: 0710417e6a802424e2dcada325f27452c95d042f