Tensors: The building block of TensorFlow

Photograph supply: https://en.wikipedia.org/wiki/TensorFlow

TensorFlow makes use of tensor to outline the framework and processing knowledge. A tensor conceptualized multidimensions vectors and matrices. Mathematically, a tensor is a geometrical object that maps in a multi-linear way geometric vectors, scalars, and any other tensor(s) to a ensuing tensor.

Rank Entity
zero Scalar
1 Vector
2 Matrix
Three Three-Tensor
n n-Tensor

Those tensor gadgets used to put into effect a Graph object which coordinated amongst them self to supply the specified end result. A tensor(tf.Tensor) object has the 2 fundamental houses which are “Knowledge Sort” and “Form”. Every component within the Tensor has the similar knowledge sort, and the information sort is all the time recognized. The form (this is, the quantity of dimensions it has and the scale of every measurement) may well be most effective partly recognized. Maximum operations produce tensors of fully-known shapes if the shapes of their inputs also are completely recognized, however in some instances, it’s most effective conceivable to seek out the form of a tensor at graph execution time. Except for this are different conceivable variables also are there.

Tensor Rank (measurement)

Rank of tensor is the true measurement of the database. The tensor form represents the scale of every measurement. A nil rank way 0 measurement and represents scalar amount.

fruit = tf.Variable("Apple", tf.string)
Rely = tf.Variable(100, tf.int16)
Weight = tf.Variable(Three.14159265359, tf.glide64)

Rank 1 way One measurement that could be a record of pieces.

Names = tf.Variable(["Nilesh","Akash","Ritesh"], tf.string) 
Weights  = tf.Variable([100, 110], tf.glide32)
GPA = tf.Variable([4,3], tf.int32)

Rank 2 way 2D array this is Listing of Listing.

Scholars = tf.Variable([["Nilesh"],["Ritesh"]], tf.string)
Ages = tf.Variable([[25],[26]], tf.int16)
Tall = tf.Variable([[False], [True]], tf.bool)

 Rank of atf.Tensor object

tf.rank approach will also be use to decide rank of a object.

r = tf.rank(Scholars)
# After the graph runs, r will cling the price 2.


 import tensorflow as tf
sess = tf.InteractiveSession()
Scholars = tf.Variable([["Nilesh"],["Ritesh"]], tf.string)
r = tf.rank(Scholars)
init = tf.global_variables_initializer()
with sess.as_default():
print_op = tf.print(r)
with tf.control_dependencies([print_op]):
out = tf.upload(r, r)
with sess.as_default():
v = sess.run(Scholars)
(venv) [nilesh@localhost TENSORFLOW]$ 
Directions for updating:
Colocations treated routinely by means of placer.

Leave a Reply

Your email address will not be published. Required fields are marked *