alexanderholt
11/7/2017 - 8:36 PM

TensorFlow Initializing Variables

# create placeholder tensors
x = tf.placeholder(tf.float32, name = 'x')
y = tf.placeholder(tf.float32, name = 'y')
# create Variable tensors

w = tf.Variable(0.0, name='w')
b = tf.Variable(0.0, name='b')
import tensorflow as tf
a_list = [1, 2, 3, 4, 5]
tf.reset_default_graph
x = tf.placeholder(tf.int32, shape=[5], name='x')

w = tf.Variable(1, name='m')

b = tf.Variable(1, name='b')

linear_func = tf.add(tf.multiply(x, w), b)

# Remember everything is run in the session, we are just define what we want to do here.
init = tf.global_variables_initializer()

with tf.Session() as sess:
    
    sess.run(init)
    
    
    
    line = sess.run(linear_func, feed_dict={x: a_list})


    print(line)