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)


<tensorflow.python.ops.variables.Variable object at 0x1067f9cc0>

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))


None
[ 75 105]

In [17]:
import numpy as np
data = np.random.randint(1000, size=10)
data


Out[17]:
array([ 75, 528, 975, 596, 512, 179, 285, 477, 474, 763])

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))


[  5625 278784 950625 355216 262144  32041  81225 227529 224676 582169]

In [23]:
with tf.Session() as session:
    session.run(model)
    for i in range(5):
        
        z = session.run(y)
        print(z+i)


[  5625 278784 950625 355216 262144  32041  81225 227529 224676 582169]
[  5626 278785 950626 355217 262145  32042  81226 227530 224677 582170]
[  5627 278786 950627 355218 262146  32043  81227 227531 224678 582171]
[  5628 278787 950628 355219 262147  32044  81228 227532 224679 582172]
[  5629 278788 950629 355220 262148  32045  81229 227533 224680 582173]

In [ ]: