tf.compat.v1.set_random_seed | TensorFlow Core v2.7.0
www.tensorflow.org › tf › compatNov 05, 2021 · To generate the same repeatable sequence for an op across sessions, set the seed for the op: a = tf.random.uniform ( [1], seed=1) b = tf.random.normal ( [1]) # Repeatedly running this block with the same graph will generate the same # sequence of values for 'a', but different sequences of values for 'b'. print ("Session 1") with tf.compat.v1.Session () as sess1: print (sess1.run (a)) # generates 'A1' print (sess1.run (a)) # generates 'A2' print (sess1.run (b)) # generates 'B1' print (sess1.