Skip to content

Add dtype and manipulation functions #1566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion dpnp/dpnp_algo/dpnp_algo.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ include "dpnp_algo_counting.pxi"
include "dpnp_algo_indexing.pxi"
include "dpnp_algo_linearalgebra.pxi"
include "dpnp_algo_logic.pxi"
include "dpnp_algo_manipulation.pxi"
include "dpnp_algo_mathematical.pxi"
include "dpnp_algo_searching.pxi"
include "dpnp_algo_sorting.pxi"
Expand Down
136 changes: 0 additions & 136 deletions dpnp/dpnp_algo/dpnp_algo_manipulation.pxi

This file was deleted.

29 changes: 8 additions & 21 deletions dpnp/dpnp_iface.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,29 +151,16 @@ def asnumpy(input, order="C"):

def astype(x1, dtype, order="K", casting="unsafe", subok=True, copy=True):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither numpy or cupy has astype method (they have it only in the context of ndarray), so I would propose to remove unsupported subok parameter here.

"""Copy the array with data type casting."""
if isinstance(x1, dpnp_array):
return x1.astype(dtype, order=order, casting=casting, copy=copy)

if isinstance(x1, dpt.usm_ndarray):
return dpt.astype(x1, dtype, order=order, casting=casting, copy=copy)

x1_desc = get_dpnp_descriptor(x1, copy_when_nondefault_queue=False)
if not x1_desc:
pass
elif order != "K":
pass
elif casting != "unsafe":
pass
elif not subok:
pass
elif not copy:
pass
elif x1_desc.dtype == numpy.complex128 or dtype == numpy.complex128:
pass
elif x1_desc.dtype == numpy.complex64 or dtype == numpy.complex64:
if subok is not True:
pass
else:
return dpnp_astype(x1_desc, dtype).get_pyobj()
if isinstance(x1, dpnp_array):
return x1.astype(dtype, order=order, casting=casting, copy=copy)

if isinstance(x1, dpt.usm_ndarray):
return dpt.astype(
x1, dtype, order=order, casting=casting, copy=copy
)

return call_origin(
numpy.ndarray.astype,
Expand Down
Loading