dimanche 3 juillet 2016

How to obtain the random seed from TensorFlow?

I want to be able to reproduce training sessions of Neural Networks in TensorFlow. When I run TensorFlow I assume it has some rand state that makes it choose some specific initialization for the variables. This is what I think I am mostly interested in reproducing. I think I can successfully reproduce the SGD steps because I am able to obtain the numpy seed that makes me have random choices of batches (see this). Since the nature of numpy is to have a weird tuples for keeping random seends, re-using that state to make a seed in TensorFlow is unclear to me. Is it possible to get the TensorFlow random seed?


I did read some of the documentation of TensorFlow on random seeds and it seems that it mainly says how to set seeds rather than read them. Does this mean that the best way to get a random seed from TensorFlow is by asking the computers OS to get a random number? Or maybe to ask python for a random seed when it runs? Or maybe a combination of those plus the current time or something like that?

Maybe something like:

random.seed()
random_seed = random.getstate()
tf_set_random_seed(random_seed)




Aucun commentaire:

Enregistrer un commentaire