Skip to content

Commit

Permalink
Allow dense in sparse convert to function (calls create)
Browse files Browse the repository at this point in the history
  • Loading branch information
shehzan10 committed Dec 6, 2016
1 parent 0bb9f3d commit 90ee624
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/api/c/sparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,12 @@ af_err af_sparse_convert_to(af_array *out, const af_array in,
const af_storage destStorage)
{
try {
// Handle dense case
const ArrayInfo& info = getInfo(in, false, true);
if(!info.isSparse()) { // If input is dense
return af_create_sparse_array_from_dense(out, in, destStorage);
}

af_array output = 0;

const SparseArrayBase base = getSparseArrayBase(in);
Expand Down
1 change: 0 additions & 1 deletion src/backend/opencl/kernel/sparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,6 @@ namespace opencl

} catch (cl::Error err) {
CL_TO_AF_ERROR(err);
throw;
}
}

Expand Down

0 comments on commit 90ee624

Please sign in to comment.