Created
August 22, 2017 12:54
-
-
Save leechanwoo/fba24aefd642b6ceb2cc526e23e6ea19 to your computer and use it in GitHub Desktop.
tensorflow basic, session
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 | |
const = tf.constant("hello world") | |
print(const) |
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 | |
const = tf.constant("hello world") | |
sess = tf.Session() | |
hello = sess.run(const) | |
print(hello) | |
sess.close() |
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 | |
const = tf.constant("hello world") | |
with tf.Session() as sess: | |
hello = sess.run(const) | |
print(hello) |
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 | |
const = tf.constant(10) | |
with tf.Session() as sess: | |
ten = sess.run(const) | |
print(ten) |
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 | |
one = tf.constant(1) | |
two = tf.constant(2) | |
three = tf.contant(3) | |
four = tf.constant(4) | |
five = tf.constant(5) | |
add12 = one + two | |
add123 = add12 + three | |
add34 = three + four | |
add2345 = two + add34 + five | |
total = add123 + add2345 | |
with tf.Session() as sess: | |
six = sess.run(add123) | |
fourteen = sess.run(add2345) | |
twenty = sess.run(total) | |
print(six) | |
print(fourteen) | |
print(twenty) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment