Skip to content

Commit f0b86b9

Browse files
Merge branch 'master' into r0.13
2 parents 8c30f4b + 9a2ef24 commit f0b86b9

File tree

8 files changed

+19
-9
lines changed

8 files changed

+19
-9
lines changed

diagnostics/model_test/verify_model.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ def calculate_output(param_dict, select_device, input_example):
7777

7878
output_tensor_name = param_dict["output_tensor_name"]
7979

80-
config = tf.ConfigProto(inter_op_parallelism_threads=1)
80+
config = tf.ConfigProto(
81+
inter_op_parallelism_threads=1, allow_soft_placement=True)
82+
config_ngraph_enabled = ngraph_bridge.update_config(config)
8183

82-
sess = tf.Session(config=tf.ConfigProto(allow_soft_placement=True))
84+
sess = tf.Session(config=config_ngraph_enabled)
8385
set_os_env(select_device)
8486

8587
# if checkpoint, then load checkpoint

examples/axpy.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@
5050
allow_soft_placement=True,
5151
log_device_placement=False,
5252
inter_op_parallelism_threads=1)
53+
config_ngraph_enabled = ngraph_bridge.update_config(config)
5354

5455
# Create session and run
55-
with tf.Session(config=config) as sess:
56+
with tf.Session(config=config_ngraph_enabled) as sess:
5657
print("Python: Running with Session")
5758
options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
5859
run_metadata = tf.RunMetadata()

examples/axpy_matmul_variable_updated.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@
6161
do_constant_folding=False,
6262
do_function_inlining=False,
6363
)))
64+
config_ngraph_enabled = ngraph_bridge.update_config(config)
6465

6566
# Create session and run
66-
with tf.Session(config=config) as sess:
67+
with tf.Session(config=config_ngraph_enabled) as sess:
6768
print("Python: Running with Session")
6869
options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
6970
run_metadata = tf.RunMetadata()

examples/axpy_variable_updated.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@
6161
do_constant_folding=False,
6262
do_function_inlining=False,
6363
)))
64+
config_ngraph_enabled = ngraph_bridge.update_config(config)
6465

6566
# Create session and run
66-
with tf.Session(config=config) as sess:
67+
with tf.Session(config=config_ngraph_enabled) as sess:
6768
print("Python: Running with Session")
6869
options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
6970
run_metadata = tf.RunMetadata()

examples/mnist/mnist_cnn_inference.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ def train_mnist_cnn(FLAGS):
130130
allow_soft_placement=True,
131131
log_device_placement=True,
132132
inter_op_parallelism_threads=4)
133+
config_ngraph_enabled = ngraph_bridge.update_config(config)
133134

134135
# Note: Additional configuration option to boost performance is to set the
135136
# following environment for the run:
@@ -164,7 +165,7 @@ def train_mnist_cnn(FLAGS):
164165
train_writer = tf.summary.FileWriter(graph_location)
165166
train_writer.add_graph(tf.get_default_graph())
166167
saver = tf.train.Saver()
167-
with tf.Session(config=config) as sess:
168+
with tf.Session(config=config_ngraph_enabled) as sess:
168169
saver.restore(sess, FLAGS.model_dir)
169170
#sess.run(tf.global_variables_initializer())
170171
test_accuracy_final = 0

examples/mnist/mnist_deep_simplified_distributed.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ def train_mnist_cnn(FLAGS):
148148
allow_soft_placement=True,
149149
log_device_placement=False,
150150
inter_op_parallelism_threads=1)
151+
config_ngraph_enabled = ngraph_bridge.update_config(config)
151152

152153
# Note: Additional configuration option to boost performance is to set the
153154
# following environment for the run:
@@ -207,7 +208,8 @@ def train_mnist_cnn(FLAGS):
207208
tf.train.StopAtStepHook(train_loops)
208209
]
209210

210-
with tf.train.MonitoredTrainingSession(hooks=hooks, config=config) as sess:
211+
with tf.train.MonitoredTrainingSession(
212+
hooks=hooks, config=config_ngraph_enabled) as sess:
211213

212214
step = 0
213215
start = time.time()

examples/mnist/mnist_fprop_only.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,9 @@ def run_mnist(_):
6868
allow_soft_placement=True,
6969
log_device_placement=True,
7070
inter_op_parallelism_threads=1)
71+
config_ngraph_enabled = ngraph_bridge.update_config(config)
7172

72-
sess = tf.Session(config=config)
73+
sess = tf.Session(config=config_ngraph_enabled)
7374
tf.global_variables_initializer().run(session=sess)
7475
# Train
7576
train_loops = FLAGS.train_loop_count

examples/mnist/mnist_softmax_distributed.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ def run_mnist(_):
9797
allow_soft_placement=True,
9898
log_device_placement=True,
9999
inter_op_parallelism_threads=1)
100+
config_ngraph_enabled = ngraph_bridge.update_config(config)
100101

101102
#config.graph_options.optimizer_options.global_jit_level = jit_level
102103
run_metadata = tf.RunMetadata()
@@ -106,7 +107,7 @@ def run_mnist(_):
106107

107108
# The MonitoredTrainingSession takes care of session initialization
108109
with tf.train.MonitoredTrainingSession(
109-
hooks=hooks, config=config) as mon_sess:
110+
hooks=hooks, config=config_ngraph_enabled) as mon_sess:
110111
start = time.time()
111112
train_writer = tf.summary.FileWriter(FLAGS.log_dir, mon_sess.graph)
112113
while not mon_sess.should_stop():

0 commit comments

Comments
 (0)