Skip to content
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

Allow asarray to work on sequences of dpnp_array #1355

Merged
merged 5 commits into from
Apr 1, 2023
Merged
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
4 changes: 2 additions & 2 deletions dpnp/dpnp_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def asarray(x1,
else:
x1_obj = x1

sycl_queue_normalized = dpnp.get_normalized_queue_device(x1_obj, device=device, sycl_queue=sycl_queue)
npolina4 marked this conversation as resolved.
Show resolved Hide resolved
if order is None:
order = 'C'

Expand All @@ -100,8 +99,9 @@ def asarray(x1,
dtype=dtype,
copy=copy,
order=order,
device=device,
usm_type=usm_type,
sycl_queue=sycl_queue_normalized)
sycl_queue=sycl_queue)
return dpnp_array(array_obj.shape, buffer=array_obj, order=order)


Expand Down
12 changes: 12 additions & 0 deletions tests/test_sycl_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,3 +945,15 @@ def test_broadcast_to(device):
x = dpnp.arange(5, device=device)
y = dpnp.broadcast_to(x, (3, 5))
assert_sycl_queue_equal(x.sycl_queue, y.sycl_queue)


@pytest.mark.parametrize("device_x",
valid_devices,
ids=[device.filter_string for device in valid_devices])
@pytest.mark.parametrize("device_y",
valid_devices,
ids=[device.filter_string for device in valid_devices])
def test_asarray(device_x, device_y):
x = dpnp.array([1, 2, 3], device=device_x)
y = dpnp.asarray([x], device=device_y)
antonwolfy marked this conversation as resolved.
Show resolved Hide resolved
assert_sycl_queue_equal(y.sycl_queue, x.to_device(device_y).sycl_queue)