Skip to content

Commit 5533133

Browse files
authored
Support usm_ndarray in dpnp.asnumpy() (#924)
1 parent e389248 commit 5533133

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dpnp/dpnp_iface.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@
4242

4343
import os
4444
import numpy
45+
import numpy.lib.stride_tricks as np_st
46+
import dpnp.config as config
4547
import collections
4648

4749
from dpnp.dpnp_algo import *
@@ -130,6 +132,8 @@ def asnumpy(input, order='C'):
130132
This function works exactly the same as :obj:`numpy.asarray`.
131133
132134
"""
135+
if config.__DPNP_OUTPUT_DPCTL__ and hasattr(input, "__sycl_usm_array_interface__"):
136+
return np_st.as_strided(input.usm_data.copy_to_host().view(input.dtype), shape=input.shape)
133137

134138
return numpy.asarray(input, order=order)
135139

0 commit comments

Comments
 (0)