Skip to content

Commit a6f370e

Browse files
Set aggressive inlining to true
Signed-off-by: Tom Wildenhain <[email protected]>
1 parent 620b8b9 commit a6f370e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tf2onnx/tf_loader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,23 +105,23 @@ def convert_variables_to_constants_large_model(func):
105105
except ImportError:
106106
_not_implemented_tf_placeholder("_convert_variables_to_constants_v2_impl")()
107107
frozen_graph_def, _ = \
108-
_convert_variables_to_constants_v2_impl(func, lower_control_flow=False, aggressive_inlining=False)
108+
_convert_variables_to_constants_v2_impl(func, lower_control_flow=False, aggressive_inlining=True)
109109
return frozen_graph_def
110110

111111
try:
112112
from tensorflow.python.framework.convert_to_constants import \
113113
_FunctionConverterData, _replace_variables_by_constants # pylint: disable=protected-access
114114
except ImportError:
115115
_not_implemented_tf_placeholder("_replace_variables_by_constants")()
116-
converter_data = _FunctionConverterData(func=func, lower_control_flow=False, aggressive_inlining=False)
116+
converter_data = _FunctionConverterData(func=func, lower_control_flow=False, aggressive_inlining=True)
117117
frozen_graph_def, _ = _replace_variables_by_constants(converter_data=converter_data)
118118
return frozen_graph_def
119119

120120
def from_function(func, input_names, output_names, large_model=False):
121121
if large_model:
122122
return convert_variables_to_constants_large_model(func)
123123

124-
frozen_func = convert_variables_to_constants_v2(func, lower_control_flow=False)
124+
frozen_func = convert_variables_to_constants_v2(func, lower_control_flow=False, aggressive_inlining=True)
125125
graph_def = frozen_func.graph.as_graph_def(add_shapes=True)
126126
# output_names = [i.name for i in frozen_func.outputs]
127127
tf_reset_default_graph()

0 commit comments

Comments
 (0)