Skip to content

Commit bf1489b

Browse files
committed
Reorder methods by lexicographical order
1 parent e0b0868 commit bf1489b

File tree

1 file changed

+153
-153
lines changed

1 file changed

+153
-153
lines changed

dpnp/dpnp_array.py

Lines changed: 153 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -113,159 +113,6 @@ def __init__(
113113
array_namespace=dpnp,
114114
)
115115

116-
@property
117-
def __sycl_usm_array_interface__(self):
118-
"""
119-
Give ``__sycl_usm_array_interface__`` dictionary describing the array.
120-
121-
"""
122-
return self._array_obj.__sycl_usm_array_interface__
123-
124-
def get_array(self):
125-
"""Get :class:`dpctl.tensor.usm_ndarray` object."""
126-
return self._array_obj
127-
128-
@property
129-
def T(self):
130-
"""
131-
View of the transposed array.
132-
133-
Same as ``self.transpose()``.
134-
135-
See Also
136-
--------
137-
:obj:`dpnp.transpose` : Equivalent function.
138-
139-
Examples
140-
--------
141-
>>> import dpnp as np
142-
>>> a = np.array([[1, 2], [3, 4]])
143-
>>> a
144-
array([[1, 2],
145-
[3, 4]])
146-
>>> a.T
147-
array([[1, 3],
148-
[2, 4]])
149-
150-
>>> a = np.array([1, 2, 3, 4])
151-
>>> a
152-
array([1, 2, 3, 4])
153-
>>> a.T
154-
array([1, 2, 3, 4])
155-
156-
"""
157-
158-
return self.transpose()
159-
160-
@property
161-
def mT(self):
162-
"""
163-
View of the matrix transposed array.
164-
165-
The matrix transpose is the transpose of the last two dimensions, even
166-
if the array is of higher dimension.
167-
168-
Raises
169-
------
170-
ValueError
171-
If the array is of dimension less than ``2``.
172-
173-
Examples
174-
--------
175-
>>> import dpnp as np
176-
>>> a = np.array([[1, 2], [3, 4]])
177-
>>> a
178-
array([[1, 2],
179-
[3, 4]])
180-
>>> a.mT
181-
array([[1, 3],
182-
[2, 4]])
183-
184-
>>> a = np.arange(8).reshape((2, 2, 2))
185-
>>> a
186-
array([[[0, 1],
187-
[2, 3]],
188-
[[4, 5],
189-
[6, 7]]])
190-
>>> a.mT
191-
array([[[0, 2],
192-
[1, 3]],
193-
[[4, 6],
194-
[5, 7]]])
195-
196-
"""
197-
198-
if self.ndim < 2:
199-
raise ValueError("matrix transpose with ndim < 2 is undefined")
200-
201-
return dpnp_array._create_from_usm_ndarray(self._array_obj.mT)
202-
203-
@property
204-
def device(self):
205-
"""
206-
Return :class:`dpctl.tensor.Device` object representing residence of
207-
the array data.
208-
209-
The ``Device`` object represents Array API notion of the device, and
210-
contains :class:`dpctl.SyclQueue` associated with this array. Hence,
211-
``.device`` property provides information distinct from ``.sycl_device``
212-
property.
213-
214-
Examples
215-
--------
216-
>>> import dpnp as np
217-
>>> x = np.ones(10)
218-
>>> x.device
219-
Device(level_zero:gpu:0)
220-
221-
"""
222-
223-
return self._array_obj.device
224-
225-
@property
226-
def sycl_context(self):
227-
"""
228-
Return :class:`dpctl.SyclContext` object to which USM data is bound.
229-
230-
"""
231-
return self._array_obj.sycl_context
232-
233-
@property
234-
def sycl_device(self):
235-
"""
236-
Return :class:`dpctl.SyclDevice` object on which USM data was
237-
allocated.
238-
239-
"""
240-
return self._array_obj.sycl_device
241-
242-
@property
243-
def sycl_queue(self):
244-
"""
245-
Return :class:`dpctl.SyclQueue` object associated with USM data.
246-
247-
"""
248-
return self._array_obj.sycl_queue
249-
250-
@property
251-
def usm_type(self):
252-
"""
253-
USM type of underlying memory. Possible values are:
254-
255-
* ``"device"``
256-
USM-device allocation in device memory, only accessible to kernels
257-
executed on the device
258-
* ``"shared"``
259-
USM-shared allocation in device memory, accessible both from the
260-
device and from the host
261-
* ``"host"``
262-
USM-host allocation in host memory, accessible both from the device
263-
and from the host
264-
265-
"""
266-
267-
return self._array_obj.usm_type
268-
269116
def __abs__(self):
270117
"""Return :math:`|self|`."""
271118
return dpnp.abs(self)
@@ -721,6 +568,14 @@ def __sub__(self, other):
721568

722569
# '__subclasshook__',
723570

571+
@property
572+
def __sycl_usm_array_interface__(self):
573+
"""
574+
Give ``__sycl_usm_array_interface__`` dictionary describing the array.
575+
576+
"""
577+
return self._array_obj.__sycl_usm_array_interface__
578+
724579
def __truediv__(self, other):
725580
"""Return :math:`self/value`."""
726581
return dpnp.true_divide(self, other)
@@ -1148,6 +1003,28 @@ def data(self):
11481003

11491004
return dpm.create_data(self._array_obj)
11501005

1006+
@property
1007+
def device(self):
1008+
"""
1009+
Return :class:`dpctl.tensor.Device` object representing residence of
1010+
the array data.
1011+
1012+
The ``Device`` object represents Array API notion of the device, and
1013+
contains :class:`dpctl.SyclQueue` associated with this array. Hence,
1014+
``.device`` property provides information distinct from ``.sycl_device``
1015+
property.
1016+
1017+
Examples
1018+
--------
1019+
>>> import dpnp as np
1020+
>>> x = np.ones(10)
1021+
>>> x.device
1022+
Device(level_zero:gpu:0)
1023+
1024+
"""
1025+
1026+
return self._array_obj.device
1027+
11511028
def diagonal(self, offset=0, axis1=0, axis2=1):
11521029
"""
11531030
Return specified diagonals.
@@ -1295,6 +1172,10 @@ def flatten(self, order="C"):
12951172

12961173
return self.reshape(-1, order=order, copy=True)
12971174

1175+
def get_array(self):
1176+
"""Get :class:`dpctl.tensor.usm_ndarray` object."""
1177+
return self._array_obj
1178+
12981179
# 'getfield',
12991180

13001181
@property
@@ -1455,6 +1336,49 @@ def min(
14551336
where=where,
14561337
)
14571338

1339+
@property
1340+
def mT(self):
1341+
"""
1342+
View of the matrix transposed array.
1343+
1344+
The matrix transpose is the transpose of the last two dimensions, even
1345+
if the array is of higher dimension.
1346+
1347+
Raises
1348+
------
1349+
ValueError
1350+
If the array is of dimension less than ``2``.
1351+
1352+
Examples
1353+
--------
1354+
>>> import dpnp as np
1355+
>>> a = np.array([[1, 2], [3, 4]])
1356+
>>> a
1357+
array([[1, 2],
1358+
[3, 4]])
1359+
>>> a.mT
1360+
array([[1, 3],
1361+
[2, 4]])
1362+
1363+
>>> a = np.arange(8).reshape((2, 2, 2))
1364+
>>> a
1365+
array([[[0, 1],
1366+
[2, 3]],
1367+
[[4, 5],
1368+
[6, 7]]])
1369+
>>> a.mT
1370+
array([[[0, 2],
1371+
[1, 3]],
1372+
[[4, 6],
1373+
[5, 7]]])
1374+
1375+
"""
1376+
1377+
if self.ndim < 2:
1378+
raise ValueError("matrix transpose with ndim < 2 is undefined")
1379+
1380+
return dpnp_array._create_from_usm_ndarray(self._array_obj.mT)
1381+
14581382
@property
14591383
def nbytes(self):
14601384
"""Total bytes consumed by the elements of the array."""
@@ -1956,6 +1880,63 @@ def swapaxes(self, axis1, axis2):
19561880

19571881
return dpnp.swapaxes(self, axis1=axis1, axis2=axis2)
19581882

1883+
@property
1884+
def sycl_context(self):
1885+
"""
1886+
Return :class:`dpctl.SyclContext` object to which USM data is bound.
1887+
1888+
"""
1889+
return self._array_obj.sycl_context
1890+
1891+
@property
1892+
def sycl_device(self):
1893+
"""
1894+
Return :class:`dpctl.SyclDevice` object on which USM data was
1895+
allocated.
1896+
1897+
"""
1898+
return self._array_obj.sycl_device
1899+
1900+
@property
1901+
def sycl_queue(self):
1902+
"""
1903+
Return :class:`dpctl.SyclQueue` object associated with USM data.
1904+
1905+
"""
1906+
return self._array_obj.sycl_queue
1907+
1908+
@property
1909+
def T(self):
1910+
"""
1911+
View of the transposed array.
1912+
1913+
Same as ``self.transpose()``.
1914+
1915+
See Also
1916+
--------
1917+
:obj:`dpnp.transpose` : Equivalent function.
1918+
1919+
Examples
1920+
--------
1921+
>>> import dpnp as np
1922+
>>> a = np.array([[1, 2], [3, 4]])
1923+
>>> a
1924+
array([[1, 2],
1925+
[3, 4]])
1926+
>>> a.T
1927+
array([[1, 3],
1928+
[2, 4]])
1929+
1930+
>>> a = np.array([1, 2, 3, 4])
1931+
>>> a
1932+
array([1, 2, 3, 4])
1933+
>>> a.T
1934+
array([1, 2, 3, 4])
1935+
1936+
"""
1937+
1938+
return self.transpose()
1939+
19591940
def take(self, indices, axis=None, out=None, mode="wrap"):
19601941
"""
19611942
Take elements from an array along an axis.
@@ -2251,3 +2232,22 @@ def view(self, dtype=None, *, type=None):
22512232
buffer=self,
22522233
strides=new_strides,
22532234
)
2235+
2236+
@property
2237+
def usm_type(self):
2238+
"""
2239+
USM type of underlying memory. Possible values are:
2240+
2241+
* ``"device"``
2242+
USM-device allocation in device memory, only accessible to kernels
2243+
executed on the device
2244+
* ``"shared"``
2245+
USM-shared allocation in device memory, accessible both from the
2246+
device and from the host
2247+
* ``"host"``
2248+
USM-host allocation in host memory, accessible both from the device
2249+
and from the host
2250+
2251+
"""
2252+
2253+
return self._array_obj.usm_type

0 commit comments

Comments
 (0)