@@ -366,37 +366,45 @@ def get_normalized_queue_device(obj=None, device=None, sycl_queue=None):
366
366
Utility to process complementary keyword arguments 'device' and 'sycl_queue'
367
367
in subsequent calls of functions from `dpctl.tensor` module.
368
368
369
- If both arguments 'device' and 'sycl_queue' have default value `None`
369
+ If both arguments 'device' and 'sycl_queue' have default value `` None` `
370
370
and 'obj' has `sycl_queue` attribute, it assumes that Compute Follows Data
371
371
approach has to be applied and so the resulting SYCL queue will be normalized
372
372
based on the queue value from 'obj'.
373
373
374
- Args:
375
- obj (optional): A python object. Can be an instance of `dpnp_array`,
376
- `dpctl.tensor.usm_ndarray`, an object representing SYCL USM allocation
377
- and implementing `__sycl_usm_array_interface__` protocol,
378
- an instance of `numpy.ndarray`, an object supporting Python buffer protocol,
379
- a Python scalar, or a (possibly nested) sequence of Python scalars.
380
- sycl_queue (:class:`dpctl.SyclQueue`, optional):
381
- explicitly indicates where USM allocation is done
382
- and the population code (if any) is executed.
383
- Value `None` is interpreted as get the SYCL queue
384
- from `obj` parameter if not None, from `device` keyword,
385
- or use default queue.
386
- Default: None
387
- device (string, :class:`dpctl.SyclDevice`, :class:`dpctl.SyclQueue,
388
- :class:`dpctl.tensor.Device`, optional):
389
- array-API keyword indicating non-partitioned SYCL device
390
- where array is allocated.
374
+ Parameters
375
+ ----------
376
+ obj : object, optional
377
+ A python object. Can be an instance of `dpnp_array`,
378
+ `dpctl.tensor.usm_ndarray`, an object representing SYCL USM allocation
379
+ and implementing `__sycl_usm_array_interface__` protocol, an instance
380
+ of `numpy.ndarray`, an object supporting Python buffer protocol,
381
+ a Python scalar, or a (possibly nested) sequence of Python scalars.
382
+ sycl_queue : class:`dpctl.SyclQueue`, optional
383
+ A queue which explicitly indicates where USM allocation is done
384
+ and the population code (if any) is executed.
385
+ Value ``None`` is interpreted as to get the SYCL queue from either
386
+ `obj` parameter if not ``None`` or from `device` keyword,
387
+ or to use default queue.
388
+ device : {string, :class:`dpctl.SyclDevice`, :class:`dpctl.SyclQueue,
389
+ :class:`dpctl.tensor.Device`}, optional
390
+ An array-API keyword indicating non-partitioned SYCL device
391
+ where array is allocated.
392
+
391
393
Returns
392
- :class:`dpctl.SyclQueue` object normalized by `normalize_queue_device` call
394
+ -------
395
+ sycl_queue: dpctl.SyclQueue
396
+ A :class:`dpctl.SyclQueue` object normalized by `normalize_queue_device` call
393
397
of `dpctl.tensor` module invoked with 'device' and 'sycl_queue' values.
394
398
If both incoming 'device' and 'sycl_queue' are None and 'obj' has `sycl_queue` attribute,
395
399
the normalization will be performed for 'obj.sycl_queue' value.
396
- Raises:
397
- TypeError: if argument is not of the expected type, or keywords
398
- imply incompatible queues.
400
+
401
+ Raises
402
+ ------
403
+ TypeError
404
+ If argument is not of the expected type, or keywords imply incompatible queues.
405
+
399
406
"""
407
+
400
408
if (
401
409
device is None
402
410
and sycl_queue is None
@@ -405,12 +413,9 @@ def get_normalized_queue_device(obj=None, device=None, sycl_queue=None):
405
413
):
406
414
sycl_queue = obj .sycl_queue
407
415
408
- # TODO: remove check dpt._device has attribute 'normalize_queue_device'
409
- if hasattr (dpt ._device , "normalize_queue_device" ):
410
- return dpt ._device .normalize_queue_device (
411
- sycl_queue = sycl_queue , device = device
412
- )
413
- return sycl_queue
416
+ return dpt ._device .normalize_queue_device (
417
+ sycl_queue = sycl_queue , device = device
418
+ )
414
419
415
420
416
421
def get_usm_ndarray (a ):
0 commit comments