Commit Graph

98 Commits

Author SHA1 Message Date
Mikhail Nosov
9f9df184c4 Added compatibility check of layout with partial shape (#10144)
* Added compatibility check of layout with partial shape

E.g. layout "NC" in not compatible with PartialShape{1,3,224,224}

Check is added:
- For parameter set_layout
- For parameter set_partial_shape
- For result set_layout
- Checked also compatibility for all results after 'validate_and_infer_types'

* Fix incorrect tests

* Fix of more incorrect tests

* Removed couple of obsoleted error-handling tests - these are catched now on earlier stages

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
2022-02-07 11:17:28 +03:00
Anastasia Popova
12a310636d Fixed input cut for case when port is not specified. (#10134) 2022-02-04 19:03:12 +03:00
Roman Kazantsev
64aabc74d1 Check the selected frontend to correspond use_new/legacy_frontend options (#10084)
* Check the selected frontend to correspond use_new/legacy_frontend options

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

* Fix a default case when no frontend is found

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2022-02-03 20:34:07 +03:00
Ilya Lavrenov
f2f281e60b Renamed ov_runtime => openvino, ov_ => openvino_ prefix (#10069)
* Renamed ov_runtime => openvino, ov_ => openvino_ prefix

* Coverage fix

* More fixes

* Fixed MO tests with custom FE
2022-02-03 20:03:41 +03:00
Anastasia Popova
86faa25724 Fix of output tensor names for mask-rcnn* models (#10042)
* Added op names to tensor names for MaskRCNN replacement transformation. Fixed output layout for MaskRCNN.

* Applied commentes left from PR with tensor names fix.

* Added tests for remove_tensor_names().

* Added checks in emitter.

* Removed debug output.

* Small fix.

* Small fix.
2022-02-03 19:44:47 +03:00
Anastasia Popova
ca45bf430a Fixed tensor names set in InputCut and AutomlEfficientDet transformation. (#9998)
* Fixed tensor names setting in InputCut, fixed tensor names losing in AutomlEfficientDet.

* Changed op name adding to tensor names in InputCut for output port case only.
2022-02-03 15:55:16 +03:00
Svetlana Dolinina
5e8f997262 Fix bug in AddReshapeTransposeAroundConvPool for Kaldi LSTM networks (#9885)
* change order of transformations to work correctly with Convolutions in Kaldi LSTM networks

* removed unneeded changes and add unit tests

* remove comment

* remove changes from memory_offset_adjustment, move all fixes inside add_reshape_transpose_around_conv_pool to avoid new bugs

* removed test for deleted changes

* replace -1 by None
2022-02-01 17:06:49 +03:00
Pavel Esir
9bb7697b2f [MO] fix simplified MO import for PyCharm Debug (#9866)
* fix simplified MO import for PyCharm Debug

* package_BOM update
2022-02-01 13:14:48 +03:00
Roman Kazantsev
298cced3b3 [MO, TF frontend] Correct loaders for StridedSlice and Pack operations (#10034)
* Correct Loaders for TensorFlow StridedSlice and Pack operations

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

* Supress INFO and WARNING messages from TensorFlow

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2022-02-01 11:02:28 +03:00
Pavel Esir
73e9eb4c61 [MO] add reinterp_shape for StridedSlice (#9622)
* added reinterp_shape for StridedSlice

* package_BOM update

* corrected unit-tests

* returned removed tests
2022-01-31 22:17:15 +03:00
Anton Chetverikov
97a78d0059 [MO] EmptyTensorList transform (#9361)
* Initial change for new transformations

* Update patterns

* Update unsupported operation replacement

* Add input/output normalization passes call

* Update logic

* Refactor output concatination transform

* Update re_numerate_input_ports and shape infer functions for Loop

* Update comments

* Add back edge removing to output concatenation transformations

* Update comment

* Remove redundant normallization call

* Update supported layers list

* Use routine in check

* Add transformation to rub_before list
2022-01-28 20:53:16 +03:00
Anastasia Popova
a61655040f Fixed loader for TF2. (#9962) 2022-01-28 13:23:22 +03:00
Nikolay Tyukaev
622027bee5 fix errors in documentation (#9384)
* add sphinx log parsing

* fix

* fix log

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* fixes

* doxygen-xfail

* fixes

* fixes

* fixes

* fixe

* fixes

* fixes

* fix pot

* add pot check

* fixes

* fixes

* Fixed POT docs

* Fixed POT docs

* Fixes

* change heading markup

* fixes

Co-authored-by: azaytsev <andrey.zaytsev@intel.com>
2022-01-27 19:39:49 +03:00
Anton Chetverikov
05684b7cd0 Move tensor name restoring transformation after output normalization (#9904) 2022-01-27 17:41:58 +03:00
Ilya Naumov
1be838576c Fix UnicodeEncodeError on Python 3.6 (#9285) 2022-01-27 14:00:38 +03:00
Yegor Kruglov
bc70b2b68b [ MO ] Support MXNet operation arange_like (#8939)
* arange_like_op

* added comments

* added unittests

* added step attr, changed axis condition, updated tests

* added op description

* fix nodes renaming

* sorted imports

* added case with repeat > 1

* finished arange_like, removed unit test

* small fix in gather infer function

* gather fix

* fix doc

* added unittests

* correct renames

* removed ConvertLike from div_sqrt_dim

* used ReduceProd instead reshape-shapeof

* added keep_dims attr to reduce_prod node
2022-01-27 12:44:12 +03:00
Roman Kazantsev
7ec1cc919e [MO] Correct preprocessing block for TensorFlow OD 2.4+ models (#9944)
* Detect casting node inside preprocessing block and leave it

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

* Fix unit-test for ObjectDetectionAPI

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2022-01-27 12:15:30 +03:00
Anastasia Popova
84f2e9fc24 Parameter/Result tensor names fix (#9754)
* Added tensor names checking transformation. Added framework name saving to tensor names list for input/output cut.

* Small fixes.

* Fixed tensor propagation in PowerToEltwises.

* Corrected tensor checking.

* Corrected tensor checking.

* Fixed MemoryOffsetAdjustment().

* Fixed tensor propagation for Yolo, ONNXMaskRCNNTransformation().

* Small fix.

* DetectionOutput tensor name set.

* Tensor name set for Reshape node in OD API.

* Temporarily added set of tensor names in ConvertGroupedStridedSlice.

* Small corrections, added tests.

* Added checks.

* Added deafault names setting.

* Moved default names setting to single place.

* Added port normilize befor setting tensor names.

* Fixed ResultRename logic.

* Removed tensor setting of unset ports.

* Corrected input cut tensor naming.

* Corrected InputCut, renamed set_tensor_names()->add_tensor_names().

* Fixed tensor setting for InputCut.

* Code corrections.
2022-01-26 17:23:46 +03:00
Milana Shhanukova
d81d7f15a1 do not change shape for scalars (#9751) 2022-01-25 19:37:34 +03:00
Eugeny Volosenkov
b57f1b0fb3 Delete check on port id in InputCut (#9796)
* delete refer_to_faq_msg(31)

* fix documentation

* fix documentation
2022-01-25 17:41:08 +03:00
Eugeny Volosenkov
439e3b26aa Model Optimizer incorrectly convert per-channel Quantize/Dequantize operatros to FakeQuantize (#8321)
* add q_dq_resolver

* prepare FQ for offline transfornations

* fix quantize_dequantize_linear_resolver.py

* fix tools/mo/openvino/tools/mo/middle/dequantize_linear_resolver.py

* enable compress_quantized_weights.py

* fix sub case

* delete force_clean_up

* add isolated attribute

* add test for quantize_dequantize_linear_resolver

* fix comments

* apply comments

* aplying comments

* applying comments

* applying comments

* Replace q_dq_resolver using pattern

* clean imports

* fix imports

* fix pattern

* delete refernce to unit tests
2022-01-25 15:35:43 +03:00
Anton Chetverikov
88903ee7ae Remove incorrect layout changing (#9764) 2022-01-25 14:10:06 +03:00
Pavel Esir
41d4fcdf25 [MO] Add reverse_infer (input rank deducing) for set of operations (#8928)
* grouped convolution resolver fix

* add reverse_infer for Transpose, Elementwise, Identity and some fixes to successfully OOB convert MXNet models

* add reverse_infer for BatchNorms, dynamic groups fix, multi_box_prior.py fix

* add reverse infer for trivial cases

* input rank setting for image detection ops

* reverse_infer for Gather, AttributedGather add todo comment for Parameter

* reverse infer for LSTM, swapaxis; fixes and unit-tests for Elementwise, Gather, Transpose; also generalized Parameter reverse_infer; fixed DetectionOutput and partial reverse_infer

* clarified comment for LSTM reverse_infer

* detalized Elementwise reverse_infer, added several more unit-tests, Split reverse_infer fix, IteratorGetNext_ext.py fix

* generalized group convolution resolver

* specified in_ports explicitly

* clarified Split, Concat, Parameter, other minor typos

* relaxed compatibility check for elementwise; simplified scalar extracting for convolution.py and gather.py, fixed replacer order for ConvolutionNormalizer.py

* added routine set_input_shapes for image detection ops

* fixed typos to pass locally E2E, slightly changed LSTM reverse_infer

* VariadicSplit reverse_infer bugfix

* IteratorGetNextCut.py added check if port is connected

* explicitly specified in_port, added asserts, improved Split reverse infer

* sorted imports

* reverse_infer for ONNX and MXNet LSTM, GRU, RNN operations

* replaced Error raising with red warning

* added missing return for defined input shapes, fixed getting num groups for tf conv

* added mandatory attributes; fixed failing unit-tests, fixed typo with scalar group in ConvolutionNormalizer

* removed priorbox reverse_infer; Parameter reverse_infer corrected to use the only one existing out_port

* fixed clarify_partial_shape_test
2022-01-25 10:14:41 +03:00
Anastasia Popova
d27bbb4bdd Preserve inputs and outputs order for TensorFlow 2 and MXNet models (#9683)
* Preserve outputs order TF.

* Preserve of input/output indices for MxNet.

* Small fix.

* Added check.

* Small fix.

* Corrected Keras model importing.

* Fixed Keras model loading.

* Small correction.

* Corrected model loading.

* Small fix.

* Comment corrected.

* Removed unnecessary import.
2022-01-25 10:13:05 +03:00
Anastasia Popova
ce533fc287 Preserve input/output order for ONNX. (#9352)
* Preserving of input/output indices for ONNX.

* Fixed checks.

* Fixed for case of multiple outputs of node before Result.

* Added test for multiple tensor names before Result.

* Multiple tensor names before Result  fix.

* Added order alignment for user input/output.

* Extended for case of input names in Parameter tensor list.

* Fixed unit tests.

* Corrected help.

* Small correction.

* Code refactoring.

* Temporarily reverted refactor.

* Fixed wrong changes.

* Fixed wrong changes.

* Returned reverted refactoring.

* Removed inputs_list from serializing.
2022-01-24 15:50:28 +03:00
Svetlana Dolinina
b9293dc424 changed Exit op infer function implementation: re-write in new API to avoid unmasking of shapes (#9664) 2022-01-24 12:12:02 +03:00
Mateusz Bencer
82cc7165e7 Fall back to legacy path if input freezing feature is used (#9668) 2022-01-21 16:46:59 +03:00
Mateusz Bencer
70ccd0e91f Handle special cases during fallback (#9651) 2022-01-20 23:34:24 +01:00
Anton Chetverikov
ff6a9a1179 [MO] Fix normalize_outputs MaxPool function condition (#9613)
* Fix condition to correct handling MaxPool1 with only 1 output port

* Update check condition

* Add unit tests

* Sort imports

* Add comment
2022-01-20 19:52:42 +03:00
Maxim Vafin
32b1c509d5 Fix data type of inserted constants for means and scales (#9741) 2022-01-19 11:09:22 +03:00
Alexey Suhov
a79830cb55 Update year to 2022 in copyright notice (#9755) 2022-01-19 01:07:49 +03:00
Mateusz Bencer
0843555ff0 switch onnx to default path for MO (#9661) 2022-01-18 16:01:10 +01:00
Tomasz Dołbniak
456a5c65e3 Friendly names setting in ONNX FE (#9682) 2022-01-18 17:46:23 +03:00
Mateusz Bencer
5fe228bc14 Intorduce json model analysis feature on the new path (#9618) 2022-01-18 11:18:19 +01:00
Svetlana Dolinina
71b7c7000a Changed permutes mechanics for Kaldi (#5744)
* changed permutes

* fixed permutes

* fixed kernel

* fix transpose after convolution

* fix for convnet

* insert transposes for all convolutions and poolings

* refactor transformations;
added unit tests;
removed old transformations for addinf permutes/reshapes

* fixed constant types

* fixes after merge

* fixed bug for rm_cnn4a: added correct time_dim for the first convolution

* added fix for timeheightconvolution: in this case we have correct time set in convolution kernel already

* minor review fixes: renamed transformation and file

* rename in test

* rename in test

* sort imports + couplt changes in comments

* review fixes: refactoring

* replaced recursive implementation by nx.topological_sort;
fixed comments

* minor fixes: comment + preserving node names
2022-01-18 12:10:51 +03:00
Anton Chetverikov
919ada63ad Update undefined dimensions parcing im parameter extender (#9699) 2022-01-18 12:02:30 +03:00
Yegor Kruglov
9b129b7c1a [MO] Support MXNet Operations: batch_dot, LayerNorm, div_sqrt_dim (#7641)
* Add new operation support

* Update range_like replacer

* Move layer normalizer to middle

* Update bom file

* Update bom

* removed ArangeLike op

* updated bom

* added tests

* Updated docs

* comments relolving

* resolve documentation merge conflict

* arange_like op

* Revert "arange_like op"

This reverts commit a30f5bbb48.

* fixes in div_sqrt_dim

* comments resolving

* updated tests

* added batch_dot and layer_norm descriptions

* updated batch_dot comment

* updated comment

* move extractors to mxnet folder

* added replacer for batch_dot

* Revert "added replacer for batch_dot"

This reverts commit 8c0e52f7dc.

* return fully connected normalization

* fix typo

* updated fully connected normalization for mxnet

* changed assert message

* fixed gamma and beta shape incompatibility problem

* fixed imports, updated unittest

* resolve comments

Co-authored-by: iimironov <iliya.mironov@intel.com>
2022-01-18 11:12:30 +03:00
Gleb Kazantaev
72942471de Added MO root directory search to simplify MO execution process (#9681)
* Added MO root directory search to simplify MO execution process

* Update sys.path

* Simplify implementation
2022-01-18 01:58:22 +03:00
Svetlana Dolinina
0ed3da0e86 add warning about order if both mean and scale set (#9284)
* add warning about order if both mean and scale set

* Update tools/mo/openvino/tools/mo/main.py

Co-authored-by: Anastasia Popova <anastasia.popova@intel.com>

* removed warning, added phrase in documentation

* fixed merge

* added phrase about order of ,mean and scale in MO help

* duplicate MO help phrase in doc

* Update docs/MO_DG/prepare_model/convert_model/Converting_Model.md

Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>

* Update docs/MO_DG/prepare_model/convert_model/Converting_Model.md

Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>

* Update docs/MO_DG/prepare_model/convert_model/Converting_Model.md

Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>

* Update tools/mo/openvino/tools/mo/utils/cli_parser.py

Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>

* Update tools/mo/openvino/tools/mo/utils/cli_parser.py

Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>

* remove tabs

* fix in order of reverse, mean, scale

Co-authored-by: Anastasia Popova <anastasia.popova@intel.com>
Co-authored-by: Anastasiya Ageeva <anastasiya.ageeva@intel.com>
2022-01-17 12:12:06 +03:00
Anastasia Kuporosova
8f12b72f46 [Python API] Rename offline_transformations in the new api (#9634)
* [Python API] Rename offline_transformations in the new api

* remove comments

* one more place to rename

* fix mo building

* fix after merge

* fix for pot import
2022-01-17 11:57:00 +03:00
Tomasz Dołbniak
8b1514d49e Set additional tensor names only if necessary (#9652) 2022-01-14 12:44:50 +01:00
Anton Chetverikov
f4b0d40cd0 [MO] Skip rt_info in old graph comparator (#9638)
* Skip rt_info while graph comparing

* Remove incorrect comparing for rt_info
2022-01-14 12:49:12 +03:00
Mateusz Tabaka
508af22c66 Add CompressQuantizeWeights transformation (#7538)
* Add CompressQuantizeWeights transformation

It's based on model-optimizer/extensions/back/compress_quantized_weights.py

* handle dequantization subgraph after quantization

* fix scale shift calculation

* remove TRANSFORMATIONS_API from CompressQuantizeWeights

* ZeroPointOptimizer

* add CompressQuantizeWeights pass to to ApplyMOCTransformations

* add comment

* fix code style

* cleanup

* ambiguous copy_runtime_info

* ambigous call

* fix case when zero_point is close to zero

* fix cf test case

* move files

* update tests

* add tests for evaluate_subgraph

* Address review comments

* make params static
2022-01-13 23:38:39 +01:00
Roman Kazantsev
a53a4da3a2 [MO, Frontends] Implement ChangePlaceholderType as Offline Transformation (#8245)
* [Common FrontEnd] Implement ChangePlaceholderType transformation with OldApiMap

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

* Add ChangePlaceholderType pass into frontend normalize

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

* Add a comment about the transformation

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

* Fix build issue

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

* Apply code review comments: remove ngraph namespace rountine, etc.

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

* Remove use of extra Node object in set_old_api_map call

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

* Create separate pass for legacy nGraph transformations for MO with new frontend

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

* Fix build for ieFuncTests

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

* Fix build issue with namespace conflicts

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

* Revert "Fix build issue with namespace conflicts"

This reverts commit 50a189f4e5.

* Move legacy transformations to ngraph namespace

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

* Fix build issue with unresolved MOCLegacyTransformation

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

* Adjust code to new OldApiMap API

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

* Resolve merge conflicts

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

* Fix build issue

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

* Do not set legacy type for parameter in case user defined type

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2022-01-13 15:29:51 +03:00
Mateusz Bencer
080477aa9c MO fallback to old path if some features are not supported yet (#9034) 2022-01-13 09:39:14 +01:00
Eugeny Volosenkov
00da13b058 Support TF ScatterND and CenterNet (#9257)
* add ScatterND for tf

* Fix ApplyPermutation

* fix description of TFScatterNDDecomposition

* fix permutation

* fix package_POM

* fix pom file

* fix BOM file

* fix bom file

* Added layer tests for TF ScatterND

* fix comments

* fix bom file

* Add additional tests

* Add additional tests

* Added ConvertLike to ScatterND decomposition
2022-01-12 23:15:45 +03:00
Maxim Vafin
9fb9e19efa Fix output layout of tf yolo models converted with transformations config (#9583) 2022-01-12 16:25:35 +03:00
Anastasia Popova
1a8506f205 Updated requirements for MO with telemetry. (#9431)
* Updated requirements for MO and POT with telemetry.

* Added mock telemetry common class for unit tests.

* Used mock telemetry in preprocessing unit tests.

* Small correction.
2022-01-11 19:54:49 +03:00
Vladimir Gavrilov
ebcd9eaf07 Fixed conversion of some models with (I)DFT when a layer immediately before (I)DFT is a producer for Result (#9489)
* Fix in the transformation PreserveRuntimeInfo: now Transpose is inserted before input port 0 of Result only, not after data node of layer before Result layer.

* Deleted commented code.

* Added more tests for the MO transformation PreserveRuntimeInfo.
2022-01-11 15:20:24 +03:00
Anastasia Popova
aecbd549f8 Support of partial shapes with boundaries in MO IR reader. (#9223)
* Added support of partial shapes boundaries in MO IR reader.

* Added comments.
2022-01-10 14:36:36 +03:00