import tensorflow as tf
y = tf.random.uniform((10,))
tf.print(x)
tf.print(y)
[0.777826548 0.549564362 0.927539468 ... 0.671201348 0.520827532 0.136777878]
[0.777826548 0.549564362 0.927539468 ... 0.671201348 0.520827532 0.136777878]
#Miserably fails, just like in your example. But if you set a seed to the generator ...
#Then things change :
tf.random.set_seed(5)
x = tf.random.uniform((10,))
y = tf.random.uniform((10,))
tf.print(x)
tf.print(y)
[0.938712 0.232297301 0.336924076 ... 0.167190075 0.713239312 0.72905457]
[0.872716188 0.777892709 0.757990599 ... 0.398707151 0.269669414 0.13554287]
#Looks like (my version of) tf.random expected me to set seed after import to function properly, and then :
for _ in range(5):
x = tf.random.uniform((10,))
tf.print(x)
y = tf.random.uniform((10,))
tf.print(y)
[0.0574320555 0.471288085 0.26564157 ... 0.996522188 0.643563628 0.726679444]
[0.557744 0.0340180397 0.834528685 ... 0.0818101168 0.734278798 0.158308387]
[0.143032432 0.18623054 0.289602399 ... 0.980972409 0.848671198 0.988181353]
[0.691958904 0.174700618 0.164491534 ... 0.116780043 0.314524889 0.39814651]
#Looks like tf.random works fine.