Skip to content

Instantly share code, notes, and snippets.

@mirrornerror
Last active October 24, 2018 09:23
Show Gist options
  • Save mirrornerror/8e03fc372e5481baf7f7aa2a9c1cc227 to your computer and use it in GitHub Desktop.
Save mirrornerror/8e03fc372e5481baf7f7aa2a9c1cc227 to your computer and use it in GitHub Desktop.
import numpy as np
import tensorflow as tf
import random as rn
import os
os.environ['PYTHONHASHSEED'] = '0'
random_n = 123
np.random.seed(random_n)
rn.seed(random_n)
session_conf = tf.ConfigProto(intra_op_parallelism_threads=1, inter_op_parallelism_threads=1)
from keras import backend as K
tf.set_random_seed(random_n)
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