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

WrapType Improvements #4040

Merged

Conversation

GlebKazantaev
Copy link
Contributor

@GlebKazantaev GlebKazantaev commented Jan 27, 2021

Description

Some pattern based transformations can work with multiple types of operations and to apply the same transformation for two different operation types it was necessary to create two different transformation classes with different patterns but with the same callback or create predicates that check this types. To simplify this workflow WrapType was extended to consume multiple DiscreteTypeInfo instances. Also wrap_type helper functions were updated to consume variadic number of operation types.

Before:

auto is_supported_lstm_cell = [](const std::shared_ptr<Node>& n) {
    return pattern::has_class<ngraph::opset1::LSTMCell>()(n) || pattern::has_class<ngraph::opset4::LSTMCell>()(n);
};
auto any_lstm = std::make_shared<pattern::op::Label>(element::f32, Shape{}, is_supported_lstm_cell);

After:

auto lstm = pattern::wrap_type<opset1::LSTMCell, opset4::LSTMCell>();

Change List

  • Updated WrapType/wrap_type facilities to consume multiple types
  • GraphRewrite engine was updated to support multiple types in WrapType for efficient execution algorithm
  • Simplified transformations with wrap_type facilities
  • Removed BatchNormV5Decomposition
  • Added tests for WrapType

@GlebKazantaev GlebKazantaev requested a review from a team January 27, 2021 11:12
@openvino-pushbot openvino-pushbot added the category: Core OpenVINO Core (aka ngraph) label Jan 27, 2021
@GlebKazantaev GlebKazantaev requested review from itikhono, jane-intel and lazarevevgeny and removed request for a team January 27, 2021 11:50
@GlebKazantaev GlebKazantaev added this to the 2021.3 milestone Jan 27, 2021
@GlebKazantaev GlebKazantaev added the category: transformations OpenVINO Runtime library - Transformations label Jan 27, 2021
@GlebKazantaev GlebKazantaev self-assigned this Jan 27, 2021
@GlebKazantaev GlebKazantaev requested a review from slyalin January 29, 2021 10:09
@GlebKazantaev GlebKazantaev force-pushed the gkzanta/variadic_wrap_type branch from a58532c to 4a03a64 Compare January 29, 2021 12:08
@GlebKazantaev GlebKazantaev merged commit cca0d56 into openvinotoolkit:master Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Core OpenVINO Core (aka ngraph) category: transformations OpenVINO Runtime library - Transformations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants