vendredi 12 janvier 2018

Tensorflow generate random seed

I a program where I use tensorflow. There are several places where I needed to generate random numbers frm numpy random and tensorflow random numbers. So I seed it at the beginning of the file like this

import random
random.seed(1337)

import numpy as np
np.random.seed(1337)  # for reproducibility

import tensorflow as tf
tf.set_random_seed(1)

Even after using such random seeds im my results are different everytime I run the program. But I need the result reproducible. How can I do that?




Aucun commentaire:

Enregistrer un commentaire