Revert "Make device check error message more descriptive (#150750)"

This reverts commit 8253970a1f.

Reverted https://github.com/pytorch/pytorch/pull/150750 on behalf of https://github.com/huydhn due to Sorry for reverting your change but it seems to cause a test to fail in trunk ([comment](https://github.com/pytorch/pytorch/pull/150750#issuecomment-2853438985))
This commit is contained in:
PyTorch MergeBot 2025-05-06 06:42:08 +00:00
parent 460888f908
commit 451d652873

View File

@ -5,8 +5,9 @@ namespace c10::impl {
void common_device_check_failure(Device common_device, const at::Tensor& tensor, at::CheckedFrom methodName, at::CheckedFrom argName) { void common_device_check_failure(Device common_device, const at::Tensor& tensor, at::CheckedFrom methodName, at::CheckedFrom argName) {
TORCH_CHECK(false, TORCH_CHECK(false,
"Expected all tensors to be on the same device, but got ", argName, " is on ", tensor.device(), "Expected all tensors to be on the same device, but "
", different from other tensors on ", common_device, " (when checking argument in method ", methodName, ")"); "found at least two devices, ", common_device, " and ", tensor.device(), "! "
"(when checking argument for argument ", argName, " in method ", methodName, ")");
} }
} // namespace c10::impl } // namespace c10::impl