Tensors
A tensor is the fundamental building block of all DL toolkits. The name sounds cool and mystic, but the underlying idea is that a tensor is a multi-dimensional array. One single number is like a point, which is zero-dimensional, while a vector is one-dimensional like a line segment, and a matrix is a two-dimensional object. Three-dimensional number collections can be represented by a parallelepiped of numbers, but don't have a separate name in the same way as matrix. We can keep this term for collections of higher dimensions, which are named multi-dimensional matrices or tensors.
![](https://static.packt-cdn.com/products/9781788834247/graphics/B09471_03_01.jpg)
Figure 1: Going from a single number to an n-dimension tensor
Creation of tensors
If you're familiar with the NumPy library (and you should be), then you already know that its central purpose is the handling of multi-dimensional arrays in a generic way. In NumPy, such arrays aren't called tensors, but, in fact, they are tensors. Tensors are used very widely in scientific computations, as generic storage for...