Skip to content

Align default order value with numpy in asarray-like functions #1526

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

Merged
merged 5 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
11 changes: 8 additions & 3 deletions dpnp/dpnp_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def arange(
def asarray(
x1,
dtype=None,
copy=False,
order="C",
copy=None,
order=None,
device=None,
usm_type=None,
sycl_queue=None,
Expand All @@ -96,7 +96,7 @@ def asarray(
dpu.validate_usm_type(usm_type, allow_none=True)

if order is None:
order = "C"
order = "K"

"""Converts incoming 'x1' object to 'dpnp_array'."""
if isinstance(x1, (list, tuple, range)):
Expand Down Expand Up @@ -127,6 +127,11 @@ def asarray(
usm_type=usm_type,
sycl_queue=sycl_queue_normalized,
)

# return x1 if dpctl returns a zero copy of x1_obj
if array_obj is x1_obj:
return x1

return dpnp_array(array_obj.shape, buffer=array_obj, order=order)


Expand Down
2 changes: 1 addition & 1 deletion dpnp/dpnp_iface.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def get_dpnp_descriptor(

if ext_obj.strides != shape_offsets or ext_obj_offset != 0:
orig_desc = dpnp_descriptor(ext_obj)
ext_obj = array(ext_obj)
ext_obj = array(ext_obj, order="C")

# while dpnp functions are based on DPNP_QUEUE
# we need to create a copy on device associated with DPNP_QUEUE
Expand Down
Loading