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

import tensorflow as tf

x=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

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

#Add Variables

a=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 graph

with 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: