def set_seed_tmp(seed=None):
if seed is None:
yield
else:
state = random.getstate()
np_state = np.random.get_state()
random.seed(seed)
np.random.seed(seed)
yield
np.random.set_state(np_state)
random.setstate(state)
评论列表
文章目录