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

RandomUniformFusion transformation. #7187

Merged

Conversation

popovaan
Copy link
Contributor

@popovaan popovaan commented Aug 20, 2021

Details:

  • Added transformation that replaces RandomUniform with Add or Mul sub-graphs with single RandomUniform.

This pattern is needed for RandomUniform with floating output type and min != 0 or max != 1. In this case Tensorflow generates following subgraph:
ru_tf

After LinOpSequenceFusion we have the following graph:
ru_ir

Mul and Add in this case can be moved to min and max inputs of RandomUniform.

This transformation is valid only for RandomUniform with floating output type.
In case if Convert goes after RandomUniform Convert should also have floating type.

Tickets:

  • 56594

@popovaan popovaan marked this pull request as ready for review August 20, 2021 16:49
@popovaan popovaan requested review from a team, mvafin, iimironov, achetver and rkazants and removed request for a team August 20, 2021 16:49
@openvino-pushbot openvino-pushbot added category: IE Tests OpenVINO Test: plugins and common category: Core OpenVINO Core (aka ngraph) labels Aug 20, 2021
@achetver
Copy link
Contributor

LGTM

@popovaan popovaan marked this pull request as draft August 25, 2021 08:32
@popovaan popovaan marked this pull request as ready for review August 31, 2021 10:43
@GlebKazantaev GlebKazantaev self-assigned this Sep 2, 2021
@popovaan popovaan requested a review from rkazants September 13, 2021 08:48
@GlebKazantaev
Copy link
Contributor

Also, why this transformation depends on LinOpSequenceFusion if it supports both RU->Add and RU->Mul fusions. So the order of Mul and Add operations after RU doesn't matter.

@popovaan
Copy link
Contributor Author

Also, why this transformation depends on LinOpSequenceFusion if it supports both RU->Add and RU->Mul fusions. So the order of Mul and Add operations after RU doesn't matter.

Because I execute RandomUniformMulFusion first, than RandomUniformAddFusion after it. If we have RU -> Add -> Mul, than only Add will be fused.

@popovaan
Copy link
Contributor Author

Also, why this transformation depends on LinOpSequenceFusion if it supports both RU->Add and RU->Mul fusions. So the order of Mul and Add operations after RU doesn't matter.

Because I execute RandomUniformMulFusion first, than RandomUniformAddFusion after it. If we have RU -> Add -> Mul, than only Add will be fused.

Discussed this offline. Yes, this transformation doesn't depend on LinOpSequenceFusion.

@popovaan popovaan requested a review from a team September 15, 2021 08:43
@rkazants rkazants merged commit 10f0075 into openvinotoolkit:master Sep 16, 2021
akuporos pushed a commit to akuporos/openvino that referenced this pull request Sep 29, 2021
* Added RandomUniformFusion transformation.

* Extended transformations for case with Convert, extended transformations for general min and max value case.

* Set to const unchanged variables.

* Apply suggestions from code review

Co-authored-by: Gleb Kazantaev <[email protected]>

* Reformat code, small corrections.

* Added const shape checks.

* Fixed transformation for case of different const ranks.

* Added type checks.

* Apply suggestions from code review

Co-authored-by: Gleb Kazantaev <[email protected]>

* United RandomUniformMulFusion and RandomUniformAddFusion to single transformation.

* Added negative tests.

* Used get_constant_from_source().

* Moved transformation to common fusions.

* Added const refs.

* Update inference-engine/src/transformations/src/transformations/common_optimizations/random_uniform_fusion.cpp

Co-authored-by: Gleb Kazantaev <[email protected]>

* Changed to single class.

* Corrected IRs checks in layer tests.

* Small corrections.

Co-authored-by: Gleb Kazantaev <[email protected]>
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: IE Tests OpenVINO Test: plugins and common
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants