0
当tensorflow的会话运行时,我需要得到相同的y值。我该如何获得具有相同价值的y,而不是重新运行此图?如何获得tensorflow中的内部张量值
import tensorflow as tf
import numpy as np
x = tf.Variable(0.0)
tf.set_random_seed(10)
x_plus1 = x+tf.random_normal([1], mean=0.0, stddev=0.01,dtype=tf.float32)
y = tf.Variable([1.0])
y += x_plus1
z = y + tf.random_normal([1], mean=0.0, stddev=0.01,dtype=tf.float32)
init = tf.global_variables_initializer()
with tf.Session() as sess:
sess.run(init)
print(z.eval())
for i in range(5):
print(y.eval())
在这里,我想得到y有助于z。
在我看来,我想在z运行时得到y。 –