In [1]:
'''
A TF / Learning model will be like a way of representing computation without actually performing it until asked.
'''
import tensorflow as tf
x = tf.constant(35, name='x')
y = tf.Variable(x + 5, name='y')
print(y)
In [14]:
import tensorflow as tf
x = tf.constant([35, 50], name='x')
y = tf.Variable(x+5, name='y')
model = tf.initialize_all_variables()
with tf.Session() as session:
print(session.run(model))
print(session.run(x+y))
In [17]:
import numpy as np
data = np.random.randint(1000, size=10)
data
Out[17]:
In [19]:
x = tf.constant(data, name='x')
y = tf.Variable(x*x, name='y')
model = tf.initialize_all_variables()
with tf.Session() as session:
session.run(model)
print(session.run(y))
In [23]:
with tf.Session() as session:
session.run(model)
for i in range(5):
z = session.run(y)
print(z+i)
In [ ]: