8000 index_put_ for complex tensors on CUDA · pytorch/pytorch@6d4948d · GitHub
[go: up one dir, main page]

8000
Skip to content

Commit 6d4948d

Browse files
committed
index_put_ for complex tensors on CUDA
ghstack-source-id: 4eb68c4 Pull Request resolved: #51148
1 parent ba316a7 commit 6d4948d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

aten/src/ATen/native/cuda/Indexing.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ void index_put_accum_kernel(Tensor & self, const c10::List<c10::optional<Tensor>
230230
std::min(std::max<int>(1,nElemBefore), at::cuda::getCurrentDeviceProperties()->maxGridSize[2]));
231231
dim3 block(C10_WARP_SIZE, indices_per_block);
232232

233-
AT_DISPATCH_ALL_TYPES_AND3(at::ScalarType::Half, at::ScalarType::Bool, at::ScalarType::BFloat16,
233+
AT_DISPATCH_ALL_TYPES_AND_COMPLEX_AND3(at::ScalarType::Half, at::ScalarType::Bool, at::ScalarType::BFloat16,
234234
value_.scalar_type(), "indexing_backward", [&] {
235235
indexing_backward_kernel<scalar_t, UNROLL><<<grid, block, 0, stream>>>(
236236
sorted_indices.data_ptr<int64_t>(),

test/test_indexing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,9 +762,9 @@ def test_int_indices(self, device):
762762
self.assertEqual(v[:, [0, 4, 2]].shape, (5, 3, 3))
763763
self.assertEqual(v[:, [[0, 1], [4, 3]]].shape, (5, 2, 2, 3))
764764

765-
@dtypes(torch.float, torch.bfloat16, torch.long, torch.bool)
766-
@dtypesIfCPU(torch.float, torch.long, torch.bool, torch.bfloat16)
767-
@dtypesIfCUDA(torch.half, torch.long, torch.bool, torch.bfloat16)
765+
@dtypes(torch.cfloat, torch.cdouble, torch.float, torch.bfloat16, torch.long, torch.bool)
766+
@dtypesIfCPU(torch.cfloat, torch.cdouble, torch.float, torch.long, torch.bool, torch.bfloat16)
767+
@dtypesIfCUDA(torch.cfloat, torch.cdouble, torch.half, torch.long, torch.bool, torch.bfloat16)
768768
def test_index_put_src_datatype(self, device, dtype):
769769
src = torch.ones(3, 2, 4, device=device, dtype=dtype)
770770
vals = torch.ones(3, 2, 4, device=device, dtype=dtype)

0 commit comments

Comments
 (0)
0