TensorFlow takes its name from a mathematical object called a tensor. You can imagine tensors as N-dimensional arrays. A tensor could be a scalar, a vector, a 3D matrix, or an N-dimensional matrix.
A fundamental component of TensorFlow, the Tensor object is used to store mathematical values. It can contain fixed values (created using tf.constant) or changing values (created using tf.Variable).
In this book, tensor denotes the mathematical concept, while Tensor (with a capital T) corresponds to the TensorFlow object.
Each Tensor object has the following:
- Type: string, float32, float16, or int8, among others.
- Shape: The dimensions of the data. For instance, the shape would be () for a scalar, (n) for a vector of size n, and (n, m) for a 2D matrix of size n × m.
- Rank: The number of dimensions, 0 for a scalar, 1 for a vector, and 2 for a 2D matrix.
Some tensors can have partially unknown shapes. For instance, a model accepting images of variable...