Created
April 14, 2018 08:02
-
-
Save kinoko3/e968ece1a67e435378889b91829d8de6 to your computer and use it in GitHub Desktop.
tensorflow study
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 | |
state = tf.Variable(0, name='test') # 变量 | |
one = tf.constant(1) # 张量 | |
new_value = tf.add(state, one) | |
update = tf.assign(state, new_value) #更新 new_value 替换state | |
init = tf.global_variables_initializer() | |
with tf.Session() as sess: | |
sess.run(init) | |
for _ in range(3): | |
sess.run(update) | |
print(sess.run(state)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment