Skip to content

Commit

Permalink
Merge pull request #993 from IntelPython/fix/typo_in_usm_ndarray_ctor
Browse files Browse the repository at this point in the history
Fix typo in the keyword argumnet when constructing a tensor.
  • Loading branch information
diptorupd authored Apr 7, 2023
2 parents c5c2962 + 029b59a commit 5c5997e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion numba_dpex/core/types/usm_ndarray_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def __init__(

if not dtype:
dummy_tensor = dpctl.tensor.empty(
sh=1, order=layout, usm_type=usm_type, sycl_queue=self.queue
shape=1, order=layout, usm_type=usm_type, sycl_queue=self.queue
)
# convert dpnp type to numba/numpy type
_dtype = dummy_tensor.dtype
Expand Down
26 changes: 26 additions & 0 deletions numba_dpex/tests/dpjit_tests/dpnp/test_dpnp_empty.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,29 @@ def func1(shape):
)
else:
c.sycl_device.filter_string == dpctl.SyclDevice().filter_string


@pytest.mark.parametrize("shape", shapes)
def test_dpnp_empty_default_dtype(shape):
@dpjit
def func1(shape):
c = dpnp.empty(shape=shape)
return c

try:
c = func1(shape)
except Exception:
pytest.fail("Calling dpnp.empty inside dpjit failed")

if len(c.shape) == 1:
assert c.shape[0] == shape
else:
assert c.shape == shape

dummy_tensor = dpctl.tensor.empty(shape=1)

assert c.dtype == dummy_tensor.dtype

dummy_tensor = dpctl.tensor.empty(shape)

assert c.dtype == dummy_tensor.dtype

0 comments on commit 5c5997e

Please sign in to comment.