From 7ac972edf6c1544df591e5b28d9e9ca816edb250 Mon Sep 17 00:00:00 2001 From: zhuyuhua-v Date: Tue, 18 Feb 2025 18:34:52 -0800 Subject: [PATCH] Fix nonzeros stride error. --- src/ATen/native/xpu/sycl/NonzeroKernel.cpp | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/ATen/native/xpu/sycl/NonzeroKernel.cpp b/src/ATen/native/xpu/sycl/NonzeroKernel.cpp index c956f411b..84d1687c5 100644 --- a/src/ATen/native/xpu/sycl/NonzeroKernel.cpp +++ b/src/ATen/native/xpu/sycl/NonzeroKernel.cpp @@ -103,7 +103,6 @@ void nonzero_template(const Tensor& self_, Tensor& tensor) { auto num_nonzeros = std::distance(idx_flat_begin, idx_flat_end); - // Tensor tensor_ = tensor.resize_({num_nonzeros, num_dim}).contiguous(); bool need_to_copy = tensor.dim() == 2 && tensor.sizes()[0] == num_nonzeros && tensor.sizes()[1] == self_.dim() && !tensor.t().is_contiguous(); @@ -141,12 +140,6 @@ void nonzero_template(const Tensor& self_, Tensor& tensor) { sycl_kernel_submit(wg_sz * num_wg, wg_sz, getCurrentSYCLQueue(), kfn); - // Support non-contiguous/outplace cases - // TODO: Next step, we will give state of art algo/implementation. - // Non-contiguous/outplace cases performance will be covered there. - // if (tensor.data_ptr() != tensor_.data_ptr()) { - // tensor.copy_(tensor_); - //} } if (need_to_copy) { tensor.copy_(tensor_.t());