bad now good, check 5: 5.55077327554663e+19
[notebooks.git] / fmda / reproducibility.py
blob98524daf3a4120245d540ba1e2191a92223df0c2
1 # make session reproducible
2 import os
3 print('setting TF_DETERMINISTIC_OPS=1 PYTHONHASHSEED=0')
4 os.environ['TF_DETERMINISTIC_OPS'] = '1'
5 os.environ['PYTHONHASHSEED'] = '0'
6 def set_seed(seed=123):
7 import random
8 random.seed(seed)
9 import numpy as np
10 np.random.seed(seed)
11 import tensorflow as tf
12 tf.random.set_seed(seed)
13 tf.keras.utils.set_random_seed(seed)
14 print('resetting random seed do %i' % seed)
15 set_seed()
16 print('call set_seed() or set_seed(seed=value) to reset')