What do you mean by Tensor and Explain about Tensor Datatype and Ranks?
A tensor is often thought of as a generalized matrix. That is, it could be a 1-D matrix (a vector is actually such a tensor), a 3-D matrix (something like a cube of numbers), even a 0-D matrix (a single number), or a higher dimensional structure that is harder to visualize. The dimension of the tensor is called its rank.
A tensor is a mathematical entity that lives in a structure and interacts with other mathematical entities. If one transforms the other entities in the structure in a regular way, then the tensor must obey a related transformation rule.
Tensor Data Type
Tensors have a data type. Refer to the tf.DType page for a complete list of the data types.
When creating a tf.Tensor from a python object you may optionally specify the datatype. If you don’t, TensorFlow chooses a datatype that can represent your data. TensorFlow converts Python integers to tf.int32 and python floating point numbers to tf.float32. Otherwise TensorFlow uses the same rules numpy uses when converting to arrays.
The rank of a tf.Tensor object is its number of dimensions. Synonyms for rank include order or degree or n-dimension. Note that rank in TensorFlow is not the same as matrix rank in mathematics. As the following table shows, each rank in TensorFlow corresponds to a different mathematical entity:
|0||Scalar (magnitude only)|
|1||Vector (magnitude and direction)|
|2||Matrix (table of numbers)|
|3||3-Tensor (cube of numbers)|
|n||n-Tensor (you get the idea)|