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

Add bool tensor support for where #47454

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion aten/src/ATen/native/cpu/TensorCompareKernel.cpp
Expand Up @@ -183,7 +183,7 @@ static void _aminmax_kernel_impl(
}

static void where_kernel_impl(TensorIterator &iter, ScalarType condition_type) {
AT_DISPATCH_ALL_TYPES_AND_COMPLEX(iter.dtype(), "where_cpu", [&] {
AT_DISPATCH_ALL_TYPES_AND_COMPLEX_AND(at::ScalarType::Bool, iter.dtype(), "where_cpu", [&] {
if (condition_type == at::ScalarType::Byte) {
cpu_kernel(
iter,
Expand Down
4 changes: 2 additions & 2 deletions test/test_torch.py
Expand Up @@ -406,8 +406,8 @@ def get_tensor(size, dtype, device, contiguous):
height = 5
width = 5
for device in torch.testing.get_all_device_types():
for dt1 in torch.testing.get_all_math_dtypes(device):
for dt2 in torch.testing.get_all_math_dtypes(device):
for dt1 in torch.testing.get_all_dtypes(include_half=device.startswith('cuda'), include_bfloat16=False):
for dt2 in torch.testing.get_all_dtypes(include_half=device.startswith('cuda'), include_bfloat16=False):
for contiguous in [True, False]:
x1 = get_tensor((height, width), dt1, device, contiguous)
x2 = get_tensor((height, width), dt2, device, contiguous)
Expand Down