Skip to content

Commit 79fc0a9

Browse files
chunhuanMengpytorchmergebot
authored andcommitted
[xpu][fix]Fall back deterministic index_copy to index_put on XPU (pytorch#167830)
A minor update has been made to the deterministic behavior checks in the `index_copy_out` implementation. This change ensures that deterministic `index_copy` is dispatched to `index_put` not only for CUDA tensors but also for XPU tensors. Pull Request resolved: pytorch#167830 Approved by: https://github.com/guangyey, https://github.com/ezyang
1 parent d01a7b0 commit 79fc0a9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

aten/src/ATen/native/TensorAdvancedIndexing.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1087,7 +1087,8 @@ TORCH_IMPL_FUNC(index_copy_out)
10871087
result.copy_(self);
10881088

10891089
// See Note [Enabling Deterministic Operations]
1090-
if (result.is_cuda() && globalContext().deterministicAlgorithms()) {
1090+
if ((result.is_cuda() || result.is_xpu()) &&
1091+
globalContext().deterministicAlgorithms()) {
10911092
torch::List<std::optional<Tensor>> indices;
10921093
indices.resize(dim + 1);
10931094
indices.set(dim, index);

0 commit comments

Comments
 (0)