Skip to content

Commit

Permalink
Fix nonzeros stride error.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhuyuhua-v committed Feb 19, 2025
1 parent d56da4d commit 7ac972e
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/ATen/native/xpu/sycl/NonzeroKernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 7ac972e

Please sign in to comment.