Skip to content

Commit a44d2ec

Browse files
Replace dpctl.tensor with dpnp.tensor in dpnp
1 parent 387c06f commit a44d2ec

21 files changed

Lines changed: 117 additions & 117 deletions

dpnp/dpnp_algo/dpnp_arraycreation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747

4848
def _as_usm_ndarray(a, usm_type, sycl_queue):
49-
"""Converts input object to `dpctl.tensor.usm_ndarray`"""
49+
"""Converts input object to `dpnp.tensor.usm_ndarray`"""
5050

5151
if isinstance(a, dpnp_array):
5252
a = a.get_array()

dpnp/dpnp_algo/dpnp_elementwise_common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class DPNPUnaryFunc(UnaryElementwiseFunc):
119119
sycl_dev - The :class:`dpctl.SyclDevice` where the function
120120
evaluation is carried out.
121121
The function is invoked when the argument of the unary function
122-
requires casting, e.g. the argument of `dpctl.tensor.log` is an
122+
requires casting, e.g. the argument of `dpnp.tensor.log` is an
123123
array with integral data type.
124124
125125
"""
@@ -137,7 +137,7 @@ def __init__(
137137
def _call_func(src, dst, sycl_queue, depends=None):
138138
"""
139139
A callback to register in UnaryElementwiseFunc class of
140-
dpctl.tensor
140+
dpnp.tensor
141141
"""
142142

143143
if depends is None:
@@ -588,7 +588,7 @@ class DPNPBinaryFunc(BinaryElementwiseFunc):
588588
evaluation is carried out.
589589
The function is only called when both arguments of the binary
590590
function require casting, e.g. both arguments of
591-
`dpctl.tensor.logaddexp` are arrays with integral data type.
591+
`dpnp.tensor.logaddexp` are arrays with integral data type.
592592
weak_type_resolver : {None, callable}, optional
593593
Function to influence type promotion behavior for Python scalar types
594594
of this binary function. The function takes 3 arguments:
@@ -615,7 +615,7 @@ def __init__(
615615
def _call_func(src1, src2, dst, sycl_queue, depends=None):
616616
"""
617617
A callback to register in UnaryElementwiseFunc class of
618-
dpctl.tensor
618+
dpnp.tensor
619619
"""
620620

621621
if depends is None:

dpnp/dpnp_array.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ class dpnp_array:
7272
An array object represents a multidimensional tensor of numeric elements
7373
stored in a USM allocation on a SYCL device.
7474
75-
This is a wrapper around :class:`dpctl.tensor.usm_ndarray` that provides
75+
This is a wrapper around :class:`dpnp.tensor.usm_ndarray` that provides
7676
methods to be compliant with original NumPy.
7777
7878
"""
@@ -609,12 +609,12 @@ def __usm_ndarray__(self):
609609
"""
610610
Property to support ``__usm_ndarray__`` protocol.
611611
612-
It assumes to return :class:`dpctl.tensor.usm_ndarray` instance
612+
It assumes to return :class:`dpnp.tensor.usm_ndarray` instance
613613
corresponding to the content of the object.
614614
615615
This property is intended to speed-up conversion from
616-
:class:`dpnp.ndarray` to :class:`dpctl.tensor.usm_ndarray` passed into
617-
:func:`dpctl.tensor.asarray` function. The input object that implements
616+
:class:`dpnp.ndarray` to :class:`dpnp.tensor.usm_ndarray` passed into
617+
:func:`dpnp.tensor.asarray` function. The input object that implements
618618
``__usm_ndarray__`` protocol is recognized as owner of USM allocation
619619
that is managed by a smart pointer, and asynchronous deallocation
620620
will not involve GIL.
@@ -631,13 +631,13 @@ def __xor__(self, other, /):
631631
def _create_from_usm_ndarray(usm_ary: dpt.usm_ndarray):
632632
"""
633633
Return :class:`dpnp.ndarray` instance from USM allocation providing
634-
by an instance of :class:`dpctl.tensor.usm_ndarray`.
634+
by an instance of :class:`dpnp.tensor.usm_ndarray`.
635635
636636
"""
637637

638638
if not isinstance(usm_ary, dpt.usm_ndarray):
639639
raise TypeError(
640-
f"Expected dpctl.tensor.usm_ndarray, got {type(usm_ary)}"
640+
f"Expected dpnp.tensor.usm_ndarray, got {type(usm_ary)}"
641641
)
642642
res = dpnp_array.__new__(dpnp_array)
643643
res._array_obj = usm_ary
@@ -826,7 +826,7 @@ def astype(
826826
`device` can be ``None``, a oneAPI filter selector string,
827827
an instance of :class:`dpctl.SyclDevice` corresponding to
828828
a non-partitioned SYCL device, an instance of
829-
:class:`dpctl.SyclQueue`, or a :class:`dpctl.tensor.Device` object
829+
:class:`dpctl.SyclQueue`, or a :class:`dpnp.tensor.Device` object
830830
returned by :attr:`dpnp.ndarray.device`.
831831
If the value is ``None``, returned array is created on the same
832832
device as that array.
@@ -937,7 +937,7 @@ def copy(
937937
`device` can be ``None``, a oneAPI filter selector string,
938938
an instance of :class:`dpctl.SyclDevice` corresponding to
939939
a non-partitioned SYCL device, an instance of
940-
:class:`dpctl.SyclQueue`, or a :class:`dpctl.tensor.Device` object
940+
:class:`dpctl.SyclQueue`, or a :class:`dpnp.tensor.Device` object
941941
returned by :attr:`dpnp.ndarray.device`.
942942
943943
Default: ``None``.
@@ -1032,7 +1032,7 @@ def data(self):
10321032
@property
10331033
def device(self):
10341034
"""
1035-
Return :class:`dpctl.tensor.Device` object representing residence of
1035+
Return :class:`dpnp.tensor.Device` object representing residence of
10361036
the array data.
10371037
10381038
The ``Device`` object represents Array API notion of the device, and
@@ -1199,7 +1199,7 @@ def flatten(self, /, order="C"):
11991199
return self.reshape(-1, order=order, copy=True)
12001200

12011201
def get_array(self):
1202-
"""Get :class:`dpctl.tensor.usm_ndarray` object."""
1202+
"""Get :class:`dpnp.tensor.usm_ndarray` object."""
12031203
return self._array_obj
12041204

12051205
# 'getfield',
@@ -2052,7 +2052,7 @@ def to_device(self, device, /, *, stream=None):
20522052
`device` can be ``None``, a oneAPI filter selector string,
20532053
an instance of :class:`dpctl.SyclDevice` corresponding to
20542054
a non-partitioned SYCL device, an instance of
2055-
:class:`dpctl.SyclQueue`, or a :class:`dpctl.tensor.Device` object
2055+
:class:`dpctl.SyclQueue`, or a :class:`dpnp.tensor.Device` object
20562056
returned by :attr:`dpnp.ndarray.device`.
20572057
stream : {SyclQueue, None}, optional
20582058
Execution queue to synchronize with. If ``None``, synchronization

dpnp/dpnp_container.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def arange(
6666
usm_type="device",
6767
sycl_queue=None,
6868
):
69-
"""Validate input parameters before passing them into `dpctl.tensor` module"""
69+
"""Validate input parameters before passing them into `dpnp.tensor` module"""
7070
dpu.validate_usm_type(usm_type, allow_none=False)
7171
sycl_queue_normalized = dpnp.get_normalized_queue_device(
7272
sycl_queue=sycl_queue, device=device
@@ -153,7 +153,7 @@ def empty(
153153
usm_type="device",
154154
sycl_queue=None,
155155
):
156-
"""Validate input parameters before passing them into `dpctl.tensor` module"""
156+
"""Validate input parameters before passing them into `dpnp.tensor` module"""
157157
dpu.validate_usm_type(usm_type, allow_none=False)
158158
sycl_queue_normalized = dpnp.get_normalized_queue_device(
159159
sycl_queue=sycl_queue, device=device
@@ -184,7 +184,7 @@ def eye(
184184
usm_type="device",
185185
sycl_queue=None,
186186
):
187-
"""Validate input parameters before passing them into `dpctl.tensor` module"""
187+
"""Validate input parameters before passing them into `dpnp.tensor` module"""
188188
dpu.validate_usm_type(usm_type, allow_none=False)
189189
sycl_queue_normalized = dpnp.get_normalized_queue_device(
190190
sycl_queue=sycl_queue, device=device
@@ -215,7 +215,7 @@ def full(
215215
usm_type=None,
216216
sycl_queue=None,
217217
):
218-
"""Validate input parameters before passing them into `dpctl.tensor` module"""
218+
"""Validate input parameters before passing them into `dpnp.tensor` module"""
219219
dpu.validate_usm_type(usm_type, allow_none=True)
220220

221221
sycl_queue_normalized = dpnp.get_normalized_queue_device(
@@ -248,7 +248,7 @@ def ones(
248248
usm_type="device",
249249
sycl_queue=None,
250250
):
251-
"""Validate input parameters before passing them into `dpctl.tensor` module"""
251+
"""Validate input parameters before passing them into `dpnp.tensor` module"""
252252
dpu.validate_usm_type(usm_type, allow_none=False)
253253
sycl_queue_normalized = dpnp.get_normalized_queue_device(
254254
sycl_queue=sycl_queue, device=device
@@ -288,7 +288,7 @@ def zeros(
288288
usm_type="device",
289289
sycl_queue=None,
290290
):
291-
"""Validate input parameters before passing them into `dpctl.tensor` module"""
291+
"""Validate input parameters before passing them into `dpnp.tensor` module"""
292292
dpu.validate_usm_type(usm_type, allow_none=False)
293293
sycl_queue_normalized = dpnp.get_normalized_queue_device(
294294
sycl_queue=sycl_queue, device=device

dpnp/dpnp_iface.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def asnumpy(a, order="C"):
142142

143143
def as_usm_ndarray(a, dtype=None, device=None, usm_type=None, sycl_queue=None):
144144
"""
145-
Return :class:`dpctl.tensor.usm_ndarray` from input object `a`.
145+
Return :class:`dpnp.tensor.usm_ndarray` from input object `a`.
146146
147147
Parameters
148148
----------
@@ -159,7 +159,7 @@ def as_usm_ndarray(a, dtype=None, device=None, usm_type=None, sycl_queue=None):
159159
`device` can be ``None``, a oneAPI filter selector string, an instance
160160
of :class:`dpctl.SyclDevice` corresponding to a non-partitioned SYCL
161161
device, an instance of :class:`dpctl.SyclQueue`, or a
162-
:class:`dpctl.tensor.Device` object returned by
162+
:class:`dpnp.tensor.Device` object returned by
163163
:attr:`dpnp.ndarray.device`.
164164
If the value is ``None``, returned array is created on the same device
165165
as `a`.
@@ -180,7 +180,7 @@ def as_usm_ndarray(a, dtype=None, device=None, usm_type=None, sycl_queue=None):
180180
out : usm_ndarray
181181
A dpctl USM ndarray from input array or scalar `a`.
182182
If `a` is instance of :class:`dpnp.ndarray`
183-
or :class:`dpctl.tensor.usm_ndarray`, no array allocation will be done
183+
or :class:`dpnp.tensor.usm_ndarray`, no array allocation will be done
184184
and `dtype`, `device`, `usm_type`, `sycl_queue` keywords
185185
will be ignored.
186186
@@ -256,7 +256,7 @@ def check_limitations(
256256
def check_supported_arrays_type(*arrays, scalar_type=False, all_scalars=False):
257257
"""
258258
Return ``True`` if each array has either type of scalar,
259-
:class:`dpnp.ndarray` or :class:`dpctl.tensor.usm_ndarray`.
259+
:class:`dpnp.ndarray` or :class:`dpnp.tensor.usm_ndarray`.
260260
But if any array has unsupported type, ``TypeError`` will be raised.
261261
262262
Parameters
@@ -318,7 +318,7 @@ def default_float_type(device=None, sycl_queue=None):
318318
`device` can be ``None``, a oneAPI filter selector string, an instance
319319
of :class:`dpctl.SyclDevice` corresponding to a non-partitioned SYCL
320320
device, an instance of :class:`dpctl.SyclQueue`, or a
321-
:class:`dpctl.tensor.Device` object returned by
321+
:class:`dpnp.tensor.Device` object returned by
322322
:attr:`dpnp.ndarray.device`.
323323
The value ``None`` is interpreted as to use a default device.
324324
@@ -434,7 +434,7 @@ def get_include():
434434
def get_normalized_queue_device(obj=None, device=None, sycl_queue=None):
435435
"""
436436
Utility to process complementary keyword arguments 'device' and 'sycl_queue'
437-
in subsequent calls of functions from `dpctl.tensor` module.
437+
in subsequent calls of functions from `dpnp.tensor` module.
438438
439439
If both arguments 'device' and 'sycl_queue' have default value ``None``
440440
and 'obj' has `sycl_queue` attribute, it assumes that Compute Follows Data
@@ -445,7 +445,7 @@ def get_normalized_queue_device(obj=None, device=None, sycl_queue=None):
445445
----------
446446
obj : object, optional
447447
A python object. Can be an instance of `dpnp_array`,
448-
`dpctl.tensor.usm_ndarray`, an object representing SYCL USM allocation
448+
`dpnp.tensor.usm_ndarray`, an object representing SYCL USM allocation
449449
and implementing `__sycl_usm_array_interface__` protocol, an instance
450450
of `numpy.ndarray`, an object supporting Python buffer protocol,
451451
a Python scalar, or a (possibly nested) sequence of Python scalars.
@@ -462,7 +462,7 @@ def get_normalized_queue_device(obj=None, device=None, sycl_queue=None):
462462
`device` can be ``None``, a oneAPI filter selector string, an instance
463463
of :class:`dpctl.SyclDevice` corresponding to a non-partitioned SYCL
464464
device, an instance of :class:`dpctl.SyclQueue`, or a
465-
:class:`dpctl.tensor.Device` object returned by
465+
:class:`dpnp.tensor.Device` object returned by
466466
:attr:`dpnp.ndarray.device`.
467467
The value ``None`` is interpreted as to use the same device as `obj`.
468468
@@ -472,7 +472,7 @@ def get_normalized_queue_device(obj=None, device=None, sycl_queue=None):
472472
-------
473473
sycl_queue: dpctl.SyclQueue
474474
A :class:`dpctl.SyclQueue` object normalized by
475-
`normalize_queue_device` call of `dpctl.tensor` module invoked with
475+
`normalize_queue_device` call of `dpnp.tensor` module invoked with
476476
`device` and `sycl_queue` values. If both incoming `device` and
477477
`sycl_queue` are ``None`` and `obj` has `sycl_queue` attribute,
478478
the normalization will be performed for `obj.sycl_queue` value.
@@ -540,13 +540,13 @@ def get_result_array(a, out=None, casting="safe"):
540540

541541
def get_usm_ndarray(a):
542542
"""
543-
Return :class:`dpctl.tensor.usm_ndarray` from input array `a`.
543+
Return :class:`dpnp.tensor.usm_ndarray` from input array `a`.
544544
545545
Parameters
546546
----------
547547
a : {dpnp.ndarray, usm_ndarray}
548548
Input array of supported type :class:`dpnp.ndarray`
549-
or :class:`dpctl.tensor.usm_ndarray`.
549+
or :class:`dpnp.tensor.usm_ndarray`.
550550
551551
Returns
552552
-------
@@ -571,13 +571,13 @@ def get_usm_ndarray(a):
571571

572572
def get_usm_ndarray_or_scalar(a):
573573
"""
574-
Return scalar or :class:`dpctl.tensor.usm_ndarray` from input object `a`.
574+
Return scalar or :class:`dpnp.tensor.usm_ndarray` from input object `a`.
575575
576576
Parameters
577577
----------
578578
a : {scalar, dpnp_array, usm_ndarray}
579579
Input of any supported type: scalar, :class:`dpnp.ndarray`
580-
or :class:`dpctl.tensor.usm_ndarray`.
580+
or :class:`dpnp.tensor.usm_ndarray`.
581581
582582
Returns
583583
-------
@@ -634,7 +634,7 @@ def is_cuda_backend(obj=None):
634634
def is_supported_array_or_scalar(a):
635635
"""
636636
Return ``True`` if `a` is a scalar or an array of either
637-
:class:`dpnp.ndarray` or :class:`dpctl.tensor.usm_ndarray` type,
637+
:class:`dpnp.ndarray` or :class:`dpnp.tensor.usm_ndarray` type,
638638
``False`` otherwise.
639639
640640
Parameters
@@ -656,7 +656,7 @@ def is_supported_array_or_scalar(a):
656656
def is_supported_array_type(a):
657657
"""
658658
Return ``True`` if an array of either type :class:`dpnp.ndarray`
659-
or :class:`dpctl.tensor.usm_ndarray` type, ``False`` otherwise.
659+
or :class:`dpnp.tensor.usm_ndarray` type, ``False`` otherwise.
660660
661661
Parameters
662662
----------

0 commit comments

Comments
 (0)