|
4 | 4 | Baby Steps - Algebra
|
5 | 5 | ====================
|
6 | 6 |
|
| 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 | + |
7 | 32 | Adding two Scalars
|
8 | 33 | ==================
|
9 | 34 |
|
@@ -173,25 +198,6 @@ It is possible to add scalars to matrices, vectors to matrices,
|
173 | 198 | scalars to vectors, etc. The behavior of these operations is defined
|
174 | 199 | by :ref:`broadcasting <libdoc_tensor_broadcastable>`.
|
175 | 200 |
|
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 |
| - |
195 | 201 |
|
196 | 202 |
|
197 | 203 | Exercise
|
|
0 commit comments