TensorFlow: feed data

From OnnoWiki
Jump to navigation Jump to search
import tensorflow as tf
import numpy as np
a = 3
b = 2
x = tf.placeholder(tf.float32,shape=(a,b))
y = tf.add(x,x)
data = np.random.rand(a,b)
sess = tf.Session()
print sess.run(y,feed_dict={x:data})
# Finally, close the TensorFlow session when you're done:
sess.close()


Pranal Menarik