Skip to content

Commit 20a5105

Browse files
Update tensor doc page to provide more information
1 parent f771da4 commit 20a5105

File tree

1 file changed

+58
-6
lines changed

1 file changed

+58
-6
lines changed

doc/tensor.rst

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,67 @@ Tensor (``dpnp.tensor``)
44
========================
55

66
``dpnp.tensor`` provides a reference implementation of the
7-
`Python Array API <https://data-apis.org/array-api/latest/>`_ specification. The implementation
8-
uses data-parallel algorithms suitable for execution on accelerators, such as GPUs.
7+
`Python Array API <https://data-apis.org/array-api/latest/>`_ specification.
8+
The implementation uses data-parallel algorithms suitable for execution on
9+
accelerators, such as GPUs.
910

10-
``dpnp.tensor`` is written using C++ and `SYCL <https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html>`_
11-
and oneAPI extensions implemented in `Intel(R) oneAPI DPC++ compiler <https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html>`_.
11+
It also provides the underlying Array API-compliant implementation
12+
used by ``dpnp``.
13+
14+
``dpnp.tensor`` is written using C++ and
15+
`SYCL <https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html>`_
16+
and oneAPI extensions implemented in
17+
`Intel(R) oneAPI DPC++ compiler <https://www.intel.com/content/www/us/en/developer/tools/oneapi/dpc-compiler.html>`_.
18+
19+
Design and Motivation
20+
---------------------
21+
22+
The tensor implementation was originally developed as a standalone project and
23+
later integrated into the `dpctl <https://intelpython.github.io/dpctl/latest/index.html>`_
24+
library as ``dpctl.tensor``. It has since been migrated into ``dpnp``,
25+
making ``dpnp`` the primary owner and development location of the tensor implementation.
26+
27+
This change simplifies maintenance, reduces cross-project
28+
dependencies, and enables independent development and release cycles.
29+
30+
Relationship to ``dpnp.ndarray``
31+
--------------------------------
32+
33+
:class:`dpnp.ndarray` is a high-level array object built on top of
34+
``dpnp.tensor.usm_ndarray``, storing array data in Unified Shared Memory
35+
(USM) allocated on a SYCL device. Most users interact with
36+
:class:`dpnp.ndarray` directly; ``dpnp.tensor.usm_ndarray`` may appear in error
37+
messages or type signatures when working with device placement or
38+
interoperability.
39+
40+
Relationship to ``dpctl``
41+
-------------------------
42+
43+
The migration of ``dpctl.tensor`` into ``dpnp.tensor`` does not replace
44+
`dpctl <https://intelpython.github.io/dpctl/latest/index.html>`_ itself.
45+
``dpctl`` remains responsible for device and queue management
46+
(:class:`dpctl.SyclDevice`, :class:`dpctl.SyclQueue`) as well as USM memory
47+
allocation. ``dpnp`` builds on top of these capabilities.
48+
49+
Example
50+
-------
51+
52+
.. code-block:: python
53+
54+
import dpnp
55+
import dpnp.tensor as dpt
56+
57+
# Create a tensor array on the default device
58+
x = dpt.asarray([1.0, 2.0, 3.0])
59+
60+
# dpnp.ndarray wraps the underlying usm_ndarray
61+
a = dpnp.asarray([1.0, 2.0, 3.0])
62+
assert isinstance(a.get_array(), dpt.usm_ndarray)
1263
1364
.. note::
1465

15-
The documentation for ``dpnp.tensor`` API documentation will be added in a future release.
66+
The ``dpnp.tensor`` API documentation will be added in a future release.
1667

17-
For the complete API reference, see the
68+
The current implementation remains compatible with the original
69+
``dpctl.tensor`` API. For the complete API reference, see the
1870
`dpctl 0.21.1 tensor documentation <https://intelpython.github.io/dpctl/0.21.1/api_reference/dpctl/tensor.html>`_.

0 commit comments

Comments
 (0)