Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made exception message for torch.LongTensor() legacy constructor more readable #46147

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions torch/csrc/utils/tensor_new.cpp
Expand Up @@ -360,9 +360,8 @@ void check_base_legacy_new(c10::DispatchKey dispatch_key, at::Layout expected_la
void check_legacy_ctor_device(c10::DispatchKey dispatch_key, c10::optional<Device> device) {
if (device.has_value()) {
TORCH_CHECK(computeDeviceType(dispatch_key) == device.value().type(),
"legacy constructor for device type: ", computeDeviceType(dispatch_key),
" was passed device type: ", device.value().type(),
", but device type must be: ", computeDeviceType(dispatch_key));
"legacy constructor expects device type: ", computeDeviceType(dispatch_key),
"but device type: ", device.value().type(), " was passed");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "but" -> ", but"

}
}

Expand Down