Skip to content

order of output array for binary elementwise funcs, clip, and matmul defaults to C-contiguous #1678

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
May 15, 2024
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
12 changes: 6 additions & 6 deletions dpctl/tensor/_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -791,17 +791,17 @@ def clip(x, /, min=None, max=None, out=None, order="K"):

if order == "K":
if (
x.flags.f_contiguous
and a_min.flags.f_contiguous
and a_max.flags.f_contiguous
):
order = "F"
elif (
x.flags.c_contiguous
and a_min.flags.c_contiguous
and a_max.flags.c_contiguous
):
order = "C"
elif (
x.flags.f_contiguous
and a_min.flags.f_contiguous
and a_max.flags.f_contiguous
):
order = "F"
if order == "K":
buf1 = _empty_like_orderK(a_min, buf1_dt)
else:
Expand Down
6 changes: 3 additions & 3 deletions dpctl/tensor/_elementwise_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -858,10 +858,10 @@ def __call__(self, o1, o2, /, *, out=None, order="K"):
return out

if order == "K":
if src1.flags.f_contiguous and src2.flags.f_contiguous:
order = "F"
elif src1.flags.c_contiguous and src2.flags.c_contiguous:
if src1.flags.c_contiguous and src2.flags.c_contiguous:
order = "C"
elif src1.flags.f_contiguous and src2.flags.f_contiguous:
order = "F"
if order == "K":
buf1 = _empty_like_orderK(src1, buf1_dt)
else:
Expand Down
6 changes: 3 additions & 3 deletions dpctl/tensor/_linear_algebra_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -942,10 +942,10 @@ def matmul(x1, x2, out=None, dtype=None, order="K"):
return out

if order == "K":
if x1.flags.f_contiguous and x2.flags.f_contiguous:
order = "F"
elif x1.flags.c_contiguous and x2.flags.c_contiguous:
if x1.flags.c_contiguous and x2.flags.c_contiguous:
order = "C"
elif x1.flags.f_contiguous and x2.flags.f_contiguous:
order = "F"
if order == "K":
buf1 = _empty_like_orderK(x1, buf1_dt)
else:
Expand Down