Skip to content

Improve reshapeability of models with eltwise nodes influencing shapes#2767

Merged
lazarevevgeny merged 9 commits intoopenvinotoolkit:masterfrom
rkazants:fix/rkazants/39665
Nov 16, 2020
Merged

Improve reshapeability of models with eltwise nodes influencing shapes#2767
lazarevevgeny merged 9 commits intoopenvinotoolkit:masterfrom
rkazants:fix/rkazants/39665

Conversation

@rkazants
Copy link
Copy Markdown
Collaborator

@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 roman.kazantsev@intel.com

@rkazants rkazants requested review from a team, e-nugmanova and lazarevevgeny 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
Copy Markdown
Collaborator Author

rkazants commented Nov 6, 2020

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

Copy link
Copy Markdown
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 <roman.kazantsev@intel.com>
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
Copy link
Copy Markdown
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 <roman.kazantsev@intel.com>
@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 <roman.kazantsev@intel.com>

* Merge EltwiseInputNormalization and EltwiseInputReshape transformations

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Remove Unsqueeze from Fused_op

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix code after code review #1

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix code after review #2

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix code review #4

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

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

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

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

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>

* Fix code after review

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
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