Let's make hello world using tensorflow function¶
In [0]:
import tensorflow as tf
tf.__version__
_helloworld = tf.constant("HelloWorld")
sess = tf.Session()
print(sess.run(_helloworld))
Let's make (node1+node2=node3 ) computational Graph using tf.constant¶
In [16]:
import tensorflow as tf
node1 = tf.constant(3.0)
node2 = tf.constant(4.0)
node3 = tf.add(node1,node2)
sess = tf.Session()
print("node3->",sess.run(node3))
Let's make (node1+node2=node3 ) coputational Graph using tf.placeholder¶
In [19]:
import tensorflow as tf
node1 = tf.placeholder(tf.float32)
node2 = tf.placeholder(tf.float32)
node3 = tf.add(node1,node2)
sess = tf.Session()
print(sess.run(node3,feed_dict ={node1:1.0,node2:2.0}))
print(sess.run(node3,feed_dict={node1:[1.0,1.0],node2:[1.0,2.0]}))
No comments:
Post a Comment