In [ ]:


In [2]:
import tensorflow as tf
#(a-b)^2=a^2+b^2-2ab
#let conder the values 
a=6
b=7

with tf.name_scope("Lab_Assignment_1"):
    with tf.name_scope("a"):
        w = tf.multiply(a,a)
        x = tf.multiply(b,b) 
    with tf.name_scope("b"):
        y = tf.multiply(2,a)
        z = tf.multiply(y,b)
        
with tf.name_scope("c"):
        r1 = tf.add(w,x)
        res = tf.subtract(r1,z)
        

with tf.Session() as sess:
    writer = tf.summary.FileWriter("/tmp/tboard/output3_VimalH",sess.graph)
    print(sess.run(res))
    writer.close()


1

In [ ]:


In [ ]:


In [ ]:


In [3]:
#(a-b-c)^2=a^2+b^2+c^2-2ab-2bc-2ca
#let conder the values 
a=6
b=7
c=8

with tf.name_scope("Lab_Assignment_2"):
    with tf.name_scope("a"):
        r = tf.multiply(a,a)
        s = tf.multiply(b,b) 
        t = tf.multiply(c,c) 
    with tf.name_scope("b"):
        u1 = tf.multiply(2,a)
        res1 = tf.multiply(u1,b)
    with tf.name_scope("c"):
        u2 = tf.multiply(2,b)
        res2 = tf.multiply(u2,c)
    with tf.name_scope("d"):
        u3 = tf.multiply(2,c)
        res3 = tf.multiply(u3,a)
        
with tf.name_scope("e"):
        r1 = tf.add(r,s)
        r2 = tf.add(r1,t)
        final1= tf.subtract(r2,res1)
        final2= tf.subtract(final1,res2)
        finalresult= tf.add(final2,res3)

with tf.Session() as sess:
    writer = tf.summary.FileWriter("/tmp/tboard/output3_vimal",sess.graph)
    print(sess.run(finalresult))
    writer.close()


49

In [ ]: