TensorFlow uses tensor to define the framework and processing data. A tensor conceptualized multidimensions vectors and matrices. Mathematically, a tensor is a geometric object that maps in a multi-linear manner geometric vectors, scalars, and another tensor(s) to a resulting tensor.
These tensor objects used to implement a Graph object which coordinated among them self to produce the desired result. A tensor(tf.Tensor) object has the two basic properties that are “Data Type” and “Shape”. Each element in the Tensor has the same data type, and the data type is always known. The shape (that is, the number of dimensions it has and the size of each dimension) might be only partially known. Most operations produce tensors of fully-known shapes if the shapes of their inputs are also fully known, but in some cases, it’s only possible to find the shape of a tensor at graph execution time. Apart from this are other possible variables are also there.
Tensor Rank (dimension)
Rank of tensor is the actual dimension of the database. The tensor shape represents the size of each dimension. A 0 rank means zero dimension and represents scalar quantity.
fruit = tf.Variable("Apple", tf.string)
Count = tf.Variable(100, tf.int16)
Weight = tf.Variable(3.14159265359, tf.float64)
Rank 1 means One dimension that is a list of items.
Names = tf.Variable(["Nilesh","Akash","Ritesh"], tf.string)
Weights = tf.Variable([100, 110], tf.float32)
GPA = tf.Variable([4,3], tf.int32)
Rank 2 means 2D array that is List of List.
Students = tf.Variable([["Nilesh"],["Ritesh"]], tf.string
Ages = tf.Variable([,], tf.int16)
Tall = tf.Variable([[False], [True]], tf.bool)
Rank of a
tf.rank method can be use to determine rank of a object.
r = tf.rank(Students)
# After the graph runs, r will hold the value 2.
import tensorflow as tf
sess = tf.InteractiveSession()
Students = tf.Variable([["Nilesh"],["Ritesh"]], tf.string)
r = tf.rank(Students)
init = tf.global_variables_initializer()
print_op = tf.print(r)
out = tf.add(r, r)
v = sess.run(Students)
(venv) [nilesh@localhost TENSORFLOW]$
Instructions for updating:
Colocations handled automatically by placer.