Skip to content

Removed emphasis on dtypes in Introduction #968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 25 additions & 19 deletions doc/tutorial/adding.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,31 @@
Baby Steps - Algebra
====================

Understanding Tensors
===========================

Before diving into PyTensor, it's essential to understand the fundamental
data structure it operates on: the *tensor*. A *tensor* is a multi-dimensional
array that serves as the foundation for symbolic computations.

tensors can represent anything from a single number (scalar) to
complex multi-dimensional arrays. Each tensor has a type that dictates its
dimensionality and the kind of data it holds.

For example, the following code creates a symbolic scalar and a symbolic matrix:

>>> x = pt.scalar('x')
>>> y = pt.matrix('y')

Here, `scalar` refers to a tensor with zero dimensions, while `matrix` refers
to a tensor with two dimensions. The same principles apply to tensors of other
dimensions.

For more information about tensors and their associated operations can be
found here: :ref:`tensor <libdoc_tensor>`.



Adding two Scalars
==================

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

The following types are available:

* **byte**: ``bscalar, bvector, bmatrix, brow, bcol, btensor3, btensor4, btensor5, btensor6, btensor7``
* **16-bit integers**: ``wscalar, wvector, wmatrix, wrow, wcol, wtensor3, wtensor4, wtensor5, wtensor6, wtensor7``
* **32-bit integers**: ``iscalar, ivector, imatrix, irow, icol, itensor3, itensor4, itensor5, itensor6, itensor7``
* **64-bit integers**: ``lscalar, lvector, lmatrix, lrow, lcol, ltensor3, ltensor4, ltensor5, ltensor6, ltensor7``
* **float**: ``fscalar, fvector, fmatrix, frow, fcol, ftensor3, ftensor4, ftensor5, ftensor6, ftensor7``
* **double**: ``dscalar, dvector, dmatrix, drow, dcol, dtensor3, dtensor4, dtensor5, dtensor6, dtensor7``
* **complex**: ``cscalar, cvector, cmatrix, crow, ccol, ctensor3, ctensor4, ctensor5, ctensor6, ctensor7``

The previous list is not exhaustive and a guide to all types compatible
with NumPy arrays may be found here: :ref:`tensor creation<libdoc_tensor_creation>`.

.. note::

You, the user---not the system architecture---have to choose whether your
program will use 32- or 64-bit integers (``i`` prefix vs. the ``l`` prefix)
and floats (``f`` prefix vs. the ``d`` prefix).



Exercise
Expand Down
Loading