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

Correct layout for Einsum inputs and output #6696

Conversation

rkazants
Copy link
Contributor

@rkazants rkazants commented Jul 19, 2021

Root cause analysis: Layout adjustment for inputs and output of Einsum operation was incorrect for some cases. Firstly, this adjustment is not needed if a model is in NCHW layout originally (or --disable_nhwc_to_nchw option is invoked). Secondly, Einsum operation can be connected with MatMul operation that forces to mark some node operations to be executed in the original layout including Einsum operation. In this second case layout for inputs and output of Einsum operation is not needed.

Solution: If one of both cases (NCHW is original layout and existence of MatMul in a model graph) is detected, do not insert Transpose operation and do not change Einsum equation

Ticket: 58534

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
  • Model Optimizer IR Reader check

Documentation:

  • Supported frameworks operations list - N/A
  • Guide on how to convert the public model - N/A
  • User guide update - N/A

@rkazants rkazants requested a review from a team July 19, 2021 11:40
@openvino-pushbot openvino-pushbot added the category: MO Model Optimizer label Jul 19, 2021
@rkazants rkazants requested review from a team, pavel-esir, iimironov, popovaan and lazarevevgeny and removed request for a team July 19, 2021 12:48
@rkazants rkazants requested a review from lazarevevgeny July 22, 2021 17:52
@lazarevevgeny lazarevevgeny enabled auto-merge (squash) July 23, 2021 05:01
@lazarevevgeny lazarevevgeny merged commit 12fb83d into openvinotoolkit:master Jul 23, 2021
rnugmanx pushed a commit to rnugmanx/openvino that referenced this pull request Aug 26, 2021
* Fix recovery of output subscript in Einsum implicit mode

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

* Fix code style

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

* Correct layout adjustment for Einsum inputs and output

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

* Correct a comment in the unit-test

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

* Setup correct transformation dependencies for LayoutChangeForEinsum

Signed-off-by: Roman Kazantsev <[email protected]>
andrei-cv pushed a commit to andrei-cv/openvino that referenced this pull request Aug 30, 2021
* Fix recovery of output subscript in Einsum implicit mode

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

* Fix code style

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

* Correct layout adjustment for Einsum inputs and output

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

* Correct a comment in the unit-test

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

* Setup correct transformation dependencies for LayoutChangeForEinsum

Signed-off-by: Roman Kazantsev <[email protected]>
akuporos pushed a commit to akuporos/openvino that referenced this pull request Sep 29, 2021
* Fix recovery of output subscript in Einsum implicit mode

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

* Fix code style

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

* Correct layout adjustment for Einsum inputs and output

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

* Correct a comment in the unit-test

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

* Setup correct transformation dependencies for LayoutChangeForEinsum

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.

6 participants