From 451d652873c1e56bdff232d212c475b2c6ff4346 Mon Sep 17 00:00:00 2001 From: PyTorch MergeBot Date: Tue, 6 May 2025 06:42:08 +0000 Subject: [PATCH] Revert "Make device check error message more descriptive (#150750)" This reverts commit 8253970a1f90a5b0b1fe0d4febd949470f6fa265. 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)) --- aten/src/ATen/core/adaption.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/aten/src/ATen/core/adaption.cpp b/aten/src/ATen/core/adaption.cpp index abb21d31e04..ef06b9606ba 100644 --- a/aten/src/ATen/core/adaption.cpp +++ b/aten/src/ATen/core/adaption.cpp @@ -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) { TORCH_CHECK(false, - "Expected all tensors to be on the same device, but got ", argName, " is on ", tensor.device(), - ", different from other tensors on ", common_device, " (when checking argument in method ", methodName, ")"); + "Expected all tensors to be on the same device, but " + "found at least two devices, ", common_device, " and ", tensor.device(), "! " + "(when checking argument for argument ", argName, " in method ", methodName, ")"); } } // namespace c10::impl