Commit Graph

162 Commits

Author SHA1 Message Date
Sergey Lyubimtsev
93342f0860 [MO] Add CMake install for Model Optimizer (28291) (#2831)
* [MO] Add CMake install for Model Optimizer

* [MO] Update test for version.py

* [MO] Add CMake install for Model Optimizer

* [MO] Update test for version.py

* [MO] Add CMake install for Model Optimizer

* [MO] Update test for version.py

* [MO] fix file permissions for install location
2020-10-30 14:37:06 +03:00
Maxim Vafin
3019a34dc8 Improve support ONNX Resize-10 created by PyTorch (#1350) 2020-10-29 15:26:23 +03:00
Evgeny Lazarev
cabf8d8534 ONNX Loop operation support (#2756)
* Generate TensorIterator without back edges from TensorFlow models

* Added a check in the MarkSubgraphsWithCorrectLayout to not fail when port is not connected

* Updated the 'protobuf2nx' to consume the graph protobuf message

* Cleanup TI from the IRv7 specific code

* Do not run some front transformations recursively

* Draft support for the ONNX Loop operation when 'cond' = True

* LoopToTI transformation changes

* Added draft of Loop operation and parser for ONNX Loop operation body

* Updated Loop body parser + added shape and type infer for the Loop operation

* Fixes for ONNX Loop operation parser

* Moved Loop parsing to Loop op extractor. Added generation of external edges for the Loop body ops

* Added support for ThresholdedRelu using decomposition

* Added support for Min ONNX operation

* Draft fixes for port_map generation for the Loop

* Rename transformation file and fix BOM

* Fixed shape inference for Loop scan outputs (axis is not None)

* Fixed shape inference for ONNX Loop operation

* Refactor checks in the TensorIteratorMerge transformation

* Code refactoring. Enabled commented transformations

* Documentation update for ONNX Loop, ThresholdedRelu and Min

* Fixed typo in the Loop front transformation where execution condition input is connected. Other refactorings

* Fixed in the Loop extractor

* Added printing 'internal_layer_id' attribute in the graph dumper

* Updated calculation of iterations number for the Loop

* Added missing code

* Fixed output port shapes and types generation for Loop operation

* Update function names and variable names in the Loop operation

* Fixed type inference for iteration count input

* Added removal of input/output ports of the Loop if they are not used

* Fixed renumbering Loop operations input/output ports to keep mandatory

* Fixed ThresholdedReluDecomposition transformation

* Updated MO IR Reader to know about Loop operation. But it is still not supported by the MO IR Reader

* Added unit test for Slice op shape infer (reverse the sequence of elements)

* Reverted changes in the ONNX loader function call to protobuf2nx

* Enable Reshape0DToSqueeze transformation recursively

* Refactored Loop operation support implementation

* Changed ThresholdedReluDecomposition to generate Const with shape [1] instead of scalar

* Code style and wording fixes

* Restored accidentally removed 'return' statement in the TI shape infer function

* Fixed comments

* Fixed comment

Co-authored-by: Evgeny Lazarev <elazarev.nnov@gmail.com>
2020-10-27 23:04:43 +03:00
iliya mironov
ce19e1fb9a Add hsigmoid fusing for MO (#2750)
* Add hsigmoid fusing for MO

* Update Bom file

* Remove comments

* Refactoring hsigmoid fusion according to review

* Add div and mul patterns for hsigmoid fusion

* Refactoring code according to review

* Fix HSigmoid fusion transformation
2020-10-24 12:51:15 +03:00
Evgenya Stepyreva
1bae540895 [ MO ] KSO=ON for Kaldi (#2028)
* [ MO ] KSO=ON for Kaldi

* [ MO ] Kaldi KSO

* set static_shape for graph cycle making transformation
2020-10-23 13:14:00 +03:00
Anton Chetverikov
44406691e5 Add Round-5 operation (#2328)
* Add Round-5 operation

* Add ONNX Round to supported operation list

* Add ngraph implementation for Round operation

* Update MO part

* Create UnaryElementwise class, update Round Operation

* Fix mode attr in mxnet extractor

* Add tests for Round shape infer

* Update 'enable' attr

* Update MO IR Reader to support UnaryElementwise operations

* Minor test refactor

* Update ngraph Round operation

* Add reference implementation

* Add test for reference implementation

* Add test for shape infer

* Add test for IE IR Reader

* AddRound operation to python api

* Fix missed mode attr

* Update Round operation version

* Fix codestyle

* Add MxNet Round to supported layers list

* Fix error in reference

* Fix comments style

* Update CMake file

* Update Ngraph reference test

* Update IE IR Reader tests

* Return v0::Round operation

* Update shape infer tests

* Fix v0::Round reference

* Fix codestyle

* Enum instead of string

* Fix codestyle

* Add Mode attribute adapter

* Update Mode attr

* Fix reference for v0::Round

* Fix codestyle

* Fix mode attr

* Fix get() method

* Fix codestyle in python api

* Update test info

* Fix ngraph api part

* Ad round v5 to interpreter tests

* Fix codestyle is ie reader test

* Update ngraph python api __init__.py file

* Adde opser5 to dafault opsets in ie_ir reader

* Add parser for Round layer

* Remove redundant spaces

* Add round creator to appropriate list

* Remove redundant import

* Commit to bump infrastructure version

I'm sorry for this, but this commit will be squashed on merge to master anyway and it is needed for your PR to correctly pass the pipeline

* Fix import

* fix codestyle

* Fix ngraph api part

* Add shape infer tests in python api

* Add .upper() for mode attr

* Refactor MO shape infer test for Round op

* Update tests and add comments

* Revert "Commit to bump infrastructure version"

This reverts commit 56e6ae1e4c.

* remove parser for Round layer

* Update Ronund-5 evaluate test

* Resolve review comments

Co-authored-by: User <user@nnlvdp-achetver.inn.intel.com>
Co-authored-by: Andrey Babushkin <andrey.babushkin@intel.com>
Co-authored-by: Anton Chetverikov <anton.chetverikov@.intel.com>
2020-10-20 18:36:19 +03:00
Maxim Vafin
a405546054 Add LogSoftmax-5 to MO and ngraph (#2409)
Co-authored-by: Evgeny Lazarev <evgeny.lazarev@intel.com>
2020-10-20 13:40:06 +03:00
Roman Kazantsev
c2394508c1 Implement LookupTableInsert shape inference (#2348)
* Implement LookupTableInsertV2 shape inference

It is needed if other nodes not beeing pruned in the graph
have a conditional dependence on LookupTableInsertV2 node.

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

* Fix after core-review #1

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

* Fix the code after review #2

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

* Fix after code review #3
2020-10-20 09:57:55 +03:00
Roman Kazantsev
d1e4ef392c Extend MO for operation GatherND (#2540)
* Extend MO for operation GatherND

* Update documentation

* Rename GatherNd.py to gathernd.py

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-10-15 07:40:58 +03:00
Evgeny Lazarev
d86019d104 Leaky relu transformation refactor (#2640)
* Refactored LeakyRelu transformation

* Added unit test for LeakyRelu transformation + removed duplicate test function valued_const
2020-10-14 16:43:29 +03:00
Pavel Esir
2110a29b7c [MO] [Kaldi] Add TDNN Component (#1870)
* [MO] [Kaldi] Added TDNN Component

* TdnnComponent replacer graphical comment updated

* Added SpecAugmentTimeMaskComponent

* some refactor of memoryoffset shape_infer

* moved memoryoffset splitting to the middle stage

* some corrections
- set `need_shape_inferenc`=False in split_memoryoffset
- use cycle instead of pattern in tdnn_replacer

* separated splitting of MemoryOffsets in LSTM and TDNN blocks

* set transpose_weights=True in TdnnComponent

* Corrected Supported_Frameworks_Layers

* corrected comments

* separate naming for tdnn and lstm memoryoffset splits

* corrected BOM file

* corrected generaldropout_ext.py and removed 'has_default' for tdnn_component

* corrections after PR review

* renamed LSTM -> recurrent; added setting element_size for paired nodes of tdnn_memoffset and othe minor changes

* Update split_tdnn_memoryoffset.py

* corrected partial infer with new API in elemental.py and split_tdnn_memoryoffset.py
2020-10-12 14:10:27 +03:00
Pavel Esir
9a9b231c98 [MO] Fix ONNX Clamp-11 shape infer with no min/max inputs (#2603) 2020-10-12 09:55:45 +03:00
Roman Donchenko
0e502ffb35 [MO] Fix many spelling and grammar errors (#2543) 2020-10-09 12:16:12 +03:00
Ilya Lavrenov
de1cc8af2e Shellcheck tests for bash scripts (#2532)
* Added bash scripts checks with shellcheck

* Fixed indentations

* Fixed setupvars.sh with shellcheck

* Fixed MO scripts

* Compilation with newer versions of shellcheck
2020-10-05 23:37:50 +03:00
Pavel Esir
9149d899b3 [MO] Fix: add PermuteInputs to shape broadcasting (#2419)
* fix: add PermuteInputs to shape broadcasting

* fix type declaration typo
2020-10-05 12:48:57 +03:00
Zoe Cayetano
62a33f7f4b Update get_ov_update_message.py (#2499) 2020-10-02 23:19:54 +03:00
Mikhail Ryzhov
afd7d63466 Added closing braсket (#2466) (#2479)
Fixed syntax error (b4b03b1)
2020-10-01 12:26:56 +03:00
Pavel Esir
1c97b13e9a [MO] Add explicit broadcasting mode (#2077)
* [MO] Add explicit broadcasting mode

* corrected value broadcast, added nontrivial test cases

* added negative unit-tests

* added axes normalization and permute inputs

* corrected axes normalization

* Update model-optimizer/mo/utils/broadcasting.py

Co-authored-by: Evgenya Stepyreva <evgenya.stepyreva@intel.com>
2020-09-25 13:26:47 +03:00
Evgenya Stepyreva
cd391389ce [ MO ] Complete weights layout permutation (#2299)
* MO TF: FQPerChannel extractor

* [ MO ] Complete weights layout permutation

* removed deleted file out of BOM

* Bring back stashed changes

* Skip if no weights permutation

* Conditional permutation

* Comments
2020-09-18 14:42:16 +03:00
Svetlana Dolinina
cdedc4af19 added check to avoid IR generation in case of wrong input shape (#2127)
* added check to avoid IR generation in case of wrong input shape

* review changes
2020-09-16 11:29:05 +03:00
Evgenya Stepyreva
1007b05104 [DOC] Reshape feature (#2023)
* [DOC] Reshape feature

* Comments adressed.

* Clarifications

* Converting_Model_General.md

* Update ShapeInference.md

* Update ShapeInference.md

* Comments

* Update Convert_Object_Detection_API_Models.md

Co-authored-by: Andrey Zaytsev <andrey.zaytsev@intel.com>
2020-09-11 21:41:42 +03:00
Anton Chetverikov
e6e7f5158a Fix Mish and SoftPlus value propagation functions (#2120)
* Fix Mish and SoftPlus value propagation functions

* Add unit tests for SoftPlus & Mish operations value propagation functions
2020-09-11 12:58:14 +03:00
Vladimir Gavrilov
dca30b4522 Extend MO for support of Interpolate-4 (#2026)
* Commit.

* Added opset4 version in the class Interpolate.

* Added class ONNXResize11Op to read ONNX Resize with opset version >= 11.

* Added support for Interpolate-4 into transformations TestInterpolateReshapeWA and InterpolateConcat.

* Added support for Interpolate-4 into transformation InterpolateWithConcat.

* Deleted redundant checks from the transformation UpsampleToResample.

* Reverted last changes.

* Changed ONNX Resize extractor to support for Interpolate-4.

* Added conversion of ONNXResize11Op into Interpolate-4.

* Added support for Interpolate-4 into the transformation InterpolateSequenceToInterpolate.

* Small fix for formatting.

* Written tests for MO version of Interpolate-4 with shape_calculation_mode = sizes.

* Written tests for infer function of Interpolate-4.

* Now transformations InterpolateWithConcat, InterpolateConcat, InterpolateReshapeWA skip Interpolate-4.

* Used create_op_with_const_inputs in the transformation InterpolateSequenceToInterpolate.

* The transformation ONNXResize11ToInterpolate4 was rewritten using find_and_replace_pattern.

* Now the dictionary infers (dictionary of infer functions of Interpolate) is a class static attribute.

* Deleted unused variable.

* Restored original logic of find_and_replace_pattern method of the class InterpolateReshapeWA.

* Used create_op_with_const_inputs() in the transformation InterpolateSequenceToInterpolate for opset1 case.

* Replaced resize_name by resize.soft_get('name', resize.id).

* Small fixes.

* Added two tests for Interpolate-4 infer function.

* Fixed the transformation ONNXResize11ToInterpolateV4 for the case when ONNXResize11 operation has 3 inputs.

* Added conversion of ONNXResize11 with tf_crop_and_resize_mode to ROIPooling + ONNXResize11.

* Fixed bugs in the transformation ONNXResize11ToInterpolateV4 and in the infer function of the operation ONNXResize11.

* Small changes.

* Renamed transformation that converts ONNXResize11 into ROIPooling + ONNXResize11 and fixed BOM-file.

* Fixed tests for the transformation InterpolateSequenceToInterpolate.

* Small change.

* Now the transformation InterpolateSequenceToInterpolate preserves output layer name.

* Deleted the transformation ONNXResize11ToTFCropAndResize.
2020-09-09 16:28:52 +03:00
Roman Kazantsev
82e15a5a64 Support python 3.8 by the Model Optimizer tool in default configuration (#2078)
* Support python 3.8 by the Model Optimizer tool in default configuration

* Fix after review #1

* Fix after the second round review
2020-09-09 08:34:43 +03:00
iliya mironov
9939253fed Refactored legacy code for mean_scale_values transformations (#1936)
* Remove move_to_preproc. Not actual.

* Updated documentation
2020-09-07 10:41:47 +03:00
Maxim Vafin
6730cab192 Move FakeOutput resolving to back phase (#2033) 2020-09-07 10:20:24 +03:00
Maxim Vafin
18a49f9e7e Fix fusing Multiply node with Convolution in case group != 1 (#1882)
* Fix fusing Multiply node with Convolution in case group != 1

* Add transformation test

* Do not fuse if not possible to reshape const

* Update fuse_linear_ops.py
2020-09-04 20:32:51 +03:00
Ivan Tikhonov
2d606e35c5 Enable force shape inference in RNNSeqNormilize transformation (#2069) 2020-09-04 15:08:52 +03:00
Ivan Tikhonov
2f5a28d44f LSTMCell/Sequence v1, reference implementations and decompose transformations for LSTM/GRU/RNN Cells (#2000)
* validate_and_infer_types() implementation

* input parameter validation for LSTM, GRU and RNN

* style-check applied

* Add LSTMSequence dynamic shape validation and test props for RNNCell, GRUCell, LSTMCell and LSTMSequence.

* recurrent_sequence.hpp moved to ngraph/core/include/ngraph/op/util/

* style check applied

* removed unused variable from LSTMSequence::validate_and_infer_types

* Add missing newline mark at the end of file.

* Add supression macro for FusedOp deprecation.

* Add element type initialization

* transpose,rnn cell reference implementations

* Apply PR review remarks

* reference implementations for cells op, single layer tests, align lstm cell/sequence according to the spec

* lstm/gru/rnn cell decompostion transformations

* ngraph codestyle

* clean up

* ngraph code style

* change inheritance of Cells, fix build

* fix build

* fix build again

* remove Peepholes from LSTMSeq, fix copy_runtime_info in transformations

* Rewrite tests to use gtest exception assertions.

* resolve tests issues

* ngraph codestyle

* add missed files

* fix typeprop tests

* fix lstm sequence checks

* fix arm build

* fix arm again

* delete unnecessary file

* add convert weghts format function, enable lstm test, resolve review comments

* add ngraph builders

* ngraph codestyle

* fix unit tests

* revert transpose reference implementation

* revert LSTM Cell v0, add LSTMCell v1, update transformation lstm_cell_to_cell_ie

* v1 version of LSTMCell op

* LSTMSequence v1 operation, exclude LSTMSeq from opset4

* fix python api tests

* resolve review comments, tests for decomposition transformations, switch lstm cell to opset4 in mo

Co-authored-by: Szymon Durawa <szymon.durawa@intel.com>
2020-09-04 09:04:36 +03:00
iliya mironov
5a376477a9 Fix version print (#2022)
* Fix version print
2020-09-03 15:39:02 +03:00
Evgenya Stepyreva
16c1bbeb52 38009: InterpolateReshape fix for TensorFlow style Concat (#2047)
* 38009: InterpolateReshape fix fot TensorFlow Models

* Update interpolate_reshape_test.py

* revert debug code
2020-09-02 23:01:12 +03:00
Evgeny Lazarev
c7bcbb576c Updated ConcatOptimization to support Concat with 0D input of one dimension (#2012)
* Updated ConcatOptimization transformation to work when one dimension of input to Concat is 0D

* Fixed ConcatOptimization transformation to reconnect input edges to Concat

* Completely re-written ConcatOptimization

* Updated Concat0D optimization transformation

* Fixed order of traversing Concat input ports

* Refactored ConcatOptimization transformation to use `delete_input_port` function

* Detele trailing unconnected ports in the ConcatOptimization.py

* Cleaner implementation of ConcatOptimization + unit test
2020-09-02 10:21:23 +03:00
Pavel Esir
7cd6b353ef [MO] Fix when Crop asks for MXNet specific cmdarg enable_ssd_gluoncv (#1978) 2020-08-31 18:06:13 +03:00
Evgenya Stepyreva
510c699731 [ MO ] DepthToSpace & ShuffleChannels fusion (#2001)
* [ MO ] ShuffleChannel fusion

* DepthToSpace fusion

* test

* comment
2020-08-31 16:20:19 +03:00
Yegor Kruglov
b162f9d5ac [ MO ][ RESHAPE ] Fixes in RNNSequenceNormalize transformation (#1909)
* initial commit

* first reshap-able variant

* right version for reshape

* comment update

* fixes for failed e2e

* set data type to ngraph TensorIterator

* Fix dynamic shapes for cells ops

* clean up

Co-authored-by: yegor.kruglov <ykruglov@nnlvdp-mkaglins.inn.intel.com>
2020-08-30 01:19:22 +03:00
Roman Kazantsev
990f4e2919 Implement reshapeable CTCGreedyDecoderPlusSparseToDense transformation and test (#1906)
* Implement reshapeable CTCGreedyDecoderPlusSparseToDense transformation and test

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

* Fix consts (after code-review #1)

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

* Add CTCGreedyDecoderTransformation with more generic pattern

Also it adds new middle-replacer for transforming sequence length to a mask
along with tests.

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

* Do fixes after review #2

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

* Fix after review #3

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

* Fix after review #4

Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-08-28 14:28:32 +03:00
Nazmul Alom
03ace8b5a6 made compatible with ubuntu 20.04 (#1798)
* made compatible with ubuntu 20.04

* demo_benchmark_app updated

* demo_security_barrier_camera updated

* demo_squeezenet_download_convert_run updated

* Update demo_benchmark_app.sh

* Update demo_security_barrier_camera.sh

* Update demo_squeezenet_download_convert_run.sh

* unwanted file removed
2020-08-27 19:40:44 +03:00
Anton Chetverikov
675e1c821e Update priorbox extenders (#1925) 2020-08-27 13:10:44 +03:00
Evgeny Lazarev
a4d90a0aba MO fusing activations (#1942)
* Added HSwish operation

* Added HSwish fusing transformation

* Fixed BOM

* Added unit test for HSwish fusing transformation

* Fixed unit tests for transformations using 'build_graph_with_edge_attrs' function to build the graph

* Added fusion transformation for Swish operation

* Added fusing transformation for Softplus operation

* Added fusion transformation for Mish operation

* Added check for the node name in the unit tests

* Fixed Mish fusion pattern

* Updated Mish fusion transformation. Added unit test

* Updated HSwish fusing transformation

* Updated Swish fusion transformation and tests

* Fixed unit tests
2020-08-27 11:56:52 +03:00
Evgenya Stepyreva
45070963a5 [MO] Relax Reshape layer hardcode under MatMul (#1921)
* [MO] Relax Reshape layer hardcode under MatMul

* Memory fix
2020-08-27 09:45:08 +03:00
Evgeny Lazarev
0e9ead3495 Added workaround for logical elementwise operations to change the constant input data type if it does not match the other one (#1955) 2020-08-27 08:46:34 +03:00
Roman Kazantsev
9d5a6cff70 Enable eager execution while TensorFlow 2 model is loaded (#1945) 2020-08-26 17:16:58 +03:00
Evgenya Stepyreva
c4920ef5a0 [ MO ] Fix for remove_op_node_with_data_node (#1934) 2020-08-25 20:30:41 +03:00
Anton Chetverikov
84c7b048db SoftPlus operation implementation (#1365) 2020-08-25 19:36:39 +03:00
Maxim Vafin
b9f698b456 Fix output name collision for incorrect ONNX models (#1930) 2020-08-25 18:43:43 +03:00
Evgeny Lazarev
aca452def8 Fixed order of transformation to convert the TF OD API SSD models (#1887)
* Fixed order of transformation to convert the TF OD API SSD models

* Refactored the sub-graph modification for the TF OD API models related to Squeeze/Reshape after SSD heads
2020-08-25 16:39:34 +03:00
Roman Kazantsev
76d2a1c351 Disable eager execution affecting TensorFlow 1 concept model handling (#1914)
Signed-off-by: Roman Kazantsev <roman.kazantsev@intel.com>
2020-08-24 18:01:45 +03:00
Evgenya Stepyreva
e6c371ae2e [ MO ] Reinfer shape sub-graphs once (#1908)
* [ MO ] Reinfer shape sub-graphs once

* feedback

* feedback
2020-08-24 14:30:41 +03:00
Ivan Tikhonov
c74643f6b6 Fix Assign, Matmul ops for correct work with keep_shape_ops feature for Kaldi models (#1885)
* fix assign and matmul ops

* fix unit test

* static shapes by default for kaldi
2020-08-24 14:11:01 +03:00
Evgenya Stepyreva
80e09dfa3b [ MO ] Change layout of Shape sub-graphs once (#1875)
* [ MO ] Change layout of Shape sub-graphs once
2020-08-21 16:27:02 +03:00