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

Fix typo in the keyword argumnet when constructing a tensor. #993

Merged
merged 1 commit into from
Apr 7, 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
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