Skip to content

Commit 4d0103b

Browse files
Removed types examples and introduced tensor (#968)
1 parent 29183c7 commit 4d0103b

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

doc/tutorial/adding.rst

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,31 @@
44
Baby Steps - Algebra
55
====================
66

7+
Understanding Tensors
8+
===========================
9+
10+
Before diving into PyTensor, it's essential to understand the fundamental
11+
data structure it operates on: the *tensor*. A *tensor* is a multi-dimensional
12+
array that serves as the foundation for symbolic computations.
13+
14+
tensors can represent anything from a single number (scalar) to
15+
complex multi-dimensional arrays. Each tensor has a type that dictates its
16+
dimensionality and the kind of data it holds.
17+
18+
For example, the following code creates a symbolic scalar and a symbolic matrix:
19+
20+
>>> x = pt.scalar('x')
21+
>>> y = pt.matrix('y')
22+
23+
Here, `scalar` refers to a tensor with zero dimensions, while `matrix` refers
24+
to a tensor with two dimensions. The same principles apply to tensors of other
25+
dimensions.
26+
27+
For more information about tensors and their associated operations can be
28+
found here: :ref:`tensor <libdoc_tensor>`.
29+
30+
31+
732
Adding two Scalars
833
==================
934

@@ -173,25 +198,6 @@ It is possible to add scalars to matrices, vectors to matrices,
173198
scalars to vectors, etc. The behavior of these operations is defined
174199
by :ref:`broadcasting <libdoc_tensor_broadcastable>`.
175200

176-
The following types are available:
177-
178-
* **byte**: ``bscalar, bvector, bmatrix, brow, bcol, btensor3, btensor4, btensor5, btensor6, btensor7``
179-
* **16-bit integers**: ``wscalar, wvector, wmatrix, wrow, wcol, wtensor3, wtensor4, wtensor5, wtensor6, wtensor7``
180-
* **32-bit integers**: ``iscalar, ivector, imatrix, irow, icol, itensor3, itensor4, itensor5, itensor6, itensor7``
181-
* **64-bit integers**: ``lscalar, lvector, lmatrix, lrow, lcol, ltensor3, ltensor4, ltensor5, ltensor6, ltensor7``
182-
* **float**: ``fscalar, fvector, fmatrix, frow, fcol, ftensor3, ftensor4, ftensor5, ftensor6, ftensor7``
183-
* **double**: ``dscalar, dvector, dmatrix, drow, dcol, dtensor3, dtensor4, dtensor5, dtensor6, dtensor7``
184-
* **complex**: ``cscalar, cvector, cmatrix, crow, ccol, ctensor3, ctensor4, ctensor5, ctensor6, ctensor7``
185-
186-
The previous list is not exhaustive and a guide to all types compatible
187-
with NumPy arrays may be found here: :ref:`tensor creation<libdoc_tensor_creation>`.
188-
189-
.. note::
190-
191-
You, the user---not the system architecture---have to choose whether your
192-
program will use 32- or 64-bit integers (``i`` prefix vs. the ``l`` prefix)
193-
and floats (``f`` prefix vs. the ``d`` prefix).
194-
195201

196202

197203
Exercise

0 commit comments

Comments
 (0)