Skip to content

Instantly share code, notes, and snippets.

@liopic
Last active July 25, 2020 19:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liopic/764328a19a01ec7b2a7a74802f7175ff to your computer and use it in GitHub Desktop.
Save liopic/764328a19a01ec7b2a7a74802f7175ff to your computer and use it in GitHub Desktop.
Keep Keras model deterministic
from numpy.random import seed
seed(42)
from tensorflow import set_random_seed
set_random_seed(42)
# tf 2.x
tf.keras.backend.clear_session()
tf.random.set_seed(51)
np.random.seed(51)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment