From 1a5c09c08f951a6cb3da76d8776fd35b4785ebf1 Mon Sep 17 00:00:00 2001 From: Victoriya Fedotova Date: Tue, 7 May 2024 16:30:45 +0200 Subject: [PATCH] Fix DPNP/DPCTL F-contiguous data processing (#1825) * Fix DPNP/DPCTL F-contiguous data processing * Code formatting * Fix linter error --- sklearnex/_device_offload.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sklearnex/_device_offload.py b/sklearnex/_device_offload.py index 5bfe872839..7f409f521e 100644 --- a/sklearnex/_device_offload.py +++ b/sklearnex/_device_offload.py @@ -127,8 +127,15 @@ def _transfer_to_host(queue, *data): queue = usm_iface["syclobj"] buffer = as_usm_memory(item).copy_to_host() + order = "C" + if usm_iface["strides"] is not None: + if usm_iface["strides"][0] < usm_iface["strides"][1]: + order = "F" item = np.ndarray( - shape=usm_iface["shape"], dtype=usm_iface["typestr"], buffer=buffer + shape=usm_iface["shape"], + dtype=usm_iface["typestr"], + buffer=buffer, + order=order, ) has_usm_data = True else: