def set_seed(seed):
seed %= 4294967294
global seed_
seed_ = seed
random.seed(seed)
np.random.seed(seed)
try:
import lasagne
lasagne.random.set_rng(np.random.RandomState(seed))
except Exception as e:
print(e)
try:
import tensorflow as tf
tf.set_random_seed(seed)
except Exception as e:
print(e)
print((
colorize(
'using seed %s' % (str(seed)),
'green'
)
))
评论列表
文章目录