Commit 4a714e00 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

add more option to reproducible

parent b9fd76bd
...@@ -8,8 +8,13 @@ from tensorflow.core.protobuf import rewriter_config_pb2 ...@@ -8,8 +8,13 @@ from tensorflow.core.protobuf import rewriter_config_pb2
def set_seed( def set_seed(
seed=0, python_hash_seed=0, log_device_placement=False, allow_soft_placement=False, seed=0,
arithmetic_optimization=None, allow_growth=None, 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 """Sets the seeds in python, numpy, and tensorflow in order to help
training reproducible networks. training reproducible networks.
...@@ -64,10 +69,13 @@ def set_seed( ...@@ -64,10 +69,13 @@ def set_seed(
allow_soft_placement=allow_soft_placement, 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 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: if allow_growth is not None:
session_config.gpu_options.allow_growth = allow_growth session_config.gpu_options.allow_growth = allow_growth
session_config.gpu_options.per_process_gpu_memory_fraction = 0.8 session_config.gpu_options.per_process_gpu_memory_fraction = 0.8
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment