tensorflow1.X改变结点值

1
2
3
4
5
6
7
8
9
10
11
import tensorflow as tf


W = tf.Variable(3.14)

with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
v_W = sess.run(W)
v_new_W = sess.run(tf.assign(W, 6.28))
print(v_W,'-->',v_new_W)
#3.14 --> 6.28

转载请注明来源 https://tianweiye.github.io