Skip to content

Commit d885351

Browse files
committed
make convert.py has same procedure with run_pretrained_models.py
1 parent aa19744 commit d885351

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tf2onnx/convert.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
import tensorflow as tf
1616

17-
from tf2onnx.graph import GraphUtil
17+
from tf2onnx import optimizer
1818
from tf2onnx.tfonnx import process_tf_graph, tf_optimize
1919
from tf2onnx import constants, loader, logging, utils
2020

@@ -145,10 +145,10 @@ def main():
145145
output_names=outputs,
146146
inputs_as_nchw=args.inputs_as_nchw)
147147

148-
model_proto = g.make_model("converted from {}".format(model_path))
149-
150-
logger.info("")
151-
model_proto = GraphUtil.optimize_model_proto(model_proto)
148+
onnx_graph = optimizer.optimize_graph(g)
149+
if not onnx_graph:
150+
onnx_graph = g
151+
model_proto = onnx_graph.make_model("converted from {}".format(model_path))
152152

153153
# write onnx graph
154154
logger.info("")

0 commit comments

Comments
 (0)