Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add comment to the line changed in this PR
  • Loading branch information
oleksandr-pavlyk committed Dec 9, 2024
commit 4b98e947894294f4b8b3b13a2e2ca415d2932d41
4 changes: 4 additions & 0 deletions dpctl/tensor/_copy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ def astype(
f_contig = usm_ary.flags.f_contiguous
needs_copy = copy or not ary_dtype == target_dtype
if not needs_copy and (order != "K"):
# ensure that order="F" for C-contig input triggers copy,
# and order="C" for F-contig input triggers copy too.
# 1D arrays which are both C- and F- contig should not
# force copying for neither order="F", nor order="C", see gh-1926
needs_copy = (
c_contig and not f_contig and order not in ["A", "C"]
Comment thread
oleksandr-pavlyk marked this conversation as resolved.
) or (not c_contig and f_contig and order not in ["A", "F"])
Expand Down