diff --git a/dpctl/tensor/libtensor/source/sorting/argsort.cpp b/dpctl/tensor/libtensor/source/sorting/argsort.cpp index 36701eee67..0bd998e90b 100644 --- a/dpctl/tensor/libtensor/source/sorting/argsort.cpp +++ b/dpctl/tensor/libtensor/source/sorting/argsort.cpp @@ -125,7 +125,6 @@ py_argsort(const dpctl::tensor::usm_ndarray &src, "Output index array must have data type int32 or int64"); } - // handle special case when both reduction and iteration are 1D contiguous bool is_src_c_contig = src.is_c_contiguous(); bool is_dst_c_contig = dst.is_c_contiguous(); @@ -150,7 +149,8 @@ py_argsort(const dpctl::tensor::usm_ndarray &src, return std::make_pair(keep_args_alive_ev, comp_ev); } - return std::make_pair(sycl::event(), sycl::event()); + throw py::value_error( + "Both source and destination arrays must be C-contiguous"); } using dpctl::tensor::kernels::sort_contig_fn_ptr_t; diff --git a/dpctl/tensor/libtensor/source/sorting/sort.cpp b/dpctl/tensor/libtensor/source/sorting/sort.cpp index aafc531eff..756e60bdf1 100644 --- a/dpctl/tensor/libtensor/source/sorting/sort.cpp +++ b/dpctl/tensor/libtensor/source/sorting/sort.cpp @@ -123,7 +123,6 @@ py_sort(const dpctl::tensor::usm_ndarray &src, "the same value data type"); } - // handle special case when both reduction and iteration are 1D contiguous bool is_src_c_contig = src.is_c_contiguous(); bool is_dst_c_contig = dst.is_c_contiguous(); @@ -144,7 +143,8 @@ py_sort(const dpctl::tensor::usm_ndarray &src, return std::make_pair(keep_args_alive_ev, comp_ev); } - return std::make_pair(sycl::event(), sycl::event()); + throw py::value_error( + "Both source and destination arrays must be C-contiguous"); } using dpctl::tensor::kernels::sort_contig_fn_ptr_t;