Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
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
7 changes: 3 additions & 4 deletions 7 dpctl/tensor/_stride_utils.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ cdef int _from_input_shape_strides(
cdef Py_ssize_t* shape_arr
cdef Py_ssize_t* strides_arr

if (int(order) not in [ord('C'), ord('F'), ord('c'), ord('f')]):
return ERROR_INCORRECT_ORDER

# 0-d array
if (nd == 0):
contig[0] = (USM_ARRAY_C_CONTIGUOUS | USM_ARRAY_F_CONTIGUOUS)
Expand Down Expand Up @@ -109,10 +112,6 @@ cdef int _from_input_shape_strides(
nelems[0] = elem_count
if (strides is None):
# no need to allocate and populate strides
if (int(order) not in [ord('C'), ord('F'), ord('c'), ord('f')]):
PyMem_Free(shape_ptr[0]);
shape_ptr[0] = <Py_ssize_t *>(<size_t>0)
return ERROR_INCORRECT_ORDER
if order == <char> ord('C') or order == <char> ord('c'):
contig[0] = USM_ARRAY_C_CONTIGUOUS
else:
Expand Down
4 changes: 4 additions & 0 deletions 4 dpctl/tests/test_usm_ndarray_ctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,10 @@ def test_ctor_invalid_order():
get_queue_or_skip()
with pytest.raises(ValueError):
dpt.usm_ndarray((5, 5, 3), order="Z")
with pytest.raises(ValueError):
dpt.usm_ndarray((10), strides=(1,), order="Z")
with pytest.raises(ValueError):
dpt.usm_ndarray((), order="Z")


def test_ctor_buffer_kwarg():
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.