Tensors are algebraic objects describes a multilinear relationship between sets of algebraic objects related to a vector space.
The simple way to think about it is that tensors generalize scalars, vectors, and matrices:
- A scalar is a 0th-order tensor
- A vector is a 1st-order tensor
- A matrix is a 2nd-order tensor
The shape of a tensor is often denoted as
For , we have scalars, for we have vectors, for we have matrices. In practice, a tensor is described by the type of its elements and its shape. Typically the element type is floating-point values, but can also be integers or even strings.
Tensors can be indexed to get slices (subsets) of their values, and most use numpy indexing conventions.
For simple equations we use pedices. For example, for a 3-dimension vector , we can write to denote a slice of size , or for a single scalar. We can use commas for more complex expressions, as to denote a slice of size .