Created
June 19, 2017 17:05
-
-
Save BinRoot/6c0b681e7a0c16a50368c723e89df50f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
x = tf.Variable(2, name='x', dtype=tf.float32) | |
log_x = tf.log(x) | |
y = tf.square(log_x) + 1 | |
optimizer = tf.train.GradientDescentOptimizer(0.5) | |
train = optimizer.minimize(y) | |
init = tf.global_variables_initializer() | |
with tf.Session() as sess: | |
sess.run(init) | |
for step in range(10): | |
x_val, y_val = sess.run([x, y]) | |
print('x: {}, y: {}'.format(x_val, y_val)) | |
sess.run(train) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment