Fix cdist backward for empty inputs (#56606)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/56606
Test Plan: Imported from OSS
Reviewed By: ailzhang
Differential Revision: D27939201
Pulled By: albanD
fbshipit-source-id: 7ac2b579577cc5b58e714935d791be26478eb83c