Commit Graph

59 Commits

Author SHA1 Message Date
Maxim Vafin
c8f4f9b7db [MO] Fix swish value infer (#10802) 2022-03-18 14:56:37 +03:00
Mateusz Bencer
d1630c9ac1 Fix problem with segfault during using extension feature via Python (#10650) 2022-03-03 11:22:42 +01:00
Roman Kazantsev
6c78715749 [MO] Clean up Model Optimizer options, help, and documentation (#10653)
* [MO] Clean-up MO cmd-line options

Remove the following Model Optimizer deprecated options that are no longer used for several releases: disable_fusing, disable_gfusing, generate_deprecated_IR_V7,
legacy_ir_generation, keep_shape_ops, move_to_preprocess
Deprecate through CLI the following options for which functionality triggered from POT or automatically: disable_weights_compression, disable_nhwc_to_nchw,
disable_resnet_optimization, finegrain_fusing.
Correct and extend description of each MO option to be printed during model conversion.

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

* Correct documentation about input shapes

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

* Perform final corrections in documentation

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

* Remove legacy_ir_generation overall

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

* Clean-up tests from deprecated options

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

* Recover disable_fusing option as deprecated

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

* Fix keys for static_shape and extensions

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

* Remove extension key that does not work

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

* Apply feedback: remove disable_gfusing, correct docs

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

* Recover disable_fusing option for unit-tests

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

* Apply feedback for documentation

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

* Apply feedback about parameters use_legacy_frontend and use_new_frontend

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

* DO minor fixes for indentation of MO logs

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

* Revert log.error for fallback message

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

* Revert disable_weights_compression parameter for tests

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2022-03-01 10:57:24 +03:00
Maxim Vafin
435584bb91 Support dynamic Broadcast and new pattern for TI condition (#9735)
* Support dynamic Broadcast and new pattern for TI condition

* Apply review feedback

* Fix broadcast if statement
2022-02-22 16:46:48 +03:00
Pavel Esir
3d223ebc2a [MO] update error message when reverse infer was not successful (#10576)
* update error message when reverse infer was not successful

* corrected message when there are several undefined Parameters
2022-02-22 13:51:10 +03:00
Pavel Esir
fb6359586d fix ConvertGroupedStridedSlice.py for XLNet (#10496) 2022-02-18 22:40:28 +03:00
Bartek Szmelczynski
2b03d5fe66 [MO args][ONNX FE]fix cutting graph with input, output or both (#9698)
* fix cutting graph with input, output or both

* fix collisions

* add regex

* revert changes to regex, fix decond_name_with_port function

* fix collisions

* optimize try_get_node function

* swap bool with enum

* revert accidental import

* optimize the code

* Update tools/mo/unit_tests/mo/moc_frontend/moc_extractor_test_actual.py

Co-authored-by: Mikhail Nosov <mikhail.nosov@intel.com>

* Update tools/mo/unit_tests/mo/moc_frontend/moc_extractor_test_actual.py

Co-authored-by: Mikhail Nosov <mikhail.nosov@intel.com>

* Update tools/mo/unit_tests/mo/moc_frontend/moc_extractor_test_actual.py

Co-authored-by: Mikhail Nosov <mikhail.nosov@intel.com>

* Update tools/mo/unit_tests/mo/moc_frontend/moc_extractor_test_actual.py

Co-authored-by: Mikhail Nosov <mikhail.nosov@intel.com>

* Update tools/mo/unit_tests/mo/moc_frontend/moc_extractor_test_actual.py

Co-authored-by: Mikhail Nosov <mikhail.nosov@intel.com>

* remove redundant check

* fix wrong nodes returns

* fix decode_with_port_name implementation, add comments

* reduce code duplicates

* remove redundant imports

Co-authored-by: Mikhail Nosov <mikhail.nosov@intel.com>
2022-02-15 10:55:40 +03:00
Pavel Esir
653ed4a34c [MO] use revision hashes to compare IE & MO versions (#10230)
* fixed version comparison: for comparsion extracted hashes are used

* shortened 7 -> 11 to match the current version fromat from nightly

* corrected regex, added comparing by minimal hash len
2022-02-12 00:13:48 +03:00
Pavel Esir
654b025a26 [MO] set explicitly argument dtype to int for np.split (#9988)
* forced split argument dtype to int

* added unit-test

* fixed typo in split_test.py

* set explicitly np.int64 instead of np.int

* use split_length's dtype
2022-02-09 12:16:33 +03:00
Maxim Vafin
1970baeb1c Apply RIC for dynamic dimension in legacy MO (#10130)
* Apply RIC for dynamic dimension in legacy MO and fail if RIC wasn't applied to any input

* Fix moc tests
2022-02-08 22:17:19 +03:00
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
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
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
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
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
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
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
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
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
Mateusz Bencer
080477aa9c MO fallback to old path if some features are not supported yet (#9034) 2022-01-13 09:39:14 +01: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
Maxim Vafin
738a571742 Use layouts in legacy pre-processing (#9355)
* Use layouts in legacy pre-processing

* Use layouts for batch in MO

* Unify code for channel and batch dimension

* Fix issue when idx is None
2021-12-30 21:01:55 +03:00
Pavel Esir
a51a735d9f [MO] cli_parser.py fix to accept scalar value for freezing (#9395)
* cli_parser.py fix to accept scalar value for freezing

* update cli help

* fixed unit-tests, clarified help for specifying data type

* typos correction
2021-12-29 01:33:49 +03:00
Roman Kazantsev
b2aff0cd56 [MO SDL] Test MO and IR Reader on attacking inputs (#8947)
* Test MO and IR Reader on attacking inputs

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

* Add test to check IR Reader against untrusted well-formed IR

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

* Refactor IR Reader tests with corrupted IR

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

* Test for regular expression denial of service

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

* Remove undesired word like bomb

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

* Move tests to new location

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

* Use correct import

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

* Revert blank line

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2021-12-28 17:49:48 +03:00
Eugeny Volosenkov
fa1b59b7be Fix incorrect working UnpackPackReverseInputChannels for centernet (#9201)
* fix UnpackPackReverseInputChannels

* Add UnpackPackReverseInputChannels test
2021-12-27 15:57:02 +03:00
Roman Kazantsev
acfae31759 Extend FIFOQueueDequeue replacer to support OOB case (#9428)
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2021-12-25 10:32:13 +03:00
Maxim Vafin
3f35e2a321 Enable new FP16 and support mixed precision by MO (#8514)
* Enable new FP16 format and support mixed precision

* Apply review comments

* Fix issue with fp64 in FakeQuantWithMinMaxVars.py

* Enabme decompression converts fusing for CPU plugin

* Apply review feedback

* Fix code style

* Fix issue with np.full and apply review feedback

* Apply review feedback

* Fix HardSigmoid onnx extractor

* Replace np.arrays that were skipped with mo_array

* Fix compress_quantized_weights_test.py

* Fix import issues

* Apply review feedback and fix type of fusing linops in MO

* Apply review feedback

* Fix types for Mean/Scales and MXNET zeros

* Add RandomUniform_8 to ConvertPrecision

* Fix merge issue

* Fix consts names collision in GPU plugin
2021-12-24 14:00:37 +03:00
Mikhail Nosov
9cc4504b78 Removed OV_FRONTEND_PATH from 'setupvars' scripts (#9396)
* Removed OV_FRONTEND_PATH from 'setupvars' scripts

* Update linux.yml

* Change mock frontend's install dir for static builds

* revert linux.yml
2021-12-24 13:01:51 +03:00
Eugeny Volosenkov
5da7a1119c Fix ChangeOutputTypeAttributes and CenterNet model conversion (#9230)
* fix fp16 issue

* fix comments

* add test for scalar case

* fix prev commit

* fix test

* revert to size
2021-12-24 11:43:07 +03:00
Yegor Kruglov
bd2880812f FifoQueueDequeue replacer (#8891)
* added_replacer

* updated comments

* move cut to fifo_replacer

* extend shape serializer for parametr node

* warning message and docstrings

* docs update

* doc fix
2021-12-24 11:38:21 +03:00
Mikhail Nosov
7bfbb46d73 [FE API]: Shared object (SO) holder to frontend's library for FrontEnd/InputModel/ov::Model (#9308)
* Squashed commit of previous work

* Fix mock tests

* clang

* Fix rebase errors

* remove unnecessary changes

* One more finding

* Copy ov::Model runtime info as well

* Fix review comments

* Commit missing file

* Copy m_shared_object when cloning model

* removed copy_shared_objects and use clone_model(model, NodeMap) as a friend for ov::Model

* Added OPENVINO_API to forward declaration

* add OPENVINO_API to friend function declaration
2021-12-24 02:56:45 +03:00
Vladimir Gavrilov
20ee7fd242 Fix MO and nGraph to support the model context_rcnn_resnet101_snapshot_serengeti (#9255)
* Fixes in the infer function of MO operation Select.

* Fixes in the nGraph transformation SharedShapeOf.

* Deleted commented code.

* Added more tests for the infer function of the MO operation Select.

* Started to write tests for the transformation SharedShapeOf.

* Added more tests.

* Now the transformation can correctly process a mix of opset1::ShapeOf and opset8::ShapeOf.

* Small change.

* Used opset1 and opset3 instead of opset1 and opset8.

* Used get_output_element_type(0) instead of checking the version of ShapeOf.
2021-12-23 09:44:47 +03:00
Ilya Churaev
42350a705e Remove legacy targets (#9333)
* Remove some legacy targets

* Replace some targets

* Removed inference_engine_plugin_api dependency

* Minor comment for developer config

* Fixed include paths

* Small fixes for static build

* Try to fix build pyopenvino

* Fixed comments

* Try to fix build

* Include OpenVINODeveloperPackage inside InferenceEngineDeveloperPackageConfig

* Try to fix GAPI tests
2021-12-23 08:16:23 +03:00
Svetlana Dolinina
63121e28ca fixed function that changes parameter but don't return it back; (#9177)
fixed return of results from transformation for case of not 1 added result (last node with several out ports)
modified test to cover case with several output ports for last node
2021-12-22 01:41:49 +03:00
Ilya Churaev
be86ec51ab Renamed frontends from *ov_frontend to ov_*_frontend (#9275)
* Renamed frontends from *ov_frontend to ov_*_frontend

* Fixed MO

* Fixed include
2021-12-18 13:25:42 +03:00
Mikhail Nosov
c7a3c93d3f FrontEnd API - change 'shared_ptr' to 'const shared_ptr&' (#9287)
* FrontEnd API - change 'shared_ptr' to 'const shared_ptr&' in public arguments

* Fix clang-format
2021-12-17 22:39:13 +03:00
Maxim Vafin
36a6774067 Fix preprocessing in MO to use friendly names as well as tensor names (#9206)
* Fix preprocessing in MO to use friendly names as well as tensor names

* Apply review comments

* Revert not necessary changes

* Apply review feedback
2021-12-17 19:05:43 +03:00