Commit Graph

120 Commits

Author SHA1 Message Date
Mikhail Nosov
6ef59ce3e4 [OV2.0] Model Optimizer: mean/scale/reverse_input_channels/layout for new frontends (#8751)
* Preprocessing API - base classes

Includes API definition for trivial mean/scale operations (which don't require layout)

Mean/scale with 'layout' support will be done under separate task together
 with Layout

Current test code coverage: 100%

* Python bindings for base preprocessing API

* remove pre_post_process directory from ngraph/core

* remove files from ngraph/python dir

* move pyngraph pre_post_process files from ngraph/python to runtime

* remove pre_post_process test from CMakeList

* move include to the header

* update include path for pre_post_process

* style fix

* bind InputTensorInfo::set_layout

* cleaned test_preprocess

* fix test expected output

* remove duplicate test

* update description of set_element_type

* fix style

* move preprocess from pyngraph to pyopenvino/graph

* update test_preprocess imports and remove unnecessary test

* remove duplicate import

* update custom method

* update test

* update test

* create decorator that changes Node into Output<Node>

* create function that cast Node to Output<Node>

* update test_preprocess to use decorator for custom function

* change _cast_to_output -> _from_node

* move frontend folder to pyopenvino

* rename includes and add compile options

* include frontend to pyopenvino

* move __init__.py

* move tests

* remove mock from tests_compatibility

* rename import module

* Fix code style cpp

* refactor a few lines

* style fix

* update few lines in mo

* add tests fro scale and mean with vector input

* style fix

* add docstring for custom_preprocess_function

* bind InputInfo network method

* style fix

* Add pyopenvino to dependencies

* bind OutputInfo

* fix description of preprocess submodule

* fix style

* update copyright year

* Fix mock

* update docstring

* bind OutputTensorInfo

* bind OutputNetworkInfo and InputNetworkInfo

* bind ColorFormat and ResizeAlgorithm

* clean imports

* fix typo

* add PostProcessSteps to init

* bind PreProcessSteps

* create additional tests

* Fix mo test

* remove module local

* fix code style

* update comment

* fix return type

* update docs

* fix code style

* change ngraph.Type to ov.Type

* fix typo

* move _from_node to node_output.hpp

* add read_model from buffer

* update imports

* add new line

* remove bad quotes

* update imports

* style fix

* add new line

* rename functin args

* remove Type import

* update tests

* style fix

* test clean

* remove blank line

* update PrePostProcessor init and build methods

* create test with model update tests with new PrePostProcessor init and build

* # Conflicts:
#	inference-engine/ie_bridges/python/src/openvino/offline_transformations/offline_transformations_api.pyx
#	inference-engine/ie_bridges/python/src/openvino/offline_transformations/offline_transformations_api_impl.cpp
#	inference-engine/ie_bridges/python/src/openvino/offline_transformations/offline_transformations_api_impl.hpp
#	inference-engine/ie_bridges/python/src/openvino/offline_transformations/offline_transformations_api_impl_defs.pxd
#	inference-engine/tests/ie_test_utils/common_test_utils/ngraph_test_utils.cpp
#	inference-engine/tests/ie_test_utils/common_test_utils/ngraph_test_utils.hpp
#	model-optimizer/mo/moc_frontend/serialize.py
#	thirdparty/gflags/gflags
#	thirdparty/gtest/gtest

* Stash

* move preprocess module from openvino.impl to openvino

* fix building

* fix code style

* try to move MO to use new api

* Intermediate commit

* try to move MO to use new api

* Test pybind11 custom holder for Preprocessing types (InputInfo and PreProcessingSteps)

* Initial code for source_target layout handling for preprocessing
Initial implementation of reverse input channels

* Use input's tensor names instead of friendly names

* Skeleton for guessing layouts and clearing it after preprocessing

* updated package_BOM.txt

* Use reference_wrapper for preprocess bindings

* Update tests

* Layout::find_permutation - support of dynamic layouts
Covered case for 'trivial convert' where no permutation is needed
It is needed for Model Optimizer for logic which will guess model's layout, like "?c??"

* Stash

* add bindings to I420_SINGLE_PLANE and I420_THREE_PLANES

* remove init from all classes except PrePostProcessor and add RGBX and BGRX to ColorFormat enum

* Guess layout so that existing mean/scale tests passed

* update test name

* Draft to guess layout for 'reverse_input_channels'

* More unit tests (error cases)

* pylint & flake8

* pylint - ignore import error

* Stash

* Moved preprocessing to 'back' folder

* More tests

* Update package_BOM

* Support layout_values with no names
Support layout set for 'outputs'
Tests

* Export more enum names from nrgaph

* Basic --layout parsing

* removed debug prints

* Further updates after rebase

* Update imports

* Removed part from 8829

* Fix imports in test code

* Minor cosmetics

* Don't guess 'C' if layout is already set by model
Expose 'Layout::empty' method

* Style fix

* Apply review comments
Restricted 'heuristics'

C++: Added 'fp16', 'fp64' support to mean/scale

* Applied review comments

* Added some dynamic test cases

* Move call of 'apply_preprocessing' to 'serialize.py'

* Unnecessary change

* Added more comments to code

Co-authored-by: pszmel <piotr.szmelczynski@intel.com>
Co-authored-by: Alexey Lebedev <alexey.lebedev@intel.com>
Co-authored-by: bszmelcz <bartosz.szmelczynski@intel.com>
Co-authored-by: Anastasia Kuporosova <anastasia.kuporosova@intel.com>
Co-authored-by: y <ilya.lavrenov@intel.com>
Co-authored-by: Vafin, Maxim <maxim.vafin@intel.com>
2021-12-07 14:31:55 +03:00
Anton Pankratov
9a5b911856 Variant replaced with Runtime Attribute (#8520) 2021-12-07 13:02:31 +03:00
Roman Kazantsev
42892767f5 [MO, nGraph, transforms., ref., python] Support DetectionOutput-8 (#8853)
* Implement MO part for DetectionOutput-8

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

* Implement nGraph part for DetectionOutput-8

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

* Implement deduction of a number of classes method

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

* Fix build

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

* Implement nGraph tests to check shape inference for DetectionOutput-8 with deduction of num_classes

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

* Implement attributes tests for DetectionOutput-8

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

* Remove DetectionOutput-1 from opset8

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

* Add python bindings for DetectionOutput-8 and tests

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

* Implement downgrading and upgrading transformations for DetectionOutput

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

* Implement tests for downgrading and upgrading transformations for DetectionOutput

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

* Adopt existing reference for DetectionOutput-8

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

* Fix DetectionOutput-8 reference

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

* Add tests for DetectionOutput-8 reference

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

* Finish resolving merge conflict

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

* Fix python bindings after re-structuring

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

* Fix BOM package list

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

* Fix multibox_detection_test

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

* Fix python bindings for DetectionOutput-8

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

* Insert blank line between summary and description for python binding

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

* Apply review comments: identation, for loop

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

* Fix formatting in python bindings

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

* Fix supported_attrs for DetectionOutput from opset1

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

* Add missed imports for python if_op

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

* Apply feedback and fix Win build

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

* Use the same test suite name for test mixture

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

* Fix transformation tests

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

* Recover BWDCMP_RTTI for legacy use and remove unused variables in tests

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

* Remove unused variables in type_prop tests

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

* Recover legacy referenceDetectionOutput constructor

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

* Fix python binding for DetectionOutput

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2021-12-07 01:17:49 +03:00
Alexey Lebedev
4e6eeea6ff [PYTHON API] move frontend bindings to pyopenvino + move MO to use new Python API (#8301)
* move frontend folder to pyopenvino

* rename includes and add compile options

* include frontend to pyopenvino

* move __init__.py

* move tests

* remove mock from tests_compatibility

* rename import module

* Fix code style cpp

* refactor a few lines

* update few lines in mo

* Add pyopenvino to dependencies

* Fix mock

* update docstring

* Fix mo test

* remove module local

* fix code style

* update comment

* fix return type

* update docs

* fix code style

* fix building

* fix code style

* try to move MO to use new api

* Export more enum names from nrgaph

* [Python API] quick fix of packaging

* update tests

* fix setup.py

* small fix

* small fixes according to comments

* skip mo frontend tests

* update mo to new imports

* try to fix win wheel

* fix win wheel

* fix code style

Co-authored-by: Anastasia Kuporosova <anastasia.kuporosova@intel.com>
Co-authored-by: y <ilya.lavrenov@intel.com>
2021-12-01 21:31:16 +03:00
Pavel Esir
6c0fa03ca6 [MO] dynamic shape calculatoin for GatherElements, Sparse ops (#8478)
* dynamic shape calculation for GatherElements

* dynamic shape calculation for sparse_reshape, corrections for sparse_segment_mean/sqrtn/sum

* corrected dynamic_dimension_value, added two unit-test cases

* simplified solution, added missing Nones

* some corrections

* added a couple of more unit-tests
2021-12-01 12:07:01 +03:00
undef-nnov
c1515d92e8 Reverse infer (#8767) 2021-12-01 10:49:04 +03:00
Vladimir Gavrilov
ab22d7d041 Incorrect output shape of Gather operation for some models (#8899)
* Fix in the MO infer function of Gather.

* Added comment about done fix.

* Added more tests.

* Now Gather and AttributedGather are always marked as reinterp_shape=True.
2021-12-01 10:22:30 +03:00
Anton Chetverikov
e9a15b70f5 [MO] Update Select shape inference function to support dynamic shapes (#8892)
* Update Select shape inference function to support dynamic shapes

* Update unit test for Select shape inference
2021-12-01 05:00:55 +03:00
Anastasia Kuporosova
f6df0a9c13 [Python API] quick fix of packaging (#8870)
* [Python API] quick fix of packaging

* update tests

* fix setup.py

* small fix

* small fixes according to comments

* skip mo frontend tests
2021-11-30 12:28:34 +03:00
Maxim Vafin
e4b5c54006 Automatically detect --disable_nhwc_to_nchw option in MO (#8450)
Clean code

Fix Result runtime info

Fix documentation

Fix documentation

Apply suggestions from code review

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>

Update docs/MO_DG/prepare_model/customize_model_optimizer/Customize_Model_Optimizer.md

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>

Apply review feedback

Apply review feedback

Apply review feedback
2021-11-29 19:58:43 +03:00
Svetlana Dolinina
980ad59ac4 Correct ReverseV2ToReverseSequence transformation (#8120)
* add subgraph instead of constant with fixed shape to allow model have undefined batch

* updated transformation (not checked yet)

* changed ReverseV2ToReverseSequence to support dynamic shapes/reshape;
added transformation to reverse_tensor_iterator to support new subgraph got from ReverseV2ToReverseSequence

* remove changes that should not be on this branch

* added tests;
fixed old transformation

* added delete of reversesequences to avoid run of transformation twice

* fixed pattern check for case with dynamic value for input of reversesequence

* Revert "fixed pattern check for case with dynamic value for input of reversesequence"

This reverts commit 0c04164e

* Revert "added delete of reversesequences to avoid run of transformation twice"

This reverts commit fcb7de9c

* reversed changes in reverse_tensorr_iterator for Squeeze case;
update reverse_tensor_iterator with shapeof subgraph
added permutations for attributes to pass layer test

* minor fix for dynamic shape

* updated test;
fixed backward compatibility in reverse_tensor_iterator transformation

* revew comments fixed:
added comments;
refactoring done;
fixed framework name saving for rank = 1

* minor review fixes

* small fix
2021-11-29 15:29:00 +03:00
Anastasia Popova
b3869cb127 Fixed tensors propagation in GlobalPoolingToReduce. (#8835) 2021-11-26 13:02:46 +03:00
Maxim Vafin
2f612f776b Define common frontend (#8110)
* Rename and reorganize frontend_manager

* Apply codestyle

* Fix installing headers

* Fix codestyle
2021-11-24 18:56:05 +03:00
Mateusz Tabaka
7720d82366 [MO] Fix fetching output Place in moc_frontend (#8431) 2021-11-23 14:40:57 +01:00
Anastasia Popova
5104bf8ce8 Fixed axis type in ReverseInputChannels. (#8708)
* Fixed axis type.

* Added checks, corrected get_fw_index.

* Corrected get_fw_index(), removed checks.
2021-11-23 15:22:42 +03:00
Anastasia Popova
5e15288c8a Separated old_api_map into two attributes. (#8632)
* Separated old_api_map into old_api_map_order and old_api_element_type.

* Clang format, small fix.

* Corrected comment.

* Removed OldApiMapOrderAttr class.
2021-11-18 22:04:50 +03:00
Mikhail Nosov
2245ea8be2 [FrontEnd] Rename all frontends from "*_ngraph_frontend*" to "_ov_frontend*" (#8645)
* Renaming all frontends from "*_ngraph_frontend*" to "_ov_frontend*"

Also Debug builds on Windows release frontends without "d" suffix will not be loaded

* Fix review comments and add wheels test debug prints

* More debug prints

* Load by absolute path and remove debug prints
2021-11-18 09:26:13 +03:00
Roman Kazantsev
8e327bd2ff [MO, TF] Support Custom Wide and Deep CTR model by MO (#8505)
* [MO, TF] Support Custom Wide and Deep CTR model by MO

It implements implicit support of EmbeddingSegmentsMean operation through decomposition.
Also, this extends the current transformation to fuse TensorFlow sub-graph (for Wide and Deep model family)
containing SparseSegmentSum and SparseSegmentMean operations into EmbeddingSegmentsSum or EmbeddingSegmentsMean.

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

* Fix unit-tests after modifications of SparseToDense and EmbeddingSegmentsOperationFusing

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

* Document SparseSegmentMean support

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

* Add computation scheme for normalization coeffs and correct documentation

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2021-11-17 11:44:04 +03:00
Anastasia Popova
f800993e6f Fix of ReverseInputChannels for NHWC layout. (#8504)
* Fixed ReverseInputChannels for new api.

* Renamed function, added node name in assert, code refactoring.

* Added ReverseChannels propagation through transposes.

* Refactored get_fw_index() method.

* Fixed wrong name.

* Added negative axis support.
2021-11-15 15:24:46 +03:00
Victor Kuznetsov
925e24525a Move unit_tests from test_pkg/tools to test_pkg/tests (#8548)
* add performance hint to time infer

* move unit_tests to tests pkg

* change unit_tests path in azure lin

* change path to mo in bom test

* fix tests_path

* change mo dir path
2021-11-15 14:18:16 +03:00
Svetlana Dolinina
ae6b16c084 Add outputs for nodes from loops (#7844)
* initial version of transformation workable for loop

* moved transformation to back + minor changes in result names

* fixed mistake: to concatenate results of all iterations Unsqueeze should be added

* added shape inference for new nodes and extend test

* added support of TensorIterator

* If support + test;
fix to save model with TI after transformation

* fix code and tests according to run with ir_reader

* added finding max internal_layer_id in sub-graph + added comments to code

* turn off transformation because it should not be used in MO scenarios

* refactor code to find out iterations count for TensorIterator

* chenged name of final result to srtucture loop1.loop2.node for path [loop1, loop2, node]

* change port number to index of added output

* return list of new nodes

* change naming of output to standard way;
return result node as output of transformation

* refactor transformation, add more comments; fine up tests

* review fixes: add more comments, refactoring of infer function, fix in iterations count calculation

* added processing of dynamic iterations count + tests

* moved iterations count calculation to TI

* fixed bug in iterations count calculation

* fix bug with adding iterations count to wrong dimension + test

* review fixes: minor renaming + fixed bug with unset stride for TI

* move logic with output record outside function calculation iteration count;
fix case with negative start/end;
fix case when division result is not integer;
added tests for such cases

* review fixes: refactoring of toerations count calculation
2021-11-12 17:02:15 +03:00
Pavel Esir
68badf5165 [MO] add IteratorGetNextCut (#8040)
* added IteratorGetNextCut, some improvements in graph.py

* added allowed types check

* reused new graph API for ports

* returned back old API 'out_nodes', removed soft-getting name from base class, changed run_after -> []

* correctly used new port API

* corrected IteratorGetNext message
2021-11-11 10:27:51 +03:00
Ilya Churaev
6a89eb2844 Change frontends namespace to ov (#8434)
* Changed namespace from ngraph to ov for OV Frontends

* Fixed python

* Fixed ONNX Editor for windows

* Try to fix centos

* Fixed code style

* Revert frontend loader
2021-11-10 12:48:37 +03:00
Anton Chetverikov
c8e1c8e3eb [MO|nGraph]GatherND_8 (#7743)
* Add GatherND_8 operation

* Update shape infer function and tests

* Initial commit for nGraph GatherND_8 operation

* Add GatherNDBase class implementation

* Fix base class errors

* Add missrd header

* Update base class

* Update GatherND_8 implementation

* Fix codestyle

* Fix wrong rank

* Implement tests for gatherND_8 shape inference function

* fix codestyle

* Add limitation to doc

* Siplyfy check in shape inference

* Add more test cases

* Update shape inference function

* Add more test cases to cover all case with dynamic input shapes

* Update shape inference function

* Refactor tests

* Add visitor tests for gatherND_8 operation

* Correct comment

* Add additional check is shape inference function

* Update shape inference implementation for gathernd operartion

* Fix codestyle

* Remove restriction for data is fully defined

* Update shape inference functon

* Fix missed check for nonetype

* Remove redundant checks for batch_dims

* Fix codestyle
2021-11-10 11:54:52 +03:00
Aleksandr Pertovsky
0feecd4450 [IE Transformations] Disable pull_transpose_through_fq transformation for activations path (#8178)
* [IE Transformations] Disable pull_transpose_through_fq transformation for activations path

* Update MO part

* Replace TEST to TEST_F

* Fix tests with fixture.

Remove dynamic shapes tests due to the fact that there is always a constant at the input
2021-11-09 13:26:07 +03:00
Anton Chetverikov
fb02aec976 [MO]Fix Merge shape infer function (#7864)
* Update merge shape infer function

* Update merge shape inference tests
2021-11-01 13:52:46 +03:00
Yegor Kruglov
90a140ae98 Extend MO/nGraph for operation MaxPool-8 (#6776)
* MO update for MaxPool-8

* using attrs in op constructor

* remove pads_value attr and pad fusing

* added axis and index_element_type parameters

* updated mo maxpool-8

* added maxpool-8->maxpool-1 transformation, disabled Pad to MaxPool fusing

* added remove_values_output to pooling extractors

* moved remove_values_output attribute to pooling infer function

* fixed ir_comparator tests

* disabled pad to maxpool fusing test

* added downgrade transformation test

* downgrade transformation update

* updated ir reader and tf pooling layer tests

* updated onnx pooling layer tests and MO infer unit test

* updated ir reader extender

* uncommented layer tests code

* disabled MaxPool-8 python binding test

* comment resolving, removed PadMaxPool fusing

* removed test

* downgrade transformation fix, MO codestyle changes

* removed axis check from downgrade transformation

* mark max_pool_test as xfail

* updated downgrade transformation test

* using OPENVINO_RTTI
2021-10-29 14:47:00 +03:00
Anastasia Popova
bf8f9164ed Unification of layout and data types of Parameter and Result in MO (#7630)
* Added transposes insertion for Parameter and Result.

* Separated into several transformations.

* Corrected runtime_info format.

* Fixed runtime info serialization.

* Code refactoring.

* Corrected checks.

* Added debug output.

* Added check.

* Fixed unit tests.

* Changed old api map format, removed debug output.

* Moved serialize to rt_info property, code corrections.

* Refactored RTInfo class.

* Small corrections.

* Small corrections.

* Removed redurant import.

* Added tests, added undefined default type.

* Code reformat.

* Fixed serialization unit tests.

* Added comment.

* Added comment.

* Small test correction.

* Changed default values of old_api_map to values from old API IR.

* np.array -> int64_array

* Update MO to use FE to read IR; Swith MO IR version to 11

* Preserve output node name when inserting Transpose

* Codestyle

* Fix layer tests

* Pylint fix

* Disable ref_graphs comparision in layer tests

* codestyle

* Updated MO IR reader.

* Moved version initialization to constructor of OldApiMap.

* Added shape infer after transpose insertion.

* Fixed Pylint

* Removed wrong attribute removal.

* Added transposes insertion for Parameter and Result.

* Separated into several transformations.

* Corrected runtime_info format.

* Fixed runtime info serialization.

* Code refactoring.

* Corrected checks.

* Added debug output.

* Added check.

* Fixed unit tests.

* Changed old api map format, removed debug output.

* Moved serialize to rt_info property, code corrections.

* Refactored RTInfo class.

* Small corrections.

* Small corrections.

* Removed redurant import.

* Added tests, added undefined default type.

* Code reformat.

* Fixed serialization unit tests.

* Added comment.

* Added comment.

* Small test correction.

* Changed default values of old_api_map to values from old API IR.

* np.array -> int64_array

* Update MO to use FE to read IR; Swith MO IR version to 11

* Preserve output node name when inserting Transpose

* Codestyle

* Fix layer tests

* Pylint fix

* Disable ref_graphs comparision in layer tests

* codestyle

* Updated MO IR reader.

* Moved version initialization to constructor of OldApiMap.

* Added shape infer after transpose insertion.

* Fixed Pylint

* Removed wrong attribute removal.

* Serialize fix.

Co-authored-by: Gleb Kazantaev <gleb.kazantaev@intel.com>
2021-10-27 03:24:54 +03:00
Yegor Kruglov
345c3510f3 set num_classes to None in multibox_detection extractor (#7860) 2021-10-26 00:02:10 +03:00
Ilya Lavrenov
1b1e0e7553 preparation for static compilation (#8099)
* 1. Removed explicit SHARED from libraries
2. Fixed double definition for ie_layer_validators

* Fixed SEG in unit-test: order of initialization for global vars

* Added an ability to find plugins.xml from static IE

* Fixes in unit-test

* Migrated to new macro for import / export

* Minimized number of custom dllexport

* Don't use IR v7 for static libraries

* Revert for merge

* Don't enable tests with dlopen for static libraries

* Code style

* Added condition for export

* Revert format_reader

* Removed forward decalaration with external linkage

* Fixed IE linkage on Windows

* Reverted back 2 flags
2021-10-21 10:56:06 +03:00
Pavel Esir
9f64f77a3c [MO] allow zero size dimensions in Slice output (#7791)
* allow zero size dimensions in Slice output

* updated comments regarding 0-size dimensions
2021-10-20 13:16:06 +03:00
Pavel Esir
f661133242 [MO] fixed dealing with None in then/else branches of Select (#7465)
* fixed dealing with None values in then/else branches of Select

* generalized solution when condition is non one elemental

* fix when both branches are None

* minor corrections

* rewritten Select unit-tests; fixed for condition with [True] mask

* removed mutable default arg from build_graph, added a few more test cases with masked condition, other minor corrections

* corrected output_shape calculation when broadcasting is off

* layer tests fixed: relaxed assert for condition shape to let pass TF Select

* corrected shape calculation when condition is not elementwise equal, calculated calculation for TF, corrected calculation of shape when values are not set

* fixed a typo for Select from TF Where
2021-10-15 18:51:52 +03:00
Anton Chetverikov
e034a072ea [MO] Fix NMS 3rd output shape (#7992)
* Fix NMS 3rd output shape

* Add tests for NMS_5 shape infer

* Add comments, fix codestyle
2021-10-15 14:44:08 +03:00
Maxim Vafin
25c2d5c6c4 [MO] Fix axes in FusedBatchNorm -> MVN transformation (#7679) (#7913) 2021-10-12 16:47:29 +03:00
Anton Chetverikov
a56d81345d [MO] IR Reader meta_info using update (#7133)
* Initial change to allow saving graphto IR without meta_info

* Update saving and restoring functions, add more comments

* Add unit tests for define_data_type() function

* Fix wrong name

* Update condition

* Update meta_data checks

* Update data_type restoretion and missed outpurt ports handling

* Update and add new test

* Update comments

* Remove commented code

* Rename function

* Update temporary Result operations processing

* Remove define_data_type function

* Move node_normalize_output function to Op class methods

* Update comments

* Update comments
2021-10-05 15:07:44 +03:00
Michał Karzyński
bd5b1bf99f Change the way Model Optimizer loads frontends (#7330)
* Adds two switches `use_new_frontend` and `use_legacy_frontend` to override defaults.
* Rename ONNX frontend from `onnx_experimental` to `onnx`
2021-09-30 12:17:36 +02:00
Svetlana Dolinina
ed96cc7c1a added Kaldi dropoutmask extraction (#7456)
* added Kaldi dropoutmask extraction and Kaldi lstmNonlinearity replacer extended for dropout case

(cherry picked from commit 0dd05f8053)

* fixed frame time calculation for Kaldi models with shapeof branches

* fix bug in frame time calculation for Kaldi models with shapeOf paths

* remove incorrect attribute from transformation

* refactoring based on review, couple more checks

* minor review fixes
2021-09-24 00:03:47 +03:00
Roman Donchenko
8598ce89a3 Add missing spaces between words in string literals (#7540)
And in one case, a missing period.
2021-09-20 15:38:49 +03:00
Anton Chetverikov
9cfdad9afc Change sort functions to fix incorrect order in port dictionaries (#7283)
* Change sort functions to fix incorrect order

* Add separate sorts for different cases

* Update sort function to correct control flow edges handling

* Refactor all sorts for dictionary ordering

* Update build_graph function for correct control_flow edges creation

* Add tests for nodes and ports sort equality

* Fix wrong port value

* Add direct conversion from bool to int

* Use .replace instead of .strip

* Add test with both control_flow and ordinary edges, refactored edges lists filling

* Refactored nodes dict filling

* Delete unused test code
2021-09-20 10:17:44 +03:00
Ilya Lavrenov
0df7dab345 New IRC package structure (#6255)
* OV new package structure

* Fixes

* More fixes

* Fixed code style in ngraph tests

* Fixes

* Paths to setupvars inside demo scripts

* Fixed demo_security_barrier_camera.sh

* Added setupvars.sh to old location as well

* Fixed path

* Fixed MO install path in .co

* Fixed install of public headers

* Fixed frontends installation

* Updated DM config files

* Keep opencv in the root

* Improvements

* Fixes for demo scripts

* Added path to TBB

* Fix for MO unit-tests

* Fixed tests on Windows

* Reverted arch

* Removed arch

* Reverted arch back: second attemp

* System type

* Fix for Windows

* Resolve merge conflicts

* Fixed path

* Path for Windows

* Added debug for Windows

* Added requirements_dev.txt to install

* Fixed wheel's setup.py

* Fixed lin build

* Fixes after merge

* Fix 2

* Fixes

* Frontends path

* Fixed deployment manager

* Fixed Windows

* Added cldnn unit tests installation

* Install samples

* Fix samples

* Fix path for samples

* Proper path

* Try to fix MO hardcodes

* samples binary location

* MO print

* Added install for libopencv_c_wrapper.so

* Added library destination

* Fixed install rule for samples

* Updated demo scripts readme.md

* Samples

* Keep source permissions for Python samples

* Fixed python

* Updated path to fast run scripts

* Fixed C samples tests

* Removed debug output

* Small fixes

* Try to unify prefix
2021-09-15 16:49:11 +03:00
Anastasia Popova
cf48792134 Random Uniform MO implementation (#6694)
* Added RandomUniform operation.

* Conflicts fix.

* Fix conflicts.

* Fix conflicts.

* Added ONNX extractor, fixed FP16 conversion, added double implementation.

* int32, int64 types.

* Added initial type attribute.

* Added extractors for MxNet and TF for RandomUniformInt.

* Fixed ChangeRandomUniformOutputType transformation.

* Corrected ONNX, MxNetextractors.

* Fixed extender.

* Code style corrected, updated BOM file.

* Small correction.

* Code reformat.

* Fixed type check.

* Small corrections, code style.

* Added RandomUniform tests to manifest file.

* Include fixed.

* Code style.

* Small corrections.

* Tests fixed.

* Manifest file updated.

* Removed initial type attribute.

* Small correction.

* Fixed problem with Const types change.

* Update ngraph/core/include/ngraph/op/random_uniform.hpp

Co-authored-by: Ilya Churaev <ilyachur@gmail.com>

* Update ngraph/core/src/op/random_uniform.cpp

Co-authored-by: Ilya Churaev <ilyachur@gmail.com>

* Update ngraph/core/src/op/random_uniform.cpp

Co-authored-by: Ilya Churaev <ilyachur@gmail.com>

* Applied comments to shell implementation.

* Applied comments to shell implementation.

* Moved shell and reference to separate PR.

* Moved shell and reference to separate PR.

* Corrected comments, code refactoring.

* Fixed seed attributes.

* Corrected mxnet extractor.

* Returned RandomUniform onnx extractor.

* Small fix.

* Used generator in tests, fixed input ports count in AttributedRandomUniform.

* Temporarily added DropoutWithRandomUniformReplacer and debug output.

* Temporarily added DropoutWithRandomUniformReplacer and debug output.

* Temporarily added DropoutWithRandomUniformReplacer and debug output.

* Temporarily added DropoutWithRandomUniformReplacer and debug output.

* Moved DropoutWithRandomUniformReplacer to ngraph, removed debug output.

* Fixed wrong change.

* Fixed wrong change.

* Added check that RandomUniform is in ShapeOf subgraph.

* Added layer tests, updated supported operations list.

* Small correction.

* Fix conflicts.

* Fix conflicts.

* Small fix.

* Used const for not changing values.

* Apply suggestions from code review

Co-authored-by: Gleb Kazantaev <gleb.nnstu@gmail.com>

* Added IR check in layer tests.

* Fixed error.

* Fixed test.

* Update inference-engine/src/transformations/include/transformations/common_optimizations/dropout_with_random_uniform_replacer.hpp

Co-authored-by: Gleb Kazantaev <gleb.nnstu@gmail.com>

* Removed ShapeOf and Mul from DropoutWithRandomUniformReplacer.

* Replaced register_new_node with make_shared.

* Added fp16 test.

* Extended for RandomUniform->Convert case.

* Used modf().

* Removed modf().

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

Co-authored-by: Gleb Kazantaev <gleb.nnstu@gmail.com>

* Added negative tests, added nullptr check for add_const_value.

Co-authored-by: Ilya Churaev <ilyachur@gmail.com>
Co-authored-by: Gleb Kazantaev <gleb.nnstu@gmail.com>
2021-09-14 21:26:57 +03:00
Ilya Lavrenov
a952540edf Openvino cmake config (#7419)
* Added OpenVINOConfig.cmake

* OpenVINOConfig.cmake part 2

* Trying to fix cmake generation

* Fixes

* Export frontends as well

* Fixed condition

* Added OpenVINO cmake package usage: docs, C samples

* Use more OpenVINO config

* Install OpenVINOConfig.cmake

* Trying to fix private plugins

* Trying to fix .tox

* Trying to fix ARM

* Fixed samples build

* Explicit ngraph duplicated targets

* Fixed fuzzing tests build

* Added IR frontend installation

* Removed install directory for IE reader

* Removed IR frontend from export list

* Reverted ngraph_DIR

* Try to fix .tox

* Fixed ieFuncTests with ONNX extensions

* Attempt #2

* Trying to fix ngraph setup.py

* Fix

* Trying to fix ONNX ngraph .tox CI

* Trying to remove spaces

* Fixed ngraph_DIR -> OpenVINO_DIR

* Removed junk files

* Try to fix ngraph wheel

* Try to fix ie_wheel

* Try to fix ngraph wheel
2021-09-10 15:31:27 +03:00
Evgenya Stepyreva
aa106ad270 Unused transformations deleted (#7428) 2021-09-09 10:07:59 +03:00
iliya mironov
60714ce40a Fix return values for lift_up_through func (#7323)
* Fix return valuese for lift_up_through func

* Update unit test

* Refactoring code according to code review

* Fix revers outputs

* Fix unit test

* Fix comment

* Add multioutput support

* Add unit test for cace with several output from ReverseChannel op

* Fix distinantion connect
2021-09-08 14:48:59 +03:00
Mateusz Tabaka
990b7e67da [MO] MulFakeQuantizeFuse - don't fuse if mul constant has zero or negative values (#7347) 2021-09-08 13:26:49 +03:00
Evgeny Lazarev
4547818fb1 Move TF OD API docs to code + several fixes for TF OD API models conversion (#7377)
* Refactored code, updated comments and documentation related to TF OD API models pre-processing.

* Improved MO messages related to pre-processor block removal during conversion of the TD OD API models. Remove mean/scale if padding is used and mean/scale is applied before resize

* Updated TF OD API transformation and documentation for SSD models

* Updated comments and documentation for the ObjectDetectionAPIMaskRCNNSigmoidReplacement transformation

* Updated comments and documentation for the ObjectDetectionAPIMaskRCNNROIPoolingSecondReplacement transformation

* Updated comments and documentation for the ObjectDetectionAPIPSROIPoolingReplacement transformation

* Updated comments and documentation for the ObjectDetectionAPIProposalReplacement transformation

* Updated comments and documentation for the ObjectDetectionAPIDetectionOutputReplacement transformation

* Minor code style fixes

* Fixed unit tests for ObjectDetectionAPIPreprocessor2Replacement transformation

* Improved unit test for pipeline.config parser. Fixed very long bug with incorrect test data for the PipelineConfig parser class

* Code style fixes

* Get rid of "coordinates_swap_method" parameter in the JSON configuration file for TF OD API models

* Code style fixes and minor refactoring

* Simplied code related to swapping Proposal coordinates

* Removed incorrectly removed code

* Fixed code review comments about the code comments
2021-09-08 10:03:01 +03:00
Evgeny Lazarev
3775dad345 MO dynamic shapes support (#5918)
* Allow MO to generate IR with -1 in dimensions

* Some fixes to support -1 for StridedSlice operation

* Updated TensorArrayGatherV3 shape infer to support dynamic output shape

* Several fixes to support undefined dimensions in the Broadcast,Reshape,Slice and Tile

* Fixed bug in the normalization transformation of TF NMS to opset NMS

* Updated shape infer functions related to StridedSlice and NMS

* Updated Select shape inference function to use common shape broadcasting function supporting dynamism

* Fixed operation TFResize shape infer function to work correctly for case when model is converted with --disable_nhwc_to_nchw

* Dynamic Range and update asserts in NMS

* Changed the way how dynamic dimensions are specified. Refactored shape inference functions and common places to use new approach

* More fixes to support dynamic shapes

* More fixes for support of dynamic shapes

* Fixed generation of IR with dynamic dimensions

* Allow reading IRs with undefined dimensions

* More changes in the IE to support dynamic dimensions

* Fixes for Switch, Merge, Concat shape and value infer related to dynamism

* Fixed TensorArray related ops to properly handle dynamic dimensions. Fixed StridedSlice infer for case with new_axis

* Fixed shape_for_layout function to generate masked array

* Fixed shape inference for Convolution and Poolings to support dynamic spatial dimensions

* Updated shape infer functions for CTCGreedyDecotder, CTCLoss and Enter

* Fixed shape inference with dynamic dimensions for MatMul, Split, Upsample, SpaceToBatch, some fixes for the TI

* Fixes for undefined dimensions support for Proposal and DetectionOutput

* Fixed ExtractImagePatches, DepthToSpace and RegionYolo shape infer functions to work with partially dynamic dimensions

* Changes in tf_window_op_pad_infer to better work with dynamic dimensions

* Fixed output shape calculation for StridedSlice operation

* More StridedSlice fixes

* Fixed resolve_convolution_with_group

* Fixed unit tests

* Fixed unit tests

* Fixed Switch op unit tests

* Fixed shape inference for Upsample operation

* Updated unit tests for the Concat operation

* Fixed eltwise shape infer unit tests

* Fixed shape infer tests for Convolution and DetectionOutput ops

* Fixed Crop shape infer function tests

* Fixed Slice op unit test and minor fix in the shape inference. Fixed emitter

* Updated unit test for telemetry and match_shape function for dynamism

* Fixed unit test for the DetectionOutput

* Added support for the TF ClipByValue operation

* Fixed GatherND shape inference for dynamic shapes support

* Dynamic shapes support for the MO IR Reader

* Fixed BlockLSTM operation to not work as an extractor

* Allow to serialize IRs with partially defined shapes

* Updated SelectBroadcast transformation to not check shape values

* Fixed MO IR comparator

* Fixed SS value propagation when slices are dynamic

* Do not re-run graph clean-up for ProposalMutation

* Fixed InterpolateSequenceToInterpolate transformation to support dynamic dimensions

* Fixed Loop iteration count calculation and reading IteratorGetNext shapes

* Fixed unit test for serialization

* Fixed serialization test

* Fixed RandomUniform shape infer

* Fixed several transformations related to RNN to respect dynamic output shapes

* Fixed Deconvolutin shape calculation for dynamic batch. Eltwise shape infer improvements

* Fixed shape infer functions for ExperimentalDetectron ops, reverted changes for NonZero and removed debug prints

* Fixed check for dynamism of a list, fixed value propagation for Concat op and remove redundant shape infer for reshape

* Update Eltwise value propagation to use np.ma

* Fixed ExpandDims shape infer function

* Shape infer functions fixes and improvements

* Remove Accum op from the MO

* Updated activation functions shape infer

* Removed unsupported operation Correlation

* Fixed shape infers for several functions

* Removed unsupported DataAugmentation operation

* Fixed shape infer functions for several ops in extensions directory

* Removed not-support operation PowerFile

* Removed unsupported SpatialTransformer,SimplerNMS and PredictionHeatmap operations

* More shape infer functions updates

* Merge shape infer fix

* Fixed typo

* Fixed TensorArraySize shape infer function

* Fixed VariadicSplit and Squeeze shape infer

* Fixed ONNX models Parameter extractor

* Updated Select value propagation for the dynamic case

* Fixed ReorgYolo shape infer and test

* Removed unnecessary tests

* Fixed Tile shape infer

* Fixed SparseFillEmptryRows unit tests

* Fixed package bom

* Added extractor for the TF operation Mod

* Fixed value propagation for MatMul operation

* Updated Parameter extender to generate shape_array when shape is partially defined only

* Fixed BOM file

* Fixed issue with the TF OD API models and DetectionOutput op. Now the shape infer function for the DO do not re-infer "num_classes" attribute value if it is already known

* Fixed unit test for the DO infer

* Fixed num classes calculation for the DO generation for Faster/Mask-RCNN models

* Changed NMS op to produce static output shape

* Restore dynamic output shape calculation for the NMS for NMS-5

* Fixed CellNormalizer transformation. It should work for static shapes only

* RNNCell Op class fixes

* Revert some changes

* Updated documentation with a list of supported operations

* Revert changes

* Fixes for the ConstantFill op

* Removed redundant SequenceLengthToMask transformation

* TensorArray* ops shape infer code style and refactoring

* Reverse some unnecessary changes in the ConvolutionNormalizer

* Fixes and unit tests for shape_array, compare_shapes, is_fully_defined functions

* Implemented shape_insert, shape_delete functions and tests for them

* Modified code to use shape_delete function

* Added usage of shape_insert function where necessary

* Use shape_insert function in many places

* Some fixes in shape inference for various ops

* Updated shape_delete function to support negative indices

* Changes and unit tests for the MatMul infer function

* Removed strange code from the TF Merge infer function

* Merge op shape infer fixes

* Fixed value propagation in the transformation EltwiseInputReshape.py for the dynamic dimension case

* Code cleanup

* Updated GatherND to support dynamic dimensions

* Minor fixes

* Fixed shape_insert and shape_delete to support np.int64 and np.int32 types

* Updated Upsample operation unit tests with dynamic input shapes

* Minor change in the extensions/back/ConvolutionNormalizer.py to make sure that input dimensions are static

* Fixed ConvertGroupedStridedSlice transformation and added unit tests

* Revert debug changes

* Fixed value propagation for Unsqueeze to work with partially defined input values

* Typo fix

* Added unit tests for the Unsqueeze op shape infer

* broadcasting functions changes and unit tests

* Fixed Tile value inference for partially defined input tensor

* Unit tests for Split and VariadicSplit ops

* Fixes for the Concat infer + unit tests

* Removed redundant tf_pack shape infer

* Fixed Concat value infer and added unit tests

* Fixed StridedSlice shape inference for case with dynamic slices

* Fixes related to StridedSlice shape infer, changes in tests

* Unit tests for the eltwise shape and value infer

* Fixed Pad op value propagation to allow dynamic input values to be propagated

* Unit test for Pooling dynamic input shape infer

* Squeeze op unit tests for dynamic input shape

* Added assert to the Squeeze op shape infer for case when squeeze dimension is dynamic value

* Added message to the MO when input shapes are dynamic

* Convolution dynamic unit test

* Removed redundant transformation GroupedConvWeightsNormalize

* Removed non-ascii character from the message

* Fixed typo in the BOM file

* Code style and comment fixes

* Fixed copy-paste issue in the DO shape infer function

* Fixed setting dynamic shape in the MO command line

* Added function to compare tensor with dynamic values. Fixes in the unit tests and shape infer functions

* Improved Reshape shape infer + added unit tests

* Fixed value propagation for Select op

* Renamed several internal functions, minor code fixes.

* Code style fixes

* Modified condition in the _set_shape method of the Port class to not check shape if the "override_output_shape" attribute is specified

* Fixed constant value propagation for ReduceOps when inputs have dynamic values. Added unit test

* Fixed shape infer for the Loop for dynamic dimensions case

* Fix in the NMS shape infer to avoid ragged numpy array generation. Fixed Scatter shape infer validation

* Improved shapes infer for eltwise ops with respect to dynamic dimensions

* Changed code comments

* Renamed tensor names in the ClipByValueTFTransformation

* Changed np.ma.allequal to strict_compare_tensors in the Merge op infer

* Chanded np.ma.allequal with strict_compare_tensor.

* Fixed Merge op value infer

* Fixed debug code

* Removed commented line

* Updated condition to check for dynamic shapes in the Partial infer to not fail for MxNet models

* Improvements to the get_shape_from_slice and is_dynamic_slice functions

* Reverted change in the `normalize_slices_attr` for ellipsis mask case

* Updated shape conditions in the ScatterNDBase op to support dynamic dimensions

* Crop op file refactoring

* Set "type" attribute to None for SparseFillEmptyRows op which is not from any opset

* Removed unnecessary extractor test

* Restored Crop operation type

* Removed "type" attribute from the Crop operation and updated the MO code to find Crop by "op" attribute

* Fixed If shape infer function to produce dynamic dimensions

* Updated If shape and value infer to properly work when condition is static

* Fixed fusing transformation check to work with dynamic dimensions. Change comparison in the shape_inference function to not use strict shapes comparison

* Optimize imports in the LayerNorm

* ConvertGroupedStridedSlice minor fixes related to dynamism support

* Fixed ConvertGroupedStridedSlice to properly check if the dimension is sliced
2021-09-01 14:35:06 +03:00
Anton Chetverikov
f8e90f0c56 [MO] Add transformation for single CTCGreedyDecoder operation (#7023)
* Add transformation for single CTCGreedyDecoder operation

* Fix style in op specification

* Update transformation logic

* refactor old tests and add tests for new transformation

* Move tf specific front transformations to tf folder

* Update transformation logic and comments

* Add run_after function and update comments

* Add output_sparse_format attribute to extractor

* Update transformation conditions and tests

* Fix incorrect comment

* Move sparse_to_dense_replacer to front/tf folder to fix problems with class registration

* Update import

* Update output ports handling in transformation

* Update test

* Fix BOM file

* Update pattern for ctcloss transformation

* Fix and refactor tests for ctcloss transform

* Update transformation conditions
2021-08-24 15:42:27 +03:00
Yegor Kruglov
14dcd43c32 [MO] Replacing StridedSlice with Squeeze/Unsqueeze (#6693)
* added reinterp_shape parameter to tf ss extractor

* removed reinterp_shape

* added transformation to replace ss

* updated bom

* fix for e2e tests

* updated a case when shrink_axis_mask and new_axis_mask are both initialized

* unittests

* added comments

* updated graph_condition

* comments resolving

* updated the case, when shrink_axis_mask and new_axis_mask are both initialized

* added layer tests for squeeze/unsqueeze cases

* remove case when shrink and new axis masks are both set
2021-08-24 13:19:40 +03:00
Ilya Churaev
334bf9d227 Moved DiscreteTypeInfo to ov namespace (#7127)
* Moved DiscreteTypeInfo to new opset

* Revert old header

* Fixed code style
2021-08-20 06:42:15 +03:00