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

[MO] Range output_type correction for FP16 #6590

Merged

Conversation

pavel-esir
Copy link
Contributor

Root cause analysis: during conversion to FP16 Range attribute output_type instead of being changed to np.float16 was kept np.float32

Solution:

  • Add transformation ChangeRangeOutputType that changes attribute similar as for Cast (ChangeCastOutputType).
  • Also removed Range from the list of shape accepting operations. Since inputs of Range affect output tensor data values (not only shape). E.g. if Range accepts values (0, 100 000, 1) (100 000 is greater than int16_max) then output_tensor = [1, 2, ..., 100 000] cannot ce casted to fp16 even if Range inputs are of fp32 type, such models essentially cannot be casted to fp16 without modification of the original file.

Ticket: xxx-59003

Code:

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

Validation:

  • Unit tests
  • Framework operation tests: checked infer locally
  • 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

@pavel-esir pavel-esir added the category: MO Model Optimizer label Jul 9, 2021
@pavel-esir pavel-esir added this to the 2022.1 milestone Jul 9, 2021
@pavel-esir pavel-esir marked this pull request as ready for review July 12, 2021 11:28
@pavel-esir pavel-esir requested review from a team, mvafin, achetver, popovaan and rkazants and removed request for a team July 12, 2021 11:28
Copy link
Contributor

@jane-intel jane-intel left a comment

Choose a reason for hiding this comment

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

Consider addressing @popovaan comment

@pavel-esir
Copy link
Contributor Author

Consider addressing @popovaan comment

merged both transformations into a single. @popovaan @rkazants @mvafin please review

@pavel-esir pavel-esir requested a review from popovaan July 27, 2021 08:18
Copy link
Contributor

@achetver achetver left a comment

Choose a reason for hiding this comment

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

Looks good to me

@lazarevevgeny lazarevevgeny enabled auto-merge (squash) July 30, 2021 15:00
@lazarevevgeny lazarevevgeny merged commit bfca47a into openvinotoolkit:master Aug 2, 2021
@pavel-esir pavel-esir deleted the change_range_output_type branch August 2, 2021 09:26
rnugmanx pushed a commit to rnugmanx/openvino that referenced this pull request Aug 26, 2021
* added ChangeRangeOutputType.py

* applied review comments

* corrected error message - warn user to use FP32

* renamed ChangeCastOutputType.py et ell.

* merged ChangeRangeOutputType.py, ChangeCastOutputType.py into a singe file

* corrections

* typo fix

* applied comments: faster find_and_replace loop, wording correction
andrei-cv pushed a commit to andrei-cv/openvino that referenced this pull request Aug 30, 2021
* added ChangeRangeOutputType.py

* applied review comments

* corrected error message - warn user to use FP32

* renamed ChangeCastOutputType.py et ell.

* merged ChangeRangeOutputType.py, ChangeCastOutputType.py into a singe file

* corrections

* typo fix

* applied comments: faster find_and_replace loop, wording correction
akuporos pushed a commit to akuporos/openvino that referenced this pull request Sep 29, 2021
* added ChangeRangeOutputType.py

* applied review comments

* corrected error message - warn user to use FP32

* renamed ChangeCastOutputType.py et ell.

* merged ChangeRangeOutputType.py, ChangeCastOutputType.py into a singe file

* corrections

* typo fix

* applied comments: faster find_and_replace loop, wording correction
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.

None yet

5 participants