Commit Graph
100 Commits
Author SHA1 Message Date
Pavel Esir 137180bce5 [tests] resolves skipped HF tests: 3rd batch (#21678)
* resolves skipped HF tests: 3rd batch

* remove comments

* minor corrections

* replace example input *argc -> **kwargc

* use config instead of dict in example input

* add kwargs
2023-12-15 19:58:12 +04:00
Pavel Esir 20ad8b43a1 Enable dinov2-base (#21626)
with the newest transformers dinov-2-base started to pass
2023-12-13 13:52:52 +00:00
Pavel EsirandMaxim Vafin 948fc265b4 [tests] resolve skipped HF models: 2nd batch (#21526)
* resolve skipped HF models: 2nd batch

* commented out models with no info and less than 10 downloads

* Revert "commented out models with no info and less than 10 downloads"

This reverts commit a55861ed69.

* replace with self.image

* resolve todo

* Update tests/model_hub_tests/torch_tests/test_hf_transformers.py

Co-authored-by: Maxim Vafin <maxim.vafin@intel.com>

* Update tests/model_hub_tests/torch_tests/test_hf_transformers.py

---------

Co-authored-by: Maxim Vafin <maxim.vafin@intel.com>
2023-12-11 15:12:12 +04:00
Pavel EsirandIlya Lavrenov b71906c672 [PT FE] [ONNX FE] Partially upcast random_normal to f32 (#21400)
* upcast randn to fp32

* style fix

* corrected tests

* add layer tests with statistics

* style-fix

* move make_random_normal to cmmmon

* style-fix

* added randn layer tests; updated CMakeLists.txt

* moved to inline

* fix problem with _USE_MATH_DEFINES on Win

* pass NodeRegistry as reference; some other minor corrections

* adjust thresholds to avoid sporadicity

* move random_normal_helper and hide from public api

* fix install

* fix install: 2nd try

* Frontend common

* remove last frontend_common::static

* build fix

* try to fix mock1 build: 2nd attempt

* try to fix mock1 build: 3rd attempt

* Update src/core/tests/CMakeLists.txt

* Fixed build: attemp 2

* Update src/plugins/intel_cpu/tests/unit/CMakeLists.txt

* Update CMakeLists.txt

---------

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
2023-12-07 15:23:03 +04:00
Pavel EsirandMaxim Vafin d5d9fd11b3 [tests] resolve skipped HF tests: 1st batch (#21305)
* initial

* some corrections for the first batch

* corrected classes for generate, corrected xfail

* leave only models with correct example input

* remove an obsolete line

* Update tests/model_hub_tests/torch_tests/test_hf_transformers.py

Co-authored-by: Maxim Vafin <maxim.vafin@intel.com>

* update musicgen

* cleanup test_hf_transformers.py

* typo fix

* Update tests/model_hub_tests/torch_tests/test_hf_transformers.py

* Update tests/model_hub_tests/torch_tests/test_hf_transformers.py

* move to up: corrected xfail

* revert back accidentally deleted elif

* Update tests/model_hub_tests/torch_tests/test_hf_transformers.py

* Update tests/model_hub_tests/torch_tests/test_hf_transformers.py

---------

Co-authored-by: Maxim Vafin <maxim.vafin@intel.com>
2023-11-30 14:37:41 +00:00
Pavel Esir 493a338ad2 resolve TODO in efficient compression: return hashing compression back (#21141)
* turn on compression by searching duplicate blobs (by hash) for fp16

* style-fix

* apply comments

* added multimap

* style fix
2023-11-25 08:35:35 +00:00
Pavel EsirandAndrei Kochin 539b5a83ba keep disable_fp16_compression rt_info (#20625)
* keep disable_fp16_compression rt_info

* style fix

* style fix 2

* cleanup init_node_info.cpp; redefining a class for rt_info in Serialize

* move rt_info refreshing inside serialize.cpp

* rename rt_info name in IR

* add rt_info serialize test

* add ticket number

* updated comments

* code style fix

---------

Co-authored-by: Andrei Kochin <andrei.kochin@intel.com>
2023-10-27 22:41:37 +00:00
Pavel Esir 9271b79540 [OVC] do not parse inputs for py_api (#19742)
* [OVC] do not parse inputs

* fix unit-tests

* remove redundant lines, add test case

* add one more unit-test

* skip None values

* replace str with List in test_mo_import_from_memory

* corrected type hints, added a safety assert
2023-09-22 15:05:21 +04:00
Pavel EsirandRoman Kazantsev efe54362fd fix f16/f32 el type mismatch for shape subgraphs: Parameter type should not be fused for precision sensitive nodes (#19959)
Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-09-22 02:06:39 +04:00
Pavel EsirandRoman Kazantsev b8226db465 [OVC] Fix output parsing (#19425)
* fix parsing output

* use always coma backspace to separate outputs ', '

* update docstring

* call parser only for ovc cli tool

* docstring correction

* separate docs for cli tool and convert_model; other minor changes

* drop redundant arg from cli_parser_test.py

* more solid test cases added

* remove redundant argv.framework from cli_parser_test.py

* shape correction in concat

* Apply suggestions from code review

fix: coma -> comma

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>

* apply review suggestions

* remove extra ')'

---------

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-09-01 11:20:22 +02:00
Pavel Esir 9a1726a419 [ovc] check if input is correct in split_inputs (#19350) 2023-08-30 17:13:43 +04:00
Pavel Esir eaeeea9c54 [tests] save into different file in compression_test.py (#19356)
* save into different file in compression_test.py

* reuse existing mechanism for tmp_file
2023-08-24 13:58:14 +02:00
Pavel Esir 90f6500871 [tests] switch layer tests to FP16 on pre-commit (#19090)
* switch to FP16 on layer tests on precommit; add Pytorch layer tests for precision sensitive subgraph

* remove redundant changes

* moved precision sensitive tests into test_mo_convert_pytorch.py

* remove redundant dumping

* skip layer tests with chaotic output

* add copy() to avoid side effects
2023-08-21 16:03:47 +04:00
Pavel Esir aeffdec5b2 Fix Division with eps marking (#18932)
* improve Division with eps marking

* delete obsolete empty files
2023-08-04 13:23:15 +04:00
Pavel Esir 5113900350 [GPU] Fuse MVN before ConvertPrecision (#18845) 2023-07-28 20:05:05 +02:00
Pavel Esir 98df87099a [MO] compress_to_fp16=True by default (2nd attempt) (#18652)
* [MO] compress_to_fp16=True by default (2dn attempt)

* fix unit-tests

* second round of fixin unit-tests

* set compress_to_fp16 default to True in ovc/cli_parser.py

* use save_model in mo_python_api_tests

* enforce compress_to_fp16=False in test_zero_copy

* selectively compress depending on the path user has chosen to generate IR

* corrected doc

* allow compress_to_fp16=False/True for ovc

* doc and unit-tests failing fix

* user save_model in ovc cli tool

* revert back serialize and compress_model but into main instead of moc_emit_ir

* cover more argument combinations for cli tool and convert_model
2023-07-27 12:32:50 +04:00
Pavel EsirandRoman Kazantsev 1cb4595727 [MO] add support for scalar shapes into cli_parser.py (#18312)
* add support for scalar shapes into cli_parser.py

* add test-case with scalar shapes for convert_model

* reordered inputs in test-case with scalar shapes for convert_model

* minor clarifications

---------

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-07-08 17:27:07 +00:00
Pavel EsirandRoman Kazantsev af9a8cbbd7 fix GitHub Actions failing tests (#18357)
Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-07-08 18:21:59 +02:00
Pavel Esir cb63b39c72 do not change names while replacing FQ nodes (#17936)
* do not change names while replacing FQ nodes

* more solid fix

* even more solid fix

* fix UT failure
2023-06-16 15:51:50 +04:00
Pavel Esir aa32ff1df3 keep Const + DecompressionConvert for CPU (#15930)
* keep Const+DecompressionConvert pattern for CPU

* temporary disabled failing unit-tests

* disable CF by modifying bounds evaluate as well; minor corrections

* added TODOs with ticket numbers

* join const+decompression markings

* minimized convert_precision.cpp changes

* minor corrections

* refactor fp16 transformations: moved into separate fp16_compression folder

* style-fix

* minor fixes

* do not disable evaluate and CF in shape path

* safer disabling of Const conversion

* style-fix and minor corrections

* restore original placement of ConvertPrecision
2023-06-15 13:07:22 +04:00
Pavel EsirandEvgenya Stepyreva 84f6deb757 [MO] disabling inserting redundant Converts for int in legacy IR serialization (#17572)
* disabling inserting redundant Converts for integer types for legacy IR serialization

* Revert "disabling inserting redundant Converts for integer types for legacy IR serialization"

This reverts commit ddd96e2034.

* more selective skip; added unit-tests

* corrected unit-tests

* fix unit-tests: replace dynamic Parameter input with Const

* fix unit-tests: implemented reading with IR frontend

* sort imports

* final revision of unit-tests

---------

Co-authored-by: Evgenya Stepyreva <evgenya.stepyreva@intel.com>
2023-05-30 11:51:56 +04:00
Pavel EsirandRoman Kazantsev 1b24e15e1e [MO] fix IR graph comparator (#17411)
* fix graph compare (legacy python MO)

* fix failing unit-tests

* fix failing unit-tests: check that shape is defined

* added explanation comment

* Apply suggestions from code review

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>

* minor corrections

* add unit-tests

---------

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-05-20 10:05:26 +04:00
Pavel Esir 585c33dfa6 Fix faq numbers (#17222)
* workaround to refer to correct FAQ questions when fail

* renumber FAQ
2023-05-08 15:54:21 +04:00
Pavel Esir e2baf7f0a2 DOCS remove deprecated options (#17167)
* DOCS remove deprecated options

* removed a couple more not actual questions

* remove the whole lines completely

* remove a couple of more deprecations
2023-04-28 11:53:46 +00:00
Pavel Esir 6ff0cad127 Fix mixed precision inference for quantized IRs (#16785)
* disable mixed precision inference for quantized IRs

* typo fix

* improved solution, disable mixed precision in quantized IRs selectively only for float nodes

* minor typos correction

* added unit-tests

* renamed rt_info

* updated list of nodes for which FQ is propagated; updated unit-tests

* fix failing build
2023-04-24 13:13:04 +04:00
Pavel Esir d70d8509c3 [FP16][IE] exclude MVN and NormalizeL2 from precision sensitive marking (#16953)
* exclude MVN from mixed infer

* fix align_mixed_fp32_fp16_types_test.cpp

* fix unit-tests for convert_precision.cpp

* code style fix
2023-04-18 16:20:49 +09:00
Pavel EsirandKarol Blaszczak 68f46ff9a1 [MO] compress_to_fp16=False by default (#16854)
* compress_to_fp16=False by default

* Apply suggestions from code review

Co-authored-by: Karol Blaszczak <karol.blaszczak@intel.com>

* note abound RAM consumption for FP16 compressed models

* detailed notion about RAM usage

* update 'get_compression_message()'

* corrected get_compression_message: remove infor about RAM

* fix pytorch convert layer tests

---------

Co-authored-by: Karol Blaszczak <karol.blaszczak@intel.com>
2023-04-14 01:16:41 +00:00
Pavel Esir f9bd2d2c1e [ie transformations] improve SoftMax fusion for better mixed precision inference (#16574)
* improve SoftMax fusion

* style and unit-test fix

* more precise SoftMax unit-tests

* rewritten SoftMaxFusion with single matcher

* fixes for align_mixed_fp32_fp16_types_test.cpp and mark_subgraph_to_keep_in_mixed_precision_test.cpp

* add include for pass/pattern/op/or.hpp

* get rank only when necessary

* style-fix

* add comment why SoftmaxFusion is called manually

* fix copy_runtime_info
2023-04-05 11:28:48 +04:00
6d064d26cb remove deprecated MO args (#16626)
Co-authored-by: Andrei Kochin <andrei.kochin@intel.com>
Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-03-31 12:28:04 +04:00
Pavel Esir 43ef89e625 [MO] remove deprecated: data_type, disable_nhwc_to_nchw, tensorflow_use_custom_operations_config (#16394)
* removed deprecated MO options: data_type, disable_nhwc_to_nchw, tensorflow_use_custom_operations_config

* fix layer_test_class.py

* data_type -> precision in layer_test_class.py

* typo fix

* corrected layer tests for compress_to_fp16 argument
2023-03-26 21:38:15 +04:00
Pavel Esir d8e7b39edb flush by recreating constant (#16430) 2023-03-21 18:05:11 +04:00
Pavel EsirandRoman Kazantsev e43f606750 [LoadTime][MO] flush fp32 subnormals to zero at offline phase (#15929)
* flush fp32 subnormals to zero in IR

* style fix in test_offline_api.py

* simplified call of FlushFP32SubnormalsToZero: is called form offline_transformations.cpp

* reverted offline_transformations.py

* use fpclassify

* style-fix

* Update src/common/transformations/tests/common_optimizations/flush_fp32_subnormals_to_zero_test.cpp

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>

---------

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-03-09 16:21:28 +04:00
Pavel Esir 15973fd2da enable --compress_to_fp16=True by default in MO (#15488)
* enable --compress_to_fp16 by default in MO

* corrected docs, added warning if user did't specify --compress_to_fp16 explicitly

* fix failing MO unit-tests

* do not wipe out data_type if user defined it explicitly by cli argument

* updated warning message and docs

* corrected phrasing

* corrected phrasing in FP16_Compression.md

* set compress_to_fp16=False for convert tests

* leftover: set compress_to_fp16=False for convert tests

* minor correction

* print info message in main.py, som minor changes

* typos fix

* fix losing information whether arguments set by user or got from defaults

* returned back default values instead of None

* more selective correcting of test_mo_convert_pytorch.py; added test for cases when compression is enabled/disabled or left by default

* fix test_mo_convert_pytorch.py
2023-02-21 13:07:43 +01:00
Pavel Esir 0f459c0455 [Core] fix compress_float_constants.cpp for denormal float16 (#15575)
* fix compress_float_constants.cpp for denormal float16

* keep denormals also in fp16; added unit-test

* fixed comment

* removed debug code; added some comments in unit-tests

* fix warning as error

* fix sign
2023-02-17 16:23:31 +04:00
Pavel Esir 63dd0685fc [IE][nG][LoadTime] speed up constant folding (#15476)
* speed up constant folding and improved load time for FP16

* fix unit-tests

* added OPENVINO_SUPPRESS_DEPRECATED_START

* new evaluate for Convert; added constructor for Constant; constant copying by reference during constant_fold

* removed deprecation macro from Convert evaluate

* returned back Convert evaluate to old HostTensorPtr because it's used in tests accuracy comparator
2023-02-13 08:00:29 +04:00
Pavel Esir 4103a931c2 [FP16] call marking for mixed precision inside ConvertPrecision (#14965)
* call marking for mixed precision inside ConvertPrecision

* fix typo in precisions list; moved conversion from f64->f32 to the very beginning

* remove obsolete convert_compressed_to_mixed_precision_test.cpp

* typo fix after merge

* corrected namespace prefix

* fixed align_mixed_fp32_fp16_types_test.cpp by removing redundant ConvertPrecision

* updated ConvertPrecison tests for mixed precision

* style fix
2023-02-03 13:47:57 +04:00
Pavel Esir da9470864c [MO] add extractor for TF Any operation (#15255)
* added extractor for TF Any operation

* enabled existing 'Any' layer test for legacy TF frontend
2023-02-01 08:59:15 +04:00
Pavel Esir 1ae0b2796e [MO] fix UnaryElementwise reverse_infer (#15366)
* fix UnaryElementwise reverse_infer

* fixed tests for UnaryElementwise reverse_infer

* reverted autocorrection edits
2023-01-31 11:56:24 +04:00
Pavel EsirandMaxim Vafin 7b6eefbbf8 [nG] [IE] add support of mixed FP16/FP32 precision ov::Model for mixed inference (#13249)
* add pattern mathing for MVN, Exp->ReduceSum, L2Normalize, Div with eps for mixed precision inference

* added necessary includes

* clang_format_fix_all

* fix warning_as_error for unused variable

* fix warning_as_error for specifying float literals

* enable marking for fp32 IRs as well

* cosmetic improvements in unit-tests

* fix warnings as error

* added unit-tests for compress_float_constants.cpp for out of range values

* Update align_mixed_fp32_fp16_types.cpp

* Apply suggestions from code review

Co-authored-by: Maxim Vafin <maxim.vafin@intel.com>

* some grooming: mainly in imports

* build fix: replaced ngraph:: -> ov::

* collected all markings in a single file

* shortened pass names

* style fix

* made MarkNormalizationOps as a separate pass

* removed redundant comment, fixed description of MarkSugraphsToKeepInMixedPrecision pass

* comments on Up and Down marking in MarkSugraphsToKeepInMixedPrecision

* cleared info messages in compress_float_constants.cpp, removed threshold adjusting from ENV

* moved declarations of MarkNormalizationOps, MarkExpInReduceOpPath, MarkDivWithEps to hide them from outside users

* simplified pattern matching for max_or_add

* moved `reduceop_path` rt_info inside mark_subgraphs_to_keep_in_mixed_precision.cpp

* fix potential bug with Convert

* removed redundant check for Converts in `insert_converts_after_if_needed` as well

* set Convert types more safely

* corrections in opset10 namespaces; some minor corrections

---------

Co-authored-by: Maxim Vafin <maxim.vafin@intel.com>
2023-01-30 10:04:12 +04:00
Pavel Esir 1d5fa360d4 fix check for data nodes in emitter.py (#14802)
* fix checking if there are data nodes for operations with several outputs

* added unit-test

* added ports explicitly, removed redundant lambda

* typo in port
2023-01-17 16:11:57 +04:00
Pavel EsirandRoman Kazantsev 9e3b52eee0 remove deprecated cli arguments from MO (#14937)
* removed deprecated cli arguments from MO

* removed deprecated options from docs

* Update tools/legacy/benchmark_app/README.md

* removed ConcatOptimization.py, removed deprecated args from unit-tests, renamed tensorflow_use_custom_operations_config -> transformations_config; replaced using or cmd_params.data_type -> cmd_params.compress_to_fp16

* added comment why we set internal 'data_type' always to 'FP32' after introducing 'compress_to_fp16'

* removed openvino_docs_MO_DG_prepare_model_Model_Optimization_Techniques from MO_DevGuide

* returned back --data_type argument

* leftovers from recovering

* returned back to package_BOM.txt; fixed NHWC by default for TF

* recovered --disable_nhwc_to_nchw to MO args

* reverted removing --tensorflow_use_custom_operations_config

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-01-12 21:12:56 +00:00
Pavel Esir a7b3ae6a9d [MO] tmp IR cleanup if serialization or fem.load_by_framework fails (#14712)
* cleanup tmp IR files after unexpected failures

* separated catching during tmp serialize and fe.load

* updated file path specification

* moved base MO arguments into utils

* removed redundant 'except' blocks

* shortened specifying MO args

* calling unit-tests from subprocess; joined 2 try/except block into a single one

* changed postfix so that test is run without duplications only once
2022-12-22 22:35:13 +03:00
Pavel Esir 33ab2fd39a always remove '_tmp' files even after offline_transformations has failed (#14335) 2022-12-06 13:19:30 +04:00
Pavel Esir 2a1a2532b2 more safe get_output_types in callback in convert_compression_only_to_legacy.cpp;more readable unit-tests for out of bound Intervals (#14300) 2022-11-29 22:05:16 +00:00
Pavel Esir e648001b12 [IE] keep constants in shape subgraphs in f32 (#14204)
* keep constants in shape subgraphs in f32

* added unit-test without callback; added comment in convert_compression_only_to_legacy.cpp
2022-11-29 13:55:06 +04:00
Pavel Esir e0c026cdfc fix Interval multiplication when result exceeds int64_max (#14230)
* fix Interval multiplication when result exceeds int64_max

* added unit-test with corner cases
2022-11-27 22:40:44 +04:00
Pavel EsirandAndrei Kochin 34f16bf749 [MO] turn on bom_tests (#13721)
* turn on bom_tests

* fixed root directories to search

* leftovers fix

* removed requirements from package_BOM.txt; corrected error messages to install via pip

* removed extract_release_version.py from package_BOM.txt, added requirements files to skip

* removed redundant commented line

* mentioned CustomLayersMapping.xml.example in docs

Co-authored-by: Andrei Kochin <andrei.kochin@intel.com>
2022-11-15 12:38:59 +04: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
Pavel Esir 43784e2cec fix convert_nms_gather_path_to_unsigned: added opset8::Slice into patter_list (#10439) 2022-02-17 12:47:25 +03:00
Pavel Esir 121d59aa80 [MO] move importlib-metadata into setup.py (#10319)
* handle 'and' marker in requirements

* Revert "handle 'and' marker in requirements"

This reverts commit 952bb949ca.

* moved importlib-metadata from requirements.txt into setup.py
2022-02-15 15:01:27 +03:00
Pavel Esir d1477b8569 fixed setting 'out_ports_count' in ir_reader (#10265) 2022-02-14 16:01:22 +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
Pavel Esir 3d6e90b8f9 concat['override_output_shape'] = True in StridedSliceNormalizer.py (#10045) 2022-02-07 13:24:56 +03:00
Pavel Esir 9bb7697b2f [MO] fix simplified MO import for PyCharm Debug (#9866)
* fix simplified MO import for PyCharm Debug

* package_BOM update
2022-02-01 13:14:48 +03:00
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
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
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
Pavel Esir ba4802554e [MO] Azure CI, unit-test dirs and howto doc fixes (#9146)
* Azure CI fixes for MO

* leftover: update imports in docs

* moved unit-tests from extensions/ into mo/
2021-12-17 15:56:40 +03:00
Pavel Esir 2ff4ef2e4f fix requirements copy in mo setup.py (#9127) 2021-12-13 13:33:14 +03:00
Pavel Esir 980904c9ec [MO] Align MO namespaces (#7708)
* Moved and merged mo/ and extensions/ into openvino/tools/mo

* edited imports

* edited docs to use mo script from entry_point

* edited MO transformations list loading and setup.py

* changed full path -> 'mo' entry point in docs (leftovers)

* corrected package_BOM

* updated resolving --transformation_config in cli_parser.py

* pkgutil-style __init__.py, added summarize_graph into entry points

* updated DOCs for the new --transformations_config

* fix select

* updated install instructions, fixed setup.py for windows and python_version < 3.8

* fixed typo in requirements.txt

* resolved conflicts

* removed creating custom __init__.py from setup.py

* corrected folder with caffe proto

* corrected loading user defined extensions

* fix openvino.tools.mo import in serialize.py

* corrected layer tests for new namespace

* fix in get_testdata.py

* moved model-optimizer into tools/

* renamed import in POT

* corrected mo.yml

* correct CMakeLists.txt for the newest tools/mo

* corrected find_ie_version.py

* docs and openvino-dev setup.py update for the newest tools/mo

* miscellaneous leftovers and fixes

* corrected CI files, pybind11_add_module in CMakeLists.txt and use of tools/mo path instead of tools/model_optimizer

* add_subdirectory pybind11 for tools/mo

* POT path fix

* updated setupvars.sh setupvars.bat

* Revert "updated setupvars.sh setupvars.bat"

This reverts commit c011142340.

* removed model-optimizer env variables from setupvars

* updated CMakeLists.txt to pack MO properly with tests component

* corrected left imports, corrected loading requirements for layer tests

* mo doc typo correction

* minor corrections in docs; removed summarize_graph from entry_points

* get_started_windows.md, MonoDepth_how_to.md corrections, mo path corrections
2021-12-08 08:53:53 +03:00
Pavel Esir b6a5532c27 [IE][nGraph] resolve division by zero for FP16 (#8676)
* initial solution

* changed namespaces from ngraph -> ov; completed unit-tests

* added Power with negative exponent into the pattern

* division to -> division by; aligned with OV new folder structure; some minor corrections

* corrected pattern

* changed get_pattern_value_map -> get_pattern_map
2021-12-07 22:53:12 +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
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
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
Pavel Esir 572ab040dc [IE] fix printing dynamic signatures (#7620)
* [IE] fix printing dynamic signatures

* fixed printing scalars output dimensions as well

* turned off printing dynamic signatures
2021-09-24 18:50:35 +03:00
Pavel Esir f68a116af1 [MO] add uint32/uint8 into list of supported data types (#7424) 2021-09-09 16:40:31 +03:00
Pavel Esir 2d75c7a894 [nG] [IE] use GatherBase in negative indices resolver (#7145)
* updated pattern matcher into GatherBase in negative indices resolver, so that it is triggered in all versions of operation

* copy_runtime_info fix

* added constant folding
2021-08-23 18:39:00 +03:00
Pavel Esir 29193982d4 [IE] Convert to unsigned NMS:0 ->Gather path (#6474)
* inserted Convert to unsigned

* moved declarations from hpp into cpp, specification corrected

* added static const modifier

* updated convert specification

* minor corrections

* split into 3 passes(Init, Propogate, Update), renamed final pass to ConvertNmsGatherPathToUnsigned

* added description why transformation is needed

* added matcher for several NMS versions, removed TRANSFORMATIONS_API macros from cpp

* applied comments:
- used GraphRewrite instead of FunctionPass
- simplified some expressions
- corrected case when Converts output goes to multiple nodes
- added to MOC transformations
- other minor corrections

* removed redundant namespace prefixes

* fixed #include <ngraph/pass/graph_rewrite.hpp>

* removed matcher_scope, debug code, and redundant dynamic_cast
2021-08-23 18:35:37 +03:00
Pavel Esir f77d838e6c [MO] turn on MarkSubGraphsWithCorrectLayout for TF NCHW (#7150)
* turned on MarkingSubgraphsWithCorrectLayout for TF NCHW

* restricted MarkSubgraphsWithCorrectLayout.py only to TF

* added comments why need to MarkSubgraphsWithCorrectLayout even for TF NCHW models
2021-08-20 18:47:45 +03:00
Pavel Esir 4738bbd757 [MO][nG] add Gather-8 to MO, layer tests, nG python api unit-tests and up/down-grading transformations (#6560)
* gather-8 upgrade/downgrade transforms

* bump to opset8

* add Gather-8 to MO

* fix permutation for Gather

* added TF layer tests, ONNX layer tests for negative indices, and nG python api unit-tests for negative indices

* typo fix, disable downgrading transformation

* disable downgrade in clDNN, line width style fix

* all Gathers are converted to 7th version, transformations will be enabled/disabled while op will be added into plugins

* disabled Gather8LayerTest on GPU

* added common function for Op replacement

* concretized meaning of negative indices, fixed some typos

* applied review comments: left only meaningful layer tests

* removed op replacing functions from common utils

* returned back transformations without subroutines

* corrected style, added comments to common_optimizations.cpp
2021-08-13 11:56:49 +03:00
Pavel Esir bfca47ad5e [MO] Range output_type correction for FP16 (#6590)
* added ChangeRangeOutputType.py

* applied review comments

* corrected error message - warn user to use FP32

* renamed ChangeCastOutputType.py et ell.

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

* corrections

* typo fix

* applied comments: faster find_and_replace loop, wording correction
2021-08-02 11:41:12 +03:00
Pavel Esir 50a9ea0b14 [doc] Corrections for Yolo V1 and V2 conversion (#6283)
* added corrections for Yolo V1 and V2

* changed order of conversion commands : v1 goes first general last

* aligned line endings

* added commit hash
2021-06-30 15:22:31 +03:00
Pavel EsirandTatiana Savina 3b2da7de30 [docs] corrected DeepSpeech conversion (#6011)
* corrected output names in DeepSpeech conversion doc

* mo args correction

* changed instruction for DeepSpeech version 0.8.2

* added venv activate; removed redundant ending

* added picture and squashed MO graph input args into one

* Apply suggestions from code review

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

* applied review comments

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
2021-06-21 19:14:37 +03:00
Pavel Esir b2d25da04d [spec] add Gather-8 with negative indices (#6172)
* add Gather-8 with negative indices

* incremented version

* updated opset8.md
2021-06-21 15:33:13 +03:00
Pavel Esir ccd568a2d2 [nG] Gather-8 shell (#6171)
* gather-8 nGraph shell

* added opset8 tbl; added visit_attribute test

* corrected opset tbl
2021-06-17 13:02:07 +03:00
Pavel Esir d3beab79b2 [nG] fix strided_slice_to_crop (#6032) 2021-06-08 10:12:35 +03:00
Pavel Esir d9d63d0d7e [MO] fix MarkNodesWithShapeValues (#5808)
* fix marking of nodes with shape values: corrected 'leaky' starting condition

* cleaned up code

* fixed t2t type collision error: removed strict assert from Pow; now type_infer is same as for other eltwise ops; added warnings about type alignment

* type cast for Pow according to ONNX spec

* fix highlight in dump_graph_for_graphviz

* soft_get('op')

* Revert "soft_get('op')"

This reverts commit cadfe18f

* Revert "type cast for Pow according to ONNX spec"

This reverts commit bf85ebf8

* applied review comments

* comment for ShapeOf bfs, removed Error from elementwise op

* reverted back dump_graph_for_graphviz: fill_color -> node_attrs

* applied last review comments: returned back Error, added type_infer into unit-test utils
2021-06-04 18:49:49 +03:00
Pavel Esir c3b4181183 [nG] Add upgrading transformation Gather-1 -> Gather-7 (#5571)
* add upgrading gather1 -> gather7 transformation

* added G1->G7 to common_optimizations list but by default in turned off

* fixed a couple of typos in comments

* corrected validation error messages for GatherBase

* removed redundant comments

* clang format fix

* coNverts v1::Gather into v7::Gather

* added explicit batch_dims = 0, corrected axis bound check for dynamic data_rank
2021-05-17 08:11:17 +03:00
Pavel Esir 5fa899a39e [nG] Gather-7 update for negative batch_dims (#5522)
* corrected negative batch_dims normalization, some improvements in dynamism for Gather_7

* corrected transformation

* added batch_dims and axis normalization for reference

* updated INTERPRETER backend tests; replaced sizet_t -> int64_t in Gather evaluate

* returned back size_t in reference

* made Gather-1 source compatible with previous ngraph library versions

* added unittest for v7->v1, with nonzero batch_dims transformation should not be executed

* fix axis validation error message

* fix batch_dims gettter

* fixed v7->v1 unittest for nonzero batch_dims
2021-05-14 10:31:36 +03:00
Pavel Esir 0383b44776 added RNN-t conversion doc (#5139)
* added RNN-t conversion doc

* applied review comments

* a couple of corrections

* added pip3 everywhere

* fixed a typo

* applied review comments

* title name fix

* applied Tatiana's comments round 2

* fixed a typo for 'inference'

* fixed typo in MLCommons name

* moved to PyTorch* specific, applied comments

* pytorch_specific typo

* froze MLCommons revision to r1.0; fixed typo in MLCommons relative path
2021-05-12 22:49:40 +03:00
Pavel Esir b17b526009 Add gather 7 to nG Python API and IE IR reader test (#5276)
* nG Python api for Gather and IE IR reader tests

* also included old IE IR reader test for Gather1

* added a blank line before Gather

* style corrections

* applied review comments

* removed blank line

* removed xfailed for Gather7 with batch_dims since CPU was moved to nGraph (...allows to fallback node execution on ngraph evaluate() method in case if optimized implementation is absent)

* added new visitor tests
2021-05-12 12:11:27 +03:00
Pavel Esir 0b22d6c51c Add Gather-7 to MO (#5264)
* initial solution

* added unit-tests + some corrections

* axis getting improvements

* fixed MO IR reader for old IR's

* a couple of corrections

* applied review comments

* corrected negative batch_dims normalization for shape calculation, for IR original negative values are kept

* added additional checks and negative tests
2021-05-11 22:29:59 +03:00
Pavel Esir 41bdec12df [nGraph] Gather v7 v1 up down transformations (#5118)
* v7->v1 works fine

* gather v1->v7 works fine

* changed op::v7 -> opset7, op:v1 -> opset1

* bumped to gather7 in all transformations

* applied review comments

* fixed pre-commit failures

* disabled incorrect unit-test, fixed f32->i32

* added comments why AddConvertToReorderTest was disabled

* Revert "bumped to gather7 in all transformations"

This reverts commit 965dc295

* fixed typos in v1->v7, v7->v1

* added GatherBase, redefined pattern in eliminate_unsqueeze gather, turned on Gather downgrading transformation

* resolved conflicts and build errors

* 🚀 finally EliminateUnsqueezeGather works: added inheritance of RTTI info from GatherBase

* fixed pre-commit failurer

* removed redundant debug code

* reverted f32 for Gather-1 indices in unit-tests and transformations

* relaxed restrictions for indices and axis type for v1::Gather

* corrected op scope

* moved type_check to validation_util.cpp

* removed type checks from Gather, removed upgrading transformation

* applied review coments

* fixed minor typos
2021-04-20 10:27:48 +03:00
Pavel Esir 1f0b55be04 fixed error with PerfCounters (#5300) 2021-04-20 06:58:26 +03:00
Pavel Esir 1a3e9abfbe nGraph shell implementation of Gather-7 (#4885)
* nGraph shell implementation of Gather-7

* review comments applied

* style_apply

* applied @ilyachur's comments

* style-apply

* applied @popovaan's comments

* changed ieFuncTest for Gather (now is created from op version instead of opset) added check for batch_dims

* clang_format_fix and some other corrections

* returned back opset3::Gather in ieFuncTests

* added `constexpr` to `AXIS_NOT_SET_VALUE` as @vgavrilo suggested

* removed AXIS_NOT_SET_VALUE and added proper support when axis is not specified

* clang_format_fix_all

* applied review comments: added support for dynamic axis

* applied review comments, minor corrections in gather_elements
2021-04-01 19:38:27 +03:00
Pavel Esir 6477e8ec01 [MO] Fix fp16 in shapeof subgraphs (#4524)
* Initial working solution

* moved bfs_search_apply_on_shapeof_subgraph_nodes from utils/graph.py to MarkShapeOfSubgraphDataType.py

* Reused bfs from MarkSubgraphsWithCorrectLayout.py

* fixed e2e precomit issues: specified correct const data_types, fixed BFS search staring point to avoid nodeless shapeof subgraphs

* fixed mxnet_rnnt: added converting all Const nodes in ShapeOf subgraph in MarkAndChangeDataTypeInShapeOfSubgraphs.py, revised Const values in transformations that affect ShapeOf subgraph nodes

* reverter ReverseV2ToReverseSequence.py and DecomposeBidirectionalRNNSequence.py

* in MarkSubgraphsWithCorrectLayout BFS search beauty applied

* apply review comments, returned back 'in_shape_subgraph' attribute

* graph condition added

* MO IR reader fix for mixed FP16 models, added replacer order placement comment

* moved to back phase

* new solution with marking nodes from bottom to top (WIP)

* successfully tested on back phase

* corrected unittest

* removed check for start nodes size in bfs

* fix transformations that insert f64 to f32 in shape subgraph

* corrected log.warning -> log.debug

* revised list if shape input operations added unittest for Const shape inputs

* applied @lazarevevgeny's comments

* licence head corrections
2021-03-30 23:16:32 +03:00
Pavel Esir 29612f15e3 Fix StridedSlice replacer order and input permutation when strides are not specified (#4545) 2021-03-03 11:16:56 +03:00
Pavel Esir 162bdde251 [MO][TF] Fixed TFSliceToSlice conversion error on Win (#4367)
* [MO][TF] Fixed TFSliceToSlice conversion error on Win, replaced int32_max with ShapeOf, minor correction in comments

* review apply: added create_op_with_const_inputs

* review apply: renamed variables, updated typehints for int64_array, float_array, float32_array

* renamed to correct_ends

* returned back check_op_attrs=True
2021-02-24 16:34:43 +03:00
Pavel Esir 7dca134031 [MO] [TF] Added TF broadcast_to extractor (#4376)
* Added TF broadcast_to extractor

* updated Supported_Frameworks_Layers.md

* corrected name

* corrected op name in Supported_Frameworks_Layers.md

* added a space after BroadcastTo in Supported_Frameworks_Layers.md
2021-02-19 11:44:11 +03:00
Pavel Esir 22169a05b9 [MO] StridedSlice improvements (#4139)
* fix ss

* successfully converted

* successfully run moved infer and normalizer unit-tests

* successfully rewritten StridedSlice infer unittests

* int64 array

* Successfully converter crash-when-loading, xj_feauture and toy nets (cherry-picked maxpoolV4 and tf_broadcast_ext)

* successfully moved PermuteAttrs to general mechanism

* successfully converted xj_feauture and crash when loading with the new rewritten SS infer

* fixed get_shape_from_slice and moved to common utils

* fixed extending masks and some other

* some refactoring

* fixed extending masks in extractor, fixed licence year and some other code clearing

* corrected a couple of unittests

* fox permute for 5 rank slice and 4 rank inputs/

* WIP

* Added comments

* fixed StridedSlice in ProposalMutation.py

* rechecked shape_infer unittests added some new cases

* added shape_infer unit-tests after StridedSliceNormalizer pass and Permute unit-tests

* corrected unittests

* Applied review comments

* general permutations for inputs implemented, corrected ellipsis unrolling when shrink_axis is at the beginning, some other corrections

* removed code duplication in infer and normalizer, moved 'slices' attr normalizing to StridedSliceNormalizer.py

* removed some code duplication and other minor improvements

* Added tests

* minor corrections

* wider range of unittests added (froze the number)

* review comments applied

* enabled skipped unit-test

* comment corrections

* applied review comments: changed op -> type, added some asserts, corrected comments and other minor corrections

* sorted inputs, updated Supported_Frameworks_Layers.md, some minor
2021-02-16 11:48:49 +03:00
Pavel Esir 7eac2a1452 [MO][TF] Add Tensorflow Pooling V2 (#3911)
* [MO][TF] Add Tensorflow Pooling V2

* corrected extractor

* applied review comments

* remove empty line in PoolV2ToAttributedPool.py

* MaxPool attributes extraction fix
2021-02-09 09:46:32 +03:00
Pavel Esir efa5b6063a [nGraph] Fix bound check for reference GatherElements (#3981)
* fix bound check for reference GatherElements

* apply review comments
2021-01-25 15:10:52 +03:00
Pavel Esir d9bd59c7a0 Evaluate, ngraph_reader check and Python nGraph API for GatherElements (#3624)
* add GatherElements evaluate to interpreter backend

* Finally successfully run on backend

* debugged non-typical cases

* added ngraph_reader tests for GatherElements

* added Python API for GatherElements

* apply_style

* corrected python api tests

* applied comments

* style-apply

* finally corrected nGraph Python API for GatherElements

* minor corrections

* style-apply

* replaced quotes

* added blank line

* corrected evaluate and disabled unit-tests for not yet supported plugins

* style-apply

* applied comments: negative tests added and additional checks in evaluate

* added bound check for axis in evaluate

* style-apply

* apply review comments

* fast correct evaluate for GatherElements

* style-apply

* revert changes in interpreter unit_test.manifest for Gather

* 🚀 optimized general solution; added separate calculation for 2D

* 🚀 applied comments

* style-apply
2021-01-11 19:52:47 +03:00
Pavel Esir 5b45299874 Spec for GatherElements-6 (#3304)
* added GatherElement_6.md spec

* corrected typos; updated examples

* moved sentence from spec to description

* ie_docs.xml updated

* made `axis` required

* removed redundant sentences

* added outputs shape info

* added 'the' articles

* removed error info about negative indices; some corrections

* rank correction in examples
2020-12-10 14:26:25 +03:00
Pavel Esir 1076d32467 [MO] cli_parser fix when input contains substring with matching scale/mean values (#3146)
* fix MO cli_parser when input contains substring with matching scale/mean values

* some additions to cli_parser unit-tests

* fixed numpy array comparisons -- added assert_ prefix

* more general solution for mean/scale cli_parser, names with only digit values are processed correctly

* minor corrections
2020-11-20 11:42:42 +03:00
Pavel Esir 8c89d8d733 add getting nms_threshold / iou_threshold from RetinaNet (#3075)
* added getting nms_threshold/iou_threshold from original TF RetinaNet model

* iou_threshold definition added

* fixed getting iou_threshold for TF NMS V2, some minor corrections

* added box_encoding to NMS extractors
2020-11-12 15:04:07 +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