Last active
December 12, 2019 14:54
-
-
Save nithyadurai87/4ad051ef5c3cc2a3da6c043cd99d0f1b to your computer and use it in GitHub Desktop.
This file contains 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.constant(0.5) | |
Y = tf.constant(0.0) | |
W = tf.Variable(1.0) | |
predict_Y = tf.multiply(X,W) | |
cost = tf.pow(Y - predict_Y,2) | |
min_cost = tf.train.GradientDescentOptimizer(0.025).minimize(cost) | |
for i in [X,W,Y,predict_Y,cost]: | |
tf.summary.scalar(i.op.name,i) | |
summaries = tf.summary.merge_all() | |
with tf.Session() as s: | |
summary_writer = tf.summary.FileWriter('single_input_neuron',s.graph) | |
s.run(tf.global_variables_initializer()) | |
for i in range(100): | |
summary_writer.add_summary(s.run(summaries),i) | |
s.run(min_cost) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment