In [1]:
#Placeholders: Feed data later and build the graph now.
import tensorflow as tf
x = tf.placeholder("float", None)
y = x*2
with tf.Session() as session:
result = session.run(y, feed_dict={x:[1,2,3]})
print(result)
In [4]:
x = tf.placeholder("float", None) # None : Any number of dimension
y = x*2
with tf.Session() as session:
xData = [
[1, 2, 3],
[4, 5, 5]
]
result = session.run(y, feed_dict={x:xData})
print(result)
In [5]:
# Graphs are created for the operations and the variables.
# The variables are called tensors.
In [10]:
session = tf.InteractiveSession()
x = tf.constant(list(range(10)))
print(x.eval())
session.close()