Tensorflow: Basics -I

Let us start with some basics of addition and multiplication program and represent them in a tensorboard.

`import tensorflow as tfx=tf.constant(1,name='x')m=tf.constant(2,name='y')z=tf.constant(3,name='z')prod=tf.multiply(x,m,name='multiply')add=tf.add(prod,z,name='add')with tf.Session() as sess:     writer=tf.summary.FileWriter(logdir='./graph',graph=sess.graph)     print(sess.run(add))Output is :5`

Now, if we want to check the graph, we have to run following command in Linux(Note: I have used Kali linux), read different types of tensor in

Next Step is to create a scope in tensorflow, this helps in maintaining the code complexity.

`#Add Variablesa=tf.constant(2,name='a')b=tf.constant(2,name='b')c=tf.constant(3,name='c')d=tf.constant(4,name='d')with tf.name_scope("Addition"):     with tf.name_scope("Addition1"):         add1=tf.add(a,b,name='Addition')     with tf.name_scope("Addition2"):         add2=tf.add(c,d,name='Addition')with tf.name_scope("Multiplication"):     mul=tf.multiply(add1,add2,name="multiply")#Run the graphwith tf.Session() as sess1:     writer= tf.summary.FileWriter(logdir='./graph1',graph=sess1.graph)     print(sess1.run(mul))tf.reset_default_graph()`

If we want to check in detail:

• oprol evorter

I like the valuable info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I am quite certain I will learn lots of new stuff right here! Good luck for the next!

• sirgliofrei

I have not checked in here for a while because I thought it was getting boring, but the last several posts are good quality so I guess I will add you back to my daily bloglist. You deserve it my friend 🙂

• Mirta

Hi mates, how is the whole thing, and what you want to say concerning