Skip to content

Commit e7d8bea

Browse files
Fixed bug in run_pretrained_models.py for models with subgraphs
Signed-off-by: Tom Wildenhain <[email protected]>
1 parent c9b4219 commit e7d8bea

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/run_pretrained_models.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,12 @@ def run_test(self, name, backend="caffe2", onnx_file=None, opset=None, extra_ops
331331

332332
from tf2onnx.tf_utils import compress_graph_def
333333
const_node_values = None
334-
if self.large_model:
335-
const_node_values = compress_graph_def(graph_def)
336-
g = tf.import_graph_def(graph_def, name='')
337-
# with tf_session(config=tf.ConfigProto(allow_soft_placement=True), graph=g) as sess:
338-
with tf_session(graph=g) as sess:
334+
with tf.Graph().as_default() as tf_graph:
335+
if self.large_model:
336+
const_node_values = compress_graph_def(graph_def)
337+
tf.import_graph_def(graph_def, name='')
338+
339+
with tf_session(graph=tf_graph) as sess:
339340
# create the input data
340341
for k in input_names:
341342
v = self.input_names[k]

0 commit comments

Comments
 (0)