We can define basically three types of tensor:

**Constant**: It is a tensor which will be constant while a graph run there is no need to initialize it.

**Variable**: It is a tensor which will be asynchronously assigned and initiated.

**Placeholder**: It is a tensor which accept value at run time from the feed_dict.

Code for Constant:

import tensorflow as tfa= tf.constant(12)b=tf.constant(13)c=tf.multiply(a,b,name='mul')print(c)sess=tf.Session()b=tf.constant(13)sess.run(c)

Code for Variable:

import tensorflow as tfa=tf.Variable(2)b=tf.Variable(3)c=tf.multiply(a,b,name='mul')b=tf.Variable(3)print(c)sess=tf.Session()b=tf.Variable(5)model=tf.global_variables_initializer()sess.run(model)sess.run(c)

Code of Place Holder:import tensorflow as tftf.reset_default_graph()a= tf.placeholder(tf.float32,shape=[1])b=tf.placeholder(tf.float32,shape=[1])c= tf.multiply(a,b)print(c)sess=tf.Session()#model=tf.global_variables_initializer()#sess.run(model)sess.run(c,feed_dict={a:(2,),b:(9,)})

very informative!

It’s very easy way.. to get learn