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

[OpenVINO-EP] Added some mo optimizations to improve performance #1674

Merged
merged 1 commit into from
Aug 23, 2019
Merged
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
36 changes: 31 additions & 5 deletions onnxruntime/core/providers/openvino/openvino_mo/openvino_mo.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,21 @@ def driver_R5(onnx_modelproto_bytes, precision: str, output_model_name: str, out
convert_batch_norm(graph)
graph_clean_up(graph)

convert_scale_shift_to_mul_add(graph)
graph_clean_up(graph)

fuse_mul_add_sequence(graph)
graph_clean_up(graph)

fuse_linear_ops(graph)
graph_clean_up(graph)

grouped_convolutions_fusing(graph)
graph_clean_up(graph)

fuse_linear_ops(graph)
graph_clean_up(graph)

convert_muladd_to_scaleshift_or_power(graph)
graph_clean_up(graph)

Expand Down Expand Up @@ -308,9 +323,7 @@ def driver_R1(onnx_modelproto_bytes, precision: str, output_model_name: str, out
input=None, input_model=None, input_shape=None, keep_shape_ops=False, log_level='ERROR', mean_scale_values={}, mean_values=(), model_name=None, move_to_preprocess=False, output=None, output_dir='.', placeholder_shapes=None, reverse_input_channels=False, scale=None, scale_values=(), silent=False, version=False)
graph.graph['fw'] = 'onnx'
graph.graph['feature_dim'] = 1 if graph.graph['layout'] == 'NCHW' else 3
graph.graph['ir_version'] = 4
extract_node_attrs(graph, lambda node: (
True, common_onnx_fields(node)))
graph.graph['ir_version'] = 5
except Exception as e:
raise Error(
'Cannot pre-process ONNX graph after reading from model file "{}". '
Expand All @@ -327,8 +340,6 @@ def driver_R1(onnx_modelproto_bytes, precision: str, output_model_name: str, out
# --------------------------------- LOAD END ------------------------------------------------------
class_registration.apply_replacements(
graph, class_registration.ClassType.FRONT_REPLACER)
partial_infer(graph)
graph.check_empty_graph('partial_infer')
class_registration.apply_replacements(
graph, class_registration.ClassType.MIDDLE_REPLACER)

Expand All @@ -339,6 +350,21 @@ def driver_R1(onnx_modelproto_bytes, precision: str, output_model_name: str, out
convert_batch_norm(graph)
graph_clean_up_onnx(graph)

convert_scale_shift_to_mul_add(graph)
graph_clean_up_onnx(graph)

fuse_mul_add_sequence(graph)
graph_clean_up_onnx(graph)

fuse_linear_ops(graph)
graph_clean_up_onnx(graph)

grouped_convolutions_fusing(graph)
graph_clean_up_onnx(graph)

fuse_linear_ops(graph)
graph_clean_up_onnx(graph)

convert_muladd_to_scaleshift_or_power(graph)
graph_clean_up_onnx(graph)

Expand Down