如題,詳細如下:
(1)
import tensorflow as tf
with tf.Session() as sess:
s = tf.random_uniform((2,3), 0, 2, dtype="int32", seed = None)
see_s = s.eval(session=sess)
這段code因為沒有指定seed,每次run都會看到不同的see_s,很正常
(2)
import tensorflow as tf
with tf.Session() as sess:
s = tf.random_uniform((2,3), 0, 2, dtype="int32", seed = 1)
see_s = s.eval(session=sess)
這段code因為有指定seed,每次run都會看到相同的see_s,很正常
但是!
(3)
import tensorflow as tf
with tf.Session() as sess:
s = tf.random_uniform((2,3), 0, 2, dtype="int32", seed = 1)
see_s_1 = s.eval(session=sess)
see_s_2 = s.eval(session=sess)
會發現see_s_1 不等於 see_s_2
WHY!?
目前只能馬後炮猜測每eval一次 會改變seed一次
但是好沒說服力QQ
請問板友們真正原因~謝謝!
ref: https://github.com/tensorflow/tensorflow/issues/9171
(好像沒有什麼結論@@?)