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

Improve reshapeability of models with eltwise nodes influencing shapes #2767

Merged
merged 9 commits into from
Nov 16, 2020

Conversation

rkazants
Copy link
Member

@rkazants rkazants commented Oct 22, 2020

Description: Reshape node always needs to be inserted in order to preserve ShapeOf nodes (reshapability of a model) that can potentially be above elementwise node.

  • Refactor EltwiseInputReshape_test and EltwiseInputNormalization_test since the logic of maintaining reshape for eltwise has been changed.
  • Merge EltwiseInputReshape and EltwiseInputNormalization transformations and corresponding tests
  • Refactor EltwiseInputReshape transformation to move to new Graph API.
  • Remove Unsqueeze from fused_op in nGraph

JIRA: 39665

Code:

  • Comments
  • Code style (PEP8)
  • Transformation generates reshape-able IR
  • Transformation preserves original framework node names

Validation:

  • Unit tests
  • Framework operation tests, N/A
  • Transformation tests
  • e2e model test with an update of ./tests/e2e_oss/utils/reshape_utils.py
  • Model Optimizer IR Reader check

Documentation:

  • Supported frameworks operations list, N/A
  • Supported public models list, N/A
  • New operations specification, N/A
  • Guide on how to convert the public model, N/A
  • User guide update, N/A

Signed-off-by: Roman Kazantsev [email protected]

@rkazants rkazants requested review from a team, lazarevevgeny and jane-intel October 22, 2020 10:29
@openvino-pushbot openvino-pushbot added the category: MO Model Optimizer label Oct 22, 2020
@rkazants rkazants requested review from achetver and vgavrilo October 22, 2020 10:33
@rkazants rkazants changed the title Fix ElementwiseInputReshape transformation Improve reshapeability of models with eltwise nodes influencing shapes Oct 29, 2020
@rkazants rkazants force-pushed the fix/rkazants/39665 branch 2 times, most recently from e23c78d to 88486b4 Compare November 2, 2020 10:32
@rkazants rkazants requested review from a team and ilyachur November 2, 2020 11:58
@rkazants
Copy link
Member Author

rkazants commented Nov 6, 2020

Now I anticipate to get opencv/opencv#18741 merged to make pre-commit green.

Copy link
Contributor

@ilyachur ilyachur left a comment

Choose a reason for hiding this comment

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

nGraph part LGTM

@rkazants rkazants force-pushed the fix/rkazants/39665 branch 3 times, most recently from 342dccc to 1e3b311 Compare November 12, 2020 21:57
Reshape node always needs to be inserted
in order to preserve ShapeOf nodes (reshapability of a model) that can potentially be above
elementwise node.

Refactor EltwiseInputReshape_test and EltwiseInputNormalization_test since the logic of maintaining reshape for eltwise has been changed.

Signed-off-by: Roman Kazantsev <[email protected]>
Signed-off-by: Roman Kazantsev <[email protected]>
Signed-off-by: Roman Kazantsev <[email protected]>
Signed-off-by: Roman Kazantsev <[email protected]>
Signed-off-by: Roman Kazantsev <[email protected]>
Copy link
Contributor

@lazarevevgeny lazarevevgeny left a comment

Choose a reason for hiding this comment

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

In general, code looks good, but some improvements should be applied

Signed-off-by: Roman Kazantsev <[email protected]>
@openvinotoolkit openvinotoolkit deleted a comment from rkazants Nov 13, 2020
@lazarevevgeny lazarevevgeny merged commit 10b18a0 into openvinotoolkit:master Nov 16, 2020
mryzhov pushed a commit to mryzhov/openvino that referenced this pull request Dec 16, 2020
openvinotoolkit#2767)

* Fix ElementwiseInputReshape transformation

Reshape node always needs to be inserted
in order to preserve ShapeOf nodes (reshapability of a model) that can potentially be above
elementwise node.

Refactor EltwiseInputReshape_test and EltwiseInputNormalization_test since the logic of maintaining reshape for eltwise has been changed.

Signed-off-by: Roman Kazantsev <[email protected]>

* Merge EltwiseInputNormalization and EltwiseInputReshape transformations

Signed-off-by: Roman Kazantsev <[email protected]>

* Remove Unsqueeze from Fused_op

Signed-off-by: Roman Kazantsev <[email protected]>

* Fix code after code review #1

Signed-off-by: Roman Kazantsev <[email protected]>

* Fix code after review #2

Signed-off-by: Roman Kazantsev <[email protected]>

* Fix code review #4

Signed-off-by: Roman Kazantsev <[email protected]>

* Perform full normalization based on shapes of all inputs to eltwise

Signed-off-by: Roman Kazantsev <[email protected]>

* Refactor much to avoid old API and edges with unsqueeze_dims attribute

Signed-off-by: Roman Kazantsev <[email protected]>

* Fix code after review

Signed-off-by: Roman Kazantsev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: MO Model Optimizer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants