Skip to content

Commit 41b9296

Browse files
committed
Turn on graph tf optimize grappler dependency
Signed-off-by: Deyu Huang <[email protected]>
1 parent 76924df commit 41b9296

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tf2onnx/tf_loader.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -687,6 +687,10 @@ def tf_optimize_grappler(input_names, output_names, graph_def):
687687
'constfold', 'function'
688688
]
689689

690+
if is_tf2():
691+
# add for tf2.x lstm optimization.
692+
rewrite_options.optimizers.append('dependency')
693+
690694
if Version(tf.__version__) >= Version("2.5"):
691695
# This flag disables folding QDQ nodes around constants in the network (eg: around conv/FC weights)
692696
rewrite_options.experimental_disable_folding_quantization_emulation = True
@@ -771,8 +775,8 @@ def toposort(data):
771775
try:
772776
func = function_def_to_graph(fdef, input_shapes=input_shapes)
773777
except: # pylint: disable=bare-except
774-
# if there is a missmatch between caller and function use the functions shape
775-
logger.warning("shape missmatch between caller and function: %s", k)
778+
# if there is a mismatch between caller and function use the functions shape
779+
logger.warning("shape mismatch between caller and function: %s", k)
776780
func = function_def_to_graph(fdef)
777781
_FUNCTIONS[k] = func
778782
_, _, _, _, _, tfunctions = tflist_to_onnx(func, {})

0 commit comments

Comments
 (0)