Skip to content

Commit 37497b2

Browse files
Merge pull request #1181 from IntelPython/fix-gh-1180
Fix for gh-1180: missing F-contiguous flags after calling squeeze
2 parents e7fc039 + 005b569 commit 37497b2

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

dpctl/tensor/_stride_utils.pxi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ cdef int _from_input_shape_strides(
6262
"""
6363
cdef int i
6464
cdef int j
65-
cdef int all_incr = 1
66-
cdef int all_decr = 1
65+
cdef bint all_incr = 1
66+
cdef bint all_decr = 1
6767
cdef Py_ssize_t elem_count = 1
6868
cdef Py_ssize_t min_shift = 0
6969
cdef Py_ssize_t max_shift = 0
@@ -152,7 +152,7 @@ cdef int _from_input_shape_strides(
152152
return 0
153153
if nd == 1:
154154
if strides_arr[0] == 1:
155-
contig[0] = USM_ARRAY_C_CONTIGUOUS
155+
contig[0] = USM_ARRAY_C_CONTIGUOUS | USM_ARRAY_F_CONTIGUOUS
156156
else:
157157
contig[0] = 0
158158
return 0

dpctl/tests/test_usm_ndarray_ctor.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ def test_usm_ndarray_flags():
7171
assert f.forc
7272
assert f.fnc
7373

74+
f = dpt.usm_ndarray((5,), dtype="i4", strides=(1,)).flags
75+
assert f.fc
76+
assert f.forc
77+
7478
f = dpt.usm_ndarray((5, 1, 2), dtype="i4", strides=(2, 0, 1)).flags
7579
assert f.c_contiguous
7680
assert f.forc

0 commit comments

Comments
 (0)