From c529b29550deb460ee805226c4d12532ce0641b7 Mon Sep 17 00:00:00 2001 From: Nikita Grigorian Date: Tue, 7 Jan 2025 10:49:01 -0800 Subject: [PATCH] import SyclDevice directly in _dldevice_conversions Full dpctl namespace is unnecessary, as only SyclDevice is used --- dpctl/tensor/_dldevice_conversions.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/dpctl/tensor/_dldevice_conversions.py b/dpctl/tensor/_dldevice_conversions.py index 0779d3eef7..ef945bcfab 100644 --- a/dpctl/tensor/_dldevice_conversions.py +++ b/dpctl/tensor/_dldevice_conversions.py @@ -14,8 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import dpctl - +from .._sycl_device import SyclDevice from ._usmarray import DLDeviceType @@ -29,12 +28,12 @@ def dldevice_to_sycldevice(dl_dev: tuple): ) if dl_dev[0] != DLDeviceType.kDLOneAPI: raise ValueError("dldevice type must be kDLOneAPI") - return dpctl.SyclDevice(str(dl_dev[1])) + return SyclDevice(str(dl_dev[1])) -def sycldevice_to_dldevice(dev: dpctl.SyclDevice): - if not isinstance(dev, dpctl.SyclDevice): +def sycldevice_to_dldevice(dev: SyclDevice): + if not isinstance(dev, SyclDevice): raise TypeError( - "dev is expected to be a dpctl.SyclDevice, got " f"{type(dev)}" + "dev is expected to be a SyclDevice, got " f"{type(dev)}" ) return (DLDeviceType.kDLOneAPI, dev.get_device_id())