Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix catch_errors flag and check axes of expand_dims in einsum optimizer #2276

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tf2onnx/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def _convert_common(frozen_graph, name="unknown", large_model=False, output_path
g = process_tf_graph(tf_graph, const_node_values=const_node_values,
custom_op_handlers=custom_op_handlers, **kwargs)
if constants.ENV_TF2ONNX_CATCH_ERRORS in os.environ:
catch_errors = constants.ENV_TF2ONNX_CATCH_ERRORS.upper() == "TRUE"
catch_errors = os.environ.get(constants.ENV_TF2ONNX_CATCH_ERRORS).upper() == "TRUE"
else:
catch_errors = not large_model
onnx_graph = optimizer.optimize_graph(g, catch_errors, optimizers=optimizers)
Expand Down
2 changes: 2 additions & 0 deletions tf2onnx/optimizer/einsum_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ def _compute_output_row_expand_dims(self, row, row2=None, ab=False):
self._check_row_(row, True)
self._check_arg_('axes', tuple)
axes = self.kwargs['axes']
if not axes:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has broken current tests. Please see if this is really required by failed tests. Thanks.

raise RuntimeError("Parameter axes of expand_dims should not be empty.")
for axis in axes:
if not isinstance(axis, tuple):
raise TypeError(
Expand Down
Loading