Skip to content
Snippets Groups Projects
Commit 12784b1c authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

add more option to reproducible

parent baa18561
No related branches found
No related tags found
No related merge requests found
......@@ -8,8 +8,13 @@ from tensorflow.core.protobuf import rewriter_config_pb2
def set_seed(
seed=0, python_hash_seed=0, log_device_placement=False, allow_soft_placement=False,
arithmetic_optimization=None, allow_growth=None,
seed=0,
python_hash_seed=0,
log_device_placement=False,
allow_soft_placement=False,
arithmetic_optimization=None,
allow_growth=None,
memory_optimization=None,
):
"""Sets the seeds in python, numpy, and tensorflow in order to help
training reproducible networks.
......@@ -64,10 +69,13 @@ def set_seed(
allow_soft_placement=allow_soft_placement,
)
if arithmetic_optimization == 'off':
off = rewriter_config_pb2.RewriterConfig.OFF
off = rewriter_config_pb2.RewriterConfig.OFF
if arithmetic_optimization == "off":
session_config.graph_options.rewrite_options.arithmetic_optimization = off
if memory_optimization == "off":
session_config.graph_options.rewrite_options.memory_optimization = off
if allow_growth is not None:
session_config.gpu_options.allow_growth = allow_growth
session_config.gpu_options.per_process_gpu_memory_fraction = 0.8
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment