Created
January 24, 2020 13:58
-
-
Save allanbatista/49021c27446ccb19645381670306a674 to your computer and use it in GitHub Desktop.
set seed for keras and tensorflow
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import tensorflow as tf | |
import numpy as np | |
import random as rn | |
from tensorflow.keras import backend as K | |
np.random.seed(0) | |
rn.seed(0) | |
session_conf = tf.ConfigProto(intra_op_parallelism_threads=1, inter_op_parallelism_threads=1) | |
tf.set_random_seed(0) | |
sess = tf.Session(graph=tf.get_default_graph(), config=session_conf) | |
K.set_session(sess) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment