Skip to content

Fix for gh-1180: missing F-contiguous flags after calling squeeze #1181

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

Merged
merged 1 commit into from
Apr 21, 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
6 changes: 3 additions & 3 deletions dpctl/tensor/_stride_utils.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ cdef int _from_input_shape_strides(
"""
cdef int i
cdef int j
cdef int all_incr = 1
cdef int all_decr = 1
cdef bint all_incr = 1
cdef bint all_decr = 1
cdef Py_ssize_t elem_count = 1
cdef Py_ssize_t min_shift = 0
cdef Py_ssize_t max_shift = 0
Expand Down Expand Up @@ -152,7 +152,7 @@ cdef int _from_input_shape_strides(
return 0
if nd == 1:
if strides_arr[0] == 1:
contig[0] = USM_ARRAY_C_CONTIGUOUS
contig[0] = USM_ARRAY_C_CONTIGUOUS | USM_ARRAY_F_CONTIGUOUS
else:
contig[0] = 0
return 0
Expand Down
4 changes: 4 additions & 0 deletions dpctl/tests/test_usm_ndarray_ctor.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ def test_usm_ndarray_flags():
assert f.forc
assert f.fnc

f = dpt.usm_ndarray((5,), dtype="i4", strides=(1,)).flags
assert f.fc
assert f.forc

f = dpt.usm_ndarray((5, 1, 2), dtype="i4", strides=(2, 0, 1)).flags
assert f.c_contiguous
assert f.forc
Expand Down