1 # make session reproducible
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):
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
)
16 print('call set_seed() or set_seed(seed=value) to reset')