Compare commits

...

515 Commits

Author SHA1 Message Date
Artyom Anokhov
fa1c41994f Bump version to 2023.0.1. Updated conflicted version for APT/YUM (#18268) 2023-06-28 13:36:31 +02:00
bstankix
caae459f54 Change html_baseurl to canonical (#18253) 2023-06-27 10:25:37 +02:00
Karol Blaszczak
7ef5cbff30 [DOCS] benchmark update for OVMS 23.0 (#18010) (#18250) 2023-06-27 09:16:16 +02:00
Maciej Smyk
85956dfa4d [DOCS] Debugging Auto-Device Plugin rst shift + Notebooks installation id align for 23.0 (#18241)
* Update AutoPlugin_Debugging.md

* Update AutoPlugin_Debugging.md

* Update AutoPlugin_Debugging.md

* Update AutoPlugin_Debugging.md

* notebooks id fix

* fixes

* Update AutoPlugin_Debugging.md
2023-06-27 08:15:51 +02:00
Maciej Smyk
2d98cbed74 [DOCS] Table directive update + Get Started fix for 23.0 (#18217)
* Update notebooks-installation.md

* Update notebooks-installation.md

* Update performance_benchmarks.md

* Update openvino_ecosystem.md

* Update get_started_demos.md

* Update installing-model-dev-tools.md

* Update installing-model-dev-tools.md

* Update installing-openvino-brew.md

* Update installing-openvino-conda.md

* fix

* Update installing-openvino-apt.md

* Update installing-openvino-apt.md

* Update installing-openvino-docker-linux.md

* Update installing-openvino-docker-windows.md

* Update installing-openvino-from-archive-linux.md

* Update installing-openvino-from-archive-macos.md

* Update installing-openvino-from-archive-macos.md

* Update installing-openvino-from-archive-linux.md

* Update installing-openvino-from-archive-macos.md

* Update installing-openvino-from-archive-linux.md

* Update installing-openvino-from-archive-macos.md

* Update installing-openvino-from-archive-windows.md

* tabs

* fixes

* fixes2

* Update GPU_RemoteTensor_API.md

* fixes

* fixes

* Get started fix
2023-06-26 10:27:12 +02:00
Sebastian Golebiewski
5d47cedcc9 updating-tutorials (#18213) 2023-06-26 09:42:21 +02:00
Ilya Lavrenov
9ab5a8f5d9 Added cmake_policy call to allow IN_LIST in if() (#18226) 2023-06-24 22:51:54 +04:00
Maciej Smyk
ad84dc6205 [DOCS] Docker and GPU update for 23.0 (#17851)
* docker gpu update

* ref fix

* Update installing-openvino-docker-linux.md

* fixes

* Update DeviceDriverVersion.svg

* Update docs/install_guides/configurations-for-intel-gpu.md

Co-authored-by: Miłosz Żeglarski <milosz.zeglarski@intel.com>

* Update docs/install_guides/configurations-for-intel-gpu.md

Co-authored-by: Miłosz Żeglarski <milosz.zeglarski@intel.com>

* fixes from review

* Update configurations-for-intel-gpu.md

* Update configurations-for-intel-gpu.md

* Update deployment_migration.md

---------

Co-authored-by: Miłosz Żeglarski <milosz.zeglarski@intel.com>
2023-06-22 15:47:59 +02:00
bstankix
bd3e4347dd [DOCS] gsearch 2023-06-22 13:08:00 +02:00
Tatiana Savina
0adf0e27ee [DOCS] Port docs fixes (#18155)
* change classification notebook (#18037)

* add python block (#18085)
2023-06-21 11:47:37 +02:00
Tatiana Savina
cb7cab1886 [DOCS] shift to rst - opsets F,G (#17253) (#18152)
Co-authored-by: Karol Blaszczak <karol.blaszczak@intel.com>
2023-06-20 14:22:13 +02:00
Georgy Krivoruchko
fd48b0bbdc [TF FE] Workaround for Broadcast/Concat issue with empty tensors (#18140)
* Added transformation for Concat
* Added test
* CI fix
* Fixed behavior of the "empty tensor list" test
2023-06-20 13:13:55 +04:00
Mateusz Bencer
691630b68c [PORT TO 23.0][ONNX FE] Allow to mix new and legacy extensions (#18116)
* [ONNX FE] Allow to mix new and legacy extensions

* added unit test

* Update op_extension.cpp

Fixed compilation with Conan

Ported https://github.com/openvinotoolkit/openvino/pull/18126

* Update op_extension.cpp

Fixed code style

---------

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
2023-06-17 13:17:37 +00:00
Nikita Malinin
205feb9421 ENABLE_MMAP property pos (#17896) (#18106)
(cherry picked from commit 29f06692d6)
2023-06-17 12:48:47 +04:00
Georgy Krivoruchko
5ef750d5b3 Fixed Windows behavior if folder path on input (#18113) 2023-06-16 16:39:33 +00:00
Zlobin Vladimir
80fddfe1c2 Update open_model_zoo submodule (#18110)
Catch up https://github.com/openvinotoolkit/open_model_zoo/pull/3790
2023-06-16 18:19:07 +04:00
Maciej Smyk
7eb59527a0 [DOCS] CMake options description in build guide for 23.0 2023-06-16 10:37:53 +02:00
Sebastian Golebiewski
21fdda5609 [DOCS] Restyling tabs for 23.0
Porting: #18054

Introducing changes in css style for tabs from sphinx-design extension.
2023-06-14 11:43:10 +00:00
Tatiana Savina
9983f74dc7 fix link (#18050) 2023-06-14 08:54:11 +00:00
Maciej Smyk
ef0b8161c9 Update build_linux.md (#18046) 2023-06-14 10:45:16 +02:00
Sebastian Golebiewski
9e2dacbc53 [DOCS] Restyling elements on home page - for 23.0 2023-06-13 08:50:20 +02:00
Sebastian Golebiewski
d299be4202 [DOCS] Fixing formatting issues in articles - for 23.0 (#18004)
* fixing-formatting
2023-06-13 07:59:16 +02:00
Tatiana Savina
99fe2e9bdc add tabs (#18007) 2023-06-12 16:45:34 +02:00
Karol Blaszczak
6668ec39d7 [DOCS] Adding Datumaro document into OV Ecosystems (#17944) (#17968)
* add Datumaro document
* add datumaro into toctree

authored-by: Wonju Lee <wonju.lee@intel.com>
2023-06-09 13:22:43 +02:00
Maciej Smyk
1e5dced9d4 Update build_linux.md (#17967) 2023-06-09 15:03:45 +04:00
Zlobin Vladimir
7d73bae243 Update open_model_zoo submodule (#17902)
* Update open_model_zoo submodule

Catch up https://github.com/openvinotoolkit/open_model_zoo/pull/3779

---------

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
2023-06-09 13:52:38 +04:00
Sebastian Golebiewski
d8d4fb9c94 [DOCS] Fixing broken code blocks for 23.0 (#17960)
* code-blocks-fixes
2023-06-09 09:08:27 +02:00
Ilya Lavrenov
11cde296b7 Updated refs to dependency repositories (#17953) 2023-06-08 20:14:48 +04:00
Ilya Lavrenov
44f8dac403 Align tabs in install archives Linux (#17947) (#17950) 2023-06-08 14:49:28 +02:00
Tatiana Savina
41b4fd1057 add enter dir (#17897) 2023-06-08 13:08:41 +02:00
Sebastian Golebiewski
0f89782489 update-deployment-manager (#17904) 2023-06-08 10:31:50 +04:00
Tatiana Savina
d894716fad [DOCS] Add sudo to uninstall (#17929)
* add sudo to uninstall

* Update uninstalling-openvino.md
2023-06-07 18:18:12 +02:00
Tatiana Savina
f6fd84d2e1 fix archive link (#17918) 2023-06-07 09:19:05 +00:00
Tatiana Savina
648b2ad308 [DOCS] Model optimization paragraph fix (#17907)
* fix mo guide paragraph

* fix format

* fix paragraph

* remove extra line
2023-06-07 10:45:01 +02:00
Tatiana Savina
ea5c1b04e5 [DOCS] Fix list and links to POT (#17887)
* change link to POT

* change header label

* fix typo
2023-06-06 10:59:05 +02:00
Karol Blaszczak
f3d88cbf99 DOCS post-release adjustments (#17876) 2023-06-05 15:43:45 +02:00
Tatiana Savina
e824e482b1 fix apt and yum links (#17877) 2023-06-05 13:11:21 +03:00
Sebastian Golebiewski
e4d0021e2c update-diagram (#17872) 2023-06-05 08:17:26 +02:00
Artyom Anokhov
e74cb4084d [docs] Conda update (#17861)
* Adding installing OV via Conda-Forge for MacOS

* Adding section Compiling with OpenVINO™ Runtime from Conda-Forge

* Update docs/install_guides/installing-openvino-conda.md

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

* Update docs/install_guides/installing-openvino-conda.md

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

* Update docs/install_guides/installing-openvino-conda.md

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

* Update docs/install_guides/installing-openvino-conda.md

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

* Update docs/install_guides/installing-openvino-conda.md

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

* Update docs/install_guides/installing-openvino-conda.md

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

* Update docs/install_guides/installing-openvino-conda.md

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

* Update docs/install_guides/installing-openvino-conda.md

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

* installing-openvino-conda: Fixed title

* installing-openvino-macos-header: Fixed order for links

---------

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
2023-06-02 21:54:11 +04:00
Tatiana Savina
e843e357cd change notebooks links (#17857) 2023-06-02 13:14:26 +02:00
Tatiana Savina
ecc502733d [DOCS] Change downloads directory link (#17846)
* installation link

* fix path
2023-06-01 19:04:02 +04:00
bstankix
d1de793552 Port default platform type selection from nightly (#17845) 2023-06-01 15:46:22 +02:00
Karol Blaszczak
ebaf6a2fcb DOCS homepage update (#17843) 2023-06-01 15:16:20 +02:00
Anton Voronov
88b006bce9 [DOC] cpu documentation fixes (#17816)
* [DOC] cpu documentation fixes

* fixed typos
2023-06-01 10:17:48 +02:00
Ilya Lavrenov
4aae068125 Update archive names for 2023.0 release (#17831) 2023-06-01 12:07:06 +04:00
Ilya Lavrenov
41c37c8af9 Updated badges for 2023.0 (#17832) 2023-06-01 12:03:20 +04:00
Sebastian Golebiewski
f40f0fa58b [DOCS] convert_model() as a default conversion path - for 23.0 (#17751)
Porting: https://github.com/openvinotoolkit/openvino/pull/17454

Updating MO documentation to make convert_model() a default conversion path.
2023-05-31 19:22:54 +02:00
Tatiana Savina
20dc436b6f DOCS Fix build links (#17821)
* change doc vers

* fix links
2023-05-31 17:45:57 +02:00
Sebastian Golebiewski
b2b7a57a4c update-tutorials (#17812) 2023-05-31 15:48:08 +02:00
Tatiana Savina
4481bfa17e [DOCS] Review release docs (#17793)
* review docs

* fix link to notebook

* fix build

* fix links

* remove bracket
2023-05-31 15:46:53 +02:00
Sebastian Golebiewski
366a5467d1 [DOCS] benchmark 23.0 update - port from master (#17806)
Porting: #17789

new benchmarking data
2023-05-31 12:58:49 +02:00
Karol Blaszczak
4be1dddb21 DOCS operation support articles update (#17449) (#17809)
port: #17449

conformance table added
ARM merged with CPU
precision support and layout tables removed from the overview device article (info available in device articles)
2023-05-31 10:56:25 +00:00
Ilya Lavrenov
3fd9b8c3b7 Updated install docs for 2023.0 (#17764) 2023-05-31 13:37:30 +04:00
Maciej Smyk
66528622a8 [DOCS] Link adjustment for dev docs + fix to build.md CPU link for 23.0 (#17747)
Port from #17744

JIRA Ticket: 110042

Update of hardcoded links to switch references from latest, nightly and 2022.3 (and earlier) to 2023.0.

JIRA Ticket: 111393

Fix for the Mac (Intel CPU) link name (it should be Intel CPU instead of Intel GPU).
2023-05-31 11:34:22 +02:00
Tatiana Savina
4fb2cebf28 [DOCS] Compile tool docs port (#17753)
* [DOCS] Compile tool docs change (#17460)

* add compile tool description

* change refs

* remove page to build docs

* doc reference fix

* review comments

* fix comment

* snippet comment

* Update docs/snippets/compile_model.cpp

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

* change snippet name

* create ov object

* code block fix

* cpp code block

* include change

* code test

* change snippet

* Update docs/snippets/export_compiled_model.cpp

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

---------

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

* Fixed compile_tool install (#17666)

---------

Co-authored-by: Ilya Churaev <ilyachur@gmail.com>
Co-authored-by: Ilya Churaev <ilya.churaev@intel.com>
2023-05-31 13:27:01 +04:00
Wanglei Shen
c18a24c05b [DOC] Add multi threading for 2023.0 release in CPU plugin document (#17788) 2023-05-31 12:54:42 +04:00
Anton Voronov
95f0005793 [DOC][CPU] Documentation update (#17786) 2023-05-31 10:37:14 +04:00
bstankix
9ac239de75 Port ability to build notebooks from local files from nightly (#17798) 2023-05-30 16:27:11 +02:00
Tatiana Savina
ad5c0808a6 add pad1 (#17760) 2023-05-30 10:39:05 +02:00
Tatiana Savina
66c6e125cf [DOCS] Port workflow docs (#17761)
* [DOCS]  Deploy and run documentation sections (#17708)

* first draft

* change name

* restructure

* workflow headers change

* change note

* remove deployment guide

* change deployment description

* fix conflicts

* clean up conflict fixes
2023-05-30 10:38:47 +02:00
Maciej Smyk
53bfc41a74 [DOCS] Configuring devices article update for 2023.0 (#17757)
* Update configure_devices.md
2023-05-29 09:02:25 +02:00
Karol Blaszczak
9b72c33039 [DOCS] install-guide fix port to 23.0 (#17672) 2023-05-25 18:39:03 +02:00
Zlobin Vladimir
c0e9e1b1a1 Update open_model_zoo submodule (#17733)
Catch up https://github.com/openvinotoolkit/open_model_zoo/pull/3770

Ticket: 110042
2023-05-25 15:56:45 +00:00
Daria Mityagina
720e283ff1 Update comments and help text (#17710) 2023-05-24 22:12:27 +02:00
Tatyana Raguzova
0e87a28791 [build_samples] Using make instead of cmake (#17560) 2023-05-24 22:43:42 +04:00
Ilya Lavrenov
6d17bbb7e9 Conan port (#17625) 2023-05-24 22:07:50 +04:00
Maxim Vafin
cebbfe65ac [DOCS] Add examples of using named outputs in extensions (#17622)
* [DOCS]Add examples of using named outputs in extensions

* Fix opset

* Apply suggestions from code review

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

* Update docs/Extensibility_UG/frontend_extensions.md

* Add reference to external docs

* Update docs/Extensibility_UG/frontend_extensions.md

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

---------

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
2023-05-24 14:15:01 +02:00
Aleksandr Voron
c4c6567182 [DOCS][CPU] Update ARM CPU plugin documentation (#17700) 2023-05-24 15:42:32 +04:00
Karol Blaszczak
1a9ce16dd6 [DOCS] framework deprecation notice (#17484) (#17537)
Port: #17484
A new PR will be created with more changes, as suggested by jane-intel and slyalin. The "deprecated" label for articles and  additional content on converting models to ONNX will be covered then.
2023-05-24 11:53:56 +02:00
Maciej Smyk
4e8d5f3798 [DOCS] link fix (#17658) 2023-05-23 07:31:19 +02:00
Przemyslaw Wysocki
7351859ec2 limit linter (#17624) 2023-05-22 23:58:06 +04:00
Ilya Lavrenov
405c5ea03a Install libtbb12 on U22 (#17653) 2023-05-22 17:52:59 +04:00
Sebastian Golebiewski
183253e834 [DOCS] Update Interactive Tutorials - for 23.0 (#17600)
port: https://github.com/openvinotoolkit/openvino/pull/17598/
2023-05-22 14:46:14 +02:00
Maciej Smyk
cfea37b139 [DOCS] RST fixes for 23.0 (#17606)
* fixes
2023-05-22 10:33:32 +02:00
Tatiana Savina
34f00bd173 DOCS Update optimization docs with NNCF PTQ changes and deprecation of POT (#17398) (#17633)
* Update model_optimization_guide.md

* Update model_optimization_guide.md

* Update model_optimization_guide.md

* Update model_optimization_guide.md

* Update model_optimization_guide.md

* Update model_optimization_guide.md

* Update model_optimization_guide.md

* Update home.rst

* Update ptq_introduction.md

* Update Introduction.md

* Update Introduction.md

* Update Introduction.md

* Update ptq_introduction.md

* Update ptq_introduction.md

* Update basic_quantization_flow.md

* Update basic_quantization_flow.md

* Update basic_quantization_flow.md

* Update quantization_w_accuracy_control.md

* Update quantization_w_accuracy_control.md

* Update quantization_w_accuracy_control.md

* Update quantization_w_accuracy_control.md

* Update quantization_w_accuracy_control.md

* Update quantization_w_accuracy_control.md

* Update quantization_w_accuracy_control.md

* Update quantization_w_accuracy_control.md

* Update quantization_w_accuracy_control.md

* Update basic_quantization_flow.md

* Update basic_quantization_flow.md

* Update quantization_w_accuracy_control.md

* Update basic_quantization_flow.md

* Update basic_quantization_flow.md

* Update model_optimization_guide.md

* Update ptq_introduction.md

* Update quantization_w_accuracy_control.md

* Update model_optimization_guide.md

* Update quantization_w_accuracy_control.md

* Update model_optimization_guide.md

* Update quantization_w_accuracy_control.md

* Update model_optimization_guide.md

* Update Introduction.md

* Update basic_quantization_flow.md

* Update basic_quantization_flow.md

* Update quantization_w_accuracy_control.md

* Update ptq_introduction.md

* Update Introduction.md

* Update model_optimization_guide.md

* Update basic_quantization_flow.md

* Update quantization_w_accuracy_control.md

* Update quantization_w_accuracy_control.md

* Update quantization_w_accuracy_control.md

* Update Introduction.md

* Update FrequentlyAskedQuestions.md

* Update model_optimization_guide.md

* Update Introduction.md

* Update model_optimization_guide.md

* Update model_optimization_guide.md

* Update model_optimization_guide.md

* Update model_optimization_guide.md

* Update model_optimization_guide.md

* Update ptq_introduction.md

* Update ptq_introduction.md

* added code snippet (#1)

* Update basic_quantization_flow.md

* Update basic_quantization_flow.md

* Update quantization_w_accuracy_control.md

* Update basic_quantization_flow.md

* Update basic_quantization_flow.md

* Update ptq_introduction.md

* Update model_optimization_guide.md

* Update basic_quantization_flow.md

* Update ptq_introduction.md

* Update quantization_w_accuracy_control.md

* Update basic_quantization_flow.md

* Update basic_quantization_flow.md

* Update basic_quantization_flow.md

* Update ptq_introduction.md

* Update ptq_introduction.md

* Delete ptq_introduction.md

* Update FrequentlyAskedQuestions.md

* Update Introduction.md

* Update quantization_w_accuracy_control.md

* Update introduction.md

* Update basic_quantization_flow.md code blocks

* Update quantization_w_accuracy_control.md code snippets

* Update docs/optimization_guide/nncf/ptq/code/ptq_torch.py



* Update model_optimization_guide.md

* Optimization docs proofreading  (#2)

* images updated

* delete reminder

* review

* text review

* change images to original ones

* Update filter_pruning.md code blocks

* Update basic_quantization_flow.md

* Update quantization_w_accuracy_control.md

* Update images (#3)

* images updated

* delete reminder

* review

* text review

* change images to original ones

* Update filter_pruning.md code blocks

* update images

* resolve conflicts

* resolve conflicts

* change images to original ones

* resolve conflicts

* update images

* fix conflicts

* Update model_optimization_guide.md

* Update docs/optimization_guide/nncf/ptq/code/ptq_tensorflow.py



* Update docs/optimization_guide/nncf/ptq/code/ptq_torch.py



* Update docs/optimization_guide/nncf/ptq/code/ptq_onnx.py



* Update docs/optimization_guide/nncf/ptq/code/ptq_aa_openvino.py



* Update docs/optimization_guide/nncf/ptq/code/ptq_openvino.py



* table format fix

* Update headers

* Update qat.md code blocks

---------

Co-authored-by: Maksim Proshin <maksim.proshin@intel.com>
Co-authored-by: Alexander Suslov <alexander.suslov@intel.com>
2023-05-19 15:37:41 +00:00
Tatiana Savina
17326abb72 [MO][TF FE] Document freezing as essential step for pruning SM format (#17595) (#17632)
* [MO][TF FE] Document freezing as essential step for pruning SM format



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



---------

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-05-19 15:32:57 +00:00
Ilya Lavrenov
8601042bea Added python 3.11 for deployment tool (#17627) 2023-05-19 18:08:49 +04:00
Artyom Anokhov
39958e0dc1 Updated APT/YUM instructions with actual version. Added instructions for Ubuntu22. Updated subfolders naming for APT. (#17561) 2023-05-19 12:46:40 +02:00
Maciej Smyk
6fc9840e32 [DOCS] Link adjustment for 23.0 (#17604) 2023-05-18 15:10:13 +02:00
Ekaterina Aidova
b4452d5630 update OMZ submodule to fix bug (#17570) 2023-05-17 05:51:59 -07:00
Evgenya Stepyreva
4c69552656 Normalize_L2 relax constant input restriction (#17567)
* Normalize_L2 relax constant input restriction

* Fix warning treated as error during windows build
2023-05-17 12:37:02 +00:00
Maciej Smyk
6d8b3405ca [DOCS] Precision Control article for 23.0 (#17573)
Port from: https://github.com/openvinotoolkit/openvino/pull/17413

Added separate article on Precision Control (ov::hint::execution_mode and ov::inference_precision properties)
2023-05-17 11:21:05 +00:00
Evgenya Stepyreva
4c2096ad9c Strided Slice fix constant creation (#17557)
* Strided Slice fix constant creation

* Apply suggestions from code review

* Final touches
2023-05-16 13:53:57 +00:00
Aleksandr Voron
0c67b90f47 [CPU][ARM] Dynamic shapes support in ARM transformations (#17517) 2023-05-16 13:10:34 +04:00
Jan Iwaszkiewicz
83f51e0d00 [PyOV][Backport] Remove numpy strides from Tensor creation (#17535)
* [PyOV] Remove numpy strides from Tensor creation

* [PyOV] Add test for stride calculation

* [PyOV] Fix flake issue
2023-05-16 09:04:56 +04:00
Dmitry Kurtaev
8bb2a2a789 [CMake] Add CMAKE_MAKE_PROGRAM arg (#17340)
Co-authored-by: Ilya Churaev <ilya.churaev@intel.com>
2023-05-15 17:22:27 +04:00
Pawel Raasz
c9cfd6755c [Core] StridedSlice improvements of bound evaluation and constant folding (#17536)
* StridedSlice improvements:
-Bound evaluation for begin, end partial values when ignore mask set.
- Custom constant fold implementation.

* Improve const folding when all begin or end values
are ignored
2023-05-15 12:24:36 +00:00
Karol Blaszczak
c0060aefa7 Prepare "memory_optimization_guide.md" (#17022) (#17498)
---------

Co-authored-by: Vitaliy Urusovskij <vitaliy.urusovskij@intel.com>
2023-05-15 10:48:32 +02:00
Gorokhov Dmitriy
8a97d3c0e1 [CPU] Restore OneDNN InnerProduct primitive os_block computation behavior (#17462) 2023-05-12 15:50:10 +04:00
Wanglei Shen
c5fd3300a2 HOT FIX: disable set_cpu_used in 2023.0 release (#17456)
* disable set_cpu_used in 2023.0 release

* fix code style issue
2023-05-12 14:16:42 +08:00
Mateusz Mikolajczyk
a7f6f5292e Add missing check for special zero (#17479) 2023-05-12 09:30:55 +04:00
Maxim Vafin
804df84f7d Add transformation to convert adaptive pool to reduce (#17478)
* Add transformation to convert adaptive pool to reduce

* Update src/common/transformations/src/transformations/common_optimizations/moc_transformations.cpp

* Add tests and apply feedback

* Simplify if branches
2023-05-11 15:51:26 +00:00
Evgenya Stepyreva
1e49a594f7 [Shape inference] Pooling: Dimension div fix (#17197) (#17471)
* Dimension div fix

* codestyle fixes

* Convolution labels propagation test instances corrected

Co-authored-by: Vladislav Golubev <vladislav.golubev@intel.com>
2023-05-11 14:36:17 +04:00
Tatiana Savina
d5ac1c2e5c [DOCS] Port update docs for TF FE (#17464)
* [TF FE] Update docs for TF FE (#17453)

* Update tensorflow_frontend.md

* Update docs/resources/tensorflow_frontend.md

---------

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-05-11 01:03:47 +04:00
Karol Blaszczak
afb2ae6b7a [DOCS] Update GPU.md (#17400) 2023-05-10 17:30:22 +02:00
Maxim Vafin
c5623b71cf Remove posibility to export to onnx (#17423)
* Remove posibility to export to onnx

* Apply suggestions from code review

* Fix tests and docs

* Workaround function inputs

* Fix code style
2023-05-10 16:35:54 +04:00
Maxim Vafin
152b11e77f Remove section about --use_legacy_frontend for PyTorch models (#17441) 2023-05-09 20:30:27 +04:00
Mateusz Tabaka
5adf3b5ca8 [TF frontend] use InterpolateMode::LINEAR_ONNX if input rank is 4 (#17406)
This change mimicks LinearToLinearONNXReplacer transformation in
legacy frontend, where linear interpolate mode is replaced with
linear_onnx due to performance reasons.

Ticket: CVS-108343
2023-05-09 14:52:35 +02:00
Fang Xu
a2ccbdf86e Update oneTBB2021.2.2 for 2023.0 (#17367)
* update oneTBB2021.2.2 for windows

* update SHA256

* update SHA256

oneTBB https://github.com/oneapi-src/oneTBB/releases/tag/v2021.2.2 (a25ebdf)

* add print for hwloc which is not found

---------

Co-authored-by: Chen Peter <peter.chen@intel.com>
2023-05-09 05:49:33 -07:00
Roman Kazantsev
1440b9950f [TF FE] Handle incorrect models (empty, fake) by TF FE (#17408) (#17432)
* [TF FE] Handle incorrect models (empty, fake) by TF FE



* Apply suggestions from code review

---------

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
2023-05-09 16:30:51 +04:00
Mateusz Tabaka
d88d4d22e8 Update docs for frontend extensions (#17428) 2023-05-09 13:27:40 +02:00
Tatiana Savina
ea79006a0a DOCS Port shift to rst - Model representation doc (#17385)
* DOCS shift to rst - Model representation doc (#17320)

* model representation to rst

* fix indentation

* fix cide tabs

* fix indentation

* change doc

* fix snippets

* fix snippet

* port changes

* dev docs port
2023-05-09 10:33:12 +02:00
Pavel Esir
a4ff3318ea renumber FAQ (#17376) 2023-05-09 11:35:55 +04:00
Anastasiia Pnevskaia
44e7a003e7 Removed checks of unsatisfied dependencies in MO (#16991) (#17419)
* Fixed dependencies check, made unsatisfied dependencies show only in case of error.

* Small fix.

* Test correction.

* Small test correction.

* Temporarily added debug print.

* Debug output.

* Debug output.

* Debug output.

* Test fix.

* Removed debug output.

* Small fix.

* Moved tests to check_info_messages_test.py

* Remove dependies checks from MO.

* Small corrections.
2023-05-09 11:32:14 +04:00
Przemyslaw Wysocki
fa4112593d [Backport] OMZ submodule bump for Python 3.11 (#17325)
* backport

* Update sha
2023-05-08 18:49:28 +02:00
Surya Siddharth Pemmaraju
45e378f189 Added Torchscript backend (#17328)
* Added Torchscript backend

* Added some torchscript backend tests to ci

* Removed tests from CI as torch.compile doesn't support 3.11 currently

* Fixed linter issues

* Addressed PR comments and linter issues
2023-05-08 03:44:10 -07:00
Maciej Smyk
9320cbaa8c [DOCS] Recreation of BDTI PRs - 23.0 (#17383)
Porting: https://github.com/openvinotoolkit/openvino/pull/16913

Recreation of BDTI PRs for master.

Recreated PRs:

Docs: Update Dynamic Shapes documentation #15216
Docs: Edits to Performance Hints and Cumulative Throughput documentation #14793
Docs: Update Devices pages to state improved INT8 performance with 11th & 12th gen devices #12067
2023-05-08 10:36:56 +00:00
Maciej Smyk
718b194ad6 [DOCS] Legacy MO Extensibility update for 23.0
porting: https://github.com/openvinotoolkit/openvino/pull/15931

Divided MO Extensibility article into separate smaller articles,
Applied the suggestion from [DOCS] Better statement about MO extensions as internal API [Recreating #14062] #15679
Recreated images in svg format
Fixing directives
2023-05-08 12:25:37 +02:00
Maxim Vafin
8241540609 [PT FE] Improve exception when decoder cannot trace or script the model (#17338) (#17347)
* [PT FE] Improve exception when decoder cannot trace or script the model

* Add exception in convert_model

* Add test
2023-05-08 09:22:47 +04:00
Maxim Vafin
10d87b7332 [PT FE] Support default strides for avg and max pooling (#17337) (#17348)
* Support default strides for avg and max pooling

* Fix code style

* Remove changes from other ticket
2023-05-08 09:21:53 +04:00
Karol Blaszczak
386d773b33 [DOCS] fix typos in install guides (#17388) 2023-05-08 07:12:38 +02:00
Sun Xiaoxia
a5312f70db fix binding wrong core with latency mode in i9-13900 (#17364) 2023-05-06 17:17:11 +08:00
Roman Kazantsev
8f113ef24e [TF FE] Provide single tensor names for inputs and outputs in SavedModel (#17373)
* [TF FE] Provide single tensor names for inputs and outputs in SavedModel

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

* Fix build issue

* Xfail some cases due to internal problems in TF

* Xfail other layer test

* Extend documentation for function to adjust tensor names

* Use old path of tf2 layer testing for legacy frontend

---------

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
2023-05-05 19:06:59 +02:00
Sebastian Golebiewski
c651bc5f87 [DOCS] Fix links - port (#17356) 2023-05-05 18:14:38 +02:00
Karol Blaszczak
12aab024d1 [GPU] Update dynamic shape document (#17274) (#17384)
porting: https://github.com/openvinotoolkit/openvino/pull/17384

* Update dynamic shape document for GPU
* Applied review comments

authored-by: Taylor Yeonbok Lee <taylor.lee@intel.com>
2023-05-05 17:58:19 +02:00
Ivan Tikhonov
3978511c5c Fix the names copying in TransposeSinking backward transformations (#17283) (#17344)
* Fix tensor names copying in TS transformations

* added a check that sinking is available for all consumers in TS backward transformations

* codestyle

* Apply review comments, add result sorting by tensor names in graph comparator

* delete debug code

* fix RemoveConsumers method implementation

* fix snippet tests

* use reference instead of raw pointer

* add new transformation tests

* fix transformation tests

Co-authored-by: Andrei Kochin <andrei.kochin@intel.com>
2023-05-05 17:09:44 +02:00
Chen Xu
0de0efd751 [CPU] Fix kernel precision mismatch in Reduce node (#17372)
* [CPU] Fix kernel precision mismatch in Reduce node

* Apply review comments
2023-05-05 14:39:30 +02:00
Sebastian Golebiewski
53e2997909 DOCS shift to rst (#17377) 2023-05-05 10:55:03 +02:00
Maciej Smyk
7779fea76f DOCS shift to rst - Opsets E for 23.0 (#17365) 2023-05-05 10:17:05 +02:00
Sebastian Golebiewski
c785551b57 DOCS shift to rst (#17346) 2023-05-04 13:29:16 +02:00
Roman Kazantsev
8c95c90e45 [TF FE] Use original input types for SavedModel (#17295) (#17335)
Also, refactor TF FE unit-tests

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
2023-05-03 16:26:33 +04:00
Evgenya Stepyreva
bf829eead4 NMS-5 calculate upper-bound (#17332)
* NMS-5 calculate upper-bound

* Test
2023-05-03 15:22:08 +04:00
Roman Kazantsev
1141e90435 [MO][TF FE] Handle constant with undefined value (#17311) (#17327)
Since TF 2.10 the native model freezing can produce constants with undefined value,
i.e. tensor shape can be any and value is []. In this case the tensor just fills up with
the default value (0 - for numerics, "" - for strings)

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
2023-05-03 12:09:57 +04:00
Roman Kazantsev
15b62d77cc [TF FE] Added additional pruned inputs for MetaGraph support (#17237) (#17326)
* Added handling of additional pruned inputs
Added possible topology of RestoreV2 -> AssignVariableOp
Added additional checks

* Extended tests coverage

Co-authored-by: Georgy Krivoruchko <georgy.krivoruchko@intel.com>
2023-05-03 12:09:20 +04:00
Maxim Vafin
e6347544e2 Fix issue with Pow when both inputs are scalars (#17305) (#17321)
* Fix issue with Pow when both inputs are scalars

* Fix code style
2023-05-03 11:32:13 +04:00
Anton Voronov
fcf261a048 [DOC] small fix for sparse weights decompression feature documentation (#17316) 2023-05-02 15:50:48 +02:00
Tatiana Savina
bba9f3094b [DOCS] Port docs: opsets, import keyword, deprecated options (#17289)
* Added missing import keyword (#17271)

* [DOCS] shift to rst - opsets N (#17267)

* opset to rst

* change list indentations

* fix formula

* add n operations

* add negative and nonzero

* fix link

* specs to rst

* fix matrixnms path

* change path to if

* fix list

* fix format

* 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

---------

Co-authored-by: Nikita Savelyev <nikita.savelyev@intel.com>
Co-authored-by: Pavel Esir <pavel.esir@intel.com>
2023-05-02 14:05:03 +02:00
Sergey Shlyapnikov
aa13ab63f5 [GPU] Use BFS processing order for out_of_order queue (#17304) 2023-05-02 15:25:21 +04:00
Tatiana Savina
8f978d2c60 update OTE and Datumaro links (#17269) (#17310) 2023-05-02 13:14:21 +02:00
Sebastian Golebiewski
a349ba7295 DOCS shift to rst - Opsets H & I - for 23.0 (#17307)
* update

* update

* cpp
2023-05-02 11:16:21 +02:00
Vladimir Paramuzov
73442bbc82 [GPU] Don't throw exception if no devices are found (#17302)
* [GPU] Don't throw exception if no devices are found

* Fix CAPI test
2023-05-01 23:18:51 +04:00
Tatiana Savina
76c237da8b [DOCS] Document Model Optimizer Python API port (#17287)
* [DOCS] Document Model Optimizer Python API (#14380)

* Added MO convert_model() documentation.

* Apply suggestions from code review

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

* Updated Convert_Model pages for PyTorch and TF with PythonAPI info. United TF2 and TF formats lists.

* Added info on flag params, example_input formats list, small corrections.

* Moved MO python API to separate doc. Small text corrections.

* Added TF types conversion description.

* Removed duplicating info.

* Added description of InputCutInfo types and default onnx opset.

* Small correction.

* Changed type table to bullets, added blank lines.

* Added quote marks.

* Removed redunrant bullets.

* Apply suggestions from code review

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

* Apply suggestions from code review.

* Added new line.

* Apply comments from review.d

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

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

* Added description of lists of parameters.

* Update docs/MO_DG/prepare_model/MO_Python_API.md

Co-authored-by: Sergey Lyalin <sergey.lyalin@intel.com>

* Added details about input_shape, example_input.

* Updated PyTorch page.

* Corrected input_signature description.

* Format correction.

* Format correction.

* Format correction.

* Format correction.

* Small correction.

* Small correction.

* Removed input_signature param description.

* Updated text.

* Small correction.

* Small correction.

* Removed not needed examples.

* Apply suggestions from code review

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

* Added new line.

* Update docs/MO_DG/prepare_model/MO_Python_API.md

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

* Added titles of examples.

* Update docs/MO_DG/prepare_model/MO_Python_API.md

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

* Apply suggestions from code review

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

* Update docs/MO_DG/prepare_model/MO_Python_API.md

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

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

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

---------

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
Co-authored-by: Sergey Lyalin <sergey.lyalin@intel.com>

* fix first paragraph

* Update MO_Python_API.md

---------

Co-authored-by: Anastasiia Pnevskaia <anastasiia.pnevskaia@intel.com>
Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
Co-authored-by: Sergey Lyalin <sergey.lyalin@intel.com>
2023-05-01 15:19:11 +04:00
Roman Lyamin
aebea2337e [GPU] Coverity fixes (#17241) (#17281) 2023-05-01 14:35:50 +04:00
Ilya Lavrenov
29c672d6d8 Fixed Python API build for Ubuntu 22.04 with python3.11 (#17297)
* Fixed Python API build for Ubuntu 22.04 with python3.11

* Update ONNX CI docker to test python 3.11 and system pybind11
2023-04-29 03:38:01 +04:00
Maksim Doronin
1f790df33c Fix enable_plugins_xml (#17293) 2023-04-29 00:02:43 +04:00
Ilya Lavrenov
5625424b91 Fixes for OpenCL via brew package (#17273) 2023-04-28 18:10:30 +04:00
Tatiana Savina
c7d0df39b5 remove pre-release note (#17265) 2023-04-28 13:04:31 +02:00
Alina Kladieva
85b57ea2bf Bump Azure refs to 2023/0 (#17264) 2023-04-27 22:09:27 +04:00
Sun Xiaoxia
893b29eab4 HOT FIX: Xiaoxia/fix read wrong data in muti threading (#17240)
* fix threading test sporadic failure

* fix read wrong data in muti threading

* fix read and write sync

* add lock before cpu._cpu_mapping_table[i][CPU_MAP_USED_FLAG],because CPU_MAP_USED_FLAG may be modified by set_cpu_used
2023-04-27 22:44:44 +08:00
Maxim Vafin
1d443c6da6 Fix problems with pytorch models passed to convert_model (#17255)
* Do eval() only for torch Module

* Add test

* Support decoder in convert_model

* Enable tests
2023-04-27 18:33:46 +04:00
Mateusz Bencer
2b8a6ba99a condition to print warnings (#17195) 2023-04-27 13:43:32 +00:00
Jan Iwaszkiewicz
ca02336c1b [PyOV] Bump pybind to 2.10.4 (#17251) 2023-04-27 16:41:45 +04:00
Artyom Anokhov
e06c4cc6fd CMakeLists: Changed FATAL_ERROR to Warning in case of OpenCLHeaders not found (#17260) 2023-04-27 16:22:53 +04:00
Ivan Tikhonov
40bf400b18 Add FakeQuantize op support in TS transformations (#17243)
* Add FQ op support in TS transformations

* codestyle

* Mark FQ as supported op in the TS ops list
2023-04-27 15:09:07 +04:00
Nikolay Shchegolev
22bb3af7df [CPU] Disable test case with sporadic failure. (#17256) 2023-04-27 14:06:33 +04:00
Sebastian Golebiewski
c0767a7e27 [DOCS] TensorFlow Lite FrontEnd updating dev docs (#17225)
* update with tflite

* Update index.md

---------

Co-authored-by: Karol Blaszczak <karol.blaszczak@intel.com>
2023-04-27 13:58:25 +04:00
Anastasiia Pnevskaia
59e28f8d0d Disabled tests. (#17231) 2023-04-27 13:39:58 +04:00
Sebastian Golebiewski
40128cded1 update tuts (#17201) 2023-04-27 11:29:19 +02:00
Ryszard Jezierski
8005a3d0b0 Removed unneeded deprecated test code (#16939) 2023-04-26 23:53:10 +04:00
Ryszard Jezierski
561bf6d478 Removed deprecated parser tests (#17151) 2023-04-26 23:51:53 +04:00
Yuan Hu
cecd0e75a6 coverity Uninitialized scalar variable (#17182)
Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>
2023-04-26 23:49:21 +04:00
Nesterov Alexander
dbaa1f0c0d [ARM CPU] Fix interpolate tests (#17171)
* fix interpolate bug

* fix interpolate bug - some tests

* fix interpolate bug - change init

* fix interpolate bug - shape fix

* fix interpolate bug - shape fix 2

* fix interpolate bug - add assert
2023-04-26 23:28:02 +04:00
Wilson Seok
03a428f50c [GPU] Fix remove redundant reorder to skip reorder fusing when sibling node doesn't support fused padding (#17041)
* initial fix

* add corresponding unit test

* skip reorder fusing when sibling node does not support fused padding

* fix data type of axis for win build

* Revert "fix data type of axis for win build"

This reverts commit 719ea75d7826aafc7bb94c1971586c33a9842f10.

* add static casting for win build
2023-04-26 16:53:23 +00:00
Sun Xiaoxia
7fc65ae3c5 fix threading test sporadic failure (#17230)
Co-authored-by: Wanglei Shen <wanglei.shen@intel.com>
2023-04-26 20:27:49 +04:00
Maxim Vafin
10392644e3 [PT FE] Enable stable sort layer tests (#17229)
* [PT FE] Enable stable sort layer tests

* Remove unused code
2023-04-26 18:24:38 +02:00
Ivan Tikhonov
80519162ae Reduce the binary size of transformation lib (#17220)
* Replace opset with op version for TransposeSinking and SmartReshape transformations to reduce binary size

* replace opset with op version in some op_conversions transformations

* codestyle
2023-04-26 19:03:36 +04:00
Ekaterina Aidova
82ff7e17c9 use input parameter for building example_inputs (#17207)
* use input parameter for building example_inputs

* Update tools/mo/openvino/tools/mo/moc_frontend/pytorch_frontend_utils.py
2023-04-26 17:58:06 +04:00
Egor Duplenskii
f1bc402b38 [CPU] Pick fix for oneDNN v3.1 release (#17144) 2023-04-26 17:44:36 +04:00
Wang Wangwang
962df2cdcb [AUTO] Exclude other vendor's GPU device in default candidate list (#17063)
* [AUTO] Plugin takes only Intel dGPU as 1st priority

* Update test case

* Simplify the code

* Support more test cases in GetDeviceList API

* Add notIntelGPU to _deviceBlocklist in AUTO plugin

* Restore some code formats

* Update test cases

* Add some logs to GetValidDevice API

* Simplify the code

---------

Co-authored-by: Wanglei Shen <wanglei.shen@intel.com>
2023-04-26 14:42:53 +01:00
Nikolay Shchegolev
c8ac7c9b82 [CPU] Infer_request crashes for SpaceToBatch operation. (#16974)
* [CPU] Infer_request crashes for SpaceToBatch operation.

* Fixes as per comments.

* Fixes as per comments 2.
2023-04-26 17:39:54 +04:00
Vladimir Paramuzov
6ed85178d5 [GPU] Fix layout propagation logic (#17199) 2023-04-26 14:20:48 +01:00
Edward Shogulin
14a14ecd76 [LPT] Precision restriction customization extending: tests (#17196)
* [LPT] Precision restriction customization extending

* comments fix: refactoring

* [LPT] Precision restriction customization extending: tests
2023-04-26 16:53:04 +04:00
Tomasz Adamowicz
546581bcce [Gna][coverity] fixes for issue type AUTO_CAUSES_COPY (#17192)
* [Gna][coverity] fixes for AUTO_CAUSES_COPY CID: 1491505, 1491595, 1502494, 1502500, 1504698, 1504769, 1507058

* update afte review

* adding const specifier to auto where needed
2023-04-26 13:32:54 +01:00
Ilya Lavrenov
cfbfa18f34 Fixed WASM build in update docker container / new dependencies (#17224) 2023-04-26 16:32:36 +04:00
Edward Shogulin
e593cf8545 [LPT] Precision restriction customization extending (#17147)
* [LPT] Precision restriction customization extending

* comments fix: refactoring
2023-04-26 13:29:09 +01:00
Alexandra Sidorova
a032d67cc7 [CPU] Fixed enforcebf16 condition for transformation pipeline (#17157)
* [CPU] Fixed enforcebf16 condition for transformation pipeline

* [Snippets][CPU][Tests] Added test with bf16
2023-04-26 16:13:01 +04:00
Irina Efode
ca92eb96ad [CONFORMANCE] Fix Runner on Win (#17221) 2023-04-26 13:03:20 +01:00
Zlobin Vladimir
de30d8523d State single value is uese (#15458)
Ticket EISW-60868
2023-04-26 14:50:03 +04:00
Ilya Lavrenov
da91b33763 ARM32 ACL kernels in oneDNN (#17142)
* ARM32 ACL kernels in oneDNN

* Fixed review comments

* Fixed ERF

* Disabled several eltwise tests on arm32
2023-04-26 13:50:10 +04:00
Vitaliy Urusovskij
02bfa7804b Add copyright (#17218) 2023-04-26 13:44:31 +04:00
Luwei Zhou
6cb6c5958a Fix the SDL issues. (#17107)
* Fix the SDL issues.

* Applied review comments.

* Update Slice test case to test none-const axis input.
2023-04-26 13:35:36 +04:00
Chenhu Wang
737864bdc7 [CPU] layout alignment to improve perf for interpolate pillow modes (#17079)
* infer planar layout with [1,2] axis as nhwc layout pass and kernel

* leftover comments apply

* comment apply
2023-04-26 11:33:17 +02:00
Ivan Tikhonov
95ca54d0ab Update ConstantFolding transformation to support Gather with dynamic input (#16973)
* ConstFold Gather op in case of dynamic dims in data input

* Update ConstantFolding transformation to support Gather with dynamic input; add test

* always mark ShapeOf nodes as can_be_folded

* add additional checks for fused_names in the gather test

---------

Co-authored-by: Andrei Kochin <andrei.kochin@intel.com>
2023-04-26 13:22:47 +04:00
Vladimir Paramuzov
ce5f65af14 [GPU] Use hash of test name for random generator initialization (#17213) 2023-04-26 12:52:38 +04:00
Ekaterina Aidova
6389f423bf [PT FE]: implement scaled dot product attention (#17178)
* [PT FE]: implement scaled dot product attention

* Apply suggestions from code review

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

* Update src/frontends/pytorch/src/op/scaled_dot_product_attention.cpp

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

---------

Co-authored-by: Maxim Vafin <maxim.vafin@intel.com>
2023-04-26 12:51:02 +04:00
Ekaterina Aidova
5857c4438b [PT FE]: switch on tracing as main path if example inputs provided (#17194) 2023-04-26 12:50:43 +04:00
Eddy Kim
09265083ed [GPU] fixed a missing data type (#17200)
* fixed missing data type

* updated the resolution for better accuracy check
2023-04-26 08:28:18 +00:00
Roman Kazantsev
7cf9d109e8 [TF FE] Implement optimal conversion of body graphs (#17211)
* [TF FE] Implement optimal conversion of body graphs

Preliminary setting input shapes and types for body graph InputModel
provides more optimal conversion of body-graphs.

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

* Fix build issue

---------

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
2023-04-26 12:12:54 +04:00
Maciej Smyk
5682e178dd DOCS shift to rst - Opsets D (#17205)
* Update Operations_specifications.md

* Update Divide_1.md

* Update DFT_7.md

* Update DetectionOutput_8.md

* Update DetectionOutput_1.md

* Update DetectionOutput_1.md

* Update DepthToSpace_1.md

* Update DeformablePSROIPooling_1.md

* Update DeformableConvolution_8.md

* Update DeformableConvolution_1.md

* Update DeformableConvolution_8.md

* fix

* fix

* Update DFT_7.md

* Update DFT_7.md

---------

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
2023-04-26 10:11:13 +02:00
Mateusz Tabaka
dfaa4e7bd6 Add ConvertSubtractWithConstant to MOCTransformations (#17058)
* Add ConvertSubtractWithConstant to MOCTransformations

Ticket: CVS-62419

* fix test_mo_import_from_memory tests

* move test file

---------

Co-authored-by: Michal Lukaszewski <michal.lukaszewski@intel.com>
2023-04-26 11:37:42 +04:00
Mateusz Tabaka
da4316845f ConvMulFusion - handle ConvolutionBackpropData with 3 inputs (#17145)
* ConvMulFusion - handle ConvolutionBackpropData with 3 inputs

Ticket: 98769

* add using

* use compare functions
2023-04-26 11:37:31 +04:00
Sungeun Kim
3c485feea8 removed case to choose onednn impl for deconv (#17108)
- in_dt(f16) wei_dt(f16) out_dt(f32)
2023-04-26 13:20:11 +09:00
Egor Duplenskii
dabd5ee412 [CPU][TESTS] Fix cmake test dependencies (#17202)
Co-authored-by: Maksim Doronin <maksim.doronin@intel.com>
2023-04-26 01:17:12 +04:00
Gorokhov Dmitriy
edec7bb897 [CORE] Disable fp32->fp16 optimized constant conversion impl (#17189) 2023-04-25 15:50:24 +00:00
Maciej Smyk
72533a7da1 DOCS shift to rst - Quantizing Models with Accuracy Control, Documentation, Get Started & Learn OpenVINO (#16997)
* Update AccuracyAwareQuantizationUsage.md

* Update AccuracyAwareQuantizationUsage.md

* Update AccuracyAwareQuantizationUsage.md

* Update AccuracyAwareQuantizationUsage.md

* Update AccuracyAwareQuantizationUsage.md

* Update AccuracyAwareQuantizationUsage.md

* Update AccuracyAwareQuantizationUsage.md

* Update AccuracyAwareQuantizationUsage.md

* Update AccuracyAwareQuantizationUsage.md

* Update AccuracyAwareQuantizationUsage.md

* Update AccuracyAwareQuantizationUsage.md

* rst

* fixes
2023-04-25 16:06:34 +02:00
Maciej Smyk
49b5d039db DOCS shift to rst - Opsets B (#17169)
* Update BatchNormInference_1.md

* Update BatchNormInference_1.md

* Update BatchNormInference_1.md

* Update BatchNormInference_1.md

* Update BatchNormInference_1.md

* Update BatchNormInference_1.md

* Update BatchNormInference_1.md

* Update BatchNormInference_1.md

* Update BatchNormInference_1.md

* Update BatchNormInference_1.md

* Update BatchNormInference_1.md

* Update BatchNormInference_1.md

* Update BatchNormInference_5.md

* Update BatchToSpace_2.md

* Update BinaryConvolution_1.md

* Update Broadcast_1.md

* Update Broadcast_3.md

* Update Bucketize_3.md

* fix

* fix-2
2023-04-25 16:06:17 +02:00
Anastasiia Pnevskaia
acd424bb5e Show message with suggestion to try legacy FE in case of conversion error (#17088)
* Moved exception checks to _convert(), added suggestion to try legacy TF in case of conversion fail.

* Added test.

* Added send_conversion_result() method.

* Small correction.

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

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

* Moved test_suggest_legacy_fe() test to check_info_messages_test.py.

* Removed not needed import.

* Small correction.

---------

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-04-25 13:57:01 +00:00
Ilya Lavrenov
57d4ca27e6 Revert "Proper ACL version detection (#17152)" (#17206)
This reverts commit 1aec450fc6.
2023-04-25 17:36:18 +04:00
Przemyslaw Wysocki
923b6f297c [PyOV] Move environment markers to requirements.txt files (#17113)
* WIP

* WIP

* Debug

* WIP

* Expand function to other setup.pies

* Revert mxnet

* Update docstring'

* restore defusedxml

* Update tools/mo/requirements.txt

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

* Code review

---------

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-04-25 13:25:21 +00:00
Vladislav Golubev
a8278ba4a6 [LPT] FQ reference implementation reused in foldFakeQuantize function (#17096)
* [LPT] reused reference FQ implementation in fold_fake_quantize

* [LPT] Removed legacy parameters

* Added plugin tests with per-channel FQ for GrConv wo reshape

* Apply folding only in the case when FQ data input is constant

* EliminateFQ fix
2023-04-25 14:08:01 +01:00
Aleksandr Voron
43a42fa9cd fix (#17179) 2023-04-25 16:50:37 +04:00
Evgenya Stepyreva
cd4c012f08 LogicalNot: convert precision (#17061)
* CVS-108362 LogicalNot: convert precision

* Test
2023-04-25 12:43:44 +00:00
Ilya Lavrenov
2e3deb8d8f Windows arm64 support for CPU plugin (#17075)
* ARM32 support

* ARM32 support

* Fixed packaging

* Windows arm64 support

* Updated submodule

* 32 bits support in Intel CPU plugin

* Fixed FIndAcl.cmake

* Enable proper conditional  compilation for Windows ARM64

* Enable proper conditional  compilation for Windows ARM64

* Updated submodule

* Updated submodule

* Updated submodule

* Updated submodule

* Updated submodule

* Added template_extension to CPU func tests dependencies

* Updated submodule

* Enabled runtime model tests

* Updated submodule

* Submodule update
2023-04-25 16:41:28 +04:00
Maxim Vafin
d423491bcb Fix Scatter value infer for fully dynamic value (#17165)
* Fix issue with dynamic Scatter in MO IR Reader

* Only normalize for 1D tensors

* Add test
2023-04-25 16:38:49 +04:00
Vitaliy Urusovskij
11a2b75161 Fix TSAN issue No2 in GNA plugin (#17185)
* Fix TSAN issue No2 in GNA plugin

* Misprint
2023-04-25 16:32:06 +04:00
Jan Iwaszkiewicz
512b186231 [PyOV] Enable group_convolution_backprop test (#17186) 2023-04-25 12:19:56 +00:00
Evgenya Stepyreva
ee4ccec190 TensorFlow Lite FrontEnd: documentation changes (#17187)
* First glance doc changes

* Apply suggestions from code review

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

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

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

---------

Co-authored-by: Tatiana Savina <tatiana.savina@intel.com>
2023-04-25 16:18:24 +04:00
Oleg Pipikin
27210b6505 Fix Coverity issue #1505788 (#17173) 2023-04-25 16:13:42 +04:00
Oleg Pipikin
ab879f143c Add check to avoid out of bounds segfault in scatterNDupdate (#17066)
* Add check to avoid out of bounds segfault in scatterNDupdate

* Fix code style
2023-04-25 16:13:14 +04:00
Aleksandr Voron
6e11645018 [CPU] Add axis check to ACL Reduce isSupported method (#17188)
* fix

* fix2
2023-04-25 16:11:50 +04:00
Sergey Shlyapnikov
0a5975bdfa [GPU] Add real kernels' execution timings collection for DumpProfilingData debug option (#15797) 2023-04-25 14:33:08 +04:00
Ilya Lavrenov
1aec450fc6 Proper ACL version detection (#17152) 2023-04-25 14:05:52 +04:00
Sungeun Kim
8c09a128ac [GPU] update weights_layout for GroupConv 1d spatial (#17109)
* update weights_layout for GroupConv 1d spatial
2023-04-25 18:54:54 +09:00
Georgy Krivoruchko
3f07c8b48b [TF FE] Added MetaGraph file format (#16524)
* Separeted SavedModelVariablesIndex class from Saved Model

* Renamed SavedModelVariablesIndex class

* Enabled Tensorflow MetaGraph

* Enabled Tensorflow MetaGraph

* Covered VariableV2 and Assign nodes

* Applied review comments

* Added tests

* Added names to input/output ports too

* Fixed naming for using with MO

* Applied part of review comments

* Renamed meta.cpp and saved_model.cpp

* Applied shared_ptr for memory management of PtrNode

* Fixing CI

* Prevent cycles while passing thru graph

* Released requirement for Checkpointable Object Graph

* Changed naming approach to align port order

* Changed renaming order (before reordering)

* Added a Placeholder translator which checks updated shape

* WA missing Identity name

* Fix CI and restored lost translators after rebase

* WA for output names

* Removing unused params after cutting a model

* Prevents crash in case VariableV2 appears in freezed model

* Fixed saved model in case no variables.index found, but
variables exists

* Changed approach for handling native formats support

* Aligned behavior with freezing .meta files

* Fixed behavior for cutting a model by input tensor

* Applied review comments
2023-04-25 13:46:06 +04:00
Maciej Kwapulinski
9c01de4b6e [GNA] fix: embedded export is available for embedded targets only (#17105)
* fix: embedded export is available for embedded targets only

* [GNA] functional tests fix - embedded export should NOT be possible on non-embedded target

* [GNA] tests added/justified to process both negative and positive path
2023-04-25 10:45:47 +01:00
Andrew Kwangwoong Park
72906ca242 [GPU] Fix i8/u8 representation error for clamp due to overflow (#17183)
* [GPU] Fix i8 representation error for clamp due to overflow

Signed-off-by: Andrew Park <andrew.park@intel.com>

* Fix to not include in ocl code

Signed-off-by: Andrew Park <andrew.park@intel.com>

---------

Signed-off-by: Andrew Park <andrew.park@intel.com>
2023-04-25 09:41:01 +00:00
Ekaterina Aidova
39ed9a624f [PT FE]: extend batch norm to support training mode (#17040) 2023-04-25 11:27:00 +02:00
Vladimir Paramuzov
f736c71feb [GPU] Fix reshape split for dynamic models + accuracy fix for SAM (#16911) 2023-04-25 09:21:31 +00:00
Alexandra Sidorova
9247906879 [Snippets][CPU] Fixed coverity (#17094) 2023-04-25 09:12:58 +00:00
hyunback kim
19f8f5a3a7 [GPU] Disable oneDNN post-op Prelu in FC,gemm (#17084)
* [GPU] Disable oneDNN post-op relu

Only disable Prelu fusion in Fc, gemm
 - check additional data input

Signed-off-by: hyunback <hyunback.kim@intel.com>
2023-04-25 18:06:22 +09:00
Yuan Hu
2255bb25fd fix input issuse of ScatterNDUpdate conformance test (#16406)
* fix input issuse of ScatterNDUpdate conformance test

Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>

* fix typo and optimize temporary variable

Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>

---------

Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>
2023-04-25 13:00:22 +04:00
Vladimir Paramuzov
ca1102b855 [GPU] Support MVN cases with axis=-1 w/o decomposition (#17020) 2023-04-25 12:59:03 +04:00
Katarzyna Mitrus
0617ce9089 Set ONNX opset in Reduce ops layer tests (#17170) 2023-04-25 10:38:56 +02:00
Ilya Lavrenov
22aee08958 Revert "[CPU] Fix data race in concurrent compile_model calls (#17164)" (#17184)
This reverts commit 8879ef53a7.
2023-04-25 12:01:02 +04:00
Nikita Malinin
e37288fbcc [POT] Added inference shape for in-place statistics (#17114)
* Added inference shape for inplace statistics

* Update graph_builder
2023-04-25 11:14:34 +04:00
Vitaliy Urusovskij
5533de5dd8 Fix TSAN issue in GNA plugin (#17163) 2023-04-25 10:33:06 +04:00
Aleksandr Voron
10f53cb40b [CPU] Force NCHW layout for ACL Interpolate executor (#17121)
* fix

* fix 2nd case
2023-04-25 10:05:15 +04:00
Alexandra Sidorova
4750523c81 [Snippets][CPU][Test] Allow tokenize MHA without machine dependancy (#17064) 2023-04-25 09:40:11 +04:00
Egor Duplenskii
478725c719 [CPU] Reorganize function tests. Remove legacy bfloat16 tests (#17130) 2023-04-25 09:32:54 +04:00
Yuan Hu
e79db660ce [CPU]GroupConvolutionLayer CPU test for AMX (#13539) 2023-04-25 09:21:17 +04:00
Vladimir Paramuzov
d1f1fa2b39 [GPU] Enable broadcast transition pass (#17172) 2023-04-25 09:04:37 +04:00
Vladimir Paramuzov
3bb0fb61f6 [GPU] Support 8d tensors in activation and quantize primitives (#16947) 2023-04-25 09:02:54 +04:00
Sun Xiaoxia
6663367183 Xiaoxia/fix performance regression (#17036)
* add _streams_info_table in Executor config

* change useHyperThreading init value

* restore cmake

* fix comments

* add calling enableCpuPinning property

* fix judgment about number of sockets in init_stream

* fix test case compile issue

* fix ci test case fail issue

* modify GetPerformanceStreams calling position

* add affinity in get_cpu_pinning

* modify ecore judgement

* add no binding core on ADL

* fix ci issue, add get_num_numa_nodes()

* fix code style

* fix StreamsHasHigherPriority issue

* fix according to comments

* fix performance degression

* fix code style

* code style

* fix warning

* fix ci test failed

* fix ImportNetwork issue

* fix ci test case issue

* fix smoke_CachingSupportCase_CPU issue

* add ExportOptimalNumStreamsTest test

* modify test name

* modify ExportOptimalNumStreams test

---------

Co-authored-by: Chen Peter <peter.chen@intel.com>
2023-04-25 04:35:47 +00:00
Chen Peter
28e54e75ea Update MULTI doc per current implementation (#17045)
* Update MULTI doc per current implementation

Signed-off-by: Peter Chen <peter.chen@intel.com>

* Update the description of Multi-Device execution mode

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

* Remove sample code and video

1. Remove the sample code for removed behaviors
2. Remove the video to avoid confusion

Signed-off-by: Peter Chen <peter.chen@intel.com>

---------

Signed-off-by: Peter Chen <peter.chen@intel.com>
Co-authored-by: Karol Blaszczak <karol.blaszczak@intel.com>
2023-04-25 10:28:48 +08:00
Pawel Raasz
38a5ee719d Remove unused lambda capture (#17160) 2023-04-25 00:39:40 +00:00
Egor Duplenskii
8879ef53a7 [CPU] Fix data race in concurrent compile_model calls (#17164) 2023-04-25 00:01:03 +00:00
Anastasiia Pnevskaia
00847cba7d Fix of tf.GenericFunction conversion in convert_model() (#17125)
* Added GenericFunction support, fixed tf.Function test.

* Added test, added TF version checks.

* Small correction

* Removed Trackable type support.

* Small correction.
2023-04-24 22:57:56 +00:00
Taylor Yeonbok Lee
ce23ce00f1 [GPU] Fixed fused_primitive_desc to have -1 value for dep_start_idx (#17099)
* Fixed fused_primitive_desc to have -1 value for dep_start_idxt b

* Fixed dgpu i8 errors
2023-04-24 22:21:58 +00:00
Roman Kazantsev
3830125e3b [TF FE] Report the full list of unsupported operations (#17143) 2023-04-24 21:33:07 +00:00
Eddy Kim
d972a71b4c [GPU] Fixed the prepare_quantization pass to support grouped_weights_shape (#17093)
* fixed to support grouped_weights_shape

* added grouped_weights unit tests
2023-04-24 14:21:50 -07:00
Piotr Krzemiński
22a81e0e58 [PT FE] Enable stable tests for sort & argsort (#16415)
* [PT FE] Enable stable tests for sort & argsort

* Update test_argsort.py

* [PT FE] Update to opset11

* [PT FE] Remove redundant argument from argsort test

---------

Co-authored-by: Michal Lukaszewski <michal.lukaszewski@intel.com>
2023-04-25 01:21:16 +04:00
Maksim Kutakov
9fce01f8cc [CPU] Remove legacy dynamic batch processing from the plugin (#17052)
* Intermediate state

* Remove old dyn batch path in the new api

* Remove legacy dyn batch support

* Remove dyn batch support field from the config

* Revert changes to the common part

* Revert accidental change in the test file

* Minor fixes

* Fix support for dyn batch without setting current

* Typo fix
2023-04-25 01:18:10 +04:00
Evgenya Stepyreva
758ec32001 CVS-108963 Coverity fixes (#17161) 2023-04-25 01:03:56 +04:00
yanlan song
64b5a4595a Bell/use cpu for dynamic models (#17149)
* clean up multi code path

Signed-off-by: fishbell <bell.song@intel.com>

* clang

Signed-off-by: fishbell <bell.song@intel.com>

* potential locking issue

Signed-off-by: fishbell <bell.song@intel.com>

* remove unecessary variable

Signed-off-by: fishbell <bell.song@intel.com>

* clear redundunt return syntax

Signed-off-by: fishbell <bell.song@intel.com>

* still use cpu for dynamic models

Signed-off-by: fishbell <bell.song@intel.com>

* merge master

Signed-off-by: fishbell <bell.song@intel.com>

---------

Signed-off-by: fishbell <bell.song@intel.com>
2023-04-25 01:01:11 +04:00
Jade Cho
5c21dcec4d [GPU] Fix detection output kernel build error on dGPU (#17150)
+ Check local memory size used in the kernel and choose proper kernel.
+ 	Select DO_STAGE_0_CAFFE instead of DO_STAGE_0_CAFFE_OPT
2023-04-25 01:00:26 +04:00
Vladislav Golubev
a6b1544acf Review comments applied (#17168) 2023-04-25 00:59:03 +04:00
Mateusz Mikolajczyk
8e5b0650a0 [PT FE] Fix for prim::Constant optional or containing list of tensors (#16754)
* Fix Constant list of tensor

* Write TorchScript transformation

* Handle Optional Tensor Constants

* Improve tests

* Add comments

* Try fix flake
2023-04-24 22:56:42 +02:00
Evgenya Stepyreva
b452dab8f0 TypeRelaxed<>::clone_with_new_inputs thread safety fix (#16881)
* TypeRelaxed<>::clone_with_new_inputs thread safety fix

* Style

* Make TypeRelaxed<BaseOp>::clone_with_new_inputs copy node the same way as copy ctor of ov::Node

* Removed mutex field from intel_cpu::GraphContext

* Removed all about has_type_relaxed_ops field from the snippets subgraph

* Clonning test
2023-04-25 00:51:18 +04:00
Ilya Lavrenov
83cc2277b4 Fixed compilation with sanitizer (#17175) 2023-04-25 00:44:16 +04:00
Alina Kladieva
f39ab0dbc9 Upper-bound for patchelf (#17177) 2023-04-24 19:52:55 +02:00
Wanglei Shen
10c56708fd update auto architecture document in GitHub for 2023.0 release (#17141)
* update auto architecture doc

* update auto architecture doc

* Apply suggestions from code review

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

* update for comments

---------

Co-authored-by: Karol Blaszczak <karol.blaszczak@intel.com>
2023-04-24 15:44:34 +00:00
Tomasz Adamowicz
86ed1e93b6 [Gna] [coverity]fixes (#17122)
* [Coverity] Fix: CID 1502468 - Not restoring ostream format

* [Coverity] Fix: CID 1502524 - Dereference null return value

* [Coverity] Fix: CID 1509007 - Uncaught exception

* [Coverity] Fix: CID 1505779, 1505781, 1505783 and 1505786 - Dereference null return value

* [Coverity] Fix: CID 1502503 - Using invalid iterator

* Revert "[Coverity] Fix: CID 1502524 - Dereference null return value"

This reverts commit b605a493ae.
2023-04-24 14:04:30 +01:00
Maksim Kutakov
f8522a6ea1 [CPU] Rnn weights repacking (#16992) 2023-04-24 15:48:57 +04:00
Vladislav Golubev
f410658d32 [LPT] AddTransformation fix (#17076)
* [LPT] AddTransformation: constants on 0's input support

* AddTransformation: new test instances

* codestyle
2023-04-24 12:15:01 +01:00
Edward Shogulin
a3f14366d9 [LPT] Extending EliminateFakeQuantize transformation (two interval boundaries) (#17140)
* [LPT] EliminateFakeQuantize extending

* tests

* folding quick fix
2023-04-24 11:58:00 +01:00
Ilya Lavrenov
a34ef680f2 Made plugins.hpp generation to be CONFIG dependent (#17139) 2023-04-24 14:48:45 +04:00
Vladimir Paramuzov
faba5fb71e [Transformations] Add threshold for const comparison in Gelu fusion pass to fuse with fp16 precision (#17042) 2023-04-24 14:37:31 +04:00
Vladimir Paramuzov
e8ae1e41ea [GPU] Skip FC fake alignment for some vector by matrix multiplications (#17051) 2023-04-24 14:34:50 +04:00
dependabot[bot]
eac265722f Update networkx requirement from <=2.8.8 to <=3.1 in /tools/pot (#16745)
Updates the requirements on [networkx](https://github.com/networkx/networkx) to permit the latest version.
- [Release notes](https://github.com/networkx/networkx/releases)
- [Commits](https://github.com/networkx/networkx/compare/networkx-0.23...networkx-3.1)

---
updated-dependencies:
- dependency-name: networkx
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-24 13:37:35 +04:00
hyunback kim
63f5c2f0e7 [GPU] Fix levit-128s accuracy issue (#17136)
* [GPU] Fix levit-128s accuracy issue

Wrong batch dims for fused eltwise of gemm.
-> The issue is getting incorrect batch size of fused eltwise used by gemm.
     Its rank is different from src tensor. Eltwise tensor rank was reduced by mistake.
     It is only reproduce in batch 1 and full tensor. 
     The batch size in here means all of non spatial dims, but previous implementation was default batch dim role.

Signed-off-by: hyunback <hyunback.kim@intel.com>
2023-04-24 18:16:00 +09: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
Maxim Vafin
01065338ef Fix MO IR Reader extender for StridedSlice to support empty begin and end masks (#17019) 2023-04-24 13:08:28 +04:00
Tatiana Savina
aa5b6ecac2 DOCS shift to rst - Opset S (#17158)
* ops to rst

* fix errors

* formula fix

* change code

* console directive

* vsplit try hoghlight

* fix code snippets

* comment fixes

* fix list
2023-04-24 11:02:30 +02:00
Tatiana Savina
b3ea6ceefa DOCS shift to rst - Opset R (#17159)
* ops to rst

* sphinx transition

* try html tag

* try comment

* try code directive

* try code directive

* try highlight

* try concole directive

* try line directive

* add highlight for code

* another directive

* introduce consoke directive

* add code format
2023-04-24 11:02:09 +02:00
Fang Xu
656d7fe380 prebuilt oneTBB binaries for ARM64 (#16904)
* use oneTBB for arm64

* force THREADING=TBB

* test: remove TBB_DIR for linux arm64

* update linux and mac arm64 packages

* update SHA256

* add comment

* disable add_rpath for tbb libraries on mac arm64

---------

Co-authored-by: Chen Peter <peter.chen@intel.com>
2023-04-24 09:48:47 +04:00
Daniil Lyakhov
7997354359 POT is depricated (#16758) 2023-04-24 09:37:57 +04:00
Vladimir Paramuzov
219a0eebdc [GPU] Fix 1d onednn convolutions (#17038) 2023-04-24 09:24:56 +04:00
Min, Byungil
bb0be3c177 [GPU] Resolve failed onednn tests (#16990)
* [GPU] Resolve failed unit-tests on dGPU

+ Modified unit-tests of asymetric conv with per channel(WA for oneDNN issue)
+ Modified conv unit-tests with padded input or output
+ For testing oneDNN conv, it needs to query oneDNN about format. Applied this to conv tests.
+ Modified accuracy checking logic in unit-tests which have different format on dGPU.
+ reorder from fsv16 to bfyx should not be optimized out if not aligned by 16

Signed-off-by: Min, Byungil <byungil.min@intel.com>
2023-04-24 14:11:35 +09:00
Ilya Lavrenov
11c3623ebb Fixed compilation errors on Linux arm64 (#17138) 2023-04-23 21:34:37 +04:00
yanlan song
fed06fcb91 resubmit PR#17006 (#17137)
* clean up multi code path

Signed-off-by: fishbell <bell.song@intel.com>

* clang

Signed-off-by: fishbell <bell.song@intel.com>

* potential locking issue

Signed-off-by: fishbell <bell.song@intel.com>

* remove unecessary variable

Signed-off-by: fishbell <bell.song@intel.com>

* clear redundunt return syntax

Signed-off-by: fishbell <bell.song@intel.com>

* WR build issue on buntu 2004

Signed-off-by: fishbell <bell.song@intel.com>

---------

Signed-off-by: fishbell <bell.song@intel.com>
2023-04-23 11:56:07 +00:00
Gorokhov Dmitriy
2c450ced24 [CPU] Fixed JIT Reorder impl on Apple targets (#17134) 2023-04-23 01:09:03 +04:00
Ilya Lavrenov
26029c2d48 Enabled runtime model tests (#17131) 2023-04-22 11:07:36 +04:00
Ilya Lavrenov
462cdb54f8 Enabled convolution_backprop_quantize_type CPU tests on non-x64 (#17123) 2023-04-22 01:45:14 +04:00
Ilya Lavrenov
46f8ebfaec Revert "Fix C API unite test case error (#17012)" (#17128)
This reverts commit 63c0089128.
2023-04-22 01:44:34 +04:00
Ilya Lavrenov
fbc28297ec Enabled C-API tests on ARM platform (#17119)
* Enabled C-API tests on ARM platform

* Fixed ARM CPU plugin test on streams
2023-04-21 22:55:18 +04:00
Ilya Lavrenov
d7b775f583 Updated onednn submodule (#17126) 2023-04-21 20:47:37 +04:00
Aleksandr Voron
e31b00c299 [CPU] Enable Python test test_infer_request.test_infer_mixed_values with bool for ARM (#17111)
* Update test_infer_request.py

* enable all py tests
2023-04-21 19:52:32 +04:00
Anastasiia Pnevskaia
50a6c88ea3 Fix of crashes of convert_model() when executed for different frameworks (#16968)
* Fix of class conflicts in different frameworks.

* Remove commented code.

* Moved FakeQuantWithMinMaxVars to common part.

* Fixed BOM package test.

* Removed not needed code.

* Removed not needed code.
2023-04-21 19:29:38 +04:00
Maksim Kutakov
793bbb6ee2 Remove dyn batch support from onednn i8 ref conv (#17106) 2023-04-21 17:44:00 +04:00
Jan Iwaszkiewicz
88cb428763 [PyOV][DOCS] Added Python advanced inference documentation (#17090)
Co-authored-by: Karol Blaszczak <karol.blaszczak@intel.com>
2023-04-21 15:22:33 +02:00
Maciej Smyk
c4b155edc2 DOCS shift to rst - Opsets C (#17112) 2023-04-21 13:30:07 +02:00
yanlan song
304991f88b Revert "Clean up unused code (#17006)" (#17110)
This reverts commit 359b444558.
2023-04-21 15:26:01 +04:00
Tomasz Dołbniak
6ea9cc7149 ONNX FE - model loading fix (#17091)
* Path retrieval fix

* More detailed messages in the failing test

* Exe path with model name

---------

Co-authored-by: Michal Lukaszewski <michal.lukaszewski@intel.com>
2023-04-21 15:25:26 +04:00
Jade Cho
8fbd78fb07 [GPU] Fix a bug of fusing eltwise sum post-op. (#17078)
+ When input of eltwise is full-tensor constant layer, use binary add
instead of sum as post-op on oneDNN.
2023-04-21 20:17:35 +09:00
Nesterov Alexander
6ad80576b7 [ARM CPU] Fix smoke_if tests (#17095)
* fix smoke if

* fix smoke if - arm32

* review fix
2023-04-21 14:45:22 +04:00
HARI CHAND BALASUBRAMANIAM
6b44902bf2 Update bug.md (#16880)
Update the OpenVINO GitHub issue submission template.  To allow the submitter to provide more information when submitting an issue.
2023-04-21 02:27:39 -07:00
Sun Xiaoxia
b22d0641cb fix streams is not correct by latency mode (#17101) 2023-04-21 09:21:14 +01:00
Yury Gaydaychuk
4ae7e1ff61 [CPU] Commit slider: safe file opening (#16755) 2023-04-21 11:42:42 +04:00
Vladislav Golubev
31efdfd00d [Transformations] BroadcastTransition transformation (#16861) 2023-04-21 11:35:04 +04:00
Chen Xu
70d80a750f [CPU] Reduce node asymmetrical precision optimization (#16829) 2023-04-21 11:00:16 +04:00
Mingyu Kim
ba23e2290e [GPU] Choose onednn impl for reorder (#17077)
* [GPU] Choose onednn impl for reorder
* [GPU] Add unit test
2023-04-21 13:56:58 +09:00
yanlan song
359b444558 Clean up unused code (#17006)
* clean up multi code path

Signed-off-by: fishbell <bell.song@intel.com>

* clang

Signed-off-by: fishbell <bell.song@intel.com>

* potential locking issue

Signed-off-by: fishbell <bell.song@intel.com>

* remove unecessary variable

Signed-off-by: fishbell <bell.song@intel.com>

* clear redundunt return syntax

Signed-off-by: fishbell <bell.song@intel.com>

---------

Signed-off-by: fishbell <bell.song@intel.com>
2023-04-21 04:23:55 +00:00
Sun Xiaoxia
c186ffdf0d Xiaoxia/stream process refactor (#16692)
* add _streams_info_table in Executor config

* change useHyperThreading init value

* restore cmake

* fix comments

* add calling enableCpuPinning property

* fix judgment about number of sockets in init_stream

* fix test case compile issue

* fix ci test case fail issue

* modify GetPerformanceStreams calling position

* add affinity in get_cpu_pinning

* modify ecore judgement

* add no binding core on ADL

* fix ci issue, add get_num_numa_nodes()

* fix code style

* fix StreamsHasHigherPriority issue

* fix according to comments

* merge master

* fix build issue

* fix template plugin test case failed issue

* fix build issue

* fix cpu test failed

* Update plugin.cpp

---------

Co-authored-by: Wanglei Shen <wanglei.shen@intel.com>
2023-04-21 01:38:32 +00:00
hyunback kim
344db564fc [GPU] Fix dump graph failure issue in levit-128s model. (#17055)
* [GPU] Fix dump_graph failure issue in levit-128s model.

1. to_string() in strided_slice always access begin/end/stride param id from dependencies
    regardless of max dependencies.
2. Add an exception in dump_full_node(). It helps below.
   - Avoid a dump failure. Usually, graph dump are used during debugging,
      which reduces unnecessary debugging time due to graph dump failure.
   - You can immediately see which node has failed, making it easy to find it.

Signed-off-by: hyunback <hyunback.kim@intel.com>
2023-04-21 09:14:47 +09:00
Wanglei Shen
14d4fcf827 enable smoke_SetConfigAffinity for ARM (#17092) 2023-04-20 20:25:35 +01:00
Anastasia Kuporosova
a8b5ccc03f [PyOV] Check for glibc version in python test (#17081)
* [PyOV] Check for glibc version in python test

* fix for no glibc
2023-04-20 19:28:55 +04:00
Karol Blaszczak
0c12ee6015 [DOCS] fix for copyright and trademark glyphs (#17021) 2023-04-20 14:11:16 +02:00
Karol Blaszczak
dcfa1f6881 [DOCS] bring back conda guide 23.0 (#17031) 2023-04-20 14:09:07 +02:00
Wanglei Shen
70e0eed075 update default affinity for macOS (#17080) 2023-04-20 11:50:04 +00:00
Mateusz Bencer
77a5d1aa03 [ONNX FE] Fixed handling duplicates during graph extraction (#17071) 2023-04-20 11:10:09 +00:00
Vladislav Golubev
f100c36ac9 [LPT] Revert changes in fold_reshape (#17068) 2023-04-20 11:43:59 +01:00
Yuan Hu
e53fc86988 [CPU] [Coverity] fix Uninitialized issue in node mvn (#16980)
* fix uninit issue in node mvn

Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>

* Revert "fix uninit issue in node mvn"

This reverts commit 45e68725f3.

* fix Uninitialized issue in MVNAttrs ctor

Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>

---------

Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>
2023-04-20 12:34:49 +02:00
Yuan Hu
bef25ddf43 [CPU] resubmit pr for optimize shape infer of Reshape (#16942)
* Revert "Revert "[CPU] optimize shape infer of Reshape (#16537)" (#16703)"

This reverts commit 06cacfe2a7.

* fix reshape connext with nonzero issue

Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>

* add nonzero connect with reshape testcase

Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>

* add debug code

Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>

* fix test case issue

fix shape_nonzero testcase issue
fix a bug in origin test case

Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>

* Revert "add debug code"

This reverts commit c305464c8c.

* fix other review comments except test case

Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>

---------

Signed-off-by: Hu Yuan2 <yuan2.hu@intel.com>
2023-04-20 12:34:21 +02:00
Maksim Kutakov
70c3979602 [CPU] Execute constants in order with the create primitives calls (#16795) 2023-04-20 14:22:57 +04:00
Mikhail Ryzhov
0f7e6de346 [GNA] WA to fix config parsing of scale factor map (#17060)
* WA to fix config parsing

* clang fix

* excluded json
2023-04-20 10:51:23 +01:00
Maciej Smyk
7d574e3114 DOCS shift to rst - Opsets (#17059) 2023-04-20 10:59:35 +02:00
Maxim Vafin
552143c9cd [MO] Fix Interpolate-11 in MO (#17002)
* Fix Interpolate-11 in MO

* Add forgotten file

* Fix output type of TopK-11

* Do not force precision on port 1 for mode scales

* Update tools/mo/openvino/tools/mo/ops/interpolate.py

---------

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
Co-authored-by: Andrei Kochin <andrei.kochin@intel.com>
Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-04-20 09:51:38 +02:00
Anastasiia Pnevskaia
5026aa044a Removed naming of inputs in MO Python API PyTorch tests. (#17070)
* Removed naming of inputs in MO Python API PyTorch tests.

* Fixed coping of data.

* Small correction.

* Small correction.

* Small fix.
2023-04-20 11:49:45 +04:00
Marcin Kusmierski
4e6a129672 [GNA] Fix tests configuration to ensure that 3_5 target is tested too (#17046) 2023-04-20 09:18:36 +02:00
Nesterov Alexander
d00731c0ab [ARM CPU] Fix tests for eltwise layer (#16917) 2023-04-20 09:57:29 +04:00
Taylor Yeonbok Lee
5bded05ae6 [GPU] Improve shape infer performance (#17039)
* [Dynamic shape] Improve shape infer performance for igpu by preventing copy from usm_device to usm host from lock()

* Fixed is_shape_infer_dep to use pointer instead of unique_id becuase unique_id may not be set
2023-04-20 03:23:52 +00:00
Tomasz Dołbniak
1bd9a1e01c Passing tests re-enabled (#17067) 2023-04-20 01:55:42 +01:00
Ekaterina Aidova
f9fbcbe419 update omz submodule (#16986) 2023-04-20 03:53:39 +04:00
Ilya Churaev
71880aadd3 Deprecate set batch method (#17057)
* Deprecate set batch method

* Fixed some errors

* Suppress warning in tests

* Fixed warning in GPU

* Deprecate python
2023-04-19 20:21:18 +00:00
Ilya Lavrenov
1ec22a3180 32 bits support in Intel CPU plugin (#16900) 2023-04-19 22:10:20 +04:00
Eddy Kim
fab8236af3 [GPU] Fixed OneDNN fc+sum fusion serialization (#16988)
* fixed onednn fc+sum fusion serialization

* removed the white list for sum post op fusion

* added deconv fusing caching tests
2023-04-19 09:43:27 -07:00
Pawel Raasz
4c3a4a8992 Correct inf bound check for 32-bit in shape infer (#17047) 2023-04-19 19:33:01 +04:00
Nesterov Alexander
3d33cb2b43 [ARM CPU] Fix eltwise op tests (Divide) (#17029)
* update skip list

* skip change

* fix divide

* review fixes

* review fixes #2
2023-04-19 18:52:09 +04:00
Egor Duplenskii
39f843fb78 [CPU] Move to oneDNN 3.1 release version (#16721) 2023-04-19 18:26:30 +04:00
Tomasz Dołbniak
d230ad9313 Interpolate op cleanup (#17026) 2023-04-19 15:47:29 +02:00
Evgenya Stepyreva
497a19edf6 CVS-102308 Read tflite model to vector (#17048) 2023-04-19 13:27:41 +00:00
Pawel Raasz
d7083fb4db Improve slice and strided slice shape inference (#16940)
when start, stop are interval values
2023-04-19 16:20:29 +04:00
Vitaliy Urusovskij
a611104b12 FQ tests leftovers (#17009)
* Try to return skipped test after FQ fix

* Copy FQ broadcast case from CPU to TEMPL tests

---------

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
2023-04-19 12:32:44 +01:00
Tatiana Savina
921bebc1ec change ov version (#17056) 2023-04-19 11:28:41 +00:00
Mateusz Tabaka
7338257e00 Fix transformations tests on 32 bit build (#17043)
Ticket: 104593
2023-04-19 11:28:00 +00:00
Artyom Anokhov
bb6a3251a8 README.md: Added Conda Budge (#17025)
* README.md: Added Conda Budge

* README: Moved Conda badge after PyPI status
2023-04-19 12:35:31 +02:00
Egor Duplenskii
4ce5548c9a [GNA] fix compilation warning (#17027)
Which becomes error with '-Werror'
2023-04-19 10:00:24 +00:00
Marcin Kusmierski
90b485715a [GNA] Fix tests failing due to dependency to CI environment state (#17007) 2023-04-19 11:42:15 +02:00
Vladislav Golubev
00a4fc514c Review comments applied (#16856) 2023-04-19 10:11:47 +01:00
Szymon Irzabek
a8c7c19cb9 [GNA] Fix channel multiplier calculation (#17010) 2023-04-19 11:01:27 +02:00
Xuejun Zhai
63c0089128 Fix C API unite test case error (#17012)
* Fix C API unite test case error

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

* Fix test error with relative path

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

---------

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>
Co-authored-by: River Li <river.li@intel.com>
2023-04-19 11:26:12 +04:00
Chenhu Wang
34b3abc0e2 [CPU][Snippets]fix candidate merged node's subgraph inputs have common subgraph input (#16249) 2023-04-19 11:12:52 +04:00
Tingqian Li
1525f6cc16 [CPU] WA: Stop fusing per-OC eltwise into Matmul with input rank >4 (#16824) 2023-04-19 11:11:04 +04:00
Vladimir Paramuzov
dbd20ec799 [GPU] Added try/catch for device detection loop to skip platforms which throw an exception (#17011) 2023-04-19 11:05:24 +04:00
Chenhu Wang
498486588e [CPU]interpolate-11 support (#16698) 2023-04-19 11:05:09 +04:00
Ilya Churaev
ca0b30c082 Added components relationships on architecture page (#17037) 2023-04-19 10:51:23 +04:00
Shen, Wanglei
626caf7f2a update file location for 2023.0 release (#17034) 2023-04-19 10:38:23 +04:00
Wilson Seok
2401b0aa3c [GPU] Skip reorder_node_to_split to avoid change of input data type for ondenn kernel support (#16827)
* skip reorder_node_to_split when new input data type of onednn kernel is not supported
* update layout_optimizer and add unit test
2023-04-19 15:00:55 +09:00
Marcin Kusmierski
1281074e15 [GNA] Fix for GNA 3_5 fixing tests after review (#16954)
* [GNA] Fix review comments for Conovolution2DLayer tests

* [GNA] fix review comments for smoke_ConvolutionPoolingStrideNotEqualWindowTest_Above

* [GNA] Fix review comments to GNAPWLExtraSegmentsTestFixture

* [GNA] Fix review comments to smoke_LSTMCellBasicCommon
2023-04-19 07:31:34 +02:00
Kelvin Choi
bd8ca523b9 [GPU] Fix proposal sort condition (#16981) 2023-04-18 21:05:32 -07:00
Ilya Lavrenov
3ad3a90e98 Enabled several arm64 tests (#17032) 2023-04-19 02:35:32 +04:00
Anastasia Kuporosova
9f250edc7f [PyOV] use generator is multi config (#17004)
* [PyOV]- use generator is multi config

* use ov

---------

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
2023-04-18 22:04:22 +00:00
Maksim Kutakov
38d97709d1 [CPU] Remove allocation by the upper bound (#16666) 2023-04-19 00:25:58 +04:00
Maksim Kutakov
531b5a3657 [CPU] Optimize TBB usage in the parallel dynamic shapes processing (#16517) 2023-04-19 00:25:03 +04:00
Aleksandr Voron
d4ac0b0e79 MultipleLSTMCellTest fix (#17015) 2023-04-18 23:27:45 +04:00
Anastasiia Pnevskaia
078f28911b Fixed parsing of 'layout' param (#16999)
* Fixed layout parsing.

* Small correction.

* Removed wrong change.
2023-04-18 22:43:38 +04:00
Roman Kazantsev
e93c8e1b1c [TF FE] Skip one Keras ConvLSTM2D test (#17028)
* [TF FE] Mark one Keras ConvLSTM2D test with xfail

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

* Change to skip

---------

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
2023-04-18 22:28:30 +04:00
Ilya Lavrenov
d5cc696e00 Removed contrib repo usage from Linux ARM64 Azure Pipeline (#17016)
* Removed contrib repo usage from Linux ARM64

* Removed contrib repo usage from Linux ARM64
2023-04-18 21:33:49 +04:00
Ilya Churaev
566ef01a3f Remove constructors for ov Exceptions (#16938)
* Remove constructors for ov Exceptions

* Fixed linux build

* Fixed ONNX Frontend

* Fixed paddle

* Fixed exceptions in tests

* Deprecate constructors for ov::Exception

* Suppress some warnings

* Merge several exceptions

* Some small changes

* Suppress more warnings

* More warnings

* mode warnings

* Suppress more warnings

* More warnings
2023-04-18 21:02:26 +04:00
Mateusz Mikolajczyk
441dad2eea Fix bug with reshape on empty tensor (#17014)
* Fix empty tensor reshape

* Add test
2023-04-18 20:56:03 +04:00
Vladislav Golubev
e6341917cd [LPT] PullReshapeThroughDequantization transformation fix (#16395)
* PullReshapeThroughDequantization fix

* Added a test-case
2023-04-18 15:22:31 +01:00
Katarzyna Mitrus
2a5c69abc6 [ONNX FE] Fix ONNX DequantizeLinear-13 import dynamic shape (#16966) 2023-04-18 13:03:55 +02:00
Marcin Kusmierski
d5123056bb [GNA] Fix issues with GNA 3.5 - Fix pooling for Convolution1D and Convolution2D (#16734)
* [GNA] Fix 1D Pooling realized as part of 2D Convolution

* [GNA] Fix pooling for GNA_SW_FP32 mode when fused with Convolution2d

* [GNA] Fix ConvolutionPoolingStrideNotEqualWindowTest tests for 3_5
2023-04-18 11:41:04 +02:00
Tatiana Savina
e3fdfc4e09 DOCS shift to rst Plugin updated (#17000)
* shift to rst

* test snippets

* test build fixes

* change code block

* test new path

* change path

* add cancel

* change note format

* add docs

* change path to snippet

* change path to snippet

* change list format

* fix list

* fix snippets path

* fix format

* fix lists

* fix snippet

* compiled model doc fix

* change indentation

* small fixes to format
2023-04-18 10:59:15 +02:00
Mikhail Ryzhov
f97eeb59d5 [GNA] Fixed cases when FQ is not the 1st layer (#16602)
* Fixed cases when FQ is not the 1st layer

* clang formatted

* Added support of Gather
2023-04-18 10:43:31 +02: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
Pawel Raasz
3494edeed2 Fix Cast util functor when cast from floating point to integer (#16959)
* Fix cast to helper from floating point to integer
when floating value is out-of-range of integer

* Fix negative float cast if outside integer range
2023-04-18 07:29:31 +04:00
Min, Byungil
bf2870a63b [GPU] Resolved failed unit-tests (#16618)
+ Resolved issues related to deconv
+ Modified test-cases for conv, fc.
+ In fc unit-tests, tiny tensors showed unexpected behavior. Modified tensor size a little
+ Bugfix in get_test_stream

Signed-off-by: Min, Byungil <byungil.min@intel.com>
2023-04-18 11:22:43 +09:00
Ilya Lavrenov
d15cdc81cd Fixed multi-config generators (#17003) 2023-04-18 02:44:38 +04:00
Shen, Wanglei
3f9cc0112a Hot Fix: using all small core as Ecore (#16978)
* using all small core as Ecore

* add test case
2023-04-18 00:06:36 +04:00
Ilya Lavrenov
adc733f1e9 Enabled several ARM CPU tests (#16995)
* Enabled several ARM CPU tests

* Removed not-valid tests

* Fixed several template plugin tests

* Removed non-working suppressions

* Disabled 2 tests on ARM CPU
2023-04-17 22:44:43 +04:00
Egor Duplenskii
e52445dda4 [CPU] Clean up temporary debug toggles (#16972) 2023-04-17 22:00:37 +04:00
Sofya Balandina
c14d0d7389 [conformance] Fix itaration of ops_list when recalculating tests counters (#16993) 2023-04-17 21:57:56 +04:00
Roman Kazantsev
ae06322cb7 [TF FE] Correct layer test for ConvLSTM2D and add to the pre-commit (#16996) 2023-04-17 17:54:19 +00:00
Mikhail Ryzhov
14f38bfde8 [GNA] Reverted internal overload correction (#16962)
* reverted overload correction

* added comment

* Enabled tests

* Revert merge error

This reverts commit daed290452.
2023-04-17 17:39:58 +00:00
Ivan Tikhonov
930441b223 TransposeSinking: Gather and ReverseSequence (#16532)
* Resolve the performance issues in TransposeSinking transformation

* codestyle

* fix warning as error, fix tests failures

* fix ts for Concat and Reduce

* Fix TransposeReduceBackward

* fix the issue in TransposeFuse transformation

* fix TransposeReduce transformations

* Fix TransposeReduction, fix TransposeSinkingSplit, add unsqueeze support

* delete debug print

* Add additional validations

* fix node validation

* Fix validate for split, revert changes for concat, add BatchToSpace/SpaceToBatch

* Add SpaceToBatch/BatchToSpace

* fix TS for Interpolate + codestyle

* fix gna build

* Support TS for Interpolate, VariadicSplit, IsInf, IsNan, IsFinite + refactoring

* add the missed line

* add include

* TransposeSinking tests refactoring: part1

* TransposeSinking tests refactoring: part2

* Add limited support for StridedSlice op

* codestye

* TransposeReduction: skip the case when 2nd input for Squeeze is not provided

* Transpose sinking tests refactoring: part 3. + Revert changes in MOC.

* fix build

* codestyle

* Add tests for TS backward transformations, update TransposeSinkingFuse transformation, delete StridedSlice transformation prototype + tests refactoring

* fix unary tests

* Fix warning as error on Windows

* Add new tests for Unsqueeze/Squeeze; refactoring; remove debug code

* TransposeSinking: add support for Slice op

* Add descriptions to the transformations, add additional checks

* fix a warning

* TransposeSinking Rafactoring part2: move the transformations to a separate folder, align namespaces

* TransposeSinking refactoring: class names, namespaces

* codestyle

* resolve merge conflicts

* codestyle

* TSReduction refactoring, move Unsqueeze/Squeeze transformations to separate files, added limited support for Reshape op + tests

* fix minor mistakes

* fix warnings

* Added TSSlice transformation to TSGeneral, created TransposeSinkingGeneral alias in ov::pass namespace

* refactoring

* codestyle

* fix TSSqueeze/TSUnsqueeze transformations

* delete debug serialize

* remove TransposeSinking from MOC

* fix TSSqueeze/TSUnsqueeze transformations in case of Reshape op

* delete debug code

* fix unit tests, revert changes for TSSlice transformation

* TransposeSinking: Add gather support

* TransposeSinking: add support for Gather, ReverseSequence ops; Fix TSReduction, TSSqueeze, TSUnsqueeze transformations

* fix new constants shape

* fix TSReduction, TSSqueeze, TSUnsqueeze transformations; codestyle

* fix TSGather

* Fix TSGather transformation, add tests

* Updated TSGather transformation, updated the tests

* fix TSGather, codestyle

* Add missing files for TS testing

* fix TS for ReverseSequence op; codestyle

* revert local changes

* fix warnings

* delete const folding passes

* disable constant folding for shapeOf subgraph only

* correct thirdparty versions

* codestyle
2023-04-17 16:38:48 +00:00
Ilya Lavrenov
f4fe8400a7 Generic ARM fixes (#16994) 2023-04-17 20:37:10 +04:00
Anastasia Kuporosova
f9098cd67c [PyOV] Mark add_openvnio_libs as internal (#16971)
* [PyOV] Mark add_openvnio_libs as internal

* fix flake8
2023-04-17 17:34:13 +01:00
Vitaliy Urusovskij
47f0d72f02 Fix broadcasting issue in FQ ref implementation (#16812) 2023-04-17 20:33:07 +04:00
Aleksandr Voron
496a608a28 [CPU] ReduceMean fix for ACL Executor (#16987)
* reduce fix

* enable gru, rnn and lstm tests
2023-04-17 19:17:50 +04:00
Karol Blaszczak
1471a6e8de [DOCS] benchmarks new page (#16620) 2023-04-17 16:43:57 +02:00
Ilya Churaev
25826bfe7d Added deprecation of nv12 legacy API (#16982)
* Added deprecation of nv12 legacy API

* Added new files

* Change macros

* Suppress warnings for preprocessing

* Suppress warnings in tests

* Suppress warnings for Windows
2023-04-17 14:13:43 +00:00
Anastasiia Pnevskaia
dc2fa65224 Support of unnamed saved_model_dir in MO Python API (#16542)
* Added support of unnamed saved_model_dir.

* Switch TF2 layer tests for unnamed saved_model_dir.

* Added test.

* Correction of comment.

* Removed unnecessary pytest mark.

* Code correction, added comment.
2023-04-17 17:20:27 +04:00
Ilya Lavrenov
4a997de4a3 Disabled failed ARM CPU tests (#16989) 2023-04-17 15:34:56 +04:00
Shen, Wanglei
98393c0da1 update number of threads per stream on Ecore to 2 for aggressive model on hybrid platform (#16857)
* update number of threads per stream on Ecore to 2 when  aggressive model run on hybrid platform

* update for corner case and add test case
2023-04-17 18:42:55 +08:00
Jan Iwaszkiewicz
816c0f76e2 [PyOV] Deprecate PerformanceMode.UNDEFINED and refactor deprecation (#16965) 2023-04-17 12:38:28 +02:00
bstankix
7c41d78b5d Add OVMS benchmarks (#16984)
* Add ovms support for Graph Builder

* Add new OVMS dataset
2023-04-17 12:27:58 +02:00
Katarzyna Mitrus
834e611bde [Interpolate-11] Additional tests for Interpolate-11 reference implementation (#16956)
* bf precision tests

* i32 prec tests

* Default axes test

* Add f16 prec tests

* i8 prec tests

* Update eval types in the new file
2023-04-17 11:39:09 +02:00
Przemyslaw Wysocki
9ca85eb363 [PyOV] Update docs with Python 3.11 (#16366) 2023-04-17 11:33:15 +02:00
Przemyslaw Wysocki
d72d833a96 [PyOV] Enable Python 3.11 (#15144)
* Bump ONNX version

* Bump protobuf

* Add xfails and skips

* Add tickets

* Skip ONNX Serialization tests

* Compile ONNX with C++17

* Force cpp17 - 2

* Use MSVC check

* Relax python reqs, enable 311 in azure

* Fix setupvars error

* Ignore watchdog error

* Update tensorflow

* Minor change

* Bump onnx to 1.13.1

* Bump protobuf to 3.20.3

* Debug test tf

* Xfail tests in comp

* Update comp tests

* Update tf reqs

* Remove deprecated ONNX function

* Align PDPD FE protobuf req with 2.4.1

* Satisfy dependency review

* Attempt to fix dependency review

* Revert pdpd protobuf

* Skip pdpd tests

* Fix MO-TF-PB test

* Skip TF test case

* Enable py311 on rest of jobs

* Try disabling pdpd req

* Exclude pdpd form cmake

* Update .ci/azure/linux.yml

Fixed unmerged merge-conflict

* CR

* Fix reqs

* Skip pdpd tests

* Disable pdpd tests building in cmake

* Skip another pdpd cmake

* Add file

* Add paddle constraint to tests

* Disable paddle reqs

* Debug prints

* Skip TF test if Python ver is 3.11

* Apply Mish cr comments

* Debug

* Debug

* Constrain tensorflow_addons

* Fix pdpd skipping

* Add debug prints

* Update skips

* Remove prints

* Minor change

* Update OMZ commit

* Fix some tests

* Minor change

* Disable pdpd at all

* Disable pdpd at all

---------

Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
2023-04-17 13:30:17 +04:00
Wang Wangwang
589bd6d076 Add the implementation to GetExecGraphInfo API in AUTO plugin (#16979) 2023-04-17 17:24:07 +08:00
Ilya Churaev
aa1f26a2b7 Enable more tests for Template plugin (#16874)
* Enable more tests for Template plugin

* Removed deprecated API

* Fixed typo

* Added internal properties

* Removed incorrect tests

* Fixed code style

* Enabled some tests
2023-04-17 07:07:09 +00:00
Andrew Kwangwoong Park
7282728cec [GPU] Fix incomplete condition for NMS shape inference (#16960)
Signed-off-by: Andrew Park <andrew.park@intel.com>
2023-04-16 22:41:57 -07:00
Eddy Kim
9b9c31d46b [GPU] Updated to allocate memory in order of size while deserializing (#16867)
* updated to allocate memory in order of size while deserializing

* fix windows build error

* updated to check dependencies between not connected nodes
2023-04-16 22:33:57 -07:00
Egor Duplenskii
175db3523a [CPU] Add few tests to smoke scope (#16963) 2023-04-17 09:04:57 +04:00
Taylor Yeonbok Lee
c96a5c4b70 Fix prepare padding which was not handling group size properly (#16977) 2023-04-16 21:42:03 -07:00
Ilya Lavrenov
31398bb3eb Fixed deprecated API warnings (#16949) 2023-04-17 07:19:53 +04:00
Roman Kazantsev
18da874c57 [MO] Remove use of mapping file and its generation (#16944)
* [MO] Remove use of mapping file and its generation

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

* Fix pylinter findings

* Remove usage of mapping file in the layer tests

* Fixing layer tests for legacy frontend

---------

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
2023-04-15 10:38:33 +00:00
Andrew Kwangwoong Park
507b3251ef [GPU] Fix to skip reorder optimization during post_optimize_graph phase (#16908)
* [GPU] Fix to skip reorder optimization during post_optimize_graph phase

Signed-off-by: Andrew Park <andrew.park@intel.com>

* Apply comment

Signed-off-by: Andrew Park <andrew.park@intel.com>

* update condition to check empty padding

Signed-off-by: Andrew Park <andrew.park@intel.com>

* add condition to check batch size

Signed-off-by: Andrew Park <andrew.park@intel.com>

---------

Signed-off-by: Andrew Park <andrew.park@intel.com>
2023-04-15 02:24:06 +00:00
Taylor Yeonbok Lee
824a5aa7fb [GPU] Fix nonzero issue in constant propagate (#16933)
* Fix gather_nonzero not to be marked as constant.
Even though count nonzero is to be turned into a constant, gather nonzero still cannot infer shape at the moment of propagate constant.

* Apply the fix only for gather_non_zero
2023-04-14 23:16:34 +00:00
Sofya Balandina
9f3bc22e7a [apiConformance] Refactoor core_integration.cpp (#16416) 2023-04-14 23:15:41 +00:00
Roman Kazantsev
4ba0ac5476 [MO][TF FE] Support delayed batch setting (#16937)
* [TF FE] Support delayed batch setting

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

* Cover BOM list

* Add unit-tests for batch setting with layout

* Apply code-review: check batch size

* Apply code-review: default index for any dimension

---------

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
2023-04-14 22:35:43 +00:00
Edward Shogulin
8bdc5bc85f [LPT] Support ONNX quantized models coming from ORT PTQ (#14811)
* [LPT] FakeQuantize fuse

* GPU & CPU tests alignment

* refactoring & comments

* doc quick fix

* quick fix
2023-04-14 21:22:55 +00:00
Ilya Lavrenov
de2e9faa58 Corrected pattern for Linux ARm64 tests disablement 2023-04-14 22:28:58 +04:00
Gorokhov Dmitriy
cc6fd80d0a [CPU] Fixed Softmax and TopK nodes initilization for ARM devices (#16950) 2023-04-14 22:13:42 +04:00
Oleg Pipikin
7ce40996e5 Fix copy constructor and assignment for ov::Any (#16757)
* Fix copy constructor and assignment for ov::Any

* Fix1

* Apply comments

* Add test

* Fix code style

* Fix2

* Fix3
2023-04-14 22:12:18 +04:00
Aleksandr Voron
dc941f69ae fix (#16969) 2023-04-14 22:09:50 +04:00
Aleksandr Voron
fe98b8ee13 reduce 6d+ fix (#16931) 2023-04-14 22:09:22 +04:00
Ilya Lavrenov
df5ada8b19 Skipped failed tests on Linux ARM64 (#16970) 2023-04-14 21:56:28 +04:00
Liubov Talamanova
0c0aa5c997 [POT] Fix POT CI (#16955) 2023-04-14 17:21:01 +00:00
Tomasz Jankowski
129670ab1e [Transformations] Fix Parameter name override while removing Select node (#16934)
Details:
Applies valid node replacement method which avoids Parameter name override

Tickets: 101209

Co-authored-by: Ivan Tikhonov <ivan.tikhonov@intel.com>
2023-04-14 18:36:25 +02:00
Sun Xiaoxia
25058da48f Hot Fix: threading is disable with "threading=omp" (#16923)
* fix omp threading disable

* the divisor and dividend are reversed
2023-04-14 20:24:28 +04:00
Ilya Lavrenov
f5c2db73d5 Moved heavy OVInferConsistencyTest tests to nightly (#16967) 2023-04-14 20:02:06 +04:00
Anastasiia Pnevskaia
24c9d95779 Support of unnamed input for MO Python API. (#16373)
* Support of unnamed input for MO Python API.

* Code correction, tests fix.

* Small fix.

* Added tests for unnamed input, code fixes.

* Small code correction.

* Removed code comment.

* Added tests, fixed bugs.

* Minor corrections, added comments.

* Code refactoring.

* Added defaults for InputCutInfo.

* Fixed error.

* Small fixes.

* Removed wrong change.

* Fixed error.

* Corrected input description.
2023-04-14 19:37:46 +04:00
Irina Efode
ae34720818 [CONFORMANCE] Add check devices in parallelization over devices (#16964)
* [CONFORMANCE] Add check devices in parallelization over devices

* Remove extra
2023-04-14 15:50:35 +01:00
Vladimir Paramuzov
231569db16 [GPU] Fix group axis value for blocking desc (#16936) 2023-04-14 14:42:21 +00:00
Tatiana Savina
cf12f92fae DOCS shift to rst - IR articles (#16437)
* add IR documentation
2023-04-14 14:11:00 +00:00
Tatiana Savina
9e5be9ad24 DOCS shift to rst Advanced topics (#16454) 2023-04-14 16:06:59 +02:00
Ilya Lavrenov
9b38e5168f Updated oneDNN to fix crash on aarch64 Linux (#16961) 2023-04-14 17:49:21 +04:00
Irina Efode
d07fa6f80e [CONFORMANCE] Fix Opset filters (#16928)
* [CONFORMANCE] Fix filters related to opsets

* fix

* Fix op_summary

* Update op_summary.cpp

* fix

* fix
2023-04-14 17:42:42 +04:00
Irina Efode
fd824cf036 [CONFORMANCE] Correct passrate when added skipped tests (#16844)
* init

* Refactor

* Static and dynamic approach

* next

* fix

* small fixes

* fix
2023-04-14 17:00:19 +04:00
Ilya Lavrenov
b9f82e37b9 Removed WAs from packaging scripts related to old ARM plugin (#16952) 2023-04-14 16:17:12 +04:00
Vitaliy Urusovskij
04a4971481 Small docs fixes (#16945) 2023-04-14 15:14:48 +04:00
Aleksandr Voron
2c7cbdb293 [TEMPLATE] Skip TopK tests for ARM (#16946)
* skip topk tests for arm

* changed macros

* added include
2023-04-14 14:50:10 +04:00
Marcin Kusmierski
d6f7e5e84d [GNA] Fix UT for adding extra segments to PWL-s after convolution (#16732) 2023-04-14 11:25:10 +02:00
Maciej Kwapulinski
435a79a2a3 Fix stride height setting in input_conv test (#16813) 2023-04-14 08:53:24 +02:00
Marcin Kusmierski
67aa807892 Fix smoke_LSTMCellBasicCommon for GNA 3.5 (#16924) 2023-04-14 08:43:30 +02:00
Egor Duplenskii
e98bd0dae4 [CPU] Correct crop in FQ optimized formula (#16887) 2023-04-14 10:43:05 +04:00
Michael Frank Hansen
a7228534af DOCS Adding results for RPL-S (#16862)
* Adding results for RPL-S
* Create OVMS-benchmark-data.csv
2023-04-14 08:01:59 +02:00
Aleksandr Voron
55fa8da5e4 [CPU] MVN 1D fix in ACL Executor (#16930) 2023-04-14 10:00:20 +04:00
Xuejun Zhai
802742e59f split evaluate_map.cpp to small files (#16216)
* Split evaluate_map.cpp

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

* Fix compiler error

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

* Fix CI build error

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

* Fix CI build error

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

* Fix CI build error

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

* Fix CI format issues

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

* Fix CI format issues

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

* Fix CI format issues

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

* Fix CI format issues

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

* Add op v7::Gelu

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>

---------

Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>
2023-04-14 06:57:19 +04:00
Pavel Esir
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
Ilya Lavrenov
de8f34c8f0 Fixed plugin name in tests for ARM CPU (#16932) 2023-04-13 22:35:21 +04:00
Ilya Lavrenov
85f9d1392c Used cmake interface in ARM compute (#16929) 2023-04-13 22:35:03 +04:00
Luwei Zhou
6aeb054e48 [CPU] Use ONEDNN3.x weight/dest scale API to optimize perf (#16805)
* [LPT][CPU] Added callback for AddTransformation

* [WIP] Convolution scales fusion

* Force to use weight sclae to test performance.

* Update on interface.

* Use weight scale to adapt to ONEDNN 3.x API changes.

* Update the code.

* Update ONEDNN fix for gemm_x8s8s32x_conv kernel

* Fix the bug in ONEDNN and deconvFusingScale.

* Fuse FC Bias when having DQscale.

* WR to perf regression on

* Update onednn version.

* Fix bug and clean code.

* FC fusing dq scale bug fix.

* Add more comments and debug information.

* Fix CI issues.

* Merge ONEDNN changes.

* Fix CI issues and bugs.

* Apply review comments.

* Update comments.

* Apply reveiw comments.

* Avoid using LPT BiasAttribute RTInfo.

* Applied review comments.

---------

Co-authored-by: Vladislav Golubev <vladislav.golubev@intel.com>
2023-04-13 19:02:48 +02:00
Maxim Vafin
25015f9790 [PT FE] Support prim::DictConstruct on the output (#16894)
* Support dict on the output

* Preserve output order
2023-04-13 16:42:17 +00:00
Aleksandr Voron
0426c645eb Fix for ambiguous overloaded function call (#16927)
* fix

* change type to unsigned long long
2023-04-13 19:28:30 +04:00
Shen, Wanglei
3461064507 update benchmark_app to remove setting UNDEFINED with -hint none (#16695)
* Remove setting ov::hint::PerformanceMode::UNDEFINED from benchmark_app

* update benchmark_app

* update python code and description

* update python code

* fix code style issue

* update python code

* update c++ app
2023-04-13 14:29:13 +00:00
Maxim Vafin
c592ecd44e [MO] Fix legacy If (#16613)
* Fix legacy If

* Add test for If op

* Small fix
2023-04-13 18:10:40 +04:00
bstankix
5795a50a22 [docs] Update switchers 5 (#16925) 2023-04-13 16:07:53 +02:00
Egor Duplenskii
a016e4e6bb [IE_TESTS] Avoid any extra work for the skipped tests (#16915)
i.e. do not clone the function if it is unnecessary
2023-04-13 13:23:38 +00:00
Vladimir Paramuzov
5299f26168 [GPU] Handle unsupported eltwise fusion for onednn gemm in dynamic cases (#16875)
* [GPU] Handle unsupported eltwise fusion for onednn gemm in dynamic cases

* Update src/plugins/intel_gpu/tests/fusions/gemm_fusion_test.cpp

Co-authored-by: Sergey Shlyapnikov <Sergeishlyapnikov@gmail.com>

---------

Co-authored-by: Sergey Shlyapnikov <Sergeishlyapnikov@gmail.com>
2023-04-13 15:55:44 +04:00
Roman Lyamin
656428bc4f [GPU] Skip kernel logic for Concat fix (#16885) 2023-04-13 15:55:05 +04:00
Min, Byungil
da7ee613a3 [GPU] Disable oneDNN failed TCs on dGPU (#16853)
Signed-off-by: Min, Byungil <byungil.min@intel.com>
2023-04-13 20:41:29 +09:00
Taylor Yeonbok Lee
df6557cfad [GPI]Fixed not to allocate internal buffer with size 0 (#16899)
* Fixed not to allocate internal buffer with size 0

* Fixed unittest failure
2023-04-13 10:32:12 +00:00
Ilya Churaev
f70954bda9 Fixed build for macOS with LLVM from brew (#16907) 2023-04-13 10:20:30 +00:00
Ilya Churaev
ad2dc4d479 Fixed ARM CPU tests. (#16910)
* Use name from OUTPUT_NAME property

* Fixed plugins without OUTPUT_NAME
2023-04-13 13:29:42 +04:00
Karol Blaszczak
7782d85b26 [DOCS] model caching update to GPU (#16909)
Update GPU.md
Update Model_caching_overview.md

Co-authored-by: Eddy Kim <eddy.kim@intel.com>
2023-04-13 11:09:16 +02:00
Mateusz Tabaka
5d80bca16e [TF frontend] Add test for Split->Conv->Concat scenario (#16816) 2023-04-13 10:42:17 +02:00
Jan Iwaszkiewicz
63c5be3ed2 [PyOV] Fix models checking and ensure correct destructor calls in tests (#16814) 2023-04-13 10:37:05 +02:00
Gorokhov Dmitriy
ae350c7107 [CPU] Fixed unused-private-field compilation errors (#16905) 2023-04-13 12:20:18 +04:00
Anastasiia Pnevskaia
4921d1ad28 Fix for slowdown of convert_model() after multiple runs (#16751)
* Used singleton class for version check.

* Moved VersionChecker to utitl/version.py, added tests.

* Minor corrections.

* Sort imports.

* Small correction.

* Small correction.
2023-04-13 11:59:11 +04:00
Nikolay Shchegolev
061ba1d773 [CPU] Convert i64->i32 for Reference node. (#16797) 2023-04-13 11:55:53 +04:00
Xuejun Zhai
e238bfc1d0 Fix C API test failed with debug version on Windows & MacOS (#16903)
Signed-off-by: Zhai, Xuejun <xuejun.zhai@intel.com>
2023-04-13 10:59:42 +04:00
Wang Wangwang
1037f24c46 [AUTO] Remove exclusive_asyc_requests property from AUTO plugin (#16840)
* Remove exclusive_asyc_requests property from AUTO plugin

* Update test case

* Add test case to test incorrect config

* Remove the test case related to exclusive_asyc_requests property of AUTO plugin
2023-04-13 06:35:42 +00:00
Vladimir Paramuzov
67c07ccebe [GPU] Support 7D and 8D tensors (#16810) 2023-04-13 09:04:14 +04:00
Tomasz Dołbniak
dcf6fb1e1a Allow stable sort in TopK when sorting by indices (#16811)
* Allow stable sort in TopK when sorting by indices

* Clarification of stable sorting by index and unblocked test

* XFAIL the test again

* Clarification of sorting by indices

* Revert of changes in previous versions op TopK (spec)
2023-04-13 05:26:01 +02:00
Vladislav Golubev
9c6d287a58 [LPT] GroupConvolution plugin tests: test class corrected to restore behavior in arm plugin instances (#16883)
* [LPT] GroupConvolution plugin tests: restored test params default values

* return FQOnData shape automatic generation
2023-04-13 01:41:44 +01:00
Min, Byungil
1ba87971d1 [GPU] fix unit-test seg fault error on dGPU (#16879)
Signed-off-by: Min, Byungil <byungil.min@intel.com>
2023-04-13 09:20:06 +09:00
Aleksandr Voron
73be9d31b6 Skip CPU tests on ARM platform (#16891)
* [CPU] ARM architecture support

This patch extends existing CPU plugin capabilities with ARM CPUs optimized support

* Fixed undefined reference in unit tests

* refactoring

* Fixed Eltwise node behavior for ARM

* init commit

* tests passed

* fix skip failures

* Apply suggestions from code review

---------

Co-authored-by: dmitrygo <dmitry.gorokhov@intel.com>
Co-authored-by: Ilya Lavrenov <ilya.lavrenov@intel.com>
2023-04-13 02:34:36 +04:00
Ilya Lavrenov
86142b0f4b Fixed compilation with gcc-12 (#16895) 2023-04-13 02:24:19 +04:00
Maciej Kwapulinski
0e975ffbb6 [GNA] smoke_MemoryTest suite enabled for transformation=NONE (#16481)
* relative threshold for smoke_MemoryTest suite adjusted for GNA

* smoke_MemoryTest suite enabled

* GNA MemoryTest. TransformNone: input changed to [5-10]. TransformLatency is disabled.

* RR comments applied

* RR2 comments applied

* RR3 comments applied

* clang-format-9 fix

* RR4 comments applied
2023-04-12 21:16:08 +00:00
Karol Blaszczak
65a49e903c Update prerelease_information.md (#16898) 2023-04-12 20:04:25 +00:00
Ilya Lavrenov
418f70abb0 Improvements related to arm support (#16892) 2023-04-12 23:02:57 +04:00
Taylor Yeonbok Lee
bee357bcf8 Fix softmax perf of stable diffusion (#16869) 2023-04-12 12:01:31 -07:00
Ilya Lavrenov
298bf15a1b Debian / RPM changes for ARM CPU plugin (#16871) 2023-04-12 23:00:07 +04:00
Aleksandr Voron
9b5ca2bb6a Add ACL license (#16889) 2023-04-12 19:53:47 +04:00
Wang, Yang
86d7c97fa9 Update the logic of benchmark app property setting (#16427)
* 1. refine the logic to ov::device::properties setting.
2. the config overrides will be performed if same config setting is came from CMD line.-a

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

* Update configuration sample file within README.md.

* Update.

* Update.

* 1. Update configuration example file within REAMDME.md for Python version.
2. implement the config DEVICE_PROPERTIES value convertation between the string type and dictionary of Python type.
3. Update the configuration file loading and dumping logic.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

* Update.

* Update.

* Update.

* Update.

* Update.

* 1. Enable configs to be interchangeable between C++ and Python.
2. Update perf_count showing logic.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>

* Revert the logic of showing show performance counters.

* Update help msg for loading config option.

---------

Signed-off-by: Wang, Yang <yang4.wang@intel.com>
2023-04-12 15:32:54 +00:00
Gorokhov Dmitriy
c283d21215 [CPU] ARM architecture support (#15256)
* [CPU] ARM architecture support

This patch extends existing CPU plugin capabilities with ARM CPUs optimized support
2023-04-12 18:42:05 +04:00
Sofya Balandina
a368e10fff [apiConformance] Stop work after crash and save report (#16539) 2023-04-12 18:31:39 +04:00
Irina Efode
c2a90f4c01 [CONFORMANCE] Fix error with import sigkill (#16884) 2023-04-12 18:21:57 +04:00
Wang Wangwang
c2c2143f45 clean AB property from virtual plugin and core global config (#16877)
* Benchmark_app set ov::hint::allow_auto_batching through compile_model

* Remove the process about allow_auto_batching in set_property of core

* Remove allow_auto_batching and auto_batch_timeout property from AUTO plugin

* Reserve the info logs and add API to check auto_batching

* Update test case, rm AB property test from core config tests

* Update some API in AUTO plugin config
2023-04-12 17:37:57 +04:00
Tomasz Dołbniak
fb49228fec Pillow modes in the preprocessor's resize mechanism (#16601) 2023-04-12 15:30:42 +02:00
Sofya Balandina
ed5148b75f [apiConformance] Refactor io_tensor tests (#16348) 2023-04-12 17:22:01 +04:00
Vladimir Paramuzov
7d4496bb12 [GPU] Remove unused constants from the graph (#16873) 2023-04-12 16:52:26 +04:00
Mateusz Bencer
e737e18b02 [ONNX FE] Fix Squeeze v1 (#16865) 2023-04-12 14:33:49 +02:00
Sergey Shlyapnikov
997f60f1c3 [GPU] Fix shape_of shape inference optimization (#16863) 2023-04-12 15:44:34 +04:00
Mateusz Tabaka
bdd79fe931 CompressQuantizeWeights - use f32 precision when computing scale and zero point (#16794)
Ticket: 101825
2023-04-12 12:42:39 +02:00
Szymon Irzabek
496fe7a7db [GNA] Extend unsupported concat detection to include cascaded concat with convolution (#16756) 2023-04-12 12:19:42 +02:00
Przemyslaw Wysocki
69d6ef33fc [PyOV] Align and bump numpy, further tidy up requirements (#16652)
* Align numpy

* Simplify the rest

* Minor change

* Minor change

* Restart CI

* Update paddle reqs
2023-04-12 13:14:38 +04:00
Marcin Kusmierski
b755d17090 [GNA] Fix plugin crash when infinite loop discovered. (#16770) 2023-04-12 10:00:52 +02:00
Maxim Vafin
23c90aecea Add support for opset10 and opset11 in MO IR Reader (#16742)
* Add support for opset10 and opset11 in MO IR Reader

* Fix unique

* Refactor tests

* Fix Unique shape infer

* Update tests

* Apply suggestions from code review

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

* Apply review feedback

* Fix BOM tests

* Update tools/mo/unit_tests/mo/utils/ir_reader/ops_test.py

* Improve error log

* Fix test fails when using pytest

* Add changes forgotten in last commit

* Fix error message

---------

Co-authored-by: Roman Kazantsev <roman.kazantsev@intel.com>
2023-04-12 11:35:52 +04:00
Ivan Tikhonov
132dceb146 Delete redandant node copies in TSSqueeze, TSUnsqueeze and TSReduction transformations (#16753)
* Delete redandant node copies in TSSqueeze, TSUnsqueeze and TSReduction transformations, add new tests

* codestyle

* codestyle
2023-04-12 11:30:48 +04:00
Bo Liu
4bb9222c6e fix Paddle unit tests unexpected exceptions and seg fault issue (#16808)
* fix Paddle unit tests unexpected exceptions and seg fault issue

* parse confine from reqfile to keep algin with other requirements

* Apply suggestions from code review

* Apply suggestions from code review
2023-04-12 11:13:25 +04:00
Karol Blaszczak
4b16c7554e [DOCS] minor fixes for front_ext and pre-notes (#16866) 2023-04-12 07:55:34 +02:00
Roman Lyamin
f8aacf3b19 [GPU] Small fix for gather_nonzero (#16858) 2023-04-12 09:15:49 +04:00
Steve Yoo
0312d8cf1b Skip asymmetric compensation if its type is not data, and add its unittests (#16494) 2023-04-11 20:16:25 -07:00
Roman Lyamin
2312ec79a2 [GPU] Skip failing lstm tests (#16868) 2023-04-12 02:10:42 +02:00
Edward Shogulin
586dd4fb0a [Snippets] BF16 enforce in snippets (#16587) 2023-04-12 01:12:17 +02:00
Anastasia Kuporosova
31aa35b646 [PyOv] remove commented functions without implementation (#16864) 2023-04-12 01:07:29 +04:00
Przemyslaw Wysocki
ea213f687a Fix regex (#16850) 2023-04-12 01:06:54 +04:00
Wang, Yang
3740ba9226 [IE Sample] incorrect nstreams retrieved from plugin (#16849)
* Retrieve the ov::num_streams through compiledModel rather than through plugin.

* Update python version.
2023-04-12 01:06:20 +04:00
Ivan Tikhonov
920900fbda Delete the redundant check in convert method of TF FrontEnd class (#16846)
* remove a check in convert method

* delete unused variables and comment

* leave only one pass::Manager in normalize method
2023-04-12 01:05:16 +04:00
Ilya Churaev
4a43753e02 Enable some tests for Template plugin (#16832)
* Remove the skip of template plugin tests

* Enable some skipped tests for template plugin

* Added cancel callback, collect per-layer statistic, fixed tests

* Fixed template tests

* Rename internal API terminate to cancel

* Fixed windows tests

* Fixed logic with performance counters
2023-04-12 01:02:28 +04:00
Ian Hunter
209db8a29b Update ie_common.h (#16860) 2023-04-12 00:52:02 +04:00
Andrew Kwangwoong Park
63b16baa7e [GPU] Fix strided slice clamped negative begin with negative stride (#16843)
Signed-off-by: Andrew Park <andrew.park@intel.com>
2023-04-11 11:52:22 -07:00
Roman Kazantsev
9e89b6c5f6 [TF FE] Support NonMaxSuppression with named outputs (#16835)
* [TF FE] Support NonMaxSuppression with named outputs

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

* Simplify the test for NMS named outputs

* Share a script for test model generation

---------

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
2023-04-11 19:14:59 +02:00
Taylor Yeonbok Lee
7513e9dee1 [GPU] Applied w/a to resolve softmax accuracy issue (#16818)
* Applied w/a to resolve softmax accuracy issue
The original impl resulted in accuracy issue if leftover is not aligned with subgroup size.
(e.g., for shape [1024, 306] where the lws = 32, itemsNum = 9, leftover = 18, subgroup size = 16)
In such a case, the result got wrong if subgroup block read/write is used.
As a w/a, not to use subgroup block read/write if leftover is not aligned with nsubgroup size.
However we can come up with better itenNum size / lefover handling in the follot bwing up work.

* Fix build error & minor revise

* Fix condition
2023-04-11 10:01:22 -07:00
Mateusz Tabaka
4fbd094cba BroadcastConstRangeReplacement - skip unsqueeze if Broadcast input is 1D (#16851)
Ticket: 106636
2023-04-11 17:59:03 +02:00
Vladislav Golubev
98afdc848a [LPT] ConvolutionTransformation: support for a new per channel dequantization representation (#16687)
* [LPT][TESTS] GrConv: added test cases with per channel dq on weights and without reshape

* FoldFQ: don't transform FQ with quantization by several dimensions

* ConvolutionTransformation: supported GrConv with per channel dq on weights and without reshape

* fold_reshape: refactoring
2023-04-11 14:07:23 +02:00
Vladislav Golubev
296c2d6603 [Transforamtions] NonZero horizontal fusion: review leftovers (#16639)
* Review comments applied

* codestyle

* review comments applied
2023-04-11 15:42:43 +04:00
Ekaterina Aidova
ca2265395d [PT FE]: fix aten::mean behaviour for provided dtype (#16790) 2023-04-11 14:29:29 +04:00
Ekaterina Aidova
d41663694c [PT FE]: aten::gather (#16784)
* [PT FE]: aten::gather

* add detach and sign
2023-04-11 14:28:05 +04:00
Ekaterina Aidova
d407bc1b3b [PT FE] fix invalid reshape shape after aten::index (#16821)
* [PT FE] fix invalid reshape shape after aten::index

* support aten::index_select
2023-04-11 12:41:59 +03:00
Eddy Kim
f6ee6e92f8 [GPU] fixed loop serialization logic for multi-stream execution (#16838)
* fixed loop serialization logic for multi-stream execution

* fixed the multistream unit test
2023-04-11 12:40:37 +04:00
Roman Kazantsev
f991f92f8c [TF FE] Test ResourceGather operation and fix debug caps (#16819)
* [TF FE] Test ResourceGather operation and fix debug caps

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

* Fix test generation script

---------

Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
2023-04-11 11:33:32 +04:00
yanlan song
527c2dad2a query capacity before popping (#16828)
* query capacity before popping

Signed-off-by: fishbell <bell.song@intel.com>

* refine

Signed-off-by: fishbell <bell.song@intel.com>

---------

Signed-off-by: fishbell <bell.song@intel.com>
2023-04-11 11:25:29 +04:00
Mingyu Kim
615177ae09 [GPU] Update onednn version to latest v3.1 (#16848) 2023-04-11 15:05:35 +09:00
Roman Lyamin
234fe92931 [GPU] MVN 1d dynamic batch case fix (#16826) 2023-04-11 09:42:51 +04:00
Oleg Pipikin
efc647a512 [Snippets][CPU] Fix cycle dependency check in snippets tokenizer (#16760) 2023-04-10 22:36:29 +04:00
Ilya Churaev
81821f3dbb Remove vopset typo (#16833)
* Remove vopset typo

* remove ::
2023-04-10 19:50:06 +04:00
Ilya Lavrenov
f1d6725477 Removed legacy src files from inference library (#16839) 2023-04-10 19:26:09 +04:00
dependabot[bot]
81af7f52cb Bump pytest from 7.2.0 to 7.3.0 in /src/bindings/python (#16830)
Bumps [pytest](https://github.com/pytest-dev/pytest) from 7.2.0 to 7.3.0.
- [Release notes](https://github.com/pytest-dev/pytest/releases)
- [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst)
- [Commits](https://github.com/pytest-dev/pytest/compare/7.2.0...7.3.0)

---
updated-dependencies:
- dependency-name: pytest
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-04-10 16:50:12 +04:00
Ilya Lavrenov
feb08c408f Return benchmark_tool to openvino-dev wheel (#16834) 2023-04-10 16:34:51 +04:00
Ilya Lavrenov
023dc1fa3d Remove warnings during cython call (#16831) 2023-04-10 16:28:15 +04:00
Roman Kazantsev
f36ee94b4b [TF FE] Correct SpaceToBatch layer test (#16823)
Signed-off-by: Kazantsev, Roman <roman.kazantsev@intel.com>
2023-04-10 14:41:02 +04:00
Evgenya Stepyreva
bc7a121a20 Removes legacy transformations from CNNNetworkNGraphImpl::reshape (#15853)
* Removes legacy transformations from CNNNetworkNGraphImpl::reshape

* Removes legacy transformations from CNNNetworkNGraphImpl::reshape

* 6 more models propagate shape more precise

* Removes legacy includes

* Fix invalidation

* Test change

* win fix

* Ilyas suggestion

* Unary ops -- removed shape relying on the output of the op, used shapes from the input tensor instead

* Code clean up

* Equal: bounds evaluation

* Equal: bounds evaluation

* Restrict TypeRelaxed from partial_value propagation

* TypeRelaxed: propagate lower/upper bounds

* Remove debug prints

* fix build

* GPU shape inference problem fixed

* Generate Proposals: better dynamic shape propagation

* Style
2023-04-10 12:36:56 +02:00
Ilya Churaev
b921bf2e29 Remove redundant copy of ov::Any in has_rt_info method (#16802)
* Remove redundant copy

* Fixed Python segfault and avoid a copy of ov::Any
2023-04-10 13:56:35 +04:00
Sergey Shlyapnikov
2075dcb7c3 [GPU] Fix Interpolate assert (#16806) 2023-04-10 12:29:01 +04:00
Sofya Balandina
ed50d3782c [apiConformance] Define mandatory scope for infer requiest tests (#16418) 2023-04-10 12:27:20 +04:00
Irina Efode
b7bf760516 [CONFORMANCE] Add re-run of interapted tests to avoid not reported tests (#16782)
* [CONFORMANCE] Add re-run of interapted tests to avod not reported tests

* Fix mistake with interapted

* test

* Remove extra prints
2023-04-10 12:23:59 +04:00
Wang Wangwang
57684e28ff [AUTO] Remove cache_dir property from AUTO plugin (#16775)
* Remove cache_dir property from AUTO plugin

* Pass the secondary property to hardware plugin

* Update test case

* Update test case, meta plugin will pass the properties to device without checking
2023-04-10 11:42:24 +04:00
Sergey Shlyapnikov
48dee7c30a [GPU] Fix missed weights params update (#16815) 2023-04-10 10:28:06 +04:00
Kelvin Choi
c7fe5ca73b [Coverity] Resource leak in primitive_inst.cpp (#16771) 2023-04-10 10:27:09 +04:00
Egor Duplenskii
b5a0497c19 [CPU][TESTS] Fix cmake subset target (#16710)
cmake iterates over a list and cannot iterate over space separated string
2023-04-10 10:00:35 +04:00
hyunback kim
f4179e8ee4 [GPU] Add to check FC bias data-type logic in issued kernel selection. (#16628)
* Fix unit test failure with broadcast primitive
* After introduce shape canonicalization, static broadcast unit test failed.
* Guilty commit is https://github.com/openvinotoolkit/openvino/pull/16166

Signed-off-by: hyunback <hyunback.kim@intel.com>
2023-04-10 14:54:15 +09:00
Chenhu Wang
d1a23e964e [CPU] Store emitter keep source vec values intact (#16313) 2023-04-10 09:51:50 +04:00
Chen Peter
13874b31e9 [AUTO] Initialize variable / reduce variable copy (#16743)
* [AUTO] Initialize variable / reduce variable copy

Signed-off-by: Peter Chen <peter.chen@intel.com>

* Be compatible with C++11

https://stackoverflow.com/questions/18184096

Signed-off-by: Peter Chen <peter.chen@intel.com>

* Fix C7555

C7555 “use of designated initializers requires at least ‘/std:c++latest’” in extern “C” code.

Signed-off-by: Peter Chen <peter.chen@intel.com>

* Init in constructor and use auto const &

Signed-off-by: Peter Chen <peter.chen@intel.com>

* Fix cpplint issue

common.hpp:72:  You don't need a ; after a }

Signed-off-by: Peter Chen <peter.chen@intel.com>

* Support all possible parameter numbers (0-6)

Signed-off-by: Peter Chen <peter.chen@intel.com>

* Fix cpplint issues

Signed-off-by: Peter Chen <peter.chen@intel.com>

---------

Signed-off-by: Peter Chen <peter.chen@intel.com>
2023-04-10 10:21:40 +08:00
Szymon Irzabek
8c69100439 [GNA] Fix tests which create convolution with stride > kernel size on height dimension (#16804) 2023-04-07 15:42:51 +02:00
yanlan song
769353df00 Support dynamic output models with all possible devices instead of CPU only (#15594)
* with dynamic output models, do not use intermediate IE blobs

Signed-off-by: fishbell <bell.song@intel.com>

* enable tests

Signed-off-by: fishbell <bell.song@intel.com>

* add some log/comment

Signed-off-by: fishbell <bell.song@intel.com>

* refine and enable tests

Signed-off-by: fishbell <bell.song@intel.com>

* change implementation

Signed-off-by: fishbell <bell.song@intel.com>

* fix issue with 1.0API

Signed-off-by: fishbell <bell.song@intel.com>

* enable unit test

Signed-off-by: fishbell <bell.song@intel.com>

* integrate test with folder change

Signed-off-by: fishbell <bell.song@intel.com>

* clean up cmake

Signed-off-by: fishbell <bell.song@intel.com>

* fix warnings

Signed-off-by: fishbell <bell.song@intel.com>

* fix conflict with master

Signed-off-by: fishbell <bell.song@intel.com>

* optimize common mock infer request

Signed-off-by: fishbell <bell.song@intel.com>

* rebase with master

Signed-off-by: fishbell <bell.song@intel.com>

* resolve merge conflict

Signed-off-by: fishbell <bell.song@intel.com>

---------

Signed-off-by: fishbell <bell.song@intel.com>
2023-04-07 20:44:36 +08:00
Daria Mityagina
8c40bfd9c7 detected vulnerability with shared_ptr (#16791) 2023-04-07 16:25:05 +04:00
Sofya Balandina
c6fc8e5adc [apiConformance] Exec_network_base refactor and define mandatory scope (#16413) 2023-04-07 16:17:50 +04:00
Ivan Tikhonov
72952bdc45 Disable ConstantFolding for ShapeOf subgraph in TS transformation (#16765)
* Disable ConstantFolding for ShapeOf expressions in TS transformation

* update ModelWithEmptyTensorListAndPushBack: add ShapeOf subgraph
2023-04-07 14:50:59 +04:00
Maxim Vafin
8b7e6878e8 [TF FE] Better support for named ports in tensorflow frontend (#16697)
* Fix in create_same_type_const_scalar; accurate updating type for parameter when inlining function call body

* Added Unique to the list of operations with named output ports (another MUSE fix)

* Draft: working version of extension with named ports in TF

* Merge fixes

* Refactor and productize POC

* Clean up

* Fix build

* Fix code style

* Fix lib so extension test

* Fix namespaces

* Remove usage of Any from CreatorFunction

* Fix build

* Fix arm build

* Apply review feedback

* Fix build after merge

* Apply suggestions from code review

---------

Co-authored-by: Sergey Lyalin <sergey.lyalin@intel.com>
2023-04-07 14:16:23 +04:00
Zlobin Vladimir
1eb6ad20c3 Update open_model_zoo submodule (#16779)
Fix model serialize

Ticket 107646
2023-04-07 12:45:49 +04:00
2772 changed files with 159604 additions and 55756 deletions

View File

@@ -31,14 +31,6 @@ pr:
- 'tools/*'
- 'tests/layer_tests/*'
resources:
repositories:
- repository: openvino_contrib
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/openvino_contrib
ref: master
variables:
- group: github
@@ -56,7 +48,6 @@ jobs:
VSTS_HTTP_TIMEOUT: 200
BUILD_TYPE: Release
OPENVINO_REPO_DIR: $(Build.Repository.LocalPath)
OPENVINO_CONTRIB_REPO_DIR: $(OPENVINO_REPO_DIR)/../openvino_contrib
WORK_DIR: $(Pipeline.Workspace)/_w
BUILD_DIR: $(WORK_DIR)/build
ANDROID_TOOLS: $(WORK_DIR)/android_tools
@@ -66,7 +57,7 @@ jobs:
SHARE_DIR: /mount/cinfsshare/onnxtestdata
CCACHE_DIR: $(SHARE_DIR)/ccache/master/android_arm64
LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib
OV_PYTHON_VERSION: 3.10.10 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache
OV_PYTHON_VERSION: 3.11.2 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache
steps:
- task: UsePythonVersion@0
@@ -76,7 +67,7 @@ jobs:
disableDownloadFromRegistry: false
architecture: 'x64'
githubToken: $(auth_token)
displayName: Setup Python 3.10
displayName: Setup Python 3.11
name: setupPython
- bash: |
#!/bin/bash
@@ -121,11 +112,6 @@ jobs:
submodules: 'true'
path: openvino
- checkout: openvino_contrib
clean: 'true'
submodules: 'true'
path: openvino_contrib
- script: |
set -e
sudo -E $(OPENVINO_REPO_DIR)/install_build_dependencies.sh
@@ -147,20 +133,14 @@ jobs:
- task: CMake@1
inputs:
cmakeArgs: >
-GNinja
-G "Ninja Multi-Config"
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
-DCMAKE_TOOLCHAIN_FILE=$(ANDROID_TOOLS)/ndk-bundle/build/cmake/android.toolchain.cmake
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
-DANDROID_ABI=$(ANDROID_ABI_CONFIG)
-DANDROID_STL=c++_shared
-DANDROID_PLATFORM=$(ANDROID_SDK_VERSION)
-DENABLE_TESTS=ON
-DBUILD_java_api=ON
-DBUILD_nvidia_plugin=OFF
-DBUILD_custom_operations=OFF
-DENABLE_INTEL_GPU=ON
-DOPENVINO_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)/modules
-DCMAKE_CXX_LINKER_LAUNCHER=ccache
-DCMAKE_C_LINKER_LAUNCHER=ccache
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache

View File

@@ -32,13 +32,13 @@ resources:
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/openvino_contrib
ref: master
ref: releases/2023/0
- repository: testdata
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/testdata
ref: master
ref: releases/2023/0
variables:
- group: github
@@ -100,17 +100,17 @@ jobs:
BUILD_PYTHON: $(WORK_DIR)/build_python
INSTALL_PYTHON: $(INSTALL_OPENVINO)/extras/python
LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib
OV_PYTHON_VERSION: 3.10.10 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache
OV_PYTHON_VERSION: 3.11.2 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(OV_PYTHON_VERSION)' # Setting only major & minor version will download latest release from GH repo example 3.10 will be 3.10.10.
versionSpec: '$(OV_PYTHON_VERSION)' # Setting only major & minor version will download latest release from GH repo example 3.10 will be 3.10.10.
addToPath: true
disableDownloadFromRegistry: false
architecture: 'x64'
githubToken: $(auth_token)
displayName: Setup Python 3.10
displayName: Setup Python 3.11
name: setupPython
- bash: |
#!/bin/bash
@@ -172,7 +172,8 @@ jobs:
# For running Python API tests
python3 -m pip install -r $(REPO_DIR)/src/bindings/python/src/compatibility/openvino/requirements-dev.txt
# For running Paddle frontend unit tests
python3 -m pip install -r $(REPO_DIR)/src/frontends/paddle/tests/requirements.txt
# TODO Reenable PDPD after paddlepaddle==2.5.0 with compliant protobuf is released (ticket 95904)
#python3 -m pip install -r $(REPO_DIR)/src/frontends/paddle/tests/requirements.txt
# For running ONNX frontend unit tests
python3 -m pip install -r $(REPO_DIR)/src/frontends/onnx/tests/requirements.txt
# For running TensorFlow frontend unit tests
@@ -244,6 +245,7 @@ jobs:
-DCMAKE_CXX_COMPILER=clang++
-DCMAKE_C_COMPILER=clang
-DENABLE_SYSTEM_SNAPPY=ON
-DENABLE_SYSTEM_TBB=ON
-DCPACK_GENERATOR=$(CMAKE_CPACK_GENERATOR)
-DBUILD_nvidia_plugin=OFF
-S $(REPO_DIR)
@@ -365,7 +367,7 @@ jobs:
displayName: 'Build cpp samples - gcc'
- script: $(SAMPLES_INSTALL_DIR)/cpp/build_samples.sh -b $(BUILD_DIR)/cpp_samples_clang
env:
env:
CC: clang
CXX: clang++
displayName: 'Build cpp samples - clang'

View File

@@ -31,14 +31,6 @@ pr:
- 'tools/*'
- 'tests/layer_tests/*'
resources:
repositories:
- repository: openvino_contrib
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/openvino_contrib
ref: master
variables:
- group: github
@@ -54,34 +46,18 @@ jobs:
system.debug: true
VSTS_HTTP_RETRY: 5
VSTS_HTTP_TIMEOUT: 200
PYTHON_ARM_VERSION: "3.10.6"
PYTHON_EXEC: "python3.10"
OPENVINO_ARCH: 'aarch64'
NUM_PROC: 1
BUILD_TYPE: Release
OPENVINO_REPO_DIR: $(Build.Repository.LocalPath)
OPENVINO_CONTRIB_REPO_DIR: $(OPENVINO_REPO_DIR)/../openvino_contrib
OPENCV_REPO_DIR: $(OPENVINO_REPO_DIR)/../opencv
ONETBB_REPO_DIR: $(OPENVINO_CONTRIB_REPO_DIR)/../oneTBB
BUILD_PYTHON: $(WORK_DIR)/build_python
BUILD_OPENCV: $(WORK_DIR)/build_opencv
BUILD_ONETBB: $(WORK_DIR)/build_onetbb
BUILD_OPENVINO: $(WORK_DIR)/build
BUILD_OPENVINO_PYTHON: $(WORK_DIR)/build_python
CROSSENV_DIR: $(WORK_DIR)/cross_env
INSTALL_OPENVINO: $(WORK_DIR)/install_openvino
INSTALL_PYTHON: $(INSTALL_OPENVINO)/extras/python
INSTALL_ONETBB: $(WORK_DIR)/build/extras/oneTBB
INSTALL_ONETBB_PACKAGE: $(INSTALL_OPENVINO)/extras/oneTBB
INSTALL_OPENCV: $(INSTALL_OPENVINO)/extras/opencv
WORK_DIR: $(Pipeline.Workspace)/_w
SHARE_DIR: /mount/cinfsshare/onnxtestdata
TMP_DIR: /mnt/tmp
OPENVINO_CCACHE_DIR: $(SHARE_DIR)/ccache/master/linux_arm64
OPENCV_CCACHE_DIR: $(SHARE_DIR)/ccache/master/linux_arm64_opencv
ONETBB_CCACHE_DIR: $(SHARE_DIR)/ccache/master/linux_arm64_onetbb
LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib
OV_PYTHON_VERSION: 3.10.10 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache
OV_PYTHON_VERSION: 3.11.2 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache
steps:
- task: UsePythonVersion@0
@@ -91,7 +67,7 @@ jobs:
disableDownloadFromRegistry: false
architecture: 'x64'
githubToken: $(auth_token)
displayName: Setup Python 3.10
displayName: Setup Python 3.11
name: setupPython
- bash: |
#!/bin/bash
@@ -121,93 +97,89 @@ jobs:
- script: |
rm -rf $(WORK_DIR) ; mkdir $(WORK_DIR)
mkdir -p $(BUILD_ONETBB) $(BUILD_OPENCV) $(BUILD_OPENVINO) $(BUILD_OPENVINO_PYTHON) $(BUILD_PYTHON)
mkdir -p $(INSTALL_ONETBB) $(INSTALL_ONETBB_PACKAGE) $(INSTALL_OPENVINO) $(INSTALL_PYTHON) $(INSTALL_OPENCV)
mkdir -p $(BUILD_OPENVINO)
mkdir -p $(INSTALL_OPENVINO)
sudo rm -rf $(TMP_DIR) ; sudo mkdir $(TMP_DIR) ; sudo chmod 777 -R $(TMP_DIR)
sudo mkdir -p $(SHARE_DIR)
sudo apt --assume-yes update && sudo apt --assume-yes install nfs-common
sudo mount -vvv -t nfs cinfsshare.file.core.windows.net:/cinfsshare/onnxtestdata $(SHARE_DIR) -o vers=4,minorversion=1,sec=sys
mkdir -p $(OPENVINO_CCACHE_DIR)
mkdir -p $(OPENCV_CCACHE_DIR)
mkdir -p $(ONETBB_CCACHE_DIR)
displayName: 'Make directories'
- checkout: self
clean: 'true'
submodules: 'true'
path: openvino
- checkout: openvino_contrib
clean: 'true'
submodules: 'true'
path: openvino_contrib
- script: |
set -e
sudo -E $(OPENVINO_REPO_DIR)/install_build_dependencies.sh
$(OPENVINO_CONTRIB_REPO_DIR)/modules/arm_plugin/scripts/install_build_dependencies.sh
python3 -m pip install --upgrade pip
python3 -m pip install -r $(OPENVINO_REPO_DIR)/src/bindings/python/requirements.txt
python3 -m pip install -r $(OPENVINO_REPO_DIR)/src/bindings/python/wheel/requirements-dev.txt
env:
CCACHE_TEMPDIR: $(TMP_DIR)/ccache
CCACHE_BASEDIR: $(Pipeline.Workspace)
CCACHE_MAXSIZE: 50G
USE_CCACHE: 1
OPENCV_CCACHE_DIR: $(OPENCV_CCACHE_DIR)
ONETBB_CCACHE_DIR: $(ONETBB_CCACHE_DIR)
PYTHON_ARM_VERSION: $(PYTHON_ARM_VERSION)
NUM_PROC: $(NUM_PROC)
BUILD_PYTHON: $(BUILD_PYTHON)
WORK_DIR: $(WORK_DIR)
INSTALL_PYTHON: $(INSTALL_PYTHON)
BUILD_TYPE: $(BUILD_TYPE)
OPENVINO_REPO_DIR: $(OPENVINO_REPO_DIR)
BUILD_ONETBB: $(BUILD_ONETBB)
INSTALL_ONETBB: $(INSTALL_ONETBB)
INSTALL_OPENCV: $(INSTALL_OPENCV)
PYTHON_EXEC: $(PYTHON_EXEC)
ONETBB_REPO_DIR: $(ONETBB_REPO_DIR)
OPENCV_REPO_DIR: $(OPENCV_REPO_DIR)
BUILD_OPENCV: $(BUILD_OPENCV)
INSTALL_OPENVINO: $(INSTALL_OPENVINO)
# install dependencies needed to build CPU plugin for ARM
sudo -E apt --assume-yes install scons crossbuild-essential-arm64
# generic dependencies
sudo -E apt --assume-yes install cmake ccache
# Speed up build
sudo -E apt -y --no-install-recommends install unzip
wget https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-linux.zip
unzip ninja-linux.zip
sudo cp -v ninja /usr/local/bin/
displayName: 'Install dependencies'
- script: |
set -e
/usr/local/bin/$(PYTHON_EXEC) -m pip install -U pip
/usr/local/bin/$(PYTHON_EXEC) -m pip install crossenv
/usr/local/bin/$(PYTHON_EXEC) -m crossenv $(INSTALL_PYTHON)/bin/$(PYTHON_EXEC) $(CROSSENV_DIR)
source $(CROSSENV_DIR)/bin/activate
build-pip3 install -U pip install -r $(OPENVINO_REPO_DIR)/src/bindings/python/wheel/requirements-dev.txt
cross-pip3 install -U pip install -r $(OPENVINO_REPO_DIR)/src/bindings/python/wheel/requirements-dev.txt
displayName: 'Create crossenv'
git submodule update --init -- $(OPENVINO_REPO_DIR)/src/plugins
git submodule update --init -- $(OPENVINO_REPO_DIR)/thirdparty/gtest
displayName: 'Init submodules for non Conan dependencies'
- task: CMake@1
inputs:
cmakeArgs: >
-GNinja
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
-DOpenCV_DIR=$(INSTALL_OPENCV)/cmake
-DENABLE_PYTHON=OFF
-DENABLE_TESTS=ON
-DENABLE_DATA=OFF
-DCMAKE_TOOLCHAIN_FILE=$(OPENVINO_REPO_DIR)/cmake/arm64.toolchain.cmake
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
-DTHREADING=TBB
-DTBB_DIR=$(INSTALL_ONETBB)/lib/cmake/TBB
-DCMAKE_VERBOSE_MAKEFILE=ON
-DOPENVINO_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)/modules/arm_plugin
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
-DCMAKE_C_COMPILER_LAUNCHER=ccache
-DCMAKE_CXX_LINKER_LAUNCHER=ccache
-DCMAKE_C_LINKER_LAUNCHER=ccache
-DARM_COMPUTE_SCONS_JOBS=$(NUM_PROC)
-DCMAKE_INSTALL_PREFIX=$(INSTALL_OPENVINO)
-S $(OPENVINO_REPO_DIR)
- script: |
python3 -m pip install conan
# generate build profile
conan profile detect
# generate host profile for linux_arm64
echo "include(default)" > $(BUILD_OPENVINO)/linux_arm64
echo "[buildenv]" >> $(BUILD_OPENVINO)/linux_arm64
echo "CC=aarch64-linux-gnu-gcc" >> $(BUILD_OPENVINO)/linux_arm64
echo "CXX=aarch64-linux-gnu-g++" >> $(BUILD_OPENVINO)/linux_arm64
# install OpenVINO dependencies
export CMAKE_CXX_COMPILER_LAUNCHER=ccache
export CMAKE_C_COMPILER_LAUNCHER=ccache
conan install $(OPENVINO_REPO_DIR)/conanfile.txt \
-pr:h $(BUILD_OPENVINO)/linux_arm64 \
-s:h arch=armv8 \
-of $(BUILD_OPENVINO) \
-b missing
env:
CCACHE_DIR: $(OPENVINO_CCACHE_DIR)
CCACHE_TEMPDIR: $(TMP_DIR)/ccache
CCACHE_BASEDIR: $(Pipeline.Workspace)
CCACHE_MAXSIZE: 50G
displayName: 'Install conan and dependencies'
- script: |
source $(BUILD_OPENVINO)/conanbuild.sh
cmake \
-G Ninja \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DBUILD_SHARED_LIBS=ON \
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON \
-DENABLE_CPPLINT=OFF \
-DENABLE_PYTHON=OFF \
-DENABLE_TESTS=ON \
-DENABLE_DATA=OFF \
-DENABLE_SYSTEM_TBB=ON \
-DENABLE_SYSTEM_PROTOBUF=ON \
-DENABLE_SYSTEM_SNAPPY=ON \
-DENABLE_SYSTEM_PUGIXML=ON \
-DCMAKE_TOOLCHAIN_FILE=$(BUILD_OPENVINO)/conan_toolchain.cmake \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DARM_COMPUTE_SCONS_JOBS=$(NUM_PROC) \
-DCMAKE_INSTALL_PREFIX=$(INSTALL_OPENVINO) \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
-S $(OPENVINO_REPO_DIR) \
-B $(BUILD_OPENVINO)
displayName: 'CMake OpenVINO ARM plugin'
source $(BUILD_OPENVINO)/deactivate_conanbuild.sh
displayName: 'CMake configure'
- script: cmake --build $(BUILD_OPENVINO) --parallel --config $(BUILD_TYPE)
env:
@@ -215,38 +187,13 @@ jobs:
CCACHE_TEMPDIR: $(TMP_DIR)/ccache
CCACHE_BASEDIR: $(Pipeline.Workspace)
CCACHE_MAXSIZE: 50G
displayName: 'Build OpenVINO ARM plugin'
displayName: 'Build OpenVINO Runtime'
- script: cmake --build $(BUILD_OPENVINO) --parallel --config $(BUILD_TYPE) --target install
displayName: 'Install OpenVINO ARM plugin'
- script: |
source $(CROSSENV_DIR)/bin/activate
cmake \
-GNinja \
-DENABLE_PYTHON=ON \
-DENABLE_WHEEL=ON \
-DCMAKE_TOOLCHAIN_FILE=$(OPENVINO_REPO_DIR)/cmake/arm64.toolchain.cmake \
-DOpenVINODeveloperPackage_DIR=$(BUILD_OPENVINO) \
-DCMAKE_INSTALL_PREFIX=$(INSTALL_OPENVINO) \
-S $(OPENVINO_REPO_DIR)/src/bindings/python \
-B $(BUILD_OPENVINO_PYTHON)
deactivate
displayName: 'CMake OpenVINO python binding'
- script: cmake --build $(BUILD_OPENVINO_PYTHON) --parallel --config $(BUILD_TYPE)
env:
CCACHE_DIR: $(OPENVINO_CCACHE_DIR)
CCACHE_TEMPDIR: $(TMP_DIR)/ccache
CCACHE_BASEDIR: $(Pipeline.Workspace)
CCACHE_MAXSIZE: 50G
displayName: 'Build OpenVINO python binding'
- script: cmake --build $(BUILD_OPENVINO_PYTHON) --parallel --target install
displayName: 'Install OpenVINO python binding'
displayName: 'Install OpenVINO Runtime'
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)
ArtifactName: 'openvino_aarch64_linux'
displayName: 'Publish OpenVINO AArch64 linux package'
displayName: 'Publish OpenVINO Runtime for ARM'

View File

@@ -35,6 +35,7 @@ resources:
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/testdata
ref: releases/2023/0
variables:
- group: github
@@ -59,7 +60,7 @@ jobs:
INSTALL_DIR: $(WORK_DIR)/install_pkg
SETUPVARS: $(INSTALL_DIR)/setupvars.sh
LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib
OV_PYTHON_VERSION: 3.10.10 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache
OV_PYTHON_VERSION: 3.11.2 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache
steps:
- task: UsePythonVersion@0
@@ -69,7 +70,7 @@ jobs:
disableDownloadFromRegistry: false
architecture: 'x64'
githubToken: $(auth_token)
displayName: Setup Python 3.10
displayName: Setup Python 3.11
name: setupPython
- bash: |
#!/bin/bash
@@ -123,12 +124,11 @@ jobs:
- task: CMake@1
inputs:
cmakeArgs: >
-GNinja
-G "Ninja Multi-Config"
-DENABLE_CPPLINT=OFF
-DENABLE_GAPI_PREPROCESSING=OFF
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
-DENABLE_FASTER_BUILD=ON
-DENABLE_PROFILING_ITT=ON
-DSELECTIVE_BUILD=COLLECT
@@ -152,11 +152,10 @@ jobs:
- task: CMake@1
inputs:
cmakeArgs: >
-GNinja
-DSELECTIVE_BUILD=ON
-DSELECTIVE_BUILD_STAT=$(BUILD_DIR)/*.csv
-S $(REPO_DIR)
-B $(BUILD_DIR)
-S $(REPO_DIR)
displayName: 'CMake CC ON'
- script: cmake --build $(BUILD_DIR) --parallel --config $(BUILD_TYPE) --target openvino_intel_cpu_plugin openvino_ir_frontend

View File

@@ -4,7 +4,7 @@ resources:
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/openvino_contrib
ref: master
ref: releases/2023/0
variables:
- group: github
@@ -33,7 +33,7 @@ jobs:
SHARE_DIR: /mount/cinfsshare/onnxtestdata
CCACHE_DIR: $(SHARE_DIR)/ccache/master/linux_coverity
LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib
OV_PYTHON_VERSION: 3.10.10 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache
OV_PYTHON_VERSION: 3.11.2 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache
steps:
- task: UsePythonVersion@0
@@ -43,7 +43,7 @@ jobs:
disableDownloadFromRegistry: false
architecture: 'x64'
githubToken: $(auth_token)
displayName: Setup Python 3.10
displayName: Setup Python 3.11
name: setupPython
- bash: |
#!/bin/bash
@@ -106,10 +106,9 @@ jobs:
inputs:
# Coverity has too many PARSE_ERROR errors with ENABLE_FASTER_BUILD=ON. Disabling FASTER_BUILD.
cmakeArgs: >
-GNinja
-G "Ninja Multi-Config"
-DENABLE_CPPLINT=OFF
-DCMAKE_VERBOSE_MAKEFILE=ON
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
-DENABLE_FASTER_BUILD=OFF
-DENABLE_STRICT_DEPENDENCIES=OFF
-DBUILD_nvidia_plugin=OFF

View File

@@ -42,11 +42,13 @@ resources:
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/openvino_contrib
ref: releases/2023/0
- repository: testdata
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/testdata
ref: releases/2023/0
jobs:
- job: CUDAPlugin_Lin
@@ -127,7 +129,7 @@ jobs:
python3 -m pip install -r /root/repos/openvino/src/bindings/python/requirements.txt &&
cmake -GNinja \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DDENABLE_CPPLINT=OFF \
-DENABLE_CPPLINT=OFF \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \
-DOPENVINO_EXTRA_MODULES=/root/repos/openvino_contrib/modules/nvidia_plugin \
-DENABLE_INTEL_CPU=OFF \

View File

@@ -34,7 +34,7 @@ resources:
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/testdata
ref: master
ref: releases/2023/0
jobs:
- job: Lin_Debian

View File

@@ -4,7 +4,7 @@
# type: github
# endpoint: openvinotoolkit
# name: openvinotoolkit/testdata
# ref: master
# ref: releases/2023/0
jobs:
- job: Lin_lohika

View File

@@ -56,7 +56,7 @@ jobs:
ONNXRUNTIME_UTILS: $(REPO_DIR)/.ci/azure/ci_utils/onnxruntime
ONNXRUNTIME_BUILD_DIR: $(ONNXRUNTIME_REPO_DIR)/build
LD_LIBRARY_PATH: $(Agent.ToolsDirectory)/Python/$(OV_PYTHON_VERSION)/x64/lib
OV_PYTHON_VERSION: 3.10.10 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache
OV_PYTHON_VERSION: 3.11.2 # Full version of Python its required for LD_LIBRARY_PATH. More details https://github.com/microsoft/azure-pipelines-tool-lib/blob/master/docs/overview.md#tool-cache
steps:
- task: UsePythonVersion@0
@@ -66,7 +66,7 @@ jobs:
disableDownloadFromRegistry: false
architecture: 'x64'
githubToken: $(auth_token)
displayName: Setup Python 3.10
displayName: Setup Python 3.11
name: setupPython
- bash: |
#!/bin/bash

View File

@@ -35,13 +35,13 @@ resources:
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/openvino_contrib
ref: master
ref: releases/2023/0
- repository: testdata
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/testdata
ref: master
ref: releases/2023/0
variables:
- group: github
@@ -73,11 +73,11 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
versionSpec: '3.11.2'
addToPath: true
architecture: 'x64'
githubToken: $(auth_token)
displayName: Setup Python 3.10
displayName: Setup Python 3.11
name: setupPython
- script: |
@@ -113,10 +113,6 @@ jobs:
lfs: 'true'
path: testdata
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
- script: |
brew install cython
brew install automake
@@ -127,7 +123,8 @@ jobs:
- script: |
export PATH="/usr/local/opt/cython/bin:$PATH"
cmake -GNinja \
cmake \
-G Ninja \
-DENABLE_CPPLINT=OFF \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) \

View File

@@ -32,13 +32,13 @@ resources:
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/openvino_contrib
ref: master
ref: releases/2023/0
- repository: testdata
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/testdata
ref: master
ref: releases/2023/0
jobs:
- job: Win
@@ -73,7 +73,7 @@ jobs:
INSTALL_DIR: $(WORK_DIR)\install_pkg
INSTALL_TEST_DIR: $(INSTALL_DIR)\tests
SETUPVARS: $(INSTALL_DIR)\setupvars.bat
PYTHON_DIR: C:\hostedtoolcache\windows\Python\3.10.7\x64
PYTHON_DIR: C:\hostedtoolcache\windows\Python\3.11.2\x64
CMAKE_VERSION: 3.24.0
CMAKE_CMD: $(WORK_DIR)\cmake-$(CMAKE_VERSION)-windows-x86_64\cmake-$(CMAKE_VERSION)-windows-x86_64\bin\cmake.exe
OV_CMAKE_TOOLCHAIN_FILE: $(REPO_DIR)\cmake\toolchains\mt.runtime.win32.toolchain.cmake
@@ -84,26 +84,26 @@ jobs:
- script: |
rd /Q /S $(WORK_DIR) & mkdir $(WORK_DIR)
rd /Q /S $(BUILD_DIR) & mkdir $(BUILD_DIR)
rd /Q /S $(WORK_DIR) & mkdir C:\hostedtoolcache\windows\Python\3.10.7
rd /Q /S $(BUILD_DIR) & mkdir C:\hostedtoolcache\windows\Python\3.10.7\x64
rd /Q /S $(WORK_DIR) & mkdir C:\hostedtoolcache\windows\Python\3.11.2
rd /Q /S $(BUILD_DIR) & mkdir C:\hostedtoolcache\windows\Python\3.11.2\x64
rd /Q /S $(BUILD_SAMPLES_DIR) & mkdir $(BUILD_SAMPLES_DIR)
rd /Q /S $(BUILD_SAMPLES_TESTS_DIR) & mkdir $(BUILD_SAMPLES_TESTS_DIR)
displayName: 'Make dir'
- script: curl -O https://www.python.org/ftp/python/3.10.7/python-3.10.7-amd64.exe
- script: curl -O https://www.python.org/ftp/python/3.11.2/python-3.11.2-amd64.exe
displayName: 'Download Python'
workingDirectory: $(WORK_DIR)
- script: |
python-3.10.7-amd64.exe /passive InstallAllUsers=0 Include_launcher=0 TargetDir=C:\hostedtoolcache\windows\Python\3.10.7\x64
cp C:\hostedtoolcache\windows\Python\3.8.2\x64.complete C:\hostedtoolcache\windows\Python\3.10.7\x64.complete
python-3.11.2-amd64.exe /passive InstallAllUsers=0 Include_launcher=0 TargetDir=C:\hostedtoolcache\windows\Python\3.11.2\x64
cp C:\hostedtoolcache\windows\Python\3.8.2\x64.complete C:\hostedtoolcache\windows\Python\3.11.2\x64.complete
displayName: 'Install Python'
workingDirectory: $(WORK_DIR)
- task: UsePythonVersion@0
displayName: 'Use Python'
inputs:
versionSpec: '3.10'
versionSpec: '3.11.2'
disableDownloadFromRegistry: true
- script: |
@@ -142,7 +142,8 @@ jobs:
python -m pip install -r $(REPO_DIR)\src\bindings\python\wheel\requirements-dev.txt
python -m pip install -r $(REPO_DIR)\src\bindings\python\requirements.txt
rem For running Paddle frontend unit tests
python -m pip install -r $(REPO_DIR)\src\frontends\paddle\tests\requirements.txt
# TODO Reenable PDPD after paddlepaddle==2.5.0 with compliant protobuf is released (ticket 95904)
#python -m pip install -r $(REPO_DIR)\src\frontends\paddle\tests\requirements.txt
rem For running ONNX frontend unit tests
python -m pip install -r $(REPO_DIR)\src\frontends\onnx\tests\requirements.txt
rem For running TensorFlow frontend unit tests
@@ -165,21 +166,21 @@ jobs:
- script: |
set PATH=$(WORK_DIR)\ninja-win;%PATH%
call "$(MSVS_VARS_PATH)" && $(CMAKE_CMD) -G "Ninja Multi-Config" ^
call "$(MSVS_VARS_PATH)" && $(CMAKE_CMD) ^
-G "Ninja Multi-Config" ^
-DENABLE_CPPLINT=OFF ^
-DENABLE_ONEDNN_FOR_GPU=$(CMAKE_BUILD_SHARED_LIBS) ^
-DBUILD_SHARED_LIBS=$(CMAKE_BUILD_SHARED_LIBS) ^
-DENABLE_FASTER_BUILD=ON ^
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) ^
-DENABLE_TESTS=ON ^
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON ^
-DENABLE_STRICT_DEPENDENCIES=OFF ^
-DENABLE_PYTHON=ON ^
-DBUILD_nvidia_plugin=OFF ^
-DCUSTOM_OPERATIONS="calculate_grid;complex_mul;fft;grid_sample;sparse_conv;sparse_conv_transpose" ^
-DPYTHON_EXECUTABLE="C:\hostedtoolcache\windows\Python\3.10.7\x64\python.exe" ^
-DPYTHON_INCLUDE_DIR="C:\hostedtoolcache\windows\Python\3.10.7\x64\include" ^
-DPYTHON_LIBRARY="C:\hostedtoolcache\windows\Python\3.10.7\x64\libs\python310.lib" ^
-DPYTHON_EXECUTABLE="C:\hostedtoolcache\windows\Python\3.11.2\x64\python.exe" ^
-DPYTHON_INCLUDE_DIR="C:\hostedtoolcache\windows\Python\3.11.2\x64\include" ^
-DPYTHON_LIBRARY="C:\hostedtoolcache\windows\Python\3.11.2\x64\libs\python311.lib" ^
-DOPENVINO_EXTRA_MODULES=$(OPENVINO_CONTRIB_REPO_DIR)\modules ^
-DCMAKE_C_COMPILER:PATH="$(MSVC_COMPILER_PATH)" ^
-DCMAKE_CXX_COMPILER:PATH="$(MSVC_COMPILER_PATH)" ^

View File

@@ -35,6 +35,7 @@ resources:
type: github
endpoint: openvinotoolkit
name: openvinotoolkit/testdata
ref: releases/2023/0
variables:
- group: github
@@ -65,11 +66,11 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
versionSpec: '3.11.2'
addToPath: true
architecture: 'x64'
githubToken: $(auth_token)
displayName: Setup Python 3.10
displayName: Setup Python 3.11
name: setupPython
- script: |
@@ -78,6 +79,8 @@ jobs:
python --version
where java
java -version
where cmake
cmake --version
wmic computersystem get TotalPhysicalMemory
wmic cpu list
wmic logicaldisk get description,name
@@ -110,10 +113,11 @@ jobs:
- script: |
set PATH=$(WORK_DIR)\ninja-win;%PATH%
call "$(MSVS_VARS_PATH)" && cmake -GNinja ^
call "$(MSVS_VARS_PATH)" && cmake ^
-G Ninja ^
-DENABLE_CPPLINT=OFF ^
-DENABLE_GAPI_PREPROCESSING=OFF ^
-DENABLE_FASTER_BUILD=ON ^
-DENABLE_PLUGINS_XML=ON ^
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON ^
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) ^
-DENABLE_PROFILING_ITT=ON ^
@@ -145,12 +149,11 @@ jobs:
displayName: 'List csv files'
- script: |
call "$(MSVS_VARS_PATH)" && cmake -G"Visual Studio 16 2019" ^
call "$(MSVS_VARS_PATH)" && cmake ^
-G "Visual Studio 16 2019" ^
-DVERBOSE_BUILD=ON ^
-DENABLE_CPPLINT=OFF ^
-DENABLE_GAPI_PREPROCESSING=OFF ^
-DENABLE_FASTER_BUILD=ON ^
-DCMAKE_BUILD_TYPE=$(BUILD_TYPE) ^
-DENABLE_PROFILING_ITT=OFF ^
-DSELECTIVE_BUILD=ON ^
-DCMAKE_COMPILE_WARNING_AS_ERROR=ON ^

View File

@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu:23.04
LABEL version=2021.03.30.1
@@ -38,6 +38,7 @@ RUN apt-get update && apt-get -y --no-install-recommends install \
python3 \
python3-pip \
python3-dev \
pybind11-dev \
python3-virtualenv \
cython3 \
tox && \
@@ -71,5 +72,5 @@ RUN ninja install
WORKDIR /openvino/src/bindings/python
ENV OpenVINO_DIR=/openvino/dist/runtime/cmake
ENV LD_LIBRARY_PATH=/openvino/dist/runtime/lib/intel64:/openvino/dist/runtime/3rdparty/tbb/lib
ENV PYTHONPATH=/openvino/bin/intel64/${BUILD_TYPE}/python_api/python3.10:${PYTHONPATH}
ENV PYTHONPATH=/openvino/bin/intel64/${BUILD_TYPE}/python_api/python3.11:${PYTHONPATH}
CMD tox

View File

@@ -1,5 +1,5 @@
---
name: Bug
name: Bug
about: Create a report to help us improve
title: "[Bug]"
labels: bug, support_request
@@ -8,19 +8,28 @@ assignees: ''
---
##### System information (version)
<!-- Example
- OpenVINO => 2020.4
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2017
- Problem classification: Model Conversion
<!-- Please use this template to submit a new issue and provide all the necessary information to expedite the response.
Example
- OpenVINO Source => Runtime /pip install / GitHub
- OpenVINO Version => Version 2022.3 / Github Master Branch / tag 2023.0
- Operating System / Platform => Windows 64 Bit / Ubuntu 20
- Compiler => Visual Studio 2017 / Cmake
- Problem classification: Model Conversion /Accuracy/TensorFlow FE
- Device use: CPU / GPU / HDDL
- Framework: TensorFlow (if applicable)
- Model name: ResNet50 (if applicable)
- Model name: ResNet50 and the link to pre-train modal (if applicable)
Please provide us with the link to your model or attach .zip file.
-->
- OpenVINO=> :grey_question:
- OpenVINO Source=> :grey_question:
- OpenVINO Version=> :grey_question:
- Operating System / Platform => :grey_question:
- Compiler => :grey_question:
- Problem classification => :grey_question:
- Device use: => :grey_question:
- Framework => :grey_question:
- Model name => :grey_question:
##### Detailed description
<!-- your description -->

1
.gitignore vendored
View File

@@ -26,6 +26,7 @@ temp/
.repo/
CMakeLists.txt.user
docs/IE_PLUGIN_DG/html/
CMakeUserPresets.json
*.project
*.cproject

3
.gitmodules vendored
View File

@@ -69,3 +69,6 @@
[submodule "thirdparty/snappy"]
path = thirdparty/snappy
url = https://github.com/google/snappy.git
[submodule "ARMComputeLibrary"]
path = src/plugins/intel_cpu/thirdparty/ComputeLibrary
url = https://github.com/ARM-software/ComputeLibrary.git

View File

@@ -40,8 +40,6 @@ endif()
# resolving dependencies for the project
message (STATUS "CMAKE_VERSION ......................... " ${CMAKE_VERSION})
message (STATUS "CMAKE_BINARY_DIR ...................... " ${CMAKE_BINARY_DIR})
message (STATUS "CMAKE_SOURCE_DIR ...................... " ${CMAKE_SOURCE_DIR})
message (STATUS "OpenVINO_SOURCE_DIR ................... " ${OpenVINO_SOURCE_DIR})
message (STATUS "OpenVINO_BINARY_DIR ................... " ${OpenVINO_BINARY_DIR})
message (STATUS "CMAKE_GENERATOR ....................... " ${CMAKE_GENERATOR})
@@ -66,7 +64,7 @@ endif()
if(CMAKE_TOOLCHAIN_FILE)
message (STATUS "CMAKE_TOOLCHAIN_FILE .................. " ${CMAKE_TOOLCHAIN_FILE})
endif()
if(OV_GLIBC_VERSION)
if(NOT OV_GLIBC_VERSION VERSION_EQUAL 0.0)
message (STATUS "GLIBC_VERSION ......................... " ${OV_GLIBC_VERSION})
endif()

View File

@@ -2,13 +2,14 @@
<img src="docs/img/openvino-logo-purple-black.png" width="400px">
[![Stable release](https://img.shields.io/badge/version-2022.2-green.svg)](https://github.com/openvinotoolkit/openvino/releases/tag/2022.2.0)
[![Apache License Version 2.0](https://img.shields.io/badge/license-Apache_2.0-green.svg)](LICENSE)
![GitHub branch checks state](https://img.shields.io/github/checks-status/openvinotoolkit/openvino/master?label=GitHub%20checks)
![Azure DevOps builds (branch)](https://img.shields.io/azure-devops/build/openvinoci/b2bab62f-ab2f-4871-a538-86ea1be7d20f/13?label=Public%20CI)
[![PyPI Status](https://badge.fury.io/py/openvino.svg)](https://badge.fury.io/py/openvino)
[![Anaconda Status](https://anaconda.org/conda-forge/openvino/badges/version.svg)](https://anaconda.org/conda-forge/openvino)
[![brew Status](https://img.shields.io/homebrew/v/openvino)](https://formulae.brew.sh/formula/openvino)
[![PyPI Downloads](https://pepy.tech/badge/openvino)](https://pepy.tech/project/openvino)
[![Anaconda Downloads](https://anaconda.org/conda-forge/openvino/badges/downloads.svg)](https://anaconda.org/conda-forge/openvino/files)
[![brew Downloads](https://img.shields.io/homebrew/installs/dy/openvino)](https://formulae.brew.sh/formula/openvino)
</div>
## Contents:
@@ -69,24 +70,24 @@ The OpenVINO™ Runtime can infer models on different hardware devices. This sec
<tbody>
<tr>
<td rowspan=2>CPU</td>
<td> <a href="https://docs.openvino.ai/nightly/openvino_docs_OV_UG_supported_plugins_CPU.html#doxid-openvino-docs-o-v-u-g-supported-plugins-c-p-u">Intel CPU</a></tb>
<td> <a href="https://docs.openvino.ai/2023.0/openvino_docs_OV_UG_supported_plugins_CPU.html#doxid-openvino-docs-o-v-u-g-supported-plugins-c-p-u">Intel CPU</a></tb>
<td><b><i><a href="./src/plugins/intel_cpu">openvino_intel_cpu_plugin</a></i></b></td>
<td>Intel Xeon with Intel® Advanced Vector Extensions 2 (Intel® AVX2), Intel® Advanced Vector Extensions 512 (Intel® AVX-512), and AVX512_BF16, Intel Core Processors with Intel AVX2, Intel Atom Processors with Intel® Streaming SIMD Extensions (Intel® SSE)</td>
</tr>
<tr>
<td> <a href="https://docs.openvino.ai/nightly/openvino_docs_OV_UG_supported_plugins_ARM_CPU.html">ARM CPU</a></tb>
<td> <a href="https://docs.openvino.ai/2023.0/openvino_docs_OV_UG_supported_plugins_CPU.html">ARM CPU</a></tb>
<td><b><i><a href="https://github.com/openvinotoolkit/openvino_contrib/tree/master/modules/arm_plugin">openvino_arm_cpu_plugin</a></i></b></td>
<td>Raspberry Pi™ 4 Model B, Apple® Mac mini with M1 chip, NVIDIA® Jetson Nano™, Android™ devices
</tr>
<tr>
<td>GPU</td>
<td><a href="https://docs.openvino.ai/nightly/openvino_docs_OV_UG_supported_plugins_GPU.html#doxid-openvino-docs-o-v-u-g-supported-plugins-g-p-u">Intel GPU</a></td>
<td><a href="https://docs.openvino.ai/2023.0/openvino_docs_OV_UG_supported_plugins_GPU.html#doxid-openvino-docs-o-v-u-g-supported-plugins-g-p-u">Intel GPU</a></td>
<td><b><i><a href="./src/plugins/intel_gpu">openvino_intel_gpu_plugin</a></i></b></td>
<td>Intel Processor Graphics, including Intel HD Graphics and Intel Iris Graphics</td>
</tr>
<tr>
<td>GNA</td>
<td><a href="https://docs.openvino.ai/nightly/openvino_docs_OV_UG_supported_plugins_GNA.html#doxid-openvino-docs-o-v-u-g-supported-plugins-g-n-a">Intel GNA</a></td>
<td><a href="https://docs.openvino.ai/2023.0/openvino_docs_OV_UG_supported_plugins_GNA.html#doxid-openvino-docs-o-v-u-g-supported-plugins-g-n-a">Intel GNA</a></td>
<td><b><i><a href="./src/plugins/intel_gna">openvino_intel_gna_plugin</a></i></b></td>
<td>Intel Speech Enabling Developer Kit, Amazon Alexa* Premium Far-Field Developer Kit, Intel Pentium Silver J5005 Processor, Intel Pentium Silver N5000 Processor, Intel Celeron J4005 Processor, Intel Celeron J4105 Processor, Intel Celeron Processor N4100, Intel Celeron Processor N4000, Intel Core i3-8121U Processor, Intel Core i7-1065G7 Processor, Intel Core i7-1060G7 Processor, Intel Core i5-1035G4 Processor, Intel Core i5-1035G7 Processor, Intel Core i5-1035G1 Processor, Intel Core i5-1030G7 Processor, Intel Core i5-1030G4 Processor, Intel Core i3-1005G1 Processor, Intel Core i3-1000G1 Processor, Intel Core i3-1000G4 Processor</td>
</tr>
@@ -104,22 +105,22 @@ OpenVINO™ Toolkit also contains several plugins which simplify loading models
</thead>
<tbody>
<tr>
<td><a href="https://docs.openvino.ai/nightly/openvino_docs_IE_DG_supported_plugins_AUTO.html#doxid-openvino-docs-i-e-d-g-supported-plugins-a-u-t-o">Auto</a></td>
<td><a href="https://docs.openvino.ai/2023.0/openvino_docs_IE_DG_supported_plugins_AUTO.html#doxid-openvino-docs-i-e-d-g-supported-plugins-a-u-t-o">Auto</a></td>
<td><b><i><a href="./src/plugins/auto">openvino_auto_plugin</a></i></b></td>
<td>Auto plugin enables selecting Intel device for inference automatically</td>
</tr>
<tr>
<td><a href="https://docs.openvino.ai/nightly/openvino_docs_OV_UG_Automatic_Batching.html">Auto Batch</a></td>
<td><a href="https://docs.openvino.ai/2023.0/openvino_docs_OV_UG_Automatic_Batching.html">Auto Batch</a></td>
<td><b><i><a href="./src/plugins/auto_batch">openvino_auto_batch_plugin</a></i></b></td>
<td>Auto batch plugin performs on-the-fly automatic batching (i.e. grouping inference requests together) to improve device utilization, with no programming effort from the user</td>
</tr>
<tr>
<td><a href="https://docs.openvino.ai/nightly/openvino_docs_OV_UG_Hetero_execution.html#doxid-openvino-docs-o-v-u-g-hetero-execution">Hetero</a></td>
<td><a href="https://docs.openvino.ai/2023.0/openvino_docs_OV_UG_Hetero_execution.html#doxid-openvino-docs-o-v-u-g-hetero-execution">Hetero</a></td>
<td><b><i><a href="./src/plugins/hetero">openvino_hetero_plugin</a></i></b></td>
<td>Heterogeneous execution enables automatic inference splitting between several devices</td>
</tr>
<tr>
<td><a href="https://docs.openvino.ai/nightly/openvino_docs_OV_UG_Running_on_multiple_devices.html#doxid-openvino-docs-o-v-u-g-running-on-multiple-devices">Multi</a></td>
<td><a href="https://docs.openvino.ai/2023.0/openvino_docs_OV_UG_Running_on_multiple_devices.html#doxid-openvino-docs-o-v-u-g-running-on-multiple-devices">Multi</a></td>
<td><b><i><a href="./src/plugins/auto">openvino_auto_plugin</a></i></b></td>
<td>Multi plugin enables simultaneous inference of the same model on several devices in parallel</td>
</tr>
@@ -156,10 +157,10 @@ The list of OpenVINO tutorials:
## System requirements
The system requirements vary depending on platform and are available on dedicated pages:
- [Linux](https://docs.openvino.ai/nightly/openvino_docs_install_guides_installing_openvino_linux_header.html)
- [Windows](https://docs.openvino.ai/nightly/openvino_docs_install_guides_installing_openvino_windows_header.html)
- [macOS](https://docs.openvino.ai/nightly/openvino_docs_install_guides_installing_openvino_macos_header.html)
- [Raspbian](https://docs.openvino.ai/nightly/openvino_docs_install_guides_installing_openvino_raspbian.html)
- [Linux](https://docs.openvino.ai/2023.0/openvino_docs_install_guides_installing_openvino_linux_header.html)
- [Windows](https://docs.openvino.ai/2023.0/openvino_docs_install_guides_installing_openvino_windows_header.html)
- [macOS](https://docs.openvino.ai/2023.0/openvino_docs_install_guides_installing_openvino_macos_header.html)
- [Raspbian](https://docs.openvino.ai/2023.0/openvino_docs_install_guides_installing_openvino_raspbian.html)
## How to build
@@ -188,7 +189,6 @@ Report questions, issues and suggestions, using:
* [Neural Network Compression Framework (NNCF)](https://github.com/openvinotoolkit/nncf) - a suite of advanced algorithms for model inference optimization including quantization, filter pruning, binarization and sparsity
* [OpenVINO™ Training Extensions (OTE)](https://github.com/openvinotoolkit/training_extensions) - convenient environment to train Deep Learning models and convert them using OpenVINO for optimized inference.
* [OpenVINO™ Model Server (OVMS)](https://github.com/openvinotoolkit/model_server) - a scalable, high-performance solution for serving deep learning models optimized for Intel architectures
* [DL Workbench](https://docs.openvino.ai/nightly/workbench_docs_Workbench_DG_Introduction.html) - an alternative, web-based version of OpenVINO designed to facilitate optimization and compression of pre-trained deep learning models.
* [Computer Vision Annotation Tool (CVAT)](https://github.com/opencv/cvat) - an online, interactive video and image annotation tool for computer vision purposes.
* [Dataset Management Framework (Datumaro)](https://github.com/openvinotoolkit/datumaro) - a framework and CLI tool to build, transform, and analyze datasets.
@@ -196,7 +196,7 @@ Report questions, issues and suggestions, using:
\* Other names and brands may be claimed as the property of others.
[Open Model Zoo]:https://github.com/openvinotoolkit/open_model_zoo
[OpenVINO™ Runtime]:https://docs.openvino.ai/nightly/openvino_docs_OV_UG_OV_Runtime_User_Guide.html
[Model Optimizer]:https://docs.openvino.ai/nightly/openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html
[Post-Training Optimization Tool]:https://docs.openvino.ai/nightly/pot_introduction.html
[OpenVINO™ Runtime]:https://docs.openvino.ai/2023.0/openvino_docs_OV_UG_OV_Runtime_User_Guide.html
[Model Optimizer]:https://docs.openvino.ai/2023.0/openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html
[Post-Training Optimization Tool]:https://docs.openvino.ai/2023.0/pot_introduction.html
[Samples]:https://github.com/openvinotoolkit/openvino/tree/master/samples

View File

@@ -53,7 +53,7 @@ if(THREADING STREQUAL "OMP")
update_deps_cache(OMP "${OMP}" "Path to OMP root folder")
debug_message(STATUS "intel_omp=" ${OMP})
ie_cpack_add_component(omp HIDDEN)
ov_cpack_add_component(omp HIDDEN)
file(GLOB_RECURSE source_list "${OMP}/*${CMAKE_SHARED_LIBRARY_SUFFIX}*")
install(FILES ${source_list}
DESTINATION ${OV_CPACK_RUNTIMEDIR}
@@ -96,11 +96,12 @@ function(ov_download_tbb)
if(WIN32 AND X86_64)
# TODO: add target_path to be platform specific as well, to avoid following if
# build oneTBB 2021.2.1 with Visual Studio 2019 (MSVC 14.21)
RESOLVE_DEPENDENCY(TBB
ARCHIVE_WIN "oneapi-tbb-2021.2.1-win.zip"
ARCHIVE_WIN "oneapi-tbb-2021.2.2-win.zip"
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "d81591673bd7d3d9454054642f8ef799e1fdddc7b4cee810a95e6130eb7323d4"
SHA256 "103b19a8af288c6a7d83ed3f0d2239c4afd0dd189fc12aad1d34b3c9e78df94b"
USE_NEW_LOCATION TRUE)
elseif(ANDROID AND X86_64)
RESOLVE_DEPENDENCY(TBB
@@ -108,7 +109,8 @@ function(ov_download_tbb)
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "f42d084224cc2d643314bd483ad180b081774608844000f132859fca3e9bf0ce")
elseif(LINUX AND X86_64)
elseif(LINUX AND X86_64 AND OV_GLIBC_VERSION VERSION_GREATER_EQUAL 2.17)
# build oneTBB 2021.2.1 with gcc 4.8 (glibc 2.17)
RESOLVE_DEPENDENCY(TBB
ARCHIVE_LIN "oneapi-tbb-2021.2.1-lin.tgz"
TARGET_PATH "${TEMP}/tbb"
@@ -122,12 +124,37 @@ function(ov_download_tbb)
ENVIRONMENT "TBBROOT"
SHA256 "321261ff2eda6d4568a473cb883262bce77a93dac599f7bd65d2918bdee4d75b")
elseif(APPLE AND X86_64)
# build oneTBB 2021.2.1 with OS version 11.4
RESOLVE_DEPENDENCY(TBB
ARCHIVE_MAC "oneapi-tbb-2021.2.1-mac.tgz"
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "c57ce4b97116cd3093c33e6dcc147fb1bbb9678d0ee6c61a506b2bfe773232cb"
USE_NEW_LOCATION TRUE)
elseif(WIN32 AND AARCH64)
# build oneTBB 2021.2.1 with Visual Studio 2022 (MSVC 14.35)
RESOLVE_DEPENDENCY(TBB
ARCHIVE_WIN "oneapi-tbb-2021.2.1-win-arm64.zip"
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "09fe7f5e7be589aa34ccd20fdfd7cad9e0afa89d1e74ecdb008a75d0af71d6e1"
USE_NEW_LOCATION TRUE)
elseif(LINUX AND AARCH64 AND OV_GLIBC_VERSION VERSION_GREATER_EQUAL 2.17)
# build oneTBB 2021.2.1 with gcc 4.8 (glibc 2.17)
RESOLVE_DEPENDENCY(TBB
ARCHIVE_LIN "oneapi-tbb-2021.2.1-lin-arm64.tgz"
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "6b87194a845aa9314f3785d842e250d934e545eccc4636655c7b27c98c302c0c"
USE_NEW_LOCATION TRUE)
elseif(APPLE AND AARCH64)
# build oneTBB 2021.2.1 with export MACOSX_DEPLOYMENT_TARGET=11.0
RESOLVE_DEPENDENCY(TBB
ARCHIVE_MAC "oneapi-tbb-2021.2.1-mac-arm64.tgz"
TARGET_PATH "${TEMP}/tbb"
ENVIRONMENT "TBBROOT"
SHA256 "15d46ef19501e4315a5498af59af873dbf8180e9a3ea55253ccf7f0c0bb6f940"
USE_NEW_LOCATION TRUE)
else()
message(WARNING "Prebuilt TBB is not available on current platform")
endif()

View File

@@ -111,8 +111,8 @@ else()
set(BIN_FOLDER "bin/${ARCH_FOLDER}")
endif()
if(CMAKE_GENERATOR MATCHES "^Ninja Multi-Config$")
# Ninja-Multi specific, see:
if(CMAKE_GENERATOR STREQUAL "Ninja Multi-Config")
# 'Ninja Multi-Config' specific, see:
# https://cmake.org/cmake/help/latest/variable/CMAKE_DEFAULT_BUILD_TYPE.html
set(CMAKE_DEFAULT_BUILD_TYPE "Release" CACHE STRING "CMake default build type")
elseif(NOT OV_GENERATOR_MULTI_CONFIG)
@@ -240,7 +240,7 @@ if(ENABLE_LTO)
LANGUAGES C CXX)
if(NOT IPO_SUPPORTED)
set(ENABLE_LTO "OFF" CACHE STRING "Enable Link Time Optmization" FORCE)
set(ENABLE_LTO "OFF" CACHE STRING "Enable Link Time Optimization" FORCE)
message(WARNING "IPO / LTO is not supported: ${OUTPUT_MESSAGE}")
endif()
endif()
@@ -250,8 +250,8 @@ endif()
macro(ov_install_static_lib target comp)
if(NOT BUILD_SHARED_LIBS)
get_target_property(target_type ${target} TYPE)
if(${target_type} STREQUAL "STATIC_LIBRARY")
set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL FALSE)
if(target_type STREQUAL "STATIC_LIBRARY")
set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL OFF)
endif()
install(TARGETS ${target} EXPORT OpenVINOTargets
ARCHIVE DESTINATION ${OV_CPACK_ARCHIVEDIR} COMPONENT ${comp} ${ARGN})

View File

@@ -4,23 +4,28 @@
if(WIN32)
set(PROGRAMFILES_ENV "ProgramFiles(X86)")
file(TO_CMAKE_PATH $ENV{${PROGRAMFILES_ENV}} PROGRAMFILES)
set(WDK_PATHS "${PROGRAMFILES}/Windows Kits/10/bin/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/x64"
"${PROGRAMFILES}/Windows Kits/10/bin/x64")
# check that PROGRAMFILES_ENV is defined, because in case of cross-compilation for Windows
# we don't have such variable
if(DEFINED ENV{PROGRAMFILES_ENV})
file(TO_CMAKE_PATH $ENV{${PROGRAMFILES_ENV}} PROGRAMFILES)
message(STATUS "Trying to find apivalidator in: ")
foreach(wdk_path IN LISTS WDK_PATHS)
message(" * ${wdk_path}")
endforeach()
set(WDK_PATHS "${PROGRAMFILES}/Windows Kits/10/bin/${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}/x64"
"${PROGRAMFILES}/Windows Kits/10/bin/x64")
find_host_program(ONECORE_API_VALIDATOR
NAMES apivalidator
PATHS ${WDK_PATHS}
DOC "ApiValidator for OneCore compliance")
message(STATUS "Trying to find apivalidator in: ")
foreach(wdk_path IN LISTS WDK_PATHS)
message(" * ${wdk_path}")
endforeach()
if(ONECORE_API_VALIDATOR)
message(STATUS "Found apivalidator: ${ONECORE_API_VALIDATOR}")
find_host_program(ONECORE_API_VALIDATOR
NAMES apivalidator
PATHS ${WDK_PATHS}
DOC "ApiValidator for OneCore compliance")
if(ONECORE_API_VALIDATOR)
message(STATUS "Found apivalidator: ${ONECORE_API_VALIDATOR}")
endif()
endif()
endif()

View File

@@ -4,8 +4,13 @@
macro(enable_fuzzing)
# Enable (libFuzzer)[https://llvm.org/docs/LibFuzzer.html] if supported.
set(FUZZING_COMPILER_FLAGS "-fsanitize=fuzzer-no-link -fprofile-instr-generate -fcoverage-mapping")
set(FUZZING_LINKER_FLAGS "-fsanitize-coverage=trace-pc-guard -fprofile-instr-generate")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# see https://learn.microsoft.com/en-us/cpp/build/reference/fsanitize?view=msvc-160#remarks
set(FUZZING_COMPILER_FLAGS "/fsanitize=fuzzer")
elseif(OV_COMPILER_IS_CLANG)
set(FUZZING_COMPILER_FLAGS "-fsanitize=fuzzer-no-link -fprofile-instr-generate -fcoverage-mapping")
set(FUZZING_LINKER_FLAGS "-fsanitize-coverage=trace-pc-guard -fprofile-instr-generate")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${FUZZING_COMPILER_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FUZZING_COMPILER_FLAGS}")
@@ -20,6 +25,10 @@ function(add_fuzzer FUZZER_EXE_NAME FUZZER_SOURCES)
add_executable(${FUZZER_EXE_NAME} ${FUZZER_SOURCES})
target_link_libraries(${FUZZER_EXE_NAME} PRIVATE fuzz-testhelper)
if(ENABLE_FUZZING)
set_target_properties(${FUZZER_EXE_NAME} PROPERTIES LINK_FLAGS "-fsanitize=fuzzer")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# no extra flags are required
elseif(OV_COMPILER_IS_CLANG)
set_target_properties(${FUZZER_EXE_NAME} PROPERTIES LINK_FLAGS "-fsanitize=fuzzer")
endif()
endif()
endfunction(add_fuzzer)

View File

@@ -12,23 +12,17 @@ include(CheckCXXCompilerFlag)
# Defines ie_c_cxx_deprecated varaible which contains C / C++ compiler flags
#
macro(ov_disable_deprecated_warnings)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(ie_c_cxx_deprecated "/wd4996")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(WIN32)
set(ie_c_cxx_deprecated "/Qdiag-disable:1478,1786")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(ie_c_cxx_deprecated "/wd4996")
elseif(OV_COMPILER_IS_CLANG)
set(ie_c_cxx_deprecated "-Wno-deprecated-declarations")
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
else()
set(ie_c_cxx_deprecated "-diag-disable=1478,1786")
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(ie_c_cxx_deprecated "-Wno-deprecated-declarations")
endif()
endif()
if(NOT ie_c_cxx_deprecated)
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(ie_c_cxx_deprecated "-Wno-deprecated-declarations")
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
@@ -49,24 +43,18 @@ endmacro()
# Defines ie_c_cxx_deprecated_no_errors varaible which contains C / C++ compiler flags
#
macro(ov_deprecated_no_errors)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# show 4996 only for /w4
set(ie_c_cxx_deprecated_no_errors "/wd4996")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(WIN32)
set(ie_c_cxx_deprecated_no_errors "/Qdiag-warning:1478,1786")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# show 4996 only for /w4
set(ie_c_cxx_deprecated_no_errors "/wd4996")
elseif(OV_COMPILER_IS_CLANG)
set(ie_c_cxx_deprecated_no_errors "-Wno-error=deprecated-declarations")
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
else()
set(ie_c_cxx_deprecated_no_errors "-diag-warning=1478,1786")
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(ie_c_cxx_deprecated_no_errors "-Wno-error=deprecated-declarations")
endif()
endif()
if(NOT ie_c_cxx_deprecated_no_errors)
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(ie_c_cxx_deprecated_no_errors "-Wno-error=deprecated-declarations")
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
@@ -101,23 +89,21 @@ endmacro()
# Provides SSE4.2 compilation flags depending on an OS and a compiler
#
macro(ie_sse42_optimization_flags flags)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# No such option for MSVC 2019
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# No such option for MSVC 2019
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(WIN32)
set(${flags} /QxSSE4.2)
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
set(${flags} -xSSE4.2)
endif()
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(${flags} -msse4.2)
if(EMSCRIPTEN)
list(APPEND ${flags} -msimd128)
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(${flags} -xSSE4.2)
else()
set(${flags} -msse4.2)
if(EMSCRIPTEN)
list(APPEND ${flags} -msimd128)
endif()
endif()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endmacro()
@@ -127,20 +113,18 @@ endmacro()
# Provides AVX2 compilation flags depending on an OS and a compiler
#
macro(ie_avx2_optimization_flags flags)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(${flags} /arch:AVX2)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(WIN32)
set(${flags} /QxCORE-AVX2)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(${flags} /arch:AVX2)
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(${flags} -xCORE-AVX2)
else()
set(${flags} -mavx2 -mfma)
endif()
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(${flags} -mavx2 -mfma)
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endmacro()
@@ -151,24 +135,18 @@ endmacro()
# depending on an OS and a compiler
#
macro(ie_avx512_optimization_flags flags)
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(${flags} /arch:AVX512)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if(WIN32)
set(${flags} /QxCOMMON-AVX512)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(${flags} /arch:AVX512)
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(${flags} -xCOMMON-AVX512)
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(${flags} -mavx512f -mfma)
endif()
if(CMAKE_CXX_COMPILER_ID MATCHES "^(Clang|AppleClang)$")
set(${flags} -mavx512f -mfma)
endif()
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
set(${flags} -mavx512f -mfma)
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endmacro()
@@ -265,8 +243,10 @@ endfunction()
function(ov_force_include target scope header_file)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(${target} ${scope} /FI"${header_file}")
else()
elseif(OV_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_GNUCXX)
target_compile_options(${target} ${scope} -include "${header_file}")
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endfunction()
@@ -318,11 +298,11 @@ set(CMAKE_VISIBILITY_INLINES_HIDDEN ON)
if(CMAKE_CL_64)
# Default char Type Is unsigned
# ie_add_compiler_flags(/J)
else()
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
ie_add_compiler_flags(-fsigned-char)
endif()
if(WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
#
# Common options / warnings enabled
#
@@ -335,16 +315,14 @@ if(WIN32)
# This option helps ensure the fewest possible hard-to-find code defects. Similar to -Wall on GNU / Clang
ie_add_compiler_flags(/W3)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Increase Number of Sections in .Obj file
ie_add_compiler_flags(/bigobj)
# Build with multiple processes
ie_add_compiler_flags(/MP)
# Increase Number of Sections in .Obj file
ie_add_compiler_flags(/bigobj)
# Build with multiple processes
ie_add_compiler_flags(/MP)
if(AARCH64 AND NOT MSVC_VERSION LESS 1930)
# otherwise, _ARM64_EXTENDED_INTRINSICS is defined, which defines 'mvn' macro
ie_add_compiler_flags(/D_ARM64_DISTINCT_NEON_TYPES)
endif()
if(AARCH64 AND NOT MSVC_VERSION LESS 1930)
# otherwise, _ARM64_EXTENDED_INTRINSICS is defined, which defines 'mvn' macro
ie_add_compiler_flags(/D_ARM64_DISTINCT_NEON_TYPES)
endif()
# Handle Large Addresses
@@ -361,42 +339,62 @@ if(WIN32)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /WX")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /WX")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /WX")
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
ie_add_compiler_flags(/Qdiag-warning:47,1740,1786)
endif()
endif()
#
# Disable noisy warnings
#
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# C4251 needs to have dll-interface to be used by clients of class
ie_add_compiler_flags(/wd4251)
# C4275 non dll-interface class used as base for dll-interface class
ie_add_compiler_flags(/wd4275)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
# 161: unrecognized pragma
# 177: variable was declared but never referenced
# 556: not matched type of assigned function pointer
# 1744: field of class type without a DLL interface used in a class with a DLL interface
# 1879: unimplemented pragma ignored
# 2586: decorated name length exceeded, name was truncated
# 2651: attribute does not apply to any entity
# 3180: unrecognized OpenMP pragma
# 11075: To get full report use -Qopt-report:4 -Qopt-report-phase ipo
# 15335: was not vectorized: vectorization possible but seems inefficient. Use vector always directive or /Qvec-threshold0 to override
ie_add_compiler_flags(/Qdiag-disable:161,177,556,1744,1879,2586,2651,3180,11075,15335)
endif()
# C4251 needs to have dll-interface to be used by clients of class
ie_add_compiler_flags(/wd4251)
# C4275 non dll-interface class used as base for dll-interface class
ie_add_compiler_flags(/wd4275)
#
# Debug information flags, by default CMake adds /Zi option
# but provides no way to specify CMAKE_COMPILE_PDB_NAME on root level
# In order to avoid issues with ninja we are replacing default flag instead of having two of them
# and observing warning D9025 about flag override
#
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel" AND WIN32)
#
# Warnings as errors
#
if(CMAKE_COMPILE_WARNING_AS_ERROR AND CMAKE_VERSION VERSION_LESS 3.24)
ie_add_compiler_flags(/Qdiag-warning:47,1740,1786)
endif()
#
# Disable noisy warnings
#
# 161: unrecognized pragma
ie_add_compiler_flags(/Qdiag-disable:161)
# 177: variable was declared but never referenced
ie_add_compiler_flags(/Qdiag-disable:177)
# 556: not matched type of assigned function pointer
ie_add_compiler_flags(/Qdiag-disable:556)
# 1744: field of class type without a DLL interface used in a class with a DLL interface
ie_add_compiler_flags(/Qdiag-disable:1744)
# 1879: unimplemented pragma ignored
ie_add_compiler_flags(/Qdiag-disable:1879)
# 2586: decorated name length exceeded, name was truncated
ie_add_compiler_flags(/Qdiag-disable:2586)
# 2651: attribute does not apply to any entity
ie_add_compiler_flags(/Qdiag-disable:2651)
# 3180: unrecognized OpenMP pragma
ie_add_compiler_flags(/Qdiag-disable:3180)
# 11075: To get full report use -Qopt-report:4 -Qopt-report-phase ipo
ie_add_compiler_flags(/Qdiag-disable:11075)
# 15335: was not vectorized: vectorization possible but seems inefficient.
# Use vector always directive or /Qvec-threshold0 to override
ie_add_compiler_flags(/Qdiag-disable:15335)
else()
#
# Common enabled warnings

View File

@@ -5,7 +5,9 @@
include(CheckCXXCompilerFlag)
if (ENABLE_SANITIZER)
if (WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# the flag is available since MSVC 2019 16.9
# see https://learn.microsoft.com/en-us/cpp/build/reference/fsanitize?view=msvc-160
check_cxx_compiler_flag("/fsanitize=address" SANITIZE_ADDRESS_SUPPORTED)
if (SANITIZE_ADDRESS_SUPPORTED)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} /fsanitize=address")
@@ -14,21 +16,23 @@ if (ENABLE_SANITIZER)
"Please, check requirements:\n"
"https://github.com/openvinotoolkit/openvino/wiki/AddressSanitizer-and-LeakSanitizer")
endif()
else()
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize=address")
check_cxx_compiler_flag("-fsanitize-recover=address" SANITIZE_RECOVER_ADDRESS_SUPPORTED)
if (SANITIZE_RECOVER_ADDRESS_SUPPORTED)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize-recover=address")
endif()
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=address")
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endif()
if (ENABLE_UB_SANITIZER)
if (WIN32)
message(FATAL_ERROR "UndefinedBehavior sanitizer is not supported in Windows")
if(ENABLE_UB_SANITIZER)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message(FATAL_ERROR "UndefinedBehavior sanitizer is not supported in Windows with MSVC compiler. Please, use clang-cl or mingw")
endif()
# TODO: Remove -fno-sanitize=null as thirdparty/ocl/clhpp_headers UBSAN compatibility resolved:
# https://github.com/KhronosGroup/OpenCL-CLHPP/issues/17
# Mute -fsanitize=function Indirect call of a function through a function pointer of the wrong type.
@@ -48,43 +52,50 @@ if (ENABLE_UB_SANITIZER)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fno-sanitize=function")
endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# TODO: Remove -Wno-maybe-uninitialized after CVS-61143 fix
if(CMAKE_COMPILER_IS_GNUCXX)
# TODO: Remove -Wno-maybe-uninitialized after CVS-61143 is fixed
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -Wno-maybe-uninitialized")
endif()
check_cxx_compiler_flag("-fsanitize-recover=undefined" SANITIZE_RECOVER_UNDEFINED_SUPPORTED)
if (SANITIZE_RECOVER_UNDEFINED_SUPPORTED)
if(SANITIZE_RECOVER_UNDEFINED_SUPPORTED)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize-recover=undefined")
endif()
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=undefined")
endif()
if (ENABLE_THREAD_SANITIZER)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize=thread")
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=thread")
if(ENABLE_THREAD_SANITIZER)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message(FATAL_ERROR "Thread sanitizer is not supported in Windows with MSVC compiler. Please, use clang-cl or mingw")
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fsanitize=thread")
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fsanitize=thread")
else()
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
endif()
# common sanitizer options
if (DEFINED SANITIZER_COMPILER_FLAGS)
if(DEFINED SANITIZER_COMPILER_FLAGS)
# ensure symbols are present
if (NOT WIN32)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} /Oy-")
elseif(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG)
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -g -fno-omit-frame-pointer")
if(NOT OV_COMPILER_IS_CLANG)
if(CMAKE_COMPILER_IS_GNUCXX)
# GPU plugin tests compilation is slow with -fvar-tracking-assignments on GCC.
# Clang has no var-tracking-assignments.
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} -fno-var-tracking-assignments")
endif()
# prevent unloading libraries at runtime, so sanitizer can resolve their symbols
if (NOT CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
if(NOT OV_COMPILER_IS_APPLECLANG)
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -Wl,-z,nodelete")
if(OV_COMPILER_IS_CLANG AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 8.0)
set(SANITIZER_LINKER_FLAGS "${SANITIZER_LINKER_FLAGS} -fuse-ld=lld")
endif()
endif()
else()
set(SANITIZER_COMPILER_FLAGS "${SANITIZER_COMPILER_FLAGS} /Oy-")
message(WARNING "Unsupported CXX compiler ${CMAKE_CXX_COMPILER_ID}")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_COMPILER_FLAGS}")

View File

@@ -2,61 +2,68 @@
# SPDX-License-Identifier: Apache-2.0
#
if(UNIX)
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wformat -Wformat-security")
if(CMAKE_COMPILER_IS_GNUCXX OR OV_COMPILER_IS_CLANG OR
(UNIX AND CMAKE_CXX_COMPILER_ID STREQUAL "Intel"))
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -Wformat -Wformat-security")
if (NOT ENABLE_SANITIZER)
if(EMSCRIPTEN)
# emcc does not support fortification, see:
# https://stackoverflow.com/questions/58854858/undefined-symbol-stack-chk-guard-in-libopenh264-so-when-building-ffmpeg-wit
else()
# ASan does not support fortification https://github.com/google/sanitizers/issues/247
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -D_FORTIFY_SOURCE=2")
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -D_FORTIFY_SOURCE=2")
endif()
endif()
if(NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -pie")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(IE_LINKER_FLAGS "${IE_LINKER_FLAGS} -z noexecstack -z relro -z now")
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv")
if(CMAKE_COMPILER_IS_GNUCXX)
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -fno-strict-overflow -fno-delete-null-pointer-checks -fwrapv")
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all")
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -fstack-protector-all")
else()
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-strong")
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -fstack-protector-strong")
endif()
if (NOT ENABLE_SANITIZER)
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -s")
# Remove all symbol table and relocation information from the executable
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -s")
endif()
if(NOT MINGW)
set(OV_LINKER_FLAGS "${OV_LINKER_FLAGS} -z noexecstack -z relro -z now")
endif()
elseif(OV_COMPILER_IS_CLANG)
if(EMSCRIPTEN)
# emcc does not support fortification
# https://stackoverflow.com/questions/58854858/undefined-symbol-stack-chk-guard-in-libopenh264-so-when-building-ffmpeg-wit
else()
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-all")
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -fstack-protector-all")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
if (NOT ENABLE_SANITIZER)
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -Wl,--strip-all")
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -Wl,--strip-all")
endif()
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} -fstack-protector-strong")
set(IE_LINKER_FLAGS "${IE_LINKER_FLAGS} -z noexecstack -z relro -z now")
endif()
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /sdl")
endif()
set(IE_C_CXX_FLAGS "${IE_C_CXX_FLAGS} /guard:cf")
if(ENABLE_INTEGRITYCHECK)
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /INTEGRITYCHECK")
endif()
if(ENABLE_QSPECTRE)
ie_add_compiler_flags(/Qspectre)
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} -fstack-protector-strong")
set(OV_LINKER_FLAGS "${OV_LINKER_FLAGS} -z noexecstack -z relro -z now")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} /sdl /guard:cf")
endif()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${IE_C_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${IE_C_CXX_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${IE_LINKER_FLAGS}")
if(ENABLE_QSPECTRE)
set(OV_C_CXX_FLAGS "${OV_C_CXX_FLAGS} /Qspectre")
endif()
if(ENABLE_INTEGRITYCHECK)
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /INTEGRITYCHECK")
endif()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${OV_C_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${OV_C_CXX_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} ${OV_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS_RELEASE "${CMAKE_MODULE_LINKER_FLAGS_RELEASE} ${OV_LINKER_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} ${OV_LINKER_FLAGS}")
unset(OV_C_CXX_FLAGS)
unset(OV_LINKER_FLAGS)

View File

@@ -641,7 +641,7 @@ _repository = None
# Files to exclude from linting. This is set by the --exclude flag.
_excludes = None
# Whether to supress PrintInfo messages
# Whether to suppress PrintInfo messages
_quiet = False
# The allowed line length of files.
@@ -752,7 +752,7 @@ def ParseNolintSuppressions(filename, raw_line, linenum, error):
'Unknown NOLINT error category: %s' % category)
def ProcessGlobalSuppresions(lines):
def ProcessGlobalSuppressions(lines):
"""Updates the list of global error suppressions.
Parses any lint directives in the file that have global effect.
@@ -780,7 +780,7 @@ def IsErrorSuppressedByNolint(category, linenum):
"""Returns true if the specified error category is suppressed on this line.
Consults the global error_suppressions map populated by
ParseNolintSuppressions/ProcessGlobalSuppresions/ResetNolintSuppressions.
ParseNolintSuppressions/ProcessGlobalSuppressions/ResetNolintSuppressions.
Args:
category: str, the category of the error.
@@ -6203,7 +6203,7 @@ def ProcessFileData(filename, file_extension, lines, error,
ResetNolintSuppressions()
CheckForCopyright(filename, lines, error)
ProcessGlobalSuppresions(lines)
ProcessGlobalSuppressions(lines)
RemoveMultiLineComments(filename, lines, error)
clean_lines = CleansedLines(lines)

View File

@@ -74,7 +74,12 @@ ie_option (VERBOSE_BUILD "shows extra information about build" OFF)
ie_option (ENABLE_UNSAFE_LOCATIONS "skip check for MD5 for dependency" OFF)
ie_dependent_option (ENABLE_FUZZING "instrument build for fuzzing" OFF "OV_COMPILER_IS_CLANG;NOT WIN32" OFF)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND MSVC_VERSION GREATER_EQUAL 1930)
# Visual Studio 2022: 1930-1939 = VS 17.0 (v143 toolset)
set(_msvc_version_2022 ON)
endif()
ie_dependent_option (ENABLE_FUZZING "instrument build for fuzzing" OFF "OV_COMPILER_IS_CLANG OR _msvc_version_2022" OFF)
#
# Check features

View File

@@ -171,7 +171,7 @@ macro(ov_add_frontend)
endforeach()
# Disable all warnings for generated code
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIONS -w GENERATED TRUE)
set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES COMPILE_OPTIONS -w GENERATED ON)
# Create library
add_library(${TARGET_NAME} ${LIBRARY_SRC} ${LIBRARY_HEADERS} ${LIBRARY_PUBLIC_HEADERS}
@@ -201,11 +201,10 @@ macro(ov_add_frontend)
${frontend_root_dir}/src
${CMAKE_CURRENT_BINARY_DIR})
ie_add_vs_version_file(NAME ${TARGET_NAME}
ov_add_vs_version_file(NAME ${TARGET_NAME}
FILEDESCRIPTION ${OV_FRONTEND_FILEDESCRIPTION})
target_link_libraries(${TARGET_NAME} PUBLIC openvino::runtime)
target_link_libraries(${TARGET_NAME} PRIVATE ${OV_FRONTEND_LINK_LIBRARIES})
target_link_libraries(${TARGET_NAME} PRIVATE ${OV_FRONTEND_LINK_LIBRARIES} PUBLIC openvino::runtime)
ov_add_library_version(${TARGET_NAME})
# WA for TF frontends which always require protobuf (not protobuf-lite)
@@ -216,23 +215,34 @@ macro(ov_add_frontend)
if(proto_files)
if(OV_FRONTEND_PROTOBUF_LITE)
if(NOT protobuf_lite_installed)
ov_install_static_lib(${Protobuf_LITE_LIBRARIES} ${OV_CPACK_COMP_CORE})
set(protobuf_lite_installed ON CACHE INTERNAL "" FORCE)
endif()
link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LITE_LIBRARIES})
set(protobuf_target_name libprotobuf-lite)
set(protobuf_install_name "protobuf_lite_installed")
else()
if(NOT protobuf_installed)
ov_install_static_lib(${Protobuf_LIBRARIES} ${OV_CPACK_COMP_CORE})
set(protobuf_installed ON CACHE INTERNAL "" FORCE)
endif()
link_system_libraries(${TARGET_NAME} PRIVATE ${Protobuf_LIBRARIES})
set(protobuf_target_name libprotobuf)
set(protobuf_install_name "protobuf_installed")
endif()
if(ENABLE_SYSTEM_PROTOBUF)
# use imported target name with namespace
set(protobuf_target_name "protobuf::${protobuf_target_name}")
endif()
# prptobuf generated code emits -Wsuggest-override error
link_system_libraries(${TARGET_NAME} PRIVATE ${protobuf_target_name})
# protobuf generated code emits -Wsuggest-override error
if(SUGGEST_OVERRIDE_SUPPORTED)
target_compile_options(${TARGET_NAME} PRIVATE -Wno-suggest-override)
endif()
# install protobuf if it is not installed yet
if(NOT ${protobuf_install_name})
if(ENABLE_SYSTEM_PROTOBUF)
# we have to add find_package(Protobuf) to the OpenVINOConfig.cmake for static build
# no needs to install protobuf
else()
ov_install_static_lib(${protobuf_target_name} ${OV_CPACK_COMP_CORE})
set("${protobuf_install_name}" ON CACHE INTERNAL "" FORCE)
endif()
endif()
endif()
if(flatbuffers_schema_files)
@@ -273,7 +283,7 @@ macro(ov_add_frontend)
set(dev_component "${OV_CPACK_COMP_CORE_DEV}")
# TODO: whether we need to do it configuralbe on Windows installer?
ie_cpack_add_component(${lib_component} HIDDEN)
ov_cpack_add_component(${lib_component} HIDDEN)
if(OV_FRONTEND_LINKABLE_FRONTEND)
set(export_set EXPORT OpenVINOTargets)

View File

@@ -2,41 +2,6 @@
# SPDX-License-Identifier: Apache-2.0
#
include(target_flags)
# TODO: remove this function: we must not have conditions for particular OS names or versions
# cmake needs to look at /etc files only when we build for Linux on Linux
if(CMAKE_HOST_LINUX AND LINUX)
function(get_linux_name res_var)
if(EXISTS "/etc/lsb-release")
# linux version detection using cat /etc/lsb-release
file(READ "/etc/lsb-release" release_data)
set(name_regex "DISTRIB_ID=([^ \n]*)\n")
set(version_regex "DISTRIB_RELEASE=([0-9]+(\\.[0-9]+)?)")
else()
execute_process(COMMAND find -L /etc/ -maxdepth 1 -type f -name *-release -exec cat {} \;
OUTPUT_VARIABLE release_data
RESULT_VARIABLE result)
string(REPLACE "Red Hat" "CentOS" release_data "${release_data}")
set(name_regex "NAME=\"([^ \"\n]*).*\"\n")
set(version_regex "VERSION=\"([0-9]+(\\.[0-9]+)?)[^\n]*\"")
endif()
string(REGEX MATCH ${name_regex} name ${release_data})
set(os_name ${CMAKE_MATCH_1})
string(REGEX MATCH ${version_regex} version ${release_data})
set(os_name "${os_name} ${CMAKE_MATCH_1}")
if(os_name)
set(${res_var} ${os_name} PARENT_SCOPE)
else ()
set(${res_var} NOTFOUND PARENT_SCOPE)
endif ()
endfunction()
else()
function(get_linux_name res_var)
set(${res_var} NOTFOUND PARENT_SCOPE)
endfunction()
endif ()
function(get_linux_name res_var)
set(${res_var} NOTFOUND PARENT_SCOPE)
endfunction()

View File

@@ -18,7 +18,7 @@ function(ov_native_compile_external_project)
set(multiValueArgs CMAKE_ARGS NATIVE_TARGETS)
cmake_parse_arguments(ARG "" "${oneValueRequiredArgs};${oneValueOptionalArgs}" "${multiValueArgs}" ${ARGN})
if(YOCTO_AARCH64)
if(YOCTO_AARCH64 OR EMSCRIPTEN)
# need to unset several variables which can set env to cross-environment
foreach(var SDKTARGETSYSROOT CONFIG_SITE OECORE_NATIVE_SYSROOT OECORE_TARGET_SYSROOT
OECORE_ACLOCAL_OPTS OECORE_BASELIB OECORE_TARGET_ARCH OECORE_TARGET_OS CC CXX
@@ -31,10 +31,17 @@ function(ov_native_compile_external_project)
endif()
endforeach()
# set root path
if(YOCTO_AARCH64)
set(root_path "$ENV{OECORE_NATIVE_SYSROOT}")
elseif(EMSCRIPTEN)
set(root_path "$ENV{EMSDK}")
endif()
# filter out PATH from yocto locations
string(REPLACE ":" ";" custom_path "$ENV{PATH}")
foreach(path IN LISTS custom_path)
if(NOT path MATCHES "^$ENV{OECORE_NATIVE_SYSROOT}")
if(DEFINED root_path AND NOT path MATCHES "^${root_path}")
list(APPEND clean_path "${path}")
endif()
endforeach()
@@ -81,6 +88,21 @@ function(ov_native_compile_external_project)
endif()
endif()
if(compile_flags)
list(APPEND ARG_CMAKE_ARGS "-DCMAKE_CXX_FLAGS=${compile_flags}" "-DCMAKE_C_FLAGS=${compile_flags}")
endif()
if(DEFINED CMAKE_CXX_COMPILER_LAUNCHER)
list(APPEND ARG_CMAKE_ARGS "-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}")
endif()
if(DEFINED CMAKE_C_COMPILER_LAUNCHER)
list(APPEND ARG_CMAKE_ARGS "-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}")
endif()
if(DEFINED CMAKE_MAKE_PROGRAM)
list(APPEND ARG_CMAKE_ARGS "-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}")
endif()
ExternalProject_Add(${ARG_TARGET_NAME}
# Directory Options
SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}"
@@ -89,12 +111,9 @@ function(ov_native_compile_external_project)
INSTALL_DIR "${ARG_NATIVE_INSTALL_DIR}"
# Configure Step Options:
CMAKE_COMMAND
${NATIVE_CMAKE_COMMAND}
"${NATIVE_CMAKE_COMMAND}" -E env ${cmake_env}
"${NATIVE_CMAKE_COMMAND}"
CMAKE_ARGS
"-DCMAKE_CXX_COMPILER_LAUNCHER=${CMAKE_CXX_COMPILER_LAUNCHER}"
"-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}"
"-DCMAKE_CXX_FLAGS=${compile_flags}"
"-DCMAKE_C_FLAGS=${compile_flags}"
"-DCMAKE_POLICY_DEFAULT_CMP0069=NEW"
"-DCMAKE_INSTALL_PREFIX=${ARG_NATIVE_INSTALL_DIR}"
${ARG_CMAKE_ARGS}
@@ -102,7 +121,7 @@ function(ov_native_compile_external_project)
${ARG_NATIVE_SOURCE_SUBDIR}
# Build Step Options:
BUILD_COMMAND
${NATIVE_CMAKE_COMMAND}
"${NATIVE_CMAKE_COMMAND}"
--build "${CMAKE_CURRENT_BINARY_DIR}/build"
--config Release
--parallel

View File

@@ -27,6 +27,8 @@ elseif(PYTHON_VERSION_MINOR EQUAL 9)
set(clang_version 12)
elseif(PYTHON_VERSION_MINOR EQUAL 10)
set(clang_version 14)
elseif(PYTHON_VERSION_MINOR EQUAL 11)
set(clang_version 14)
else()
message(WARNING "Cannot suggest clang package for python ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
endif()

View File

@@ -25,7 +25,7 @@ macro(ov_common_libraries_cpack_set_dirs)
set(OV_CPACK_IE_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/inferenceengine${OpenVINO_VERSION})
set(OV_CPACK_NGRAPH_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/ngraph${OpenVINO_VERSION})
set(OV_CPACK_OPENVINO_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/openvino${OpenVINO_VERSION})
set(OV_CPACK_DOCDIR ${CMAKE_INSTALL_DATADIR}/doc/openvino-${OpenVINO_VERSION})
set(OV_CPACK_LICENSESDIR licenses)
ov_get_pyversion(pyversion)
if(pyversion)

View File

@@ -31,6 +31,7 @@ macro(ov_debian_cpack_set_dirs)
set(OV_CPACK_NGRAPH_CMAKEDIR ${OV_CPACK_RUNTIMEDIR}/cmake/ngraph${OpenVINO_VERSION})
set(OV_CPACK_OPENVINO_CMAKEDIR ${OV_CPACK_RUNTIMEDIR}/cmake/openvino${OpenVINO_VERSION})
set(OV_CPACK_DOCDIR ${CMAKE_INSTALL_DATADIR}/doc/openvino-${OpenVINO_VERSION})
set(OV_CPACK_LICENSESDIR ${OV_CPACK_DOCDIR}/licenses)
set(OV_CPACK_PYTHONDIR lib/python3/dist-packages)
# non-native stuff

View File

@@ -29,6 +29,7 @@ macro(ov_cpack_set_dirs)
set(OV_CPACK_NGRAPH_CMAKEDIR runtime/cmake)
set(OV_CPACK_OPENVINO_CMAKEDIR runtime/cmake)
set(OV_CPACK_DOCDIR docs)
set(OV_CPACK_LICENSESDIR ${OV_CPACK_DOCDIR}/licenses)
set(OV_CPACK_SAMPLESDIR samples)
set(OV_CPACK_WHEELSDIR tools)
set(OV_CPACK_TOOLSDIR tools)
@@ -66,11 +67,11 @@ endmacro()
ov_cpack_set_dirs()
#
# ie_cpack_add_component(NAME ...)
# ov_cpack_add_component(NAME ...)
#
# Wraps original `cpack_add_component` and adds component to internal IE list
#
function(ie_cpack_add_component name)
function(ov_cpack_add_component name)
if(NOT ${name} IN_LIST IE_CPACK_COMPONENTS_ALL)
cpack_add_component(${name} ${ARGN})
@@ -99,10 +100,10 @@ endif()
# if <FILE> is a symlink, we resolve it, but install file with a name of symlink
#
function(ov_install_with_name file component)
if((APPLE AND file MATCHES "^[^\.]+\.[0-9]+${CMAKE_SHARED_LIBRARY_SUFFIX}$") OR
(file MATCHES "^.*\.${CMAKE_SHARED_LIBRARY_SUFFIX}\.[0-9]+$"))
get_filename_component(actual_name "${file}" NAME)
if((APPLE AND actual_name MATCHES "^[^\.]+\.[0-9]+${CMAKE_SHARED_LIBRARY_SUFFIX}$") OR
(actual_name MATCHES "^.*\.${CMAKE_SHARED_LIBRARY_SUFFIX}\.[0-9]+$"))
if(IS_SYMLINK "${file}")
get_filename_component(actual_name "${file}" NAME)
get_filename_component(file "${file}" REALPATH)
set(install_rename RENAME "${actual_name}")
endif()
@@ -162,7 +163,7 @@ elseif(CPACK_GENERATOR STREQUAL "RPM")
include(packaging/rpm/rpm)
elseif(CPACK_GENERATOR STREQUAL "NSIS")
include(packaging/nsis)
elseif(CPACK_GENERATOR MATCHES "^(CONDA-FORGE|BREW)$")
elseif(CPACK_GENERATOR MATCHES "^(CONDA-FORGE|BREW|CONAN)$")
include(packaging/common-libraries)
endif()

View File

@@ -22,6 +22,11 @@ macro(ov_rpm_cpack_set_dirs)
set(OV_CPACK_NGRAPH_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/ngraph${OpenVINO_VERSION})
set(OV_CPACK_OPENVINO_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/cmake/openvino${OpenVINO_VERSION})
set(OV_CPACK_DOCDIR ${CMAKE_INSTALL_DATADIR}/doc/openvino-${OpenVINO_VERSION})
set(OV_CPACK_LICENSESDIR ${OV_CPACK_DOCDIR}/licenses)
# TODO:
# 1. define python installation directories for RPM packages
# 2. make sure only a single version of python API can be installed at the same time (define conflicts section)
# set(OV_CPACK_PYTHONDIR lib/python3/dist-packages)
ov_get_pyversion(pyversion)

View File

@@ -4,13 +4,13 @@
cmake_policy(SET CMP0007 NEW)
set(newContent " <plugin name=\"${IE_DEVICE_NAME}\" location=\"${IE_PLUGIN_LIBRARY_NAME}\">")
set(newContent " <plugin name=\"${OV_DEVICE_NAME}\" location=\"${OV_PLUGIN_LIBRARY_NAME}\">")
if(IE_PLUGIN_PROPERTIES)
if(OV_PLUGIN_PROPERTIES)
set(newContent "${newContent}
<properties>")
foreach(props IN LISTS IE_PLUGIN_PROPERTIES)
foreach(props IN LISTS OV_PLUGIN_PROPERTIES)
string(REPLACE ":" ";" props "${props}")
list(GET props 0 key)
@@ -27,4 +27,4 @@ endif()
set(newContent "${newContent}
</plugin>")
file(WRITE "${IE_CONFIG_OUTPUT_FILE}" "${newContent}")
file(WRITE "${OV_CONFIG_OUTPUT_FILE}" "${newContent}")

View File

@@ -6,11 +6,15 @@ include(CMakeParseArguments)
set(PLUGIN_FILES "" CACHE INTERNAL "")
function(ie_plugin_get_file_name target_name library_name)
function(ov_plugin_get_file_name target_name library_name)
set(LIB_PREFIX "${CMAKE_SHARED_MODULE_PREFIX}")
set(LIB_SUFFIX "${IE_BUILD_POSTFIX}${CMAKE_SHARED_MODULE_SUFFIX}")
set("${library_name}" "${LIB_PREFIX}${target_name}${LIB_SUFFIX}" PARENT_SCOPE)
get_target_property(LIB_NAME ${target_name} OUTPUT_NAME)
if (LIB_NAME STREQUAL "LIB_NAME-NOTFOUND")
set(LIB_NAME ${target_name})
endif()
set("${library_name}" "${LIB_PREFIX}${LIB_NAME}${LIB_SUFFIX}" PARENT_SCOPE)
endfunction()
if(NOT TARGET ov_plugins)
@@ -18,7 +22,7 @@ if(NOT TARGET ov_plugins)
endif()
#
# ie_add_plugin(NAME <targetName>
# ov_add_plugin(NAME <targetName>
# DEVICE_NAME <deviceName>
# [PSEUDO_DEVICE]
# [PSEUDO_PLUGIN_FOR <actual_device>]
@@ -32,25 +36,25 @@ endif()
# [ADD_CLANG_FORMAT]
# )
#
function(ie_add_plugin)
function(ov_add_plugin)
set(options SKIP_INSTALL PSEUDO_DEVICE ADD_CLANG_FORMAT AS_EXTENSION SKIP_REGISTRATION)
set(oneValueArgs NAME DEVICE_NAME VERSION_DEFINES_FOR PSEUDO_PLUGIN_FOR)
set(multiValueArgs DEFAULT_CONFIG SOURCES OBJECT_LIBRARIES CPPLINT_FILTERS)
cmake_parse_arguments(IE_PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
cmake_parse_arguments(OV_PLUGIN "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT IE_PLUGIN_NAME)
if(NOT OV_PLUGIN_NAME)
message(FATAL_ERROR "Please, specify plugin target name")
endif()
if(NOT IE_PLUGIN_DEVICE_NAME)
message(FATAL_ERROR "Please, specify device name for ${IE_PLUGIN_NAME}")
if(NOT OV_PLUGIN_DEVICE_NAME)
message(FATAL_ERROR "Please, specify device name for ${OV_PLUGIN_NAME}")
endif()
# create and configure target
if(NOT IE_PLUGIN_PSEUDO_PLUGIN_FOR)
set(input_files ${IE_PLUGIN_SOURCES})
foreach(obj_lib IN LISTS IE_PLUGIN_OBJECT_LIBRARIES)
if(NOT OV_PLUGIN_PSEUDO_PLUGIN_FOR)
set(input_files ${OV_PLUGIN_SOURCES})
foreach(obj_lib IN LISTS OV_PLUGIN_OBJECT_LIBRARIES)
list(APPEND input_files $<TARGET_OBJECTS:${obj_lib}>)
add_cpplint_target(${obj_lib}_cpplint FOR_TARGETS ${obj_lib})
endforeach()
@@ -61,120 +65,122 @@ function(ie_add_plugin)
set(library_type STATIC)
endif()
add_library(${IE_PLUGIN_NAME} ${library_type} ${input_files})
add_library(${OV_PLUGIN_NAME} ${library_type} ${input_files})
if(IE_PLUGIN_VERSION_DEFINES_FOR)
ov_add_version_defines(${IE_PLUGIN_VERSION_DEFINES_FOR} ${IE_PLUGIN_NAME})
if(OV_PLUGIN_VERSION_DEFINES_FOR)
ov_add_version_defines(${OV_PLUGIN_VERSION_DEFINES_FOR} ${OV_PLUGIN_NAME})
endif()
target_compile_definitions(${IE_PLUGIN_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_PLUGIN)
target_compile_definitions(${OV_PLUGIN_NAME} PRIVATE IMPLEMENT_INFERENCE_ENGINE_PLUGIN)
if(NOT BUILD_SHARED_LIBS)
# to distinguish functions creating plugin objects
target_compile_definitions(${IE_PLUGIN_NAME} PRIVATE
IE_CREATE_PLUGIN=CreatePluginEngine${IE_PLUGIN_DEVICE_NAME}
OV_CREATE_PLUGIN=CreatePluginEngine${IE_PLUGIN_DEVICE_NAME})
if(IE_PLUGIN_AS_EXTENSION)
target_compile_definitions(${OV_PLUGIN_NAME} PRIVATE
IE_CREATE_PLUGIN=CreatePluginEngine${OV_PLUGIN_DEVICE_NAME}
OV_CREATE_PLUGIN=CreatePluginEngine${OV_PLUGIN_DEVICE_NAME})
if(OV_PLUGIN_AS_EXTENSION)
# to distinguish functions creating extensions objects
target_compile_definitions(${IE_PLUGIN_NAME} PRIVATE
IE_CREATE_EXTENSION=CreateExtensionShared${IE_PLUGIN_DEVICE_NAME})
target_compile_definitions(${OV_PLUGIN_NAME} PRIVATE
IE_CREATE_EXTENSION=CreateExtensionShared${OV_PLUGIN_DEVICE_NAME})
endif()
endif()
ie_add_vs_version_file(NAME ${IE_PLUGIN_NAME}
FILEDESCRIPTION "OpenVINO Runtime ${IE_PLUGIN_DEVICE_NAME} device plugin library")
ov_add_vs_version_file(NAME ${OV_PLUGIN_NAME}
FILEDESCRIPTION "OpenVINO Runtime ${OV_PLUGIN_DEVICE_NAME} device plugin library")
target_link_libraries(${IE_PLUGIN_NAME} PRIVATE openvino::runtime openvino::runtime::dev)
target_link_libraries(${OV_PLUGIN_NAME} PRIVATE openvino::runtime openvino::runtime::dev)
if(WIN32)
set_target_properties(${IE_PLUGIN_NAME} PROPERTIES COMPILE_PDB_NAME ${IE_PLUGIN_NAME})
set_target_properties(${OV_PLUGIN_NAME} PROPERTIES COMPILE_PDB_NAME ${OV_PLUGIN_NAME})
endif()
if(CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CROSSCOMPILING)
target_link_options(${IE_PLUGIN_NAME} PRIVATE -Wl,--unresolved-symbols=ignore-in-shared-libs)
target_link_options(${OV_PLUGIN_NAME} PRIVATE -Wl,--unresolved-symbols=ignore-in-shared-libs)
endif()
set(custom_filter "")
foreach(filter IN LISTS IE_PLUGIN_CPPLINT_FILTERS)
foreach(filter IN LISTS OV_PLUGIN_CPPLINT_FILTERS)
string(CONCAT custom_filter "${custom_filter}" "," "${filter}")
endforeach()
if (IE_PLUGIN_ADD_CLANG_FORMAT)
add_clang_format_target(${IE_PLUGIN_NAME}_clang FOR_TARGETS ${IE_PLUGIN_NAME})
if (OV_PLUGIN_ADD_CLANG_FORMAT)
add_clang_format_target(${OV_PLUGIN_NAME}_clang FOR_TARGETS ${OV_PLUGIN_NAME})
else()
add_cpplint_target(${IE_PLUGIN_NAME}_cpplint FOR_TARGETS ${IE_PLUGIN_NAME} CUSTOM_FILTERS ${custom_filter})
add_cpplint_target(${OV_PLUGIN_NAME}_cpplint FOR_TARGETS ${OV_PLUGIN_NAME} CUSTOM_FILTERS ${custom_filter})
endif()
add_dependencies(ov_plugins ${IE_PLUGIN_NAME})
add_dependencies(ov_plugins ${OV_PLUGIN_NAME})
# install rules
if(NOT IE_PLUGIN_SKIP_INSTALL OR NOT BUILD_SHARED_LIBS)
string(TOLOWER "${IE_PLUGIN_DEVICE_NAME}" install_component)
if(NOT OV_PLUGIN_SKIP_INSTALL OR NOT BUILD_SHARED_LIBS)
string(TOLOWER "${OV_PLUGIN_DEVICE_NAME}" install_component)
if(IE_PLUGIN_PSEUDO_DEVICE)
if(OV_PLUGIN_PSEUDO_DEVICE)
set(plugin_hidden HIDDEN)
endif()
ie_cpack_add_component(${install_component}
DISPLAY_NAME "${IE_PLUGIN_DEVICE_NAME} runtime"
DESCRIPTION "${IE_PLUGIN_DEVICE_NAME} runtime"
ov_cpack_add_component(${install_component}
DISPLAY_NAME "${OV_PLUGIN_DEVICE_NAME} runtime"
DESCRIPTION "${OV_PLUGIN_DEVICE_NAME} runtime"
${plugin_hidden}
DEPENDS ${OV_CPACK_COMP_CORE})
if(BUILD_SHARED_LIBS)
install(TARGETS ${IE_PLUGIN_NAME}
install(TARGETS ${OV_PLUGIN_NAME}
LIBRARY DESTINATION ${OV_CPACK_PLUGINSDIR}
COMPONENT ${install_component})
install(TARGETS ${IE_PLUGIN_NAME}
install(TARGETS ${OV_PLUGIN_NAME}
LIBRARY DESTINATION ${OV_CPACK_PLUGINSDIR}
COMPONENT ${install_component})
else()
ov_install_static_lib(${IE_PLUGIN_NAME} ${install_component})
ov_install_static_lib(${OV_PLUGIN_NAME} ${install_component})
endif()
endif()
endif()
# Enable for static build to generate correct plugins.hpp
if(NOT IE_PLUGIN_SKIP_REGISTRATION OR NOT BUILD_SHARED_LIBS)
if(NOT OV_PLUGIN_SKIP_REGISTRATION OR NOT BUILD_SHARED_LIBS)
# check that plugin with such name is not registered
foreach(plugin_entry IN LISTS PLUGIN_FILES)
string(REPLACE ":" ";" plugin_entry "${plugin_entry}")
list(GET plugin_entry -1 library_name)
list(GET plugin_entry 0 plugin_name)
if(plugin_name STREQUAL "${IE_PLUGIN_DEVICE_NAME}" AND
NOT library_name STREQUAL ${IE_PLUGIN_NAME})
message(FATAL_ERROR "${IE_PLUGIN_NAME} and ${library_name} are both registered as ${plugin_name}")
if(plugin_name STREQUAL "${OV_PLUGIN_DEVICE_NAME}" AND
NOT library_name STREQUAL ${OV_PLUGIN_NAME})
message(FATAL_ERROR "${OV_PLUGIN_NAME} and ${library_name} are both registered as ${plugin_name}")
endif()
endforeach()
# append plugin to the list to register
list(APPEND PLUGIN_FILES "${IE_PLUGIN_DEVICE_NAME}:${IE_PLUGIN_NAME}")
list(APPEND PLUGIN_FILES "${OV_PLUGIN_DEVICE_NAME}:${OV_PLUGIN_NAME}")
set(PLUGIN_FILES "${PLUGIN_FILES}" CACHE INTERNAL "" FORCE)
set(${IE_PLUGIN_DEVICE_NAME}_CONFIG "${IE_PLUGIN_DEFAULT_CONFIG}" CACHE INTERNAL "" FORCE)
set(${IE_PLUGIN_DEVICE_NAME}_PSEUDO_PLUGIN_FOR "${IE_PLUGIN_PSEUDO_PLUGIN_FOR}" CACHE INTERNAL "" FORCE)
set(${IE_PLUGIN_DEVICE_NAME}_AS_EXTENSION "${IE_PLUGIN_AS_EXTENSION}" CACHE INTERNAL "" FORCE)
set(${OV_PLUGIN_DEVICE_NAME}_CONFIG "${OV_PLUGIN_DEFAULT_CONFIG}" CACHE INTERNAL "" FORCE)
set(${OV_PLUGIN_DEVICE_NAME}_PSEUDO_PLUGIN_FOR "${OV_PLUGIN_PSEUDO_PLUGIN_FOR}" CACHE INTERNAL "" FORCE)
set(${OV_PLUGIN_DEVICE_NAME}_AS_EXTENSION "${OV_PLUGIN_AS_EXTENSION}" CACHE INTERNAL "" FORCE)
endif()
endfunction()
function(ov_add_plugin)
ie_add_plugin(${ARGN})
function(ie_add_plugin)
ov_add_plugin(${ARGN})
endfunction()
#
# ie_register_plugins_dynamic(MAIN_TARGET <main target name>)
# ov_register_in_plugins_xml(MAIN_TARGET <main target name>)
#
macro(ie_register_plugins_dynamic)
# Registers plugins in plugins.xml files for dynamic plugins build
#
macro(ov_register_in_plugins_xml)
set(options)
set(oneValueArgs MAIN_TARGET)
set(multiValueArgs)
cmake_parse_arguments(IE_REGISTER "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
cmake_parse_arguments(OV_REGISTER "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(NOT IE_REGISTER_MAIN_TARGET)
if(NOT OV_REGISTER_MAIN_TARGET)
message(FATAL_ERROR "Please, define MAIN_TARGET")
endif()
# Unregister <device_name>.xml files for plugins from current build tree
set(config_output_file "$<TARGET_FILE_DIR:${IE_REGISTER_MAIN_TARGET}>/plugins.xml")
set(config_output_file "$<TARGET_FILE_DIR:${OV_REGISTER_MAIN_TARGET}>/plugins.xml")
foreach(name IN LISTS PLUGIN_FILES)
string(REPLACE ":" ";" name "${name}")
@@ -183,12 +189,12 @@ macro(ie_register_plugins_dynamic)
message(FATAL_ERROR "Unexpected error, please, contact developer of this script")
endif()
list(GET name 0 device_name)
add_custom_command(TARGET ${IE_REGISTER_MAIN_TARGET} POST_BUILD
add_custom_command(TARGET ${OV_REGISTER_MAIN_TARGET} POST_BUILD
COMMAND
"${CMAKE_COMMAND}"
-D "IE_CONFIG_OUTPUT_FILE=${config_output_file}"
-D "IE_PLUGIN_NAME=${device_name}"
-D "IE_CONFIGS_DIR=${CMAKE_BINARY_DIR}/plugins"
-D "OV_CONFIG_OUTPUT_FILE=${config_output_file}"
-D "OV_PLUGIN_NAME=${device_name}"
-D "OV_CONFIGS_DIR=${CMAKE_BINARY_DIR}/plugins"
-P "${IEDevScripts_DIR}/plugins/unregister_plugin_cmake.cmake"
COMMENT
"Remove ${device_name} from the plugins.xml file"
@@ -209,15 +215,15 @@ macro(ie_register_plugins_dynamic)
# create plugin file
set(config_file_name "${CMAKE_BINARY_DIR}/plugins/${device_name}.xml")
ie_plugin_get_file_name(${name} library_name)
ov_plugin_get_file_name(${name} library_name)
add_custom_command(TARGET ${IE_REGISTER_MAIN_TARGET} POST_BUILD
add_custom_command(TARGET ${OV_REGISTER_MAIN_TARGET} POST_BUILD
COMMAND
"${CMAKE_COMMAND}"
-D "IE_CONFIG_OUTPUT_FILE=${config_file_name}"
-D "IE_DEVICE_NAME=${device_name}"
-D "IE_PLUGIN_PROPERTIES=${${device_name}_CONFIG}"
-D "IE_PLUGIN_LIBRARY_NAME=${library_name}"
-D "OV_CONFIG_OUTPUT_FILE=${config_file_name}"
-D "OV_DEVICE_NAME=${device_name}"
-D "OV_PLUGIN_PROPERTIES=${${device_name}_CONFIG}"
-D "OV_PLUGIN_LIBRARY_NAME=${library_name}"
-P "${IEDevScripts_DIR}/plugins/create_plugin_file.cmake"
COMMENT "Register ${device_name} device as ${library_name}"
VERBATIM)
@@ -227,17 +233,24 @@ macro(ie_register_plugins_dynamic)
# Combine all <device_name>.xml files into plugins.xml
if(ENABLE_PLUGINS_XML)
add_custom_command(TARGET ${IE_REGISTER_MAIN_TARGET} POST_BUILD
COMMAND
"${CMAKE_COMMAND}"
-D "CMAKE_SHARED_MODULE_PREFIX=${CMAKE_SHARED_MODULE_PREFIX}"
-D "IE_CONFIG_OUTPUT_FILE=${config_output_file}"
-D "IE_CONFIGS_DIR=${CMAKE_BINARY_DIR}/plugins"
-P "${IEDevScripts_DIR}/plugins/register_plugin_cmake.cmake"
COMMENT
"Registering plugins to plugins.xml config file"
VERBATIM)
add_custom_command(TARGET ${OV_REGISTER_MAIN_TARGET} POST_BUILD
COMMAND
"${CMAKE_COMMAND}"
-D "CMAKE_SHARED_MODULE_PREFIX=${CMAKE_SHARED_MODULE_PREFIX}"
-D "OV_CONFIG_OUTPUT_FILE=${config_output_file}"
-D "OV_CONFIGS_DIR=${CMAKE_BINARY_DIR}/plugins"
-P "${IEDevScripts_DIR}/plugins/register_plugin_cmake.cmake"
COMMENT
"Registering plugins to plugins.xml config file"
VERBATIM)
endmacro()
#
# ov_register_plugins()
#
macro(ov_register_plugins)
if(BUILD_SHARED_LIBS AND ENABLE_PLUGINS_XML)
ov_register_in_plugins_xml(${ARGN})
endif()
endmacro()
@@ -245,24 +258,13 @@ endmacro()
# ie_register_plugins()
#
macro(ie_register_plugins)
if(BUILD_SHARED_LIBS)
ie_register_plugins_dynamic(${ARGN})
endif()
ov_register_plugins(${ARGN})
endmacro()
#
# ov_register_plugins()
# ov_target_link_plugins(<TARGET_NAME>)
#
macro(ov_register_plugins)
if(BUILD_SHARED_LIBS)
ie_register_plugins_dynamic(${ARGN})
endif()
endmacro()
#
# ie_target_link_plugins(<TARGET_NAME>)
#
function(ie_target_link_plugins TARGET_NAME)
function(ov_target_link_plugins TARGET_NAME)
if(BUILD_SHARED_LIBS)
return()
endif()
@@ -283,6 +285,10 @@ endfunction()
#
# ov_generate_plugins_hpp()
#
# Generates plugins.hpp file for:
# - static plugins build
# - cases when plugins.xml file is disabled
#
function(ov_generate_plugins_hpp)
set(device_mapping)
set(device_configs)
@@ -298,7 +304,7 @@ function(ov_generate_plugins_hpp)
list(GET name 0 device_name)
if(BUILD_SHARED_LIBS)
list(GET name 1 library_name)
ie_plugin_get_file_name(${library_name} library_name)
ov_plugin_get_file_name(${library_name} library_name)
list(APPEND device_mapping "${device_name}:${library_name}")
else()
if(${device_name}_PSEUDO_PLUGIN_FOR)
@@ -322,12 +328,16 @@ function(ov_generate_plugins_hpp)
endforeach()
# add plugins to libraries including ov_plugins.hpp
ie_target_link_plugins(openvino)
ov_target_link_plugins(openvino)
if(TARGET inference_engine_s)
ie_target_link_plugins(inference_engine_s)
ov_target_link_plugins(inference_engine_s)
endif()
set(ov_plugins_hpp "${CMAKE_BINARY_DIR}/src/inference/ov_plugins.hpp")
if(OV_GENERATOR_MULTI_CONFIG AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
set(ov_plugins_hpp "${CMAKE_BINARY_DIR}/src/inference/$<CONFIG>/ov_plugins.hpp")
else()
set(ov_plugins_hpp "${CMAKE_BINARY_DIR}/src/inference/ov_plugins.hpp")
endif()
set(plugins_hpp_in "${IEDevScripts_DIR}/plugins/plugins.hpp.in")
add_custom_command(OUTPUT "${ov_plugins_hpp}"
@@ -348,7 +358,7 @@ function(ov_generate_plugins_hpp)
VERBATIM)
# for some reason dependency on source files does not work
# so, we have to use explicit target and make it dependency for inference_engine
# so, we have to use explicit target and make it dependency for inference_engine_obj
add_custom_target(_ov_plugins_hpp DEPENDS ${ov_plugins_hpp})
add_dependencies(inference_engine_obj _ov_plugins_hpp)
endfunction()

View File

@@ -8,18 +8,18 @@ set(file_content
</plugins>
</ie>")
if(NOT EXISTS "${IE_CONFIG_OUTPUT_FILE}")
file(WRITE "${IE_CONFIG_OUTPUT_FILE}" "${file_content}")
if(NOT EXISTS "${OV_CONFIG_OUTPUT_FILE}")
file(WRITE "${OV_CONFIG_OUTPUT_FILE}" "${file_content}")
endif()
# get list of plugin files
file(GLOB plugin_files "${IE_CONFIGS_DIR}/*.xml")
file(GLOB plugin_files "${OV_CONFIGS_DIR}/*.xml")
function(check_plugin_exists plugin_name outvar)
set(${outvar} OFF PARENT_SCOPE)
# check if config file already has this plugin
file(STRINGS "${IE_CONFIG_OUTPUT_FILE}" content REGEX "plugin .*=\"")
file(STRINGS "${OV_CONFIG_OUTPUT_FILE}" content REGEX "plugin .*=\"")
foreach(line IN LISTS content)
string(REGEX MATCH "location=\"([^\"]*)\"" location "${line}")
@@ -44,7 +44,7 @@ endforeach()
# add plugin
set(newContent "")
file(STRINGS "${IE_CONFIG_OUTPUT_FILE}" content)
file(STRINGS "${OV_CONFIG_OUTPUT_FILE}" content)
set(already_exists_in_xml OFF)
foreach(line IN LISTS content)
@@ -77,4 +77,4 @@ ${content}")
endif()
endforeach()
file(WRITE "${IE_CONFIG_OUTPUT_FILE}" "${newContent}")
file(WRITE "${OV_CONFIG_OUTPUT_FILE}" "${newContent}")

View File

@@ -2,16 +2,16 @@
# SPDX-License-Identifier: Apache-2.0
#
if(NOT EXISTS "${IE_CONFIG_OUTPUT_FILE}")
if(NOT EXISTS "${OV_CONFIG_OUTPUT_FILE}")
return()
endif()
# remove plugin file
file(REMOVE "${IE_CONFIGS_DIR}/${IE_PLUGIN_NAME}.xml")
file(REMOVE "${OV_CONFIGS_DIR}/${IE_PLUGIN_NAME}.xml")
# remove plugin
set(newContent "")
file(STRINGS "${IE_CONFIG_OUTPUT_FILE}" content)
file(STRINGS "${OV_CONFIG_OUTPUT_FILE}" content)
set(skip_plugin OFF)
foreach(line IN LISTS content)
@@ -32,4 +32,4 @@ foreach(line IN LISTS content)
endif()
endforeach()
file(WRITE "${IE_CONFIG_OUTPUT_FILE}" "${newContent}")
file(WRITE "${OV_CONFIG_OUTPUT_FILE}" "${newContent}")

View File

@@ -17,20 +17,44 @@ if(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
endif()
if(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
set(arch_flag X86_64)
set(host_arch_flag X86_64)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*")
set(arch_flag X86)
set(host_arch_flag X86)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(arm64.*|aarch64.*|AARCH64.*|ARM64.*)")
set(arch_flag AARCH64)
set(host_arch_flag AARCH64)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
set(arch_flag ARM)
set(host_arch_flag ARM)
elseif(CMAKE_HOST_SYSTEM_PROCESSOR MATCHES "^riscv64$")
set(arch_flag RISCV64)
set(host_arch_flag RISCV64)
endif()
set(HOST_${arch_flag} ON)
set(HOST_${host_arch_flag} ON)
macro(_ie_process_msvc_generator_platform arch_flag)
macro(_ov_detect_arch_by_processor_type)
if(CMAKE_OSX_ARCHITECTURES AND APPLE)
if(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
set(AARCH64 ON)
elseif(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
set(X86_64 ON)
elseif(CMAKE_OSX_ARCHITECTURES MATCHES ".*x86_64.*" AND CMAKE_OSX_ARCHITECTURES MATCHES ".*arm64.*")
set(UNIVERSAL2 ON)
else()
message(FATAL_ERROR "Unsupported value: CMAKE_OSX_ARCHITECTURES = ${CMAKE_OSX_ARCHITECTURES}")
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
set(X86_64 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*|wasm")
set(X86 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64.*|aarch64.*|AARCH64.*|ARM64.*|armv8)")
set(AARCH64 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
set(ARM ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^riscv64$")
set(RISCV64 ON)
endif()
endmacro()
macro(_ov_process_msvc_generator_platform)
# if cmake -A <ARM|ARM64|x64|Win32> is passed
if(CMAKE_GENERATOR_PLATFORM STREQUAL "ARM64")
set(AARCH64 ON)
@@ -41,45 +65,30 @@ macro(_ie_process_msvc_generator_platform arch_flag)
elseif(CMAKE_GENERATOR_PLATFORM STREQUAL "Win32")
set(X86 ON)
else()
set(${arch_flag} ON)
_ov_detect_arch_by_processor_type()
endif()
endmacro()
# TODO: why OpenCV is found by cmake
if(MSVC64 OR MINGW64)
_ie_process_msvc_generator_platform(${arch_flag})
_ov_process_msvc_generator_platform()
elseif(MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING))
_ie_process_msvc_generator_platform(${arch_flag})
elseif(CMAKE_OSX_ARCHITECTURES AND APPLE)
if(CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
set(AARCH64 ON)
elseif(CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
set(X86_64 ON)
elseif(CMAKE_OSX_ARCHITECTURES MATCHES ".*x86_64.*" AND CMAKE_OSX_ARCHITECTURES MATCHES ".*arm64.*")
set(UNIVERSAL2 ON)
else()
message(FATAL_ERROR "Unsupported value: CMAKE_OSX_ARCHITECTURES = ${CMAKE_OSX_ARCHITECTURES}")
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*")
set(X86_64 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*|amd64.*|AMD64.*")
set(X86 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64.*|aarch64.*|AARCH64.*|ARM64.*)")
set(AARCH64 ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)")
set(ARM ON)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^riscv64$")
set(RISCV64 ON)
_ov_process_msvc_generator_platform()
else()
_ov_detect_arch_by_processor_type()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
set(EMSCRIPTEN ON)
endif()
if(UNIX AND NOT (APPLE OR ANDROID OR EMSCRIPTEN))
if(UNIX AND NOT (APPLE OR ANDROID OR EMSCRIPTEN OR CYGWIN))
set(LINUX ON)
endif()
if(NOT DEFINED CMAKE_HOST_LINUX AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(CMAKE_VERSION VERSION_LESS 3.25 AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
# the variable is available since 3.25
# https://cmake.org/cmake/help/latest/variable/CMAKE_HOST_LINUX.html
set(CMAKE_HOST_LINUX ON)
endif()

View File

@@ -2,18 +2,18 @@
# SPDX-License-Identifier: Apache-2.0
#
set(IE_VS_VER_FILEVERSION_QUAD "${OpenVINO_VERSION_MAJOR},${OpenVINO_VERSION_MINOR},${OpenVINO_VERSION_PATCH},${OpenVINO_VERSION_BUILD}")
set(IE_VS_VER_PRODUCTVERSION_QUAD "${OpenVINO_VERSION_MAJOR},${OpenVINO_VERSION_MINOR},${OpenVINO_VERSION_PATCH},${OpenVINO_VERSION_BUILD}")
set(IE_VS_VER_FILEVERSION_STR "${OpenVINO_VERSION_MAJOR}.${OpenVINO_VERSION_MINOR}.${OpenVINO_VERSION_PATCH}.${OpenVINO_VERSION_BUILD}")
set(OV_VS_VER_FILEVERSION_QUAD "${OpenVINO_VERSION_MAJOR},${OpenVINO_VERSION_MINOR},${OpenVINO_VERSION_PATCH},${OpenVINO_VERSION_BUILD}")
set(OV_VS_VER_PRODUCTVERSION_QUAD "${OpenVINO_VERSION_MAJOR},${OpenVINO_VERSION_MINOR},${OpenVINO_VERSION_PATCH},${OpenVINO_VERSION_BUILD}")
set(OV_VS_VER_FILEVERSION_STR "${OpenVINO_VERSION_MAJOR}.${OpenVINO_VERSION_MINOR}.${OpenVINO_VERSION_PATCH}.${OpenVINO_VERSION_BUILD}")
set(IE_VS_VER_COMPANY_NAME_STR "Intel Corporation")
set(IE_VS_VER_PRODUCTVERSION_STR "${CI_BUILD_NUMBER}")
set(IE_VS_VER_PRODUCTNAME_STR "OpenVINO toolkit")
set(IE_VS_VER_COPYRIGHT_STR "Copyright (C) 2018-2021, Intel Corporation")
set(IE_VS_VER_COMMENTS_STR "https://docs.openvino.ai/")
set(OV_VS_VER_COMPANY_NAME_STR "Intel Corporation")
set(OV_VS_VER_PRODUCTVERSION_STR "${CI_BUILD_NUMBER}")
set(OV_VS_VER_PRODUCTNAME_STR "OpenVINO toolkit")
set(OV_VS_VER_COPYRIGHT_STR "Copyright (C) 2018-2021, Intel Corporation")
set(OV_VS_VER_COMMENTS_STR "https://docs.openvino.ai/")
#
# ie_add_vs_version_file(NAME <name>
# ov_add_vs_version_file(NAME <name>
# FILEDESCRIPTION <file description>
# [COMPANY_NAME <company name>]
# [FILEVERSION <file version>]
@@ -25,7 +25,7 @@ set(IE_VS_VER_COMMENTS_STR "https://docs.openvino.ai/")
# [FILEVERSION_QUAD <name>]
# [PRODUCTVERSION_QUAD <name>])
#
function(ie_add_vs_version_file)
function(ov_add_vs_version_file)
if(NOT WIN32 OR NOT BUILD_SHARED_LIBS)
return()
endif()
@@ -38,14 +38,14 @@ function(ie_add_vs_version_file)
get_target_property(target_type ${VS_VER_NAME} TYPE)
if(NOT target_type MATCHES "^(SHARED|MODULE)_LIBRARY$")
message(FATAL_ERROR "ie_add_vs_version_file can work only with dynamic libraries")
message(FATAL_ERROR "ov_add_vs_version_file can work only with dynamic libraries")
endif()
macro(_vs_ver_update_variable name)
if(VS_VER_NAME AND DEFINED IE_${VS_VER_NAME}_VS_VER_${name})
set(IE_VS_VER_${name} "${IE_${VS_VER_NAME}_VS_VER_${name}}")
if(VS_VER_NAME AND DEFINED OV_${VS_VER_NAME}_VS_VER_${name})
set(OV_VS_VER_${name} "${OV_${VS_VER_NAME}_VS_VER_${name}}")
elseif(VS_VER_${name})
set(IE_VS_VER_${name} "${VS_VER_${name}}")
set(OV_VS_VER_${name} "${VS_VER_${name}}")
endif()
endmacro()
@@ -53,10 +53,10 @@ function(ie_add_vs_version_file)
_vs_ver_update_variable(PRODUCTVERSION_QUAD)
macro(_vs_ver_update_str_variable name)
if(VS_VER_NAME AND DEFINED IE_${VS_VER_NAME}_VS_VER_${name})
set(IE_VS_VER_${name}_STR "${IE_${VS_VER_NAME}_VS_VER_${name}}")
if(VS_VER_NAME AND DEFINED OV_${VS_VER_NAME}_VS_VER_${name})
set(OV_VS_VER_${name}_STR "${OV_${VS_VER_NAME}_VS_VER_${name}}")
elseif(VS_VER_${name})
set(IE_VS_VER_${name}_STR "${VS_VER_${name}}")
set(OV_VS_VER_${name}_STR "${VS_VER_${name}}")
endif()
endmacro()
@@ -69,8 +69,8 @@ function(ie_add_vs_version_file)
_vs_ver_update_str_variable(PRODUCTVERSION)
_vs_ver_update_str_variable(COMMENTS)
set(IE_VS_VER_ORIGINALFILENAME_STR "${CMAKE_SHARED_LIBRARY_PREFIX}${VS_VER_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(IE_VS_VER_INTERNALNAME_STR ${VS_VER_NAME})
set(OV_VS_VER_ORIGINALFILENAME_STR "${CMAKE_SHARED_LIBRARY_PREFIX}${VS_VER_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(OV_VS_VER_INTERNALNAME_STR ${VS_VER_NAME})
set(vs_version_output "${CMAKE_CURRENT_BINARY_DIR}/vs_version.rc")
configure_file("${IEDevScripts_DIR}/vs_version/vs_version.rc.in" "${vs_version_output}" @ONLY)

View File

@@ -1,8 +1,8 @@
#include <winver.h>
VS_VERSION_INFO VERSIONINFO
FILEVERSION @IE_VS_VER_FILEVERSION_QUAD@
PRODUCTVERSION @IE_VS_VER_PRODUCTVERSION_QUAD@
FILEVERSION @OV_VS_VER_FILEVERSION_QUAD@
PRODUCTVERSION @OV_VS_VER_PRODUCTVERSION_QUAD@
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
#ifdef _DEBUG
FILEFLAGS 1
@@ -17,15 +17,15 @@ BEGIN
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "@IE_VS_VER_COMPANY_NAME_STR@\0"
VALUE "FileDescription", "@IE_VS_VER_FILEDESCRIPTION_STR@\0"
VALUE "FileVersion", "@IE_VS_VER_FILEVERSION_STR@\0"
VALUE "InternalName", "@IE_VS_VER_INTERNALNAME_STR@\0"
VALUE "LegalCopyright", "@IE_VS_VER_COPYRIGHT_STR@\0"
VALUE "OriginalFilename", "@IE_VS_VER_ORIGINALFILENAME_STR@\0"
VALUE "ProductName", "@IE_VS_VER_PRODUCTNAME_STR@\0"
VALUE "ProductVersion", "@IE_VS_VER_PRODUCTVERSION_STR@\0"
VALUE "Comments", "@IE_VS_VER_COMMENTS_STR@\0"
VALUE "CompanyName", "@OV_VS_VER_COMPANY_NAME_STR@\0"
VALUE "FileDescription", "@OV_VS_VER_FILEDESCRIPTION_STR@\0"
VALUE "FileVersion", "@OV_VS_VER_FILEVERSION_STR@\0"
VALUE "InternalName", "@OV_VS_VER_INTERNALNAME_STR@\0"
VALUE "LegalCopyright", "@OV_VS_VER_COPYRIGHT_STR@\0"
VALUE "OriginalFilename", "@OV_VS_VER_ORIGINALFILENAME_STR@\0"
VALUE "ProductName", "@OV_VS_VER_PRODUCTNAME_STR@\0"
VALUE "ProductVersion", "@OV_VS_VER_PRODUCTVERSION_STR@\0"
VALUE "Comments", "@OV_VS_VER_COMMENTS_STR@\0"
END
END
BLOCK "VarFileInfo"

View File

@@ -40,6 +40,7 @@ function(ieTargetLinkWholeArchive targetName)
"-Wl,-noall_load"
)
else()
# non-Apple Clang and GCC / MinGW
list(APPEND libs
"-Wl,--whole-archive"
${staticLib}

View File

@@ -6,7 +6,9 @@
# Common cmake options
#
ie_dependent_option (ENABLE_INTEL_CPU "CPU plugin for OpenVINO Runtime" ON "RISCV64 OR X86 OR X86_64" OFF)
ie_dependent_option (ENABLE_INTEL_CPU "CPU plugin for OpenVINO Runtime" ON "RISCV64 OR X86 OR X86_64 OR AARCH64 OR ARM" OFF)
ie_dependent_option (ENABLE_ARM_COMPUTE_CMAKE "Enable ARM Compute build via cmake" OFF "ENABLE_INTEL_CPU" OFF)
ie_option (ENABLE_TESTS "unit, behavior and functional tests" OFF)
@@ -20,7 +22,7 @@ else()
set(ENABLE_INTEL_GPU_DEFAULT OFF)
endif()
ie_dependent_option (ENABLE_INTEL_GPU "GPU OpenCL-based plugin for OpenVINO Runtime" ${ENABLE_INTEL_GPU_DEFAULT} "X86_64 OR AARCH64;NOT APPLE;NOT MINGW;NOT WINDOWS_STORE;NOT WINDOWS_PHONE" OFF)
ie_dependent_option (ENABLE_INTEL_GPU "GPU OpenCL-based plugin for OpenVINO Runtime" ${ENABLE_INTEL_GPU_DEFAULT} "X86_64 OR AARCH64;NOT APPLE;NOT WINDOWS_STORE;NOT WINDOWS_PHONE" OFF)
if (ANDROID OR (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0))
# oneDNN doesn't support old compilers and android builds for now, so we'll
@@ -32,6 +34,10 @@ endif()
ie_dependent_option (ENABLE_ONEDNN_FOR_GPU "Enable oneDNN with GPU support" ${ENABLE_ONEDNN_FOR_GPU_DEFAULT} "ENABLE_INTEL_GPU" OFF)
ie_option (ENABLE_DEBUG_CAPS "enable OpenVINO debug capabilities at runtime" OFF)
ie_dependent_option (ENABLE_GPU_DEBUG_CAPS "enable GPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS;ENABLE_INTEL_CPU" OFF)
ie_dependent_option (ENABLE_CPU_DEBUG_CAPS "enable CPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS;ENABLE_INTEL_GPU" OFF)
ie_option (ENABLE_PROFILING_ITT "Build with ITT tracing. Optionally configure pre-built ittnotify library though INTEL_VTUNE_DIR variable." OFF)
ie_option_enum(ENABLE_PROFILING_FILTER "Enable or disable ITT counter groups.\
@@ -79,41 +85,45 @@ ie_dependent_option (ENABLE_TBBBIND_2_5 "Enable TBBBind_2_5 static usage in Open
ie_dependent_option (ENABLE_INTEL_GNA "GNA support for OpenVINO Runtime" ON
"NOT APPLE;NOT ANDROID;X86_64;CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 5.4" OFF)
ie_option (ENABLE_INTEL_GNA_DEBUG "GNA debug build" OFF)
ie_dependent_option (ENABLE_INTEL_GNA_DEBUG "GNA debug build" OFF "ENABLE_INTEL_GNA" OFF)
ie_dependent_option (ENABLE_V7_SERIALIZE "enables serialization to IR v7" OFF "ENABLE_INTEL_GNA" OFF)
ie_dependent_option (ENABLE_IR_V7_READER "Enables IR v7 reader" ${BUILD_SHARED_LIBS} "ENABLE_TESTS;ENABLE_INTEL_GNA" OFF)
ie_option (ENABLE_GAPI_PREPROCESSING "Enables G-API preprocessing" ON)
ie_dependent_option (ENABLE_GAPI_PREPROCESSING "Enables G-API preprocessing" ON "NOT MINGW64" OFF)
ie_option (ENABLE_MULTI "Enables MULTI Device Plugin" ON)
ie_option (ENABLE_AUTO "Enables AUTO Device Plugin" ON)
ie_option (ENABLE_AUTO_BATCH "Enables Auto-Batching Plugin" ON)
ie_option (ENABLE_HETERO "Enables Hetero Device Plugin" ON)
ie_option (ENABLE_TEMPLATE "Enable template plugin" ON)
ie_dependent_option (ENABLE_PLUGINS_XML "Generate plugins.xml configuration file or not" OFF "NOT BUILD_SHARED_LIBS" OFF)
ie_dependent_option (ENABLE_PLUGINS_XML "Generate plugins.xml configuration file or not" OFF "BUILD_SHARED_LIBS" OFF)
ie_dependent_option (GAPI_TEST_PERF "if GAPI unit tests should examine performance" OFF "ENABLE_TESTS;ENABLE_GAPI_PREPROCESSING" OFF)
ie_dependent_option (ENABLE_DATA "fetch models from testdata repo" ON "ENABLE_FUNCTIONAL_TESTS;NOT ANDROID" OFF)
ie_dependent_option (ENABLE_BEH_TESTS "tests oriented to check OpenVINO Runtime API correctness" ON "ENABLE_TESTS" OFF)
ie_dependent_option (ENABLE_FUNCTIONAL_TESTS "functional tests" ON "ENABLE_TESTS" OFF)
ie_option (ENABLE_SAMPLES "console samples are part of OpenVINO Runtime package" ON)
ie_option (ENABLE_OPENCV "enables custom OpenCV download" OFF)
ie_option (ENABLE_V7_SERIALIZE "enables serialization to IR v7" OFF)
set(OPENVINO_EXTRA_MODULES "" CACHE STRING "Extra paths for extra modules to include into OpenVINO build")
ie_dependent_option(ENABLE_TBB_RELEASE_ONLY "Only Release TBB libraries are linked to the OpenVINO Runtime binaries" ON "THREADING MATCHES TBB;LINUX" OFF)
find_host_package(PythonInterp 3 QUIET)
ie_option(ENABLE_OV_ONNX_FRONTEND "Enable ONNX FrontEnd" ${PYTHONINTERP_FOUND})
ie_option(ENABLE_OV_PADDLE_FRONTEND "Enable PaddlePaddle FrontEnd" ON)
ie_option(ENABLE_OV_IR_FRONTEND "Enable IR FrontEnd" ON)
ie_option(ENABLE_OV_PYTORCH_FRONTEND "Enable PyTorch FrontEnd" ON)
ie_option(ENABLE_OV_IR_FRONTEND "Enable IR FrontEnd" ON)
ie_option(ENABLE_OV_TF_FRONTEND "Enable TensorFlow FrontEnd" ON)
ie_option(ENABLE_OV_TF_LITE_FRONTEND "Enable TensorFlow Lite FrontEnd" ON)
ie_dependent_option(ENABLE_SNAPPY_COMPRESSION "Enables compression support for TF FE" ON
"ENABLE_OV_TF_FRONTEND" ON)
if(CMAKE_HOST_LINUX AND LINUX)
# Debian packages are enabled on Ubuntu systems
# so, system TBB / pugixml / OpenCL can be tried for usage
@@ -129,40 +139,37 @@ else()
set(ENABLE_SYSTEM_TBB_DEFAULT ${ENABLE_SYSTEM_LIBS_DEFAULT})
endif()
if(BUILD_SHARED_LIBS)
set(ENABLE_SYSTEM_PUGIXML_DEFAULT ${ENABLE_SYSTEM_LIBS_DEFAULT})
else()
# for static libraries case libpugixml.a must be compiled with -fPIC
# but we still need an ability to compile with system PugiXML and BUILD_SHARED_LIBS
# for Conan case where everything is compiled statically
set(ENABLE_SYSTEM_PUGIXML_DEFAULT OFF)
endif()
# users wants to use his own TBB version, specific either via env vars or cmake options
if(DEFINED ENV{TBBROOT} OR DEFINED ENV{TBB_DIR} OR DEFINED TBB_DIR OR DEFINED TBBROOT)
set(ENABLE_SYSTEM_TBB_DEFAULT OFF)
endif()
# for static libraries case libpugixml.a must be compiled with -fPIC
ie_dependent_option (ENABLE_SYSTEM_PUGIXML "use the system copy of pugixml" ${ENABLE_SYSTEM_LIBS_DEFAULT} "BUILD_SHARED_LIBS" OFF)
ie_dependent_option (ENABLE_SYSTEM_TBB "use the system version of TBB" ${ENABLE_SYSTEM_TBB_DEFAULT} "THREADING MATCHES TBB" OFF)
ie_dependent_option (ENABLE_SYSTEM_OPENCL "Use the system version of OpenCL" ${ENABLE_SYSTEM_LIBS_DEFAULT} "BUILD_SHARED_LIBS;ENABLE_INTEL_GPU" OFF)
ie_option (ENABLE_DEBUG_CAPS "enable OpenVINO debug capabilities at runtime" OFF)
ie_dependent_option (ENABLE_GPU_DEBUG_CAPS "enable GPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS" OFF)
ie_dependent_option (ENABLE_CPU_DEBUG_CAPS "enable CPU debug capabilities at runtime" ON "ENABLE_DEBUG_CAPS" OFF)
find_host_package(PythonInterp 3 QUIET)
ie_option(ENABLE_OV_ONNX_FRONTEND "Enable ONNX FrontEnd" ${PYTHONINTERP_FOUND})
ie_option(ENABLE_OV_PADDLE_FRONTEND "Enable PaddlePaddle FrontEnd" ON)
ie_option(ENABLE_OV_IR_FRONTEND "Enable IR FrontEnd" ON)
ie_option(ENABLE_OV_PYTORCH_FRONTEND "Enable PyTorch FrontEnd" ON)
ie_option(ENABLE_OV_TF_FRONTEND "Enable TensorFlow FrontEnd" ON)
ie_option(ENABLE_OV_TF_LITE_FRONTEND "Enable TensorFlow Lite FrontEnd" ON)
ie_option(ENABLE_OV_IR_FRONTEND "Enable IR FrontEnd" ON)
ie_dependent_option(ENABLE_SNAPPY_COMPRESSION "Enables compression support for TF FE" ON
"ENABLE_OV_TF_FRONTEND" ON)
ie_dependent_option(ENABLE_SYSTEM_PROTOBUF "Enables use of system protobuf" OFF
"ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_TF_FRONTEND;BUILD_SHARED_LIBS" OFF)
ie_dependent_option (ENABLE_SYSTEM_TBB "Enables use of system TBB" ${ENABLE_SYSTEM_TBB_DEFAULT}
"THREADING MATCHES TBB" OFF)
# TODO: turn it off by default during the work on cross-os distribution, because pugixml is not
# available out of box on all systems (like RHEL, UBI)
ie_option (ENABLE_SYSTEM_PUGIXML "Enables use of system PugiXML" ${ENABLE_SYSTEM_PUGIXML_DEFAULT})
# the option is on by default, because we use only flatc compiler and don't use any libraries
ie_dependent_option(ENABLE_SYSTEM_FLATBUFFERS "Enables use of system flatbuffers" ON
"ENABLE_OV_TF_LITE_FRONTEND" OFF)
ie_dependent_option(ENABLE_SYSTEM_SNAPPY "Enables use of system version of snappy" OFF "ENABLE_SNAPPY_COMPRESSION;BUILD_SHARED_LIBS" OFF)
ie_dependent_option (ENABLE_SYSTEM_OPENCL "Enables use of system OpenCL" ${ENABLE_SYSTEM_LIBS_DEFAULT}
"ENABLE_INTEL_GPU" OFF)
# the option is turned off by default, because we compile our own static version of protobuf
# with LTO and -fPIC options, while system one does not have such flags
ie_dependent_option (ENABLE_SYSTEM_PROTOBUF "Enables use of system Protobuf" OFF
"ENABLE_OV_ONNX_FRONTEND OR ENABLE_OV_PADDLE_FRONTEND OR ENABLE_OV_TF_FRONTEND" OFF)
# the option is turned off by default, because we don't want to have a dependency on libsnappy.so
ie_dependent_option (ENABLE_SYSTEM_SNAPPY "Enables use of system version of Snappy" OFF
"ENABLE_SNAPPY_COMPRESSION" OFF)
ie_option(ENABLE_OPENVINO_DEBUG "Enable output for OPENVINO_DEBUG statements" OFF)

View File

@@ -10,8 +10,8 @@ macro(ov_cpack_settings)
set(cpack_components_all ${CPACK_COMPONENTS_ALL})
unset(CPACK_COMPONENTS_ALL)
foreach(item IN LISTS cpack_components_all)
# filter out some components, which are not needed to be wrapped to conda-forge | brew
if(# python is not a part of conda | brew
# filter out some components, which are not needed to be wrapped to conda-forge | brew | conan
if(# python is not a part of conda | brew | conan
NOT item MATCHES "^${OV_CPACK_COMP_PYTHON_OPENVINO}_python.*" AND
# python wheels are not needed to be wrapped by conda | brew packages
NOT item STREQUAL OV_CPACK_COMP_PYTHON_WHEELS AND

View File

@@ -93,7 +93,7 @@ macro(ov_cpack_settings)
# - 2022.1.0 is the last public release with debian packages from Intel install team
# - 2022.1.1, 2022.2 do not have debian packages enabled, distributed only as archives
# - 2022.3 is the first release where Debian updated packages are introduced, others 2022.3.X are LTS
2022.3.0 2022.3.1 2022.3.2 2022.3.3 2022.3.4 2022.3.5
2022.3.0 2022.3.1 2022.3.2 2022.3.3 2022.3.4 2022.3.5 2023.0.0
)
#
@@ -156,17 +156,20 @@ macro(ov_cpack_settings)
set(auto_copyright "generic")
endif()
# intel-cpu
if(ENABLE_INTEL_CPU OR DEFINED openvino_arm_cpu_plugin_SOURCE_DIR)
if(ENABLE_INTEL_CPU)
# cpu
if(ENABLE_INTEL_CPU)
if(ARM OR AARCH64)
set(CPACK_DEBIAN_CPU_PACKAGE_NAME "libopenvino-arm-cpu-plugin-${cpack_name_ver}")
set(CPACK_COMPONENT_CPU_DESCRIPTION "ARM® CPU plugin")
set(cpu_copyright "arm_cpu")
elseif(X86 OR X86_64)
set(CPACK_DEBIAN_CPU_PACKAGE_NAME "libopenvino-intel-cpu-plugin-${cpack_name_ver}")
set(CPACK_COMPONENT_CPU_DESCRIPTION "Intel® CPU plugin")
set(cpu_copyright "generic")
else()
set(CPACK_COMPONENT_CPU_DESCRIPTION "ARM CPU")
set(cpu_copyright "arm_cpu")
message(FATAL_ERROR "Unsupported CPU architecture: ${CMAKE_SYSTEM_PROCESSOR}")
endif()
set(CPACK_COMPONENT_CPU_DEPENDS "${OV_CPACK_COMP_CORE}")
set(CPACK_DEBIAN_CPU_PACKAGE_NAME "libopenvino-intel-cpu-plugin-${cpack_name_ver}")
set(CPACK_DEBIAN_CPU_PACKAGE_CONTROL_EXTRA "${def_postinst};${def_postrm}")
_ov_add_plugin(cpu OFF)
endif()

View File

@@ -6,7 +6,7 @@ if(CPACK_GENERATOR STREQUAL "DEB")
include(cmake/packaging/debian.cmake)
elseif(CPACK_GENERATOR STREQUAL "RPM")
include(cmake/packaging/rpm.cmake)
elseif(CPACK_GENERATOR MATCHES "^(CONDA-FORGE|BREW)$")
elseif(CPACK_GENERATOR MATCHES "^(CONDA-FORGE|BREW|CONAN)$")
include(cmake/packaging/common-libraries.cmake)
elseif(CPACK_GENERATOR STREQUAL "NSIS")
include(cmake/packaging/nsis.cmake)

View File

@@ -79,7 +79,7 @@ macro(ov_cpack_settings)
# - 2022.1.0 is the last public release with rpm packages from Intel install team
# - 2022.1.1, 2022.2 do not have rpm packages enabled, distributed only as archives
# - 2022.3 is the first release where RPM updated packages are introduced, others 2022.3.X are LTS
2022.3.0 2022.3.1 2022.3.2 2022.3.3 2022.3.4 2022.3.5
2022.3.0 2022.3.1 2022.3.2 2022.3.3 2022.3.4 2022.3.5 2023.0.0
)
find_host_program(rpmlint_PROGRAM NAMES rpmlint DOC "Path to rpmlint")
@@ -156,17 +156,20 @@ macro(ov_cpack_settings)
set(auto_copyright "generic")
endif()
# intel-cpu
if(ENABLE_INTEL_CPU OR DEFINED openvino_arm_cpu_plugin_SOURCE_DIR)
if(ENABLE_INTEL_CPU)
# cpu
if(ENABLE_INTEL_CPU)
if(ARM OR AARCH64)
set(CPACK_RPM_CPU_PACKAGE_NAME "libopenvino-arm-cpu-plugin-${cpack_name_ver}")
set(CPACK_COMPONENT_CPU_DESCRIPTION "ARM® CPU plugin")
set(cpu_copyright "arm_cpu")
elseif(X86 OR X86_64)
set(CPACK_RPM_CPU_PACKAGE_NAME "libopenvino-intel-cpu-plugin-${cpack_name_ver}")
set(CPACK_COMPONENT_CPU_DESCRIPTION "Intel® CPU")
set(cpu_copyright "generic")
else()
set(CPACK_COMPONENT_CPU_DESCRIPTION "ARM CPU")
set(cpu_copyright "arm_cpu")
message(FATAL_ERROR "Unsupported CPU architecture: ${CMAKE_SYSTEM_PROCESSOR}")
endif()
set(CPACK_RPM_CPU_PACKAGE_REQUIRES "${core_package}")
set(CPACK_RPM_CPU_PACKAGE_NAME "libopenvino-intel-cpu-plugin-${cpack_name_ver}")
_ov_add_package(plugin_packages cpu)
endif()

View File

@@ -142,6 +142,14 @@ if(ENABLE_SYSTEM_PUGIXML)
endif()
endif()
set(_IE_nlohmann_json_FOUND "@nlohmann_json_FOUND@")
if(_IE_nlohmann_json_FOUND)
find_dependency(nlohmann_json)
set_target_properties(nlohmann_json::nlohmann_json PROPERTIES IMPORTED_GLOBAL ON)
add_library(IE::nlohmann_json ALIAS nlohmann_json::nlohmann_json)
endif()
unset(_IE_nlohmann_json_FOUND)
# inherit OpenCV from main IE project if enabled
if ("@OpenCV_FOUND@")
load_cache("${cache_path}" READ_WITH_PREFIX "" OpenCV_DIR)

View File

@@ -85,9 +85,9 @@
#
# `OpenVINO_VERSION_MAJOR`
# Major version component
#
#
# `OpenVINO_VERSION_MINOR`
# minor version component
# Minor version component
#
# `OpenVINO_VERSION_PATCH`
# Patch version component
@@ -138,7 +138,7 @@ endmacro()
macro(_ov_find_tbb)
set(THREADING "@THREADING@")
if((THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO") AND NOT TBB_FOUND)
if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
set(enable_pkgconfig_tbb "@tbb_FOUND@")
# try tbb.pc
@@ -153,10 +153,10 @@ macro(_ov_find_tbb)
endif()
pkg_search_module(tbb
${pkg_config_quiet_arg}
${pkg_config_required_arg}
IMPORTED_TARGET
tbb)
${pkg_config_quiet_arg}
${pkg_config_required_arg}
IMPORTED_TARGET
tbb)
unset(pkg_config_quiet_arg)
unset(pkg_config_required_arg)
@@ -223,28 +223,185 @@ macro(_ov_find_tbb)
PATHS ${_tbb_bind_dir}
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
set_target_properties(${TBBBIND_2_5_IMPORTED_TARGETS} PROPERTIES IMPORTED_GLOBAL ON)
unset(_tbb_bind_dir)
endif()
unset(install_tbbbind)
endif()
endmacro()
macro(_ov_find_pugixml)
set(_OV_ENABLE_SYSTEM_PUGIXML "@ENABLE_SYSTEM_PUGIXML@")
if(_OV_ENABLE_SYSTEM_PUGIXML)
set(_ov_pugixml_pkgconfig_interface "@pugixml_FOUND@")
set(_ov_pugixml_cmake_interface "@PugiXML_FOUND@")
if(_ov_pugixml_pkgconfig_interface AND NOT ANDROID)
_ov_find_dependency(PkgConfig)
elseif(_ov_pugixml_cmake_interface)
_ov_find_dependency(PugiXML REQUIRED)
endif()
if(PugiXML_FOUND)
if(TARGET pugixml)
set(_ov_pugixml_target pugixml)
elseif(TARGET pugixml::pugixml)
set(_ov_pugixml_target pugixml::pugixml)
endif()
if(OpenVINODeveloperPackage_DIR)
set_property(TARGET ${_ov_pugixml_target} PROPERTY IMPORTED_GLOBAL ON)
# align with build tree
add_library(openvino::pugixml ALIAS ${_ov_pugixml_target})
endif()
unset(_ov_pugixml_target)
elseif(PkgConfig_FOUND)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
set(pkg_config_quiet_arg QUIET)
endif()
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
set(pkg_config_required_arg REQUIRED)
endif()
pkg_search_module(pugixml
${pkg_config_quiet_arg}
${pkg_config_required_arg}
IMPORTED_TARGET
GLOBAL
pugixml)
unset(pkg_config_quiet_arg)
unset(pkg_config_required_arg)
if(pugixml_FOUND)
if(OpenVINODeveloperPackage_DIR)
add_library(openvino::pugixml ALIAS PkgConfig::pugixml)
endif()
# PATCH: on Ubuntu 18.04 pugixml.pc contains incorrect include directories
get_target_property(interface_include_dir PkgConfig::pugixml INTERFACE_INCLUDE_DIRECTORIES)
if(interface_include_dir AND NOT EXISTS "${interface_include_dir}")
set_target_properties(PkgConfig::pugixml PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "")
endif()
endif()
endif()
# debian 9 case: no cmake, no pkg-config files
if(NOT TARGET openvino::pugixml)
find_library(PUGIXML_LIBRARY NAMES pugixml DOC "Path to pugixml library")
if(PUGIXML_LIBRARY)
add_library(openvino::pugixml INTERFACE IMPORTED)
set_target_properties(openvino::pugixml PROPERTIES INTERFACE_LINK_LIBRARIES "${PUGIXML_LIBRARY}")
else()
message(FATAL_ERROR "Failed to find system pugixml in OpenVINO Developer Package")
endif()
endif()
endif()
endmacro()
macro(_ov_find_itt)
set(_ENABLE_PROFILING_ITT "@ENABLE_PROFILING_ITT@")
# whether 'ittapi' is found via find_package
set(_ENABLE_SYSTEM_ITTAPI "@ittapi_FOUND@")
if(_ENABLE_PROFILING_ITT AND _ENABLE_SYSTEM_ITTAPI)
_ov_find_dependency(ittapi)
endif()
unset(_ENABLE_PROFILING_ITT)
unset(_ENABLE_SYSTEM_ITTAPI)
endmacro()
macro(_ov_find_ade)
set(_OV_ENABLE_GAPI_PREPROCESSING "@ENABLE_GAPI_PREPROCESSING@")
# whether 'ade' is found via find_package
set(_ENABLE_SYSTEM_ADE "@ade_FOUND@")
if(_OV_ENABLE_GAPI_PREPROCESSING AND _ENABLE_SYSTEM_ADE)
_ov_find_dependency(ade 0.1.2)
endif()
unset(_OV_ENABLE_GAPI_PREPROCESSING)
unset(_ENABLE_SYSTEM_ADE)
endmacro()
macro(_ov_find_intel_cpu_dependencies)
set(_OV_ENABLE_CPU_ACL "@DNNL_USE_ACL@")
if(_OV_ENABLE_CPU_ACL)
if(_ov_as_external_package)
set_and_check(ARM_COMPUTE_LIB_DIR "@PACKAGE_ARM_COMPUTE_LIB_DIR@")
set(_ov_find_acl_options NO_DEFAULT_PATH)
set(_ov_find_acl_path "${CMAKE_CURRENT_LIST_DIR}")
else()
set_and_check(_ov_find_acl_path "@PACKAGE_FIND_ACL_PATH@")
endif()
_ov_find_dependency(ACL
NO_MODULE
PATHS "${_ov_find_acl_path}"
${_ov_find_acl_options})
unset(ARM_COMPUTE_LIB_DIR)
unset(_ov_find_acl_path)
unset(_ov_find_acl_options)
endif()
unset(_OV_ENABLE_CPU_ACL)
endmacro()
macro(_ov_find_intel_gpu_dependencies)
set(_OV_ENABLE_INTEL_GPU "@ENABLE_INTEL_GPU@")
set(_OV_ENABLE_SYSTEM_OPENCL "@ENABLE_SYSTEM_OPENCL@")
if(_OV_ENABLE_INTEL_GPU AND _OV_ENABLE_SYSTEM_OPENCL)
set(_OV_OpenCLICDLoader_FOUND "@OpenCLICDLoader_FOUND@")
if(_OV_OpenCLICDLoader_FOUND)
_ov_find_dependency(OpenCLICDLoader)
else()
_ov_find_dependency(OpenCL)
endif()
unset(_OV_OpenCLICDLoader_FOUND)
endif()
unset(_OV_ENABLE_INTEL_GPU)
unset(_OV_ENABLE_SYSTEM_OPENCL)
endmacro()
macro(_ov_find_intel_gna_dependencies)
set(_OV_ENABLE_INTEL_GNA "@ENABLE_INTEL_GNA@")
if(_OV_ENABLE_INTEL_GNA AND NOT libGNA_FOUND)
if(_OV_ENABLE_INTEL_GNA)
set_and_check(GNA_PATH "@PACKAGE_GNA_PATH@")
_ov_find_dependency(libGNA
COMPONENTS KERNEL
CONFIG
PATHS "${CMAKE_CURRENT_LIST_DIR}"
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH)
unset(GNA_PATH)
endif()
unset(_OV_ENABLE_INTEL_GNA)
endmacro()
macro(_ov_find_protobuf_frontend_dependency)
set(_OV_ENABLE_SYSTEM_PROTOBUF "@ENABLE_SYSTEM_PROTOBUF@")
# TODO: remove check for target existence
if(_OV_ENABLE_SYSTEM_PROTOBUF AND NOT TARGET protobuf::libprotobuf)
_ov_find_dependency(Protobuf @Protobuf_VERSION@ EXACT)
endif()
unset(_OV_ENABLE_SYSTEM_PROTOBUF)
endmacro()
macro(_ov_find_tensorflow_frontend_dependencies)
set(_OV_ENABLE_SYSTEM_SNAPPY "@ENABLE_SYSTEM_SNAPPY@")
set(_ov_snappy_lib "@ov_snappy_lib@")
# TODO: remove check for target existence
if(_OV_ENABLE_SYSTEM_SNAPPY AND NOT TARGET ${_ov_snappy_lib})
_ov_find_dependency(Snappy @Snappy_VERSION@ EXACT)
endif()
unset(_OV_ENABLE_SYSTEM_SNAPPY)
unset(_ov_snappy_lib)
set(PACKAGE_PREFIX_DIR ${_ov_package_prefix_dir})
endmacro()
macro(_ov_find_onnx_frontend_dependencies)
set(_OV_ENABLE_SYSTEM_ONNX "@ENABLE_SYSTEM_ONNX@")
if(_OV_ENABLE_SYSTEM_ONNX)
_ov_find_dependency(ONNX @ONNX_VERSION@ EXACT)
endif()
unset(_OV_ENABLE_SYSTEM_ONNX)
endmacro()
function(_ov_target_no_deprecation_error)
if(NOT MSVC)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
@@ -265,13 +422,41 @@ endfunction()
# OpenVINO config
#
cmake_policy(PUSH)
# we need CMP0057 to allow IN_LIST in if() command
if(POLICY CMP0057)
cmake_policy(SET CMP0057 NEW)
else()
message(FATAL_ERROR "OpenVINO requires CMake 3.3 or newer")
endif()
# need to store current PACKAGE_PREFIX_DIR, because it's overwritten by sub-package one
set(_ov_package_prefix_dir "${PACKAGE_PREFIX_DIR}")
set(_OV_ENABLE_OPENVINO_BUILD_SHARED "@BUILD_SHARED_LIBS@")
if(NOT TARGET openvino)
set(_ov_as_external_package ON)
endif()
if(NOT _OV_ENABLE_OPENVINO_BUILD_SHARED)
# common openvino dependencies
_ov_find_tbb()
_ov_find_itt()
_ov_find_pugixml()
# preprocessing dependencies
_ov_find_ade()
# frontend dependencies
_ov_find_protobuf_frontend_dependency()
_ov_find_tensorflow_frontend_dependencies()
_ov_find_onnx_frontend_dependencies()
# plugin dependencies
_ov_find_intel_cpu_dependencies()
_ov_find_intel_gpu_dependencies()
_ov_find_intel_gna_dependencies()
endif()
@@ -279,13 +464,26 @@ _ov_find_dependency(Threads)
unset(_OV_ENABLE_OPENVINO_BUILD_SHARED)
if(NOT TARGET openvino)
set(_ov_as_external_package ON)
set(_ov_imported_libs openvino::runtime openvino::runtime::c
openvino::frontend::onnx openvino::frontend::paddle openvino::frontend::tensorflow
openvino::frontend::pytorch openvino::frontend::tensorflow_lite)
if(_ov_as_external_package)
include("${CMAKE_CURRENT_LIST_DIR}/OpenVINOTargets.cmake")
foreach(target IN LISTS _ov_imported_libs)
if(TARGET ${target})
get_target_property(imported_configs ${target} IMPORTED_CONFIGURATIONS)
if(NOT RELWITHDEBINFO IN_LIST imported_configs)
set_property(TARGET ${target} PROPERTY MAP_IMPORTED_CONFIG_RELWITHDEBINFO RELEASE)
endif()
unset(imported_configs)
endif()
endforeach()
# WA for cmake version < 3.16 which does not export
# IMPORTED_LINK_DEPENDENT_LIBRARIES_** properties if no PUBLIC dependencies for the library
if((THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO") AND TBB_FOUND)
if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
foreach(type RELEASE DEBUG RELWITHDEBINFO MINSIZEREL)
foreach(tbb_target TBB::tbb TBB::tbbmalloc PkgConfig::tbb)
if(TARGET ${tbb_target})
@@ -326,12 +524,12 @@ endif()
# Apply common functions
#
foreach(target openvino::runtime openvino::runtime::c
openvino::frontend::onnx openvino::frontend::paddle openvino::frontend::tensorflow)
foreach(target IN LISTS _ov_imported_libs)
if(TARGET ${target} AND _ov_as_external_package)
_ov_target_no_deprecation_error(${target})
endif()
endforeach()
unset(_ov_imported_libs)
unset(_ov_as_external_package)
# restore PACKAGE_PREFIX_DIR
@@ -349,3 +547,7 @@ unset(${CMAKE_FIND_PACKAGE_NAME}_IR_FOUND)
unset(${CMAKE_FIND_PACKAGE_NAME}_Paddle_FOUND)
unset(${CMAKE_FIND_PACKAGE_NAME}_ONNX_FOUND)
unset(${CMAKE_FIND_PACKAGE_NAME}_TensorFlow_FOUND)
unset(${CMAKE_FIND_PACKAGE_NAME}_TensorFlowLite_FOUND)
unset(${CMAKE_FIND_PACKAGE_NAME}_PyTorch_FOUND)
cmake_policy(POP)

View File

@@ -56,6 +56,7 @@ find_dependency(OpenVINO
NO_DEFAULT_PATH)
_ov_find_tbb()
_ov_find_pugixml()
foreach(component @openvino_export_components@)
# TODO: remove legacy targets from some tests
@@ -65,58 +66,6 @@ foreach(component @openvino_export_components@)
# endif()
endforeach()
if(ENABLE_SYSTEM_PUGIXML)
set(_ov_pugixml_pkgconfig_interface "@pugixml_FOUND@")
set(_ov_pugixml_cmake_interface "@PugiXML_FOUND@")
if(_ov_pugixml_pkgconfig_interface)
find_dependency(PkgConfig)
elseif(_ov_pugixml_cmake_interface)
find_dependency(PugiXML)
endif()
if(PugiXML_FOUND)
set_property(TARGET pugixml PROPERTY IMPORTED_GLOBAL TRUE)
add_library(openvino::pugixml ALIAS pugixml)
elseif(PkgConfig_FOUND)
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
set(pkg_config_quiet_arg QUIET)
endif()
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
set(pkg_config_required_arg REQUIRED)
endif()
pkg_search_module(pugixml
${pkg_config_quiet_arg}
${pkg_config_required_arg}
IMPORTED_TARGET GLOBAL
pugixml)
unset(pkg_config_quiet_arg)
unset(pkg_config_required_arg)
if(pugixml_FOUND)
add_library(openvino::pugixml ALIAS PkgConfig::pugixml)
# PATCH: on Ubuntu 18.04 pugixml.pc contains incorrect include directories
get_target_property(interface_include_dir PkgConfig::pugixml INTERFACE_INCLUDE_DIRECTORIES)
if(interface_include_dir AND NOT EXISTS "${interface_include_dir}")
set_target_properties(PkgConfig::pugixml PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "")
endif()
endif()
endif()
# debian 9 case: no cmake, no pkg-config files
if(NOT TARGET openvino::pugixml)
find_library(PUGIXML_LIBRARY NAMES pugixml DOC "Path to pugixml library")
if(PUGIXML_LIBRARY)
add_library(openvino::pugixml INTERFACE IMPORTED GLOBAL)
set_target_properties(openvino::pugixml PROPERTIES INTERFACE_LINK_LIBRARIES "${PUGIXML_LIBRARY}")
else()
message(FATAL_ERROR "Failed to find system pugixml in OpenVINO Developer Package")
endif()
endif()
endif()
# inherit OpenCV from main OpenVINO project if enabled
if ("@OpenCV_FOUND@")
load_cache("${cache_path}" READ_WITH_PREFIX "" OpenCV_DIR)

View File

@@ -42,11 +42,12 @@ function(ov_model_convert SRC DST OUT)
endif()
set(full_out_name "${DST}/${rel_out_name}")
file(MAKE_DIRECTORY "${DST}/${rel_dir}")
if(ext STREQUAL ".prototxt")
# convert .prototxt models to .onnx binary
add_custom_command(OUTPUT ${full_out_name}
COMMAND ${CMAKE_COMMAND} -E make_directory
"${DST}/${rel_dir}"
COMMAND ${PYTHON_EXECUTABLE} ${onnx_gen_script}
"${SRC}/${in_file}" ${full_out_name}
DEPENDS ${onnx_gen_script} "${SRC}/${in_file}"
@@ -55,6 +56,8 @@ function(ov_model_convert SRC DST OUT)
WORKING_DIRECTORY "${model_source_dir}")
else()
add_custom_command(OUTPUT ${full_out_name}
COMMAND ${CMAKE_COMMAND} -E make_directory
"${DST}/${rel_dir}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"${SRC}/${in_file}" ${full_out_name}
DEPENDS ${onnx_gen_script} "${SRC}/${in_file}"
@@ -68,18 +71,24 @@ function(ov_model_convert SRC DST OUT)
set(${OUT} ${files} PARENT_SCOPE)
endfunction()
if(OV_GENERATOR_MULTI_CONFIG AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.20)
set(test_model_zoo_output_dir "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>/test_model_zoo")
else()
set(test_model_zoo_output_dir "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_model_zoo")
endif()
ov_model_convert("${CMAKE_CURRENT_SOURCE_DIR}/src/core/tests"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_model_zoo/core"
"${test_model_zoo_output_dir}/core"
core_tests_out_files)
set(rel_path "src/tests/functional/plugin/shared/models")
ov_model_convert("${OpenVINO_SOURCE_DIR}/${rel_path}"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_model_zoo/func_tests/models"
"${test_model_zoo_output_dir}/func_tests/models"
ft_out_files)
set(rel_path "src/frontends/onnx/tests/models")
ov_model_convert("${OpenVINO_SOURCE_DIR}/${rel_path}"
"${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_model_zoo/onnx"
"${test_model_zoo_output_dir}/onnx"
onnx_fe_out_files)
if(ENABLE_TESTS)
@@ -87,11 +96,12 @@ if(ENABLE_TESTS)
${ft_out_files}
${onnx_fe_out_files})
if (ENABLE_OV_PADDLE_FRONTEND)
add_dependencies(test_model_zoo paddle_test_models)
endif()
# TODO Reenable PDPD after paddlepaddle==2.5.0 with compliant protobuf is released (ticket 95904)
#if (ENABLE_OV_PADDLE_FRONTEND)
# add_dependencies(test_model_zoo paddle_test_models)
#endif()
install(DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/test_model_zoo"
install(DIRECTORY "${test_model_zoo_output_dir}"
DESTINATION tests COMPONENT tests EXCLUDE_FROM_ALL)
set(TEST_MODEL_ZOO "./test_model_zoo" CACHE PATH "Path to test model zoo")

View File

@@ -0,0 +1,95 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
# Prerequisites:
#
# Build platform: Ubuntu
# apt-get install mingw-w64 mingw-w64-tools g++-mingw-w64-x86-64 gcc-mingw-w64-x86-64
#
# Build platform: macOS
# brew install mingw-w64
#
set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR x86_64)
set(CMAKE_C_COMPILER x86_64-w64-mingw32-gcc-posix)
set(CMAKE_CXX_COMPILER x86_64-w64-mingw32-g++-posix)
set(PKG_CONFIG_EXECUTABLE x86_64-w64-mingw32-pkg-config CACHE PATH "Path to Windows x86_64 pkg-config")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
macro(__cmake_find_root_save_and_reset)
foreach(v
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
)
set(__save_${v} ${${v}})
set(${v} NEVER)
endforeach()
endmacro()
macro(__cmake_find_root_restore)
foreach(v
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
)
set(${v} ${__save_${v}})
unset(__save_${v})
endforeach()
endmacro()
# macro to find programs on the host OS
macro(find_host_program)
__cmake_find_root_save_and_reset()
if(CMAKE_HOST_WIN32)
SET(WIN32 1)
SET(UNIX)
SET(APPLE)
elseif(CMAKE_HOST_APPLE)
SET(APPLE 1)
SET(UNIX)
SET(WIN32)
elseif(CMAKE_HOST_UNIX)
SET(UNIX 1)
SET(WIN32)
SET(APPLE)
endif()
find_program(${ARGN})
SET(WIN32 1)
SET(APPLE)
SET(UNIX)
__cmake_find_root_restore()
endmacro()
# macro to find packages on the host OS
macro(find_host_package)
__cmake_find_root_save_and_reset()
if(CMAKE_HOST_WIN32)
SET(WIN32 1)
SET(UNIX)
SET(APPLE)
elseif(CMAKE_HOST_APPLE)
SET(APPLE 1)
SET(WIN32)
SET(UNIX)
elseif(CMAKE_HOST_UNIX)
SET(UNIX 1)
SET(WIN32)
SET(APPLE)
endif()
find_package(${ARGN})
SET(WIN32 1)
SET(APPLE)
SET(UNIX)
__cmake_find_root_restore()
endmacro()

View File

@@ -24,7 +24,7 @@ set(CMAKE_LINKER ${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-ld)
set(CMAKE_OBJCOPY ${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-objcopy)
set(CMAKE_OBJDUMP ${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-objdump)
set(CMAKE_READELF ${RISCV_TOOLCHAIN_ROOT}/bin/riscv64-unknown-linux-gnu-readelf)
set(PKG_CONFIG_EXECUTABLE "NOT-FOUND" CACHE PATH "Path to ARM64 pkg-config")
set(PKG_CONFIG_EXECUTABLE "NOT-FOUND" CACHE PATH "Path to RISC-V pkg-config")
# Don't run the linker on compiler check
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)

View File

@@ -0,0 +1,75 @@
# Copyright (C) 2018-2023 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR amd64)
set(CMAKE_C_COMPILER x86_64-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER x86_64-linux-gnu-g++)
set(CMAKE_STRIP x86_64-linux-gnu-strip)
set(PKG_CONFIG_EXECUTABLE "NOT-FOUND" CACHE PATH "Path to amd64 pkg-config")
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
macro(__cmake_find_root_save_and_reset)
foreach(v
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
)
set(__save_${v} ${${v}})
set(${v} NEVER)
endforeach()
endmacro()
macro(__cmake_find_root_restore)
foreach(v
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
)
set(${v} ${__save_${v}})
unset(__save_${v})
endforeach()
endmacro()
# macro to find programs on the host OS
macro(find_host_program)
__cmake_find_root_save_and_reset()
if(CMAKE_HOST_WIN32)
SET(WIN32 1)
SET(UNIX)
elseif(CMAKE_HOST_APPLE)
SET(APPLE 1)
SET(UNIX)
endif()
find_program(${ARGN})
SET(WIN32)
SET(APPLE)
SET(UNIX 1)
__cmake_find_root_restore()
endmacro()
# macro to find packages on the host OS
macro(find_host_package)
__cmake_find_root_save_and_reset()
if(CMAKE_HOST_WIN32)
SET(WIN32 1)
SET(UNIX)
elseif(CMAKE_HOST_APPLE)
SET(APPLE 1)
SET(UNIX)
endif()
find_package(${ARGN})
SET(WIN32)
SET(APPLE)
SET(UNIX 1)
__cmake_find_root_restore()
endmacro()

33
conanfile.txt Normal file
View File

@@ -0,0 +1,33 @@
[requires]
ade/0.1.2a
onetbb/[>=2021.2.1]
pugixml/[>=1.10]
protobuf/[>=3.20.3]
ittapi/[>=3.23.0]
zlib/[>=1.2.8]
opencl-icd-loader/[>=2022.09.30]
# opencl-clhpp-headers/[>=2022.09.30]
opencl-headers/[>=2022.09.30]
xbyak/[>=6.62]
snappy/[>=1.1.7]
gflags/2.2.2
onnx/1.13.1
nlohmann_json/[>=3.1.1]
pybind11/[>=2.10.1]
flatbuffers/[>=22.9.24]
[tool_requires]
cmake/[>=3.15]
patchelf/[>=0.12]
protobuf/[>=3.20.3]
flatbuffers/[>=22.9.24]
[options]
protobuf/*:lite=True
onetbb/*:tbbmalloc=True
onetbb/*:tbbproxy=True
flatbuffers/*:header_only=True
[generators]
CMakeDeps
CMakeToolchain

View File

@@ -77,7 +77,7 @@ function(build_docs)
if(ENABLE_OPENVINO_NOTEBOOKS)
set(NBDOC_SCRIPT "${DOCS_SOURCE_DIR}/nbdoc/nbdoc.py")
list(APPEND commands
COMMAND ${PYTHON_EXECUTABLE} "${NBDOC_SCRIPT}" "${RST_OUTPUT}/notebooks"
COMMAND ${PYTHON_EXECUTABLE} "${NBDOC_SCRIPT}" "${DOCS_SOURCE_DIR}/notebooks" "${RST_OUTPUT}/notebooks"
)
endif()

View File

@@ -0,0 +1,71 @@
# Datumaro {#datumaro_documentation}
@sphinxdirective
Datumaro provides a suite of basic data import/export (IE) for more than 35 public vision data
formats and manipulation functionalities such as validation, correction, filtration, and some
transformations. To achieve the web-scale training, this further aims to merge multiple
heterogeneous datasets through comparator and merger. Datumaro is integrated into Geti™, OpenVINO™
Training Extensions, and CVAT for the ease of data preparation. Datumaro is open-sourced and
available on `GitHub <https://github.com/openvinotoolkit/datumaro>`__.
Refer to the official `documentation <https://openvinotoolkit.github.io/datumaro/stable/docs/get-started/introduction.html>`__ to learn more.
Plus, enjoy `Jupyter notebooks <https://github.com/openvinotoolkit/datumaro/tree/develop/notebooks>`__ for the real Datumaro practices.
Detailed Workflow
#################
.. image:: ./_static/images/datumaro.png
1. To start working with Datumaro, download public datasets or prepare your own annotated dataset.
.. note::
Datumaro provides a CLI `datum download` for downloading `TensorFlow Datasets <https://www.tensorflow.org/datasets>`__.
2. Import data into Datumaro and manipulate the dataset for the data quality using `Validator`, `Corrector`, and `Filter`.
3. Compare two datasets and transform the label schemas (category information) before merging them.
4. Merge two datasets to a large-scale dataset.
.. note::
There are some choices of merger, i.e., `ExactMerger`, `IntersectMerger`, and `UnionMerger`.
5. Split the unified dataset into subsets, e.g., `train`, `valid`, and `test` through `Splitter`.
.. note::
We can split data with a given ratio of subsets according to both the number of samples or
annotations. Please see `SplitTask` for the task-specific split.
6. Export the cleaned and unified dataset for follow-up workflows such as model training.
Go to :doc:`OpenVINO™ Training Extensions <ote_documentation>`.
If the results are unsatisfactory, add datasets and perform the same steps, starting with dataset annotation.
Datumaro Components
###################
* `Datumaro CLIs <https://openvinotoolkit.github.io/datumaro/stable/docs/command-reference/overview.html>`__
* `Datumaro APIs <https://openvinotoolkit.github.io/datumaro/stable/docs/reference/datumaro_module.html>`__
* `Datumaro data format <https://openvinotoolkit.github.io/datumaro/stable/docs/data-formats/datumaro_format.html>`__
* `Supported data formats <https://openvinotoolkit.github.io/datumaro/stable/docs/data-formats/formats/index.html>`__
Tutorials
#########
* `Basic skills <https://openvinotoolkit.github.io/datumaro/stable/docs/level-up/basic_skills/index.html>`__
* `Intermediate skills <https://openvinotoolkit.github.io/datumaro/stable/docs/level-up/intermediate_skills/index.html>`__
* `Advanced skills <https://openvinotoolkit.github.io/datumaro/stable/docs/level-up/advanced_skills/index.html>`__
Python Hands-on Examples
########################
* `Data IE <https://openvinotoolkit.github.io/datumaro/stable/docs/jupyter_notebook_examples/dataset_IO.html>`__
* `Data manipulation <https://openvinotoolkit.github.io/datumaro/stable/docs/jupyter_notebook_examples/manipulate.html>`__
* `Data exploration <https://openvinotoolkit.github.io/datumaro/stable/docs/jupyter_notebook_examples/explore.html>`__
* `Data refinement <https://openvinotoolkit.github.io/datumaro/stable/docs/jupyter_notebook_examples/refine.html>`__
* `Data transformation <https://openvinotoolkit.github.io/datumaro/stable/docs/jupyter_notebook_examples/transform.html>`__
* `Deep learning end-to-end use-cases <https://openvinotoolkit.github.io/datumaro/stable/docs/jupyter_notebook_examples/e2e_example.html>`__
@endsphinxdirective

View File

@@ -1,33 +0,0 @@
# Running and Deploying Inference {#openvino_docs_deployment_guide_introduction}
@sphinxdirective
.. toctree::
:maxdepth: 1
:hidden:
Run and Deploy Locally <openvino_deployment_guide>
Deploy via Model Serving <ovms_what_is_openvino_model_server>
Once you have a model that meets both OpenVINO™ and your requirements, you can choose how to deploy it with your application.
.. panels::
:doc:`Deploy via OpenVINO Runtime <openvino_deployment_guide>`
^^^^^^^^^^^^^^
Local deployment uses OpenVINO Runtime that is called from, and linked to, the application directly.
It utilizes resources available to the system and provides the quickest way of launching inference.
---
:doc:`Deploy via Model Server <ovms_what_is_openvino_model_server>`
^^^^^^^^^^^^^^
Deployment via OpenVINO Model Server allows the application to connect to the inference server set up remotely.
This way inference can use external resources instead of those available to the application itself.
Apart from the default deployment options, you may also :doc:`deploy your application for the TensorFlow framework with OpenVINO Integration <ovtf_integration>`
@endsphinxdirective

View File

@@ -17,7 +17,7 @@ OpenVINO Runtime offers multiple inference modes to allow optimum hardware utili
The remaining modes assume certain levels of automation in selecting devices for inference. Using them in the deployed solution may potentially increase its performance and portability. The automated modes are:
* :doc:`Automatic Device Selection (AUTO) <openvino_docs_OV_UG_supported_plugins_AUTO>`
* :doc:``Multi-Device Execution (MULTI) <openvino_docs_OV_UG_Running_on_multiple_devices>`
* :doc:`Multi-Device Execution (MULTI) <openvino_docs_OV_UG_Running_on_multiple_devices>`
* :doc:`Heterogeneous Execution (HETERO) <openvino_docs_OV_UG_Hetero_execution>`
* :doc:`Automatic Batching Execution (Auto-batching) <openvino_docs_OV_UG_Automatic_Batching>`

View File

@@ -10,22 +10,48 @@
omz_tools_downloader
Every deep learning workflow begins with obtaining a model. You can choose to prepare a custom one, use a ready-made solution and adjust it to your needs, or even download and run a pre-trained network from an online database, such as OpenVINO's :doc:`Open Model Zoo <model_zoo>`.
Every deep learning workflow begins with obtaining a model. You can choose to prepare a custom one, use a ready-made solution and adjust it to your needs, or even download and run a pre-trained network from an online database, such as `TensorFlow Hub <https://tfhub.dev/>`__, `Hugging Face <https://huggingface.co/>`__, `Torchvision models <https://pytorch.org/hub/>`__.
:doc:`OpenVINO™ supports several model formats <Supported_Model_Formats>` and allows to convert them to it's own, OpenVINO IR, providing a tool dedicated to this task.
:doc:`OpenVINO™ supports several model formats <Supported_Model_Formats>` and allows converting them to it's own, `openvino.runtime.Model <api/ie_python_api/_autosummary/openvino.runtime.Model.html>`__ (`ov.Model <api/ie_python_api/_autosummary/openvino.runtime.Model.html>`__ ), providing a tool dedicated to this task.
:doc:`Model Optimizer <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>` reads the original model and creates the OpenVINO IR model (.xml and .bin files) so that inference can ultimately be performed without delays due to format conversion. Optionally, Model Optimizer can adjust the model to be more suitable for inference, for example, by :doc:`alternating input shapes <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`, :doc:`embedding preprocessing <openvino_docs_MO_DG_Additional_Optimization_Use_Cases>` and :doc:`cutting training parts off <openvino_docs_MO_DG_prepare_model_convert_model_Cutting_Model>`.
There are several options to convert a model from original framework to OpenVINO model format (``ov.Model``).
The approach to fully convert a model is considered the default choice, as it allows the full extent of OpenVINO features. The OpenVINO IR model format is used by other conversion and preparation tools, such as the Post-Training Optimization Tool, for further optimization of the converted model.
The ``read_model()`` method reads a model from a file and produces ``ov.Model``. If the file is in one of the supported original framework file formats, it is converted automatically to OpenVINO Intermediate Representation. If the file is already in the OpenVINO IR format, it is read "as-is", without any conversion involved. ``ov.Model`` can be serialized to IR using the ``ov.serialize()`` method. The serialized IR can be further optimized using :doc:`Neural Network Compression Framework (NNCF) <ptq_introduction>` that applies post-training quantization methods.
Conversion is not required for ONNX, PaddlePaddle, and TensorFlow models (check :doc:`TensorFlow Frontend Capabilities and Limitations <openvino_docs_MO_DG_TensorFlow_Frontend>`), as OpenVINO provides C++ and Python APIs for importing them to OpenVINO Runtime directly. It provides a convenient way to quickly switch from framework-based code to OpenVINO-based code in your inference application.
Convert a model in Python
######################################
Model conversion API, specifically, the ``mo.convert_model()`` method converts a model from original framework to ``ov.Model``. ``mo.convert_model()`` returns ``ov.Model`` object in memory so the ``read_model()`` method is not required. The resulting ``ov.Model`` can be inferred in the same training environment (python script or Jupiter Notebook). ``mo.convert_model()`` provides a convenient way to quickly switch from framework-based code to OpenVINO-based code in your inference application. In addition to model files, ``mo.convert_model()`` can take OpenVINO extension objects constructed directly in Python for easier conversion of operations that are not supported in OpenVINO. The ``mo.convert_model()`` method also has a set of parameters to :doc:`cut the model <openvino_docs_MO_DG_prepare_model_convert_model_Cutting_Model>`, :doc:`set input shapes or layout <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>`, :doc:`add preprocessing <openvino_docs_MO_DG_Additional_Optimization_Use_Cases>`, etc.
.. image:: _static/images/model_conversion_diagram.svg
:alt: model conversion diagram
Convert a model with ``mo`` command-line tool
#############################################
Another option to convert a model is to use ``mo`` command-line tool. ``mo`` is a cross-platform tool that facilitates the transition between training and deployment environments, performs static model analysis, and adjusts deep learning models for optimal execution on end-point target devices in the same measure, as the ``mo.convert_model`` method.
``mo`` requires the use of a pre-trained deep learning model in one of the supported formats: TensorFlow, TensorFlow Lite, PaddlePaddle, or ONNX. ``mo`` converts the model to the OpenVINO Intermediate Representation format (IR), which needs to be read with the ``ov.read_model()`` method. Then, you can compile and infer the ``ov.Model`` later with :doc:`OpenVINO™ Runtime <openvino_docs_OV_UG_OV_Runtime_User_Guide>`.
The figure below illustrates the typical workflow for deploying a trained deep learning model:
.. image:: _static/images/BASIC_FLOW_MO_simplified.svg
where IR is a pair of files describing the model:
* ``.xml`` - Describes the network topology.
* ``.bin`` - Contains the weights and biases binary data.
Model files (not Python objects) from ONNX, PaddlePaddle, TensorFlow and TensorFlow Lite (check :doc:`TensorFlow Frontend Capabilities and Limitations <openvino_docs_MO_DG_TensorFlow_Frontend>`) do not require a separate step for model conversion, that is ``mo.convert_model``. OpenVINO provides C++ and Python APIs for importing the models to OpenVINO Runtime directly by just calling the ``read_model`` method.
The results of both ``mo`` and ``mo.convert_model()`` conversion methods described above are the same. You can choose one of them, depending on what is most convenient for you. Keep in mind that there should not be any differences in the results of model conversion if the same set of parameters is used.
This section describes how to obtain and prepare your model for work with OpenVINO to get the best inference results:
* :doc:`See the supported formats and how to use them in your project <Supported_Model_Formats>`.
* :doc:`Convert different model formats to the OpenVINO IR format <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
* `Automate model-related tasks with Model Downloader and additional OMZ Tools <https://docs.openvino.ai/latest/omz_tools_downloader.html>`__.
* :doc:`Convert different model formats to the ov.Model format <openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide>`.
To begin with, you may want to :doc:`browse a database of models for use in your projects <model_zoo>`.
@endsphinxdirective

View File

@@ -7,16 +7,16 @@
:hidden:
ote_documentation
ovtf_integration
datumaro_documentation
ovsa_get_started
openvino_inference_engine_tools_compile_tool_README
openvino_docs_tuning_utilities
OpenVINO™ is not just one tool. It is an expansive ecosystem of utilities, providing a comprehensive workflow for deep learning solution development. Learn more about each of them to reach the full potential of OpenVINO™ Toolkit.
Neural Network Compression Framework (NNCF)
###########################################
**Neural Network Compression Framework (NNCF)**
A suite of advanced algorithms for Neural Network inference optimization with minimal accuracy drop. NNCF applies quantization, filter pruning, binarization and sparsity algorithms to PyTorch and TensorFlow models during training.
@@ -27,8 +27,7 @@ More resources:
* `PyPI <https://pypi.org/project/nncf/>`__
OpenVINO™ Training Extensions
#############################
**OpenVINO™ Training Extensions**
A convenient environment to train Deep Learning models and convert them using the OpenVINO™ toolkit for optimized inference.
@@ -38,71 +37,60 @@ More resources:
* `GitHub <https://github.com/openvinotoolkit/training_extensions>`__
* `Documentation <https://openvinotoolkit.github.io/training_extensions/stable/guide/get_started/introduction.html>`__
OpenVINO™ Security Add-on
#########################
**OpenVINO™ Security Add-on**
A solution for Model Developers and Independent Software Vendors to use secure packaging and secure model execution.
More resources:
* `Documentation <https://docs.openvino.ai/latest/ovsa_get_started.html>`__
* :doc:`Documentation <ovsa_get_started>`
* `GitHub <https://github.com/openvinotoolkit/security_addon>`__
OpenVINO™ integration with TensorFlow (OVTF)
############################################
A solution empowering TensorFlow developers with OpenVINO's optimization capabilities. With just two lines of code in your application, you can offload inference to OpenVINO, while keeping the TensorFlow API.
More resources:
* `Documentation <https://github.com/openvinotoolkit/openvino_tensorflow>`__
* `PyPI <https://pypi.org/project/openvino-tensorflow/>`__
* `GitHub <https://github.com/openvinotoolkit/openvino_tensorflow>`__
DL Streamer
###########
A streaming media analytics framework, based on the GStreamer multimedia framework, for creating complex media analytics pipelines.
More resources:
* `Documentation on GitHub <https://dlstreamer.github.io/index.html>`__
* `Installation Guide on GitHub <https://github.com/openvinotoolkit/dlstreamer_gst/wiki/Install-Guide>`__
DL Workbench
############
A web-based tool for deploying deep learning models. Built on the core of OpenVINO and equipped with a graphics user interface, DL Workbench is a great way to explore the possibilities of the OpenVINO workflow, import, analyze, optimize, and build your pre-trained models. You can do all that by visiting `Intel® Developer Cloud <https://software.intel.com/content/www/us/en/develop/tools/devcloud.html>`__ and launching DL Workbench online.
More resources:
* `Documentation <https://docs.openvino.ai/2022.3/workbench_docs_Workbench_DG_Introduction.html>`__
* `Docker Hub <https://hub.docker.com/r/openvino/workbench>`__
* `PyPI <https://pypi.org/project/openvino-workbench/>`__
Computer Vision Annotation Tool (CVAT)
######################################
An online, interactive video and image annotation tool for computer vision purposes.
More resources:
* `Documentation on GitHub <https://opencv.github.io/cvat/docs/>`__
* `Web application <https://www.cvat.ai/>`__
* `Docker Hub <https://hub.docker.com/r/openvino/cvat_server>`__
* `GitHub <https://github.com/openvinotoolkit/cvat>`__
Dataset Management Framework (Datumaro)
#######################################
**Dataset Management Framework (Datumaro)**
A framework and CLI tool to build, transform, and analyze datasets.
More resources:
* `Documentation on GitHub <https://openvinotoolkit.github.io/datumaro/docs/>`__
* :doc:`Overview <datumaro_documentation>`
* `PyPI <https://pypi.org/project/datumaro/>`__
* `GitHub <https://github.com/openvinotoolkit/datumaro>`__
* `Documentation <https://openvinotoolkit.github.io/datumaro/stable/docs/get-started/introduction.html>`__
**Compile Tool**
Compile tool is now deprecated. If you need to compile a model for inference on a specific device, use the following script:
.. tab-set::
.. tab-item:: Python
:sync: py
.. doxygensnippet:: docs/snippets/export_compiled_model.py
:language: python
:fragment: [export_compiled_model]
.. tab-item:: C++
:sync: cpp
.. doxygensnippet:: docs/snippets/export_compiled_model.cpp
:language: cpp
:fragment: [export_compiled_model]
To learn which device supports the import / export functionality, see the :doc:`feature support matrix <openvino_docs_OV_UG_Working_with_devices>`.
For more details on preprocessing steps, refer to the :doc:`Optimize Preprocessing <openvino_docs_OV_UG_Preprocessing_Overview>`. To compile the model with advanced preprocessing capabilities, refer to the :doc:`Use Case - Integrate and Save Preprocessing Steps Into OpenVINO IR <openvino_docs_OV_UG_Preprocess_Usecase_save>`, which shows how to have all the preprocessing in the compiled blob.
**DL Workbench**
A web-based tool for deploying deep learning models. Built on the core of OpenVINO and equipped with a graphics user interface, DL Workbench is a great way to explore the possibilities of the OpenVINO workflow, import, analyze, optimize, and build your pre-trained models. You can do all that by visiting `Intel® Developer Cloud <https://software.intel.com/content/www/us/en/develop/tools/devcloud.html>`__ and launching DL Workbench online.
**OpenVINO™ integration with TensorFlow (OVTF)**
OpenVINO™ Integration with TensorFlow will no longer be supported as of OpenVINO release 2023.0. As part of the 2023.0 release, OpenVINO will feature a significantly enhanced TensorFlow user experience within native OpenVINO without needing offline model conversions. :doc:`Learn more <openvino_docs_MO_DG_TensorFlow_Frontend>`.
@endsphinxdirective

View File

@@ -1,55 +0,0 @@
# OpenVINO™ integration with TensorFlow {#ovtf_integration}
@sphinxdirective
**OpenVINO™ integration with TensorFlow** is a solution for TensorFlow developers who want to get started with OpenVINO™ in their inferencing applications. By adding just two lines of code you can now take advantage of OpenVINO™ toolkit optimizations with TensorFlow inference applications across a range of Intel® computation devices.
This is all you need:
.. code-block:: bash
import openvino_tensorflow
openvino_tensorflow.set_backend('<backend_name>')
**OpenVINO™ integration with TensorFlow** accelerates inference across many AI models on a variety of Intel® technologies, such as:
* Intel® CPUs
* Intel® integrated GPUs
.. note::
For maximum performance, efficiency, tooling customization, and hardware control, we recommend developers to adopt native OpenVINO™ solutions.
To find out more about the product itself, as well as learn how to use it in your project, check its dedicated `GitHub repository <https://github.com/openvinotoolkit/openvino_tensorflow/tree/master/docs>`__.
To see what you can do with **OpenVINO™ integration with TensorFlow**, explore the demos located in the `examples folder <https://github.com/openvinotoolkit/openvino_tensorflow/tree/master/examples>`__ in our GitHub repository.
Sample tutorials are also hosted on `Intel® DevCloud <https://www.intel.com/content/www/us/en/developer/tools/devcloud/edge/build/ovtfoverview.html>`__. The demo applications are implemented using Jupyter Notebooks. You can interactively execute them on Intel® DevCloud nodes, compare the results of **OpenVINO™ integration with TensorFlow**, native TensorFlow, and OpenVINO™.
License
#######
**OpenVINO™ integration with TensorFlow** is licensed under `Apache License Version 2.0 <https://github.com/openvinotoolkit/openvino_tensorflow/blob/master/LICENSE>`__.
By contributing to the project, you agree to the license and copyright terms therein
and release your contribution under these terms.
Support
#######
Submit your questions, feature requests and bug reports via `GitHub issues <https://github.com/openvinotoolkit/openvino_tensorflow/issues>`__.
How to Contribute
#################
We welcome community contributions to **OpenVINO™ integration with TensorFlow**. If you have an idea for improvement:
* Share your proposal via `GitHub issues <https://github.com/openvinotoolkit/openvino_tensorflow/issues>`__.
* Submit a `pull request <https://github.com/openvinotoolkit/openvino_tensorflow/pulls>`__.
We will review your contribution as soon as possible. If any additional fixes or modifications are necessary, we will guide you and provide feedback. Before you make your contribution, make sure you can build **OpenVINO™ integration with TensorFlow** and run all the examples with your fix/patch. If you want to introduce a large feature, create test cases for your feature. Upon our verification of your pull request, we will merge it to the repository provided that the pull request has met the above mentioned requirements and proved acceptable.
\* Other names and brands may be claimed as the property of others.
@endsphinxdirective

View File

@@ -19,21 +19,22 @@ Detailed Workflow
.. note::
Prepare a separate dataset or split the dataset you have for more accurate quality evaluation.
3. Having successful evaluation results received, you have an opportunity to deploy your model or continue optimizing it, using NNCF and POT. For more information about these frameworks, go to :doc:`Optimization Guide <openvino_docs_model_optimization_guide>`.
3. Having successful evaluation results received, you have an opportunity to deploy your model or continue optimizing it, using NNCF. For more information about these frameworks, go to :doc:`Optimization Guide <openvino_docs_model_optimization_guide>`.
If the results are unsatisfactory, add datasets and perform the same steps, starting with dataset annotation.
OpenVINO Training Extensions Components
#######################################
- `OpenVINO Training Extensions SDK <https://github.com/openvinotoolkit/training_extensions/tree/master/ote_sdk>`__
- `OpenVINO Training Extensions CLI <https://github.com/openvinotoolkit/training_extensions/tree/master/ote_cli>`__
- `OpenVINO Training Extensions Algorithms <https://github.com/openvinotoolkit/training_extensions/tree/master/external>`__
* `OpenVINO Training Extensions API <https://github.com/openvinotoolkit/training_extensions/tree/develop/otx/api>`__
* `OpenVINO Training Extensions CLI <https://github.com/openvinotoolkit/training_extensions/tree/develop/otx/cli>`__
* `OpenVINO Training Extensions Algorithms <https://github.com/openvinotoolkit/training_extensions/tree/develop/otx/algorithms>`__
Tutorials
#########
`Object Detection <https://github.com/openvinotoolkit/training_extensions/blob/master/ote_cli/notebooks/train.ipynb>`__
* `Base tutorial <https://openvinotoolkit.github.io/training_extensions/stable/guide/tutorials/base/index.html>`__
* `Advanced tutorial <https://openvinotoolkit.github.io/training_extensions/stable/guide/tutorials/advanced/index.html>`__
@endsphinxdirective

View File

@@ -9,16 +9,34 @@
Model Preparation <openvino_docs_model_processing_introduction>
Model Optimization and Compression <openvino_docs_model_optimization_guide>
Running and Deploying Inference <openvino_docs_deployment_guide_introduction>
Running Inference <openvino_docs_OV_UG_OV_Runtime_User_Guide>
Deployment on a Local System <openvino_deployment_guide>
Deployment on a Model Server <ovms_what_is_openvino_model_server>
| :doc:`Model Preparation <openvino_docs_model_processing_introduction>`
| With Model Downloader and Model Optimizer guides, you will learn to download pre-trained models and convert them for use with OpenVINO™. You can use your own models or choose some from a broad selection provided in the Open Model Zoo.
| With model conversion API guide, you will learn to convert pre-trained models for use with OpenVINO™. You can use your own models or choose some from a broad selection in online databases, such as `TensorFlow Hub <https://tfhub.dev/>`__, `Hugging Face <https://huggingface.co/>`__, `Torchvision models <https://pytorch.org/hub/>`__..
| :doc:`Model Optimization and Compression <openvino_docs_model_optimization_guide>`
| In this section you will find out how to optimize a model to achieve better inference performance. It describes multiple optimization methods for both the training and post-training stages.
| :doc:`Deployment <openvino_docs_deployment_guide_introduction>`
| This section explains the process of deploying your own inference application using either OpenVINO Runtime or OpenVINO Model Server. It describes how to run inference which is the most basic form of deployment and the quickest way of launching inference.
| :doc:`Running Inference <openvino_docs_OV_UG_OV_Runtime_User_Guide>`
| This section explains describes how to run inference which is the most basic form of deployment and the quickest way of launching inference.
Once you have a model that meets both OpenVINO™ and your requirements, you can choose how to deploy it with your application.
| :doc:`Option 1. Deployment via OpenVINO Runtime <openvino_deployment_guide>`
| Local deployment uses OpenVINO Runtime that is called from, and linked to, the application directly.
| It utilizes resources available to the system and provides the quickest way of launching inference.
| Deployment on a local system requires performing the steps from the running inference section.
| :doc:`Option 2. Deployment via Model Server <ovms_what_is_openvino_model_server>`
| Deployment via OpenVINO Model Server allows the application to connect to the inference server set up remotely.
| This way inference can use external resources instead of those available to the application itself.
| Deployment on a model server can be done quickly and without performing any additional steps described in the running inference section.
@endsphinxdirective

View File

@@ -9,7 +9,6 @@
openvino_docs_Extensibility_UG_add_openvino_ops
openvino_docs_Extensibility_UG_Frontend_Extensions
openvino_docs_Extensibility_UG_GPU
openvino_docs_MO_DG_prepare_model_customize_model_optimizer_Customize_Model_Optimizer
.. toctree::
:maxdepth: 1
@@ -18,14 +17,20 @@
openvino_docs_transformations
OpenVINO Plugin Developer Guide <openvino_docs_ie_plugin_dg_overview>
The Intel® Distribution of OpenVINO™ toolkit supports neural network models trained with various frameworks, including
TensorFlow, PyTorch, ONNX, PaddlePaddle, Apache MXNet, Caffe, and Kaldi. The list of supported operations is different for
each of the supported frameworks. To see the operations supported by your framework, refer to :doc:`Supported Framework Operations <openvino_docs_MO_DG_prepare_model_Supported_Frameworks_Layers>`.
.. toctree::
:maxdepth: 1
:hidden:
openvino_docs_MO_DG_prepare_model_customize_model_optimizer_Customize_Model_Optimizer
The Intel® Distribution of OpenVINO™ toolkit supports neural-network models trained with various frameworks, including
TensorFlow, PyTorch, ONNX, TensorFlow Lite, and PaddlePaddle (OpenVINO support for Apache MXNet, Caffe, and Kaldi is currently
being deprecated and will be removed entirely in the future). The list of supported operations is different for each of the supported frameworks.
To see the operations supported by your framework, refer to :doc:`Supported Framework Operations <openvino_resources_supported_operations_frontend>`.
Custom operations, which are not included in the list, are not recognized by OpenVINO out-of-the-box. The need for custom operation may appear in two cases:
1. A new or rarely used regular framework operation is not supported in OpenVINO yet.
2. A new user operation that was created for some specific model topology by the author of the model using framework extension capabilities.
Importing models with such operations requires additional steps. This guide illustrates the workflow for running inference on models featuring custom operations. This allows plugging in your own implementation for them. OpenVINO Extensibility API enables adding support for those custom operations and using one implementation for Model Optimizer and OpenVINO Runtime.
@@ -52,13 +57,13 @@ Mapping from Framework Operation
Mapping of custom operation is implemented differently, depending on model format used for import. You may choose one of the following:
1. If a model is represented in the ONNX (including models exported from Pytorch in ONNX), PaddlePaddle or TensorFlow formats, then one of the classes from :doc:`Frontend Extension API <openvino_docs_Extensibility_UG_Frontend_Extensions>` should be used. It consists of several classes available in C++ which can be used with the ``--extensions`` option in Model Optimizer or when a model is imported directly to OpenVINO runtime using the ``read_model`` method. Python API is also available for runtime model import.
1. If a model is represented in the ONNX (including models exported from Pytorch in ONNX), TensorFlow Lite, PaddlePaddle or TensorFlow formats, then one of the classes from :doc:`Frontend Extension API <openvino_docs_Extensibility_UG_Frontend_Extensions>` should be used. It consists of several classes available in C++ which can be used with the ``--extensions`` option in Model Optimizer or when a model is imported directly to OpenVINO runtime using the ``read_model`` method. Python API is also available for runtime model import.
2. If a model is represented in the Caffe, Kaldi or MXNet formats, then :doc:`Model Optimizer Extensions <openvino_docs_MO_DG_prepare_model_customize_model_optimizer_Customize_Model_Optimizer>` should be used. This approach is available for model conversion in Model Optimizer only.
2. If a model is represented in the Caffe, Kaldi or MXNet formats (as legacy frontends), then :doc:`[Legacy] Model Optimizer Extensions <openvino_docs_MO_DG_prepare_model_customize_model_optimizer_Customize_Model_Optimizer>` should be used. This approach is available for model conversion in Model Optimizer only.
Existing of two approaches simultaneously is explained by two different types of frontends used for model conversion in OpenVINO: new frontends (ONNX, PaddlePaddle and TensorFlow) and legacy frontends (Caffe, Kaldi and Apache MXNet). Model Optimizer can use both front-ends in contrast to the direct import of model with ``read_model`` method which can use new frontends only. Follow one of the appropriate guides referenced above to implement mappings depending on framework frontend.
Existing of two approaches simultaneously is explained by two different types of frontends used for model conversion in OpenVINO: new frontends (ONNX, PaddlePaddle, TensorFlow Lite, and TensorFlow) and legacy frontends (Caffe, Kaldi, and Apache MXNet). Model Optimizer can use both frontends in contrast to the direct import of model with ``read_model`` method which can use new frontends only. Follow one of the appropriate guides referenced above to implement mappings depending on framework frontend.
If you are implementing extensions for new ONNX, PaddlePaddle or TensorFlow frontends and plan to use the ``--extensions`` option in Model Optimizer for model conversion, then the extensions should be:
If you are implementing extensions for new ONNX, PaddlePaddle, TensorFlow Lite or TensorFlow frontends and plan to use the ``--extensions`` option in Model Optimizer for model conversion, then the extensions should be:
1. Implemented in C++ only.
@@ -121,6 +126,8 @@ The ``Identity`` is a custom operation class defined in :doc:`Custom Operation G
When Python API is used, there is no way to implement a custom OpenVINO operation. Even if custom OpenVINO operation is implemented in C++ and loaded into the runtime by a shared library, there is still no way to add a frontend mapping extension that refers to this custom operation. In this case, use C++ shared library approach to implement both operations semantics and framework mapping.
Python can still be used to map and decompose operations when only operations from the standard OpenVINO operation set are used.
.. _create_a_library_with_extensions:
Create a Library with Extensions
++++++++++++++++++++++++++++++++
@@ -187,4 +194,4 @@ See Also
* :doc:`Using OpenVINO Runtime Samples <openvino_docs_OV_UG_Samples_Overview>`
* :doc:`Hello Shape Infer SSD sample <openvino_inference_engine_samples_hello_reshape_ssd_README>`
@endsphinxdirective
@endsphinxdirective

View File

@@ -2,32 +2,52 @@
@sphinxdirective
The goal of this chapter is to explain how to use Frontend extension classes to facilitate mapping of custom operations from framework model representation to OpenVINO representation. Refer to :doc:`Introduction to OpenVINO Extension <openvino_docs_Extensibility_UG_Intro>` to understand entire flow.
The goal of this chapter is to explain how to use Frontend extension classes to facilitate
mapping of custom operations from framework model representation to OpenVINO representation.
Refer to :doc:`Introduction to OpenVINO Extension <openvino_docs_Extensibility_UG_Intro>` to
understand the entire flow.
This API is applicable for new frontends only, which exist for ONNX, PaddlePaddle and TensorFlow. If a different model format is used, follow legacy :doc:`Model Optimizer Extensions <openvino_docs_MO_DG_prepare_model_customize_model_optimizer_Customize_Model_Optimizer>` guide.
This API is applicable to new frontends only, which exist for ONNX, TensorFlow Lite, PaddlePaddle, and TensorFlow.
If a different model format is used, follow legacy
:doc:`Model Optimizer Extensions <openvino_docs_MO_DG_prepare_model_customize_model_optimizer_Customize_Model_Optimizer>`
guide.
.. note::
This documentation is written based on the `Template extension <https://github.com/openvinotoolkit/openvino/tree/master/src/core/template_extension/new>`__, which demonstrates extension development details based on minimalistic ``Identity`` operation that is a placeholder for your real custom operation. You can review the complete code, which is fully compliable, to see how it works.
Single Operation Mapping with OpExtension
#########################################
This documentation is written based on the `Template extension <https://github.com/openvinotoolkit/openvino/tree/master/src/core/template_extension/new>`__,
which demonstrates extension development details based on minimalistic ``Identity``
operation that is a placeholder for your real custom operation. You can review the complete code,
which is fully compilable, to see how it works.
This section covers the case when a single operation in framework representation is mapped to a single operation in OpenVINO representation. This is called *one-to-one mapping*. There is ``OpExtension`` class that works well if all the following conditions are satisfied:
1. Number of inputs to operation in the Framework representation is the same as in the OpenVINO representation.
2. Number of outputs is also the same in both representations.
3. Inputs can be indexed and are mapped in order correspondingly, e.g. input with index 0 in framework representation maps to input with index 0 in OpenVINO representation and so on.
4. The same for outputs.
5. Each attribute in OpenVINO operation can be initialized from one of the attributes of original operation or by some predefined constant value. Value of copied attributes cannot contain expressions, value is accepted as-is, so type of a value should be compatible.
.. note::
``OpExtension`` class is currently available for ONNX and TensorFlow frontends. PaddlePaddle frontend has named inputs and outputs for operation (not indexed) therefore OpExtension mapping is not applicable for this case.
You can find more examples of extensions in `openvino_contrib repository <https://github.com/openvinotoolkit/openvino_contrib/tree/master/modules/custom_operations>`_.
The next example maps ONNX operation with type `Identity <https://github.com/onnx/onnx/blob/main/docs/Operators.md#Identity>`__ to OpenVINO template extension ``Identity`` class.
Single Operation Mapping with OpExtension
#########################################
This section covers the case when a single operation in framework representation is mapped to a single
operation in OpenVINO representation. This is called *one-to-one mapping*. There is ``OpExtension``
class that works well if all the following conditions are satisfied:
1. Number of inputs to operation in the Framework representation is the same as in the OpenVINO representation.
2. Number of outputs is also the same in both representations.
3. Inputs can be indexed and are mapped in order correspondingly, e.g.
input with index 0 in framework representation maps to input with index 0 in OpenVINO representation and so on.
4. The same for outputs.
5. Each attribute in OpenVINO operation can be initialized from one of the attributes of original operation or by
some predefined constant value. Value of copied attributes cannot contain expressions, value is accepted as-is,
so type of a value should be compatible.
.. note::
``OpExtension`` class is currently available for ONNX and TensorFlow frontends.
PaddlePaddle frontend has named inputs and outputs for operation (not indexed)
therefore OpExtension mapping is not applicable for this case.
The following example maps ONNX operation with the type of `Identity <https://github.com/onnx/onnx/blob/main/docs/Operators.md#Identity>`__
to OpenVINO template extension ``Identity`` class.
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
@@ -39,22 +59,32 @@ The next example maps ONNX operation with type `Identity <https://github.com/onn
The mapping doesnt involve any attributes, as operation Identity doesnt have them.
Extension objects, like just constructed ``extension`` can be used to add to the OpenVINO runtime just before the loading a model that contains custom operations:
Extension objects, like just constructed ``extension`` can be used to add to the
OpenVINO runtime just before the loading a model that contains custom operations:
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_read_model]
Or extensions can be constructed in a separately compiled shared library. Separately compiled library can be used in Model Optimizer or ``benchmark_app``. Read about how to build and load such library in chapter “Create library with extensions” in :doc:`Introduction to OpenVINO Extension <openvino_docs_Extensibility_UG_Intro>`.
Or extensions can be constructed in a separately compiled shared library.
Separately compiled library can be used in Model Optimizer or ``benchmark_app``.
Read about how to build and load such a library in the chapter of “Create library with extensions” in
:doc:`Introduction to OpenVINO Extension <openvino_docs_Extensibility_UG_Intro>`.
If operation have multiple inputs and/or outputs they will be mapped in order. The type of elements in input/output tensors should match expected types in the surrounding operations. For example, if custom operation produces ``f32`` data type then operation that consumes this output should also support ``f32``. Otherwise, model conversion fails with an error, there are no automatic type conversion happens.
If operation have multiple inputs and/or outputs they will be mapped in order.
The type of elements in input/output tensors should match expected types in the surrounding operations.
For example, if a custom operation produces the ``f32`` data type, the operation that consumes this output
should also support ``f32``. Otherwise, model conversion fails with an error, as no automatic type conversion is performed.
Converting to Standard OpenVINO Operation
+++++++++++++++++++++++++++++++++++++++++
``OpExtension`` class can be used when mapping to one of the operations from standard OpenVINO operation set is what you need and there is no class like ``TemplateExtension::Identity`` implemented.
``OpExtension`` class can be used when mapping to one of the operations from standard OpenVINO
operation set is what you need and there is no class like ``TemplateExtension::Identity`` implemented.
Here is an example for a custom framework operation MyRelu. Suppose it is mathematically equivalent to standard `Relu` that exists in OpenVINO operation set, but for some reason has type name “MyRelu”. In this case you can directly say that “MyRelu” -> ``Relu`` mapping should be used:
Here is an example of a custom framework operation 'MyRelu'. Assume it is mathematically equivalent
to standard ``Relu`` that exists in the OpenVINO operation set, but for some reason has the type name of 'MyRelu'.
In this case, you can directly say that 'MyRelu' -> ``Relu`` mapping should be used:
.. tab-set::
@@ -66,33 +96,53 @@ Here is an example for a custom framework operation “MyRelu”. Suppose it is
:fragment: [frontend_extension_MyRelu]
.. tab-item:: Python
:sync: python
:sync: py
.. doxygensnippet:: docs/snippets/ov_extensions.py
:language: python
:fragment: [py_frontend_extension_MyRelu]
In the resulting converted OpenVINO model, “MyRelu” operation will be replaced by the standard operation ``Relu`` from the latest available OpenVINO operation set. Notice that when standard operation is used, it can be specified using just a type string (“Relu”) instead of using a ``ov::opset8::Relu`` class name as a template parameter for ``OpExtension``. This method is available for operations from the standard operation set only. For a user custom OpenVINO operation the corresponding class should be always specified as a template parameter as it was demonstrated with ``TemplateExtension::Identity``.
In the resulting converted OpenVINO model, “MyRelu” operation will be replaced by the standard operation
``Relu`` from the latest available OpenVINO operation set. Notice that when standard operation is used,
it can be specified using just a type string (“Relu”) instead of using a ``ov::opset8::Relu`` class name as a
template parameter for ``OpExtension``. This method is available for operations from the standard operation set only.
For a user custom OpenVINO operation the corresponding class should be always specified as a template parameter
as it was demonstrated with ``TemplateExtension::Identity``.
Attributes Mapping
Attribute Mapping
++++++++++++++++++
As described above, ``OpExtension`` is useful when attributes can be mapped one by one or initialized by a constant. If the set of attributes in framework representation and OpenVINO representation completely match by their names and types, nothing should be specified in OpExtension constructor parameters. The attributes are discovered and mapped automatically based on ``visit_attributes`` method that should be defined for any OpenVINO operation.
As described above, ``OpExtension`` is useful when attributes can be mapped one by one or initialized by a constant.
Attributes in OpenVINO operators are identified by their names, so for frameworks that also have named attributes (like TensorFlow, PaddlePaddle, ONNX),
you can specify name to name mapping. For frameworks where OpenVINO operator's attributes can be mapped to one of the framework
operator inputs (like PyTorch), there's a name to input index mapping.
Imagine you have CustomOperation class implementation that has two attributes with names ``attr1`` and ``attr2``:
Named attributes mapping
^^^^^^^^^^^^^^^^^^^^^^^^
If the set of attributes in framework representation and OpenVINO representation completely match by their names and types,
no attribute mapping has to be specified in OpExtension constructor parameters. The attributes are discovered and mapped automatically
based on ``visit_attributes`` method that should be defined for any OpenVINO operation.
Imagine you have CustomOperation class implementation that has two attributes with names: ``attr1`` and ``attr2``.
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_CustomOperation]
And original model in framework representation also has operation with name CustomOperatoin” with the same ``attr1`` and ``attr2`` attributes. Then with the following code:
And original model in framework representation also has operation with name ``CustomOperation`` with the same
``attr1`` and ``attr2`` attributes. Then with the following code:
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_CustomOperation_as_is]
both ``attr1`` and ``attr2`` are copied from framework representation to OpenVINO representation automatically. If for some reason names of attributes are different but values still can be copied “as-is” you can pass attribute names mapping in ``OpExtension`` constructor:
Both ``attr1`` and ``attr2`` are copied from framework representation to OpenVINO representation automatically.
If for some reason names of attributes are different but values still can be copied “as-is” you can pass attribute
names mapping in ``OpExtension`` constructor:
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
@@ -100,62 +150,182 @@ both ``attr1`` and ``attr2`` are copied from framework representation to OpenVIN
Where ``fw_attr1`` and ``fw_attr2`` are names for corresponding attributes in framework operation representation.
If copying of an attribute is not what you need, ``OpExtension`` also can set attribute to predefined constant value. For the same ``CustomOperation``, imagine you want to set ``attr2`` to value 5 instead of copying from ``fw_attr2``, to achieve that do the following:
If copying of an attribute is not what you need, ``OpExtension`` also can set attribute to predefined constant value.
For the same ``CustomOperation``, imagine you want to set ``attr2`` to value 5 instead of copying from ``fw_attr2``,
to achieve that do the following:
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_CustomOperation_rename_set]
So the conclusion is that each attribute of target OpenVINO operation should be initialized either by
1. Setting automatically due to name matching
2. Mapped by attribute name
3. Set to a constant value
This is achieved by specifying maps as arguments for `OpExtension` constructor.
This is achieved by specifying maps as arguments for ``OpExtension`` constructor.
### Mapping custom operations to frontends with OPENVINO_FRAMEWORK_MAP macro
> **NOTE**: Below solution works only for ONNX and Tensorflow frontends.
Attribute mapping with named inputs and outputs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
`OPENVINO_FRAMEWORK_MAP` is a macro that should be used inside OpenVINO operation's class definition and that lets you specify the mapping between this operation to a frontend operation.
Mappings in previous examples assume that inputs and outputs of an operator in framework model representation come
with a particular order so you can directly map framework operation input ``0`` to OpenVINO operation input ``0`` and so on.
That's not always the case, for frameworks like PaddlePaddle, operation inputs and outputs are identified by their names
and may be defined in any order. So to map it to OpenVINO operation inputs and outputs, you have to specify that order yourself.
This can be done by creating two vector of strings, one for input and one for output, where framework operation
input name at position ``i`` maps to OpenVINO operation input at position ``i`` (and similarly for outputs).
Let's consider the following example. Imagine you have an ONNX model with `CustomOp` operation (and this operation has `mode` attribute) and a Tensorflow model with `CustomOpV3` operation (this operation has `axis` attribute) and both of them can be implemented with a single OpenVINO operation `CustomOp` like follows:
@snippet ov_extensions.cpp frontend_extension_framework_map_macro_headers
@snippet ov_extensions.cpp frontend_extension_framework_map_macro_CustomOp
Let's see the following example. Like previously, we'd like to map ``CustomOperation`` in the original model,
to OpenVINO ``CustomOperation`` as is (so their name and attributes names match). This time, that framework operation
inputs and outputs are not stricly ordered and can be identified by their names ``A``, ``B``, ``C`` for inputs
and ``X``, ``Y`` for outputs. Those inputs and outputs can be mapped to OpenVINO operation, such that inputs
``A``, ``B``, ``C`` map to OpenVINO ``CustomOperation`` first, second and third input and ``X`` and ``Y``
outputs map to OpenVINO ``CustomOperation`` first and second output respectively.
Let's take a closer look at the parameters this macro takes:
```cpp
OPENVINO_FRAMEWORK_MAP(framework, name, attributes_map, attributes_values)
```
- `framework` - framework name.
- `name` - the framework operation name. It's optional if the OpenVINO custom operation name (that is the name that is passed as the first parameter to `OPENVINO_OP` macro) is the same as the framework operation name and both `attributes_map` and `attributes_values` are not provided.
- `attributes_map` - used to provide a mapping between OpenVINO operation attribute and framework operation attribute. Contains key-value pairs, where key is an OpenVINO operation attribute name and value is its corresponding framework operation attribute name. This parameter is optional if the number of OpenVINO operation attributes and their names match one-to-one with framework operation attributes.
- `attributes_values` - used to provide default values for OpenVINO operation attributes that are not specified in `attributes_map`. Contains key-value pairs, where key is an OpenVINO operation attribute name and the value is this attribute value. This parameter cannot be provided if `attributes_map` contains all of OpenVINO operation attributes or if `attributes_map` is not provided.
Given that, such custom operation can be registered by the following:
In the example above, `OPENVINO_FRAMEWORK_MAP` is used twice.
First, OpenVINO `CustomOp` is mapped to ONNX `CustomOp` operation, `m_mode` attribute is mapped to `mode` attribute, while `m_axis` attribute gets the default value `-1`.
Secondly, OpenVINO `CustomOp` is mapped to Tensorflow `CustomOpV3` operation, `m_axis` attribute is mapped to `axis` attribute, while `m_mode` attribute gets the default value `"linear"`.
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_CustomOperation_as_is_paddle]
Second example shows how to map the operation with named inputs and outputs, but when names of attributes are different:
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_CustomOperation_rename_paddle]
and the last one shows how to map the operation with named inputs and outputs, but when (in order to correctly map framework
operation to OpenVINO operation) one of the attributes has to be set to predefined value:
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_CustomOperation_rename_set_paddle]
Mapping attributes from operation inputs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
For models (like PyTorch models), where operations have attributes on the input list, you can specify name to input index mapping.
For example, imagine you have created a custom OpenVINO operation that implements a variant of ELU activation function
with two attributes ``alpha`` and ``beta``:
.. math::
CustomElu=\left\lbrace
\begin{array}{ll}
beta * x & \textrm{if x > 0} \newline
alpha * (exp(x) - 1) & \textrm{otherwise}
\end{array}
\right.
Below is a snippet of ``CustomElu`` class showing how to define its attributes:
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_framework_map_CustomElu]
Let's see an example of how you can map ``CustomElu`` to PyTorch `aten::elu <https://pytorch.org/docs/stable/generated/torch.nn.functional.elu.html>`_
(note that if ``beta`` is equal to ``1``, ``CustomElu`` works the same as ``aten::elu``).
``aten::elu`` has ``alpha`` attribute second on the input list, but it doesn't have ``beta``.
So in order to map it to ``CustomElu`` you can use the following:
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_framework_map_CustomElu_mapping]
This will map ``alpha`` to the second input and map ``beta`` attribute to constant value ``1.0f``.
Such created extension can be used, e.g. in dynamic library, please refer to :ref:`Create a library with extensions <create_a_library_with_extensions>`.
Mapping custom operations to frontends with OPENVINO_FRAMEWORK_MAP macro
########################################################################
``OPENVINO_FRAMEWORK_MAP`` is a macro that should be used inside OpenVINO operation's class definition and that lets you specify
the mapping between this operation to a frontend operation.
Let's consider the following example. Imagine you have an ONNX model with ``CustomOp`` operation (and this operation has ``mode`` attribute),
a TensorFlow model with ``CustomOpV3`` operation (this operation has ``axis`` attribute) and a PaddlePaddle model with ``CustomOp`` (with ``mode`` attribute)
that has input named "X" and output named "Out" and all of them can be implemented with a single OpenVINO operation ``CustomOp`` like follows:
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_framework_map_macro_headers]
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_framework_map_macro_CustomOp]
Let's take a closer look at the parameters this macro takes (note that there are two flavors - the second one is to map
for PaddlePaddle operations where input and output names have to be specified).
.. code-block:: cpp
OPENVINO_FRAMEWORK_MAP(framework, name, attributes_map, attributes_values)
OPENVINO_FRAMEWORK_MAP(framework, input_names, output_names, name, attributes_map, attributes_values)
- ``framework`` - framework name.
- ``name`` - the framework operation name. It's optional if the OpenVINO custom operation name
(that is the name that is passed as the first parameter to ``OPENVINO_OP`` macro) is the same
as the framework operation name and both ``attributes_map`` and ``attributes_values`` are not provided.
- ``input_names`` - vector of strings that specify the names of inputs (needed to map PaddlePaddle to OpenVINO operations),
- ``output_names`` - vector of strings that specify the names of outputs (needed to map PaddlePaddle to OpenVINO operations),
- ``attributes_map`` - used to provide a mapping between OpenVINO operation attribute and
framework operation attribute. Contains key-value pairs, where key is an OpenVINO operation
attribute name and value is its corresponding framework operation attribute name.
This parameter is optional if the number of OpenVINO operation attributes and their names
match one-to-one with framework operation attributes.
- ``attributes_values`` - used to provide default values for OpenVINO operation attributes
that are not specified in ``attributes_map``. Contains key-value pairs, where key is an OpenVINO
operation attribute name and the value is this attribute value. This parameter cannot be provided
if ``attributes_map`` contains all of OpenVINO operation attributes or if ``attributes_map`` is not provided.
In the example above, ``OPENVINO_FRAMEWORK_MAP`` is used three times.
First, OpenVINO ``CustomOp`` is mapped to ONNX ``CustomOp`` operation, ``m_mode`` attribute is mapped to ``mode``
attribute, while ``m_axis`` attribute gets the default value ``-1``. Secondly, OpenVINO ``CustomOp`` is mapped
to TensorFlow ``CustomOpV3`` operation, ``m_axis`` attribute is mapped to ``axis`` attribute, while ``m_mode``
attribute gets the default value ``"linear"``. Thirdly, OpenVINO ``CustomOp`` is mapped to PaddlePaddle ``CustomOp`` operation,
``m_mode`` attribute is mapped to ``mode`` attribute, while ``m_axis`` attribute gets the default value ``-1``.
This mapping also specifies the input name "X" and output name "Out".
The last step is to register this custom operation by following:
@snippet ov_extensions.cpp frontend_extension_framework_map_macro_add_extension
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_framework_map_macro_add_extension]
Mapping to Multiple Operations with ConversionExtension
#######################################################
Previous sections cover the case when a single operation is mapped to a single operation with optional adjustment in names and attribute values. That is likely enough for your own custom operation with existing C++ kernel implementation. In this case your framework representation and OpenVINO representation for the operation are under your control and inputs/outpus/attributes can be aligned to make ``OpExtension`` usable.
Previous sections cover the case when a single operation is mapped to a single operation with optional
adjustment in names and attribute values. That is likely enough for your own custom operation with existing
C++ kernel implementation. In this case your framework representation and OpenVINO representation for the
operation are under your control and inputs/outpus/attributes can be aligned to make ``OpExtension`` usable.
In case if one-to-one mapping is not possible, *decomposition to multiple operations* should be considered. It is achieved by using more verbose and less automated ``ConversionExtension`` class. It enables writing arbitrary code to replace a single framework operation by multiple connected OpenVINO operations constructing dependency graph of any complexity.
In case if one-to-one mapping is not possible, *decomposition to multiple operations* should be considered.
It is achieved by using more verbose and less automated ``ConversionExtension`` class.
It enables writing arbitrary code to replace a single framework operation by multiple connected OpenVINO
operations constructing dependency graph of any complexity.
``ConversionExtension`` maps a single operation to a function which builds a graph using OpenVINO operation classes. Follow chapter :ref:`Build a Model in OpenVINO Runtime <ov_ug_build_model>` to learn how to use OpenVINO operation classes to build a fragment of model for replacement.
``ConversionExtension`` maps a single operation to a function which builds a graph using OpenVINO
operation classes. Follow chapter :ref:`Build a Model in OpenVINO Runtime <ov_ug_build_model>` to
learn how to use OpenVINO operation classes to build a fragment of model for replacement.
The next example illustrates using ``ConversionExtension`` for conversion of “ThresholdedRelu” from ONNX according to the formula: ``ThresholdedRelu(x, alpha) -> Multiply(x, Convert(Greater(x, alpha), type=float))``.
Below example illustrates using ``ConversionExtension`` for conversion of “ThresholdedRelu”
from ONNX according to the formula: ``ThresholdedRelu(x, alpha) -> Multiply(x, Convert(Greater(x, alpha), type=float))``.
.. note::
``ThresholdedRelu`` is one of the standard ONNX operators which is supported by ONNX frontend natively out-of-the-box. Here we are re-implementing it to illustrate how you can add a similar support for your custom operation instead of ``ThresholdedRelu``.
``ThresholdedRelu`` is one of the standard ONNX operators which is supported by ONNX frontend
natively out-of-the-box. Here we are re-implementing it to illustrate how you can add a similar
support for your custom operation instead of ``ThresholdedRelu``.
.. tab-set::
@@ -167,13 +337,12 @@ The next example illustrates using ``ConversionExtension`` for conversion of “
:fragment: [frontend_extension_ThresholdedReLU_header]
.. tab-item:: Python
:sync: python
:sync: py
.. doxygensnippet:: docs/snippets/ov_extensions.py
:language: python
:fragment: [py_frontend_extension_ThresholdedReLU_header]
.. tab-set::
.. tab-item:: C++
@@ -184,20 +353,52 @@ The next example illustrates using ``ConversionExtension`` for conversion of “
:fragment: [frontend_extension_ThresholdedReLU]
.. tab-item:: Python
:sync: python
:sync: py
.. doxygensnippet:: docs/snippets/ov_extensions.py
:language: python
:fragment: [py_frontend_extension_ThresholdedReLU]
To access original framework operation attribute value and connect to inputs, ``node`` object of type ``NodeContext`` is used. It has two main methods:
The next example shows how to use ``ConversionExtension`` to convert PyTorch
`aten::hardtanh <https://pytorch.org/docs/stable/generated/torch.nn.functional.hardtanh.html>`_
to demonstrate how to use ``get_values_from_const_input`` function to fetch an attribute value from input:
.. doxygensnippet:: docs/snippets/ov_extensions.py
:language: python
:fragment: [py_frontend_extension_aten_hardtanh]
To access original framework operation attribute value and connect to inputs, ``node`` object of type ``NodeContext`` is used. It has three main methods:
* ``NodeContext::get_input`` to get input with a given index,
* ``NodeContext::get_attribute`` to get attribute value with a given name.
* ``NodeContext::get_attribute`` to get attribute value with a given name,
The conversion function should return a vector of node outputs that are mapped to corresponding outputs of the original framework operation in the same order.
* ``NodeContext::get_values_from_const_input`` to get an attribute with a given input index.
The conversion function should return a vector of node outputs that are mapped to
corresponding outputs of the original framework operation in the same order.
Some frameworks require output names of the operation to be provided during conversion.
For PaddlePaddle operations, it is generally necessary to provide names for all outputs using the ``NamedOutputs`` container.
Usually those names can be found in source code of the individual operation in PaddlePaddle code.
The next example shows such conversion for the ``top_k_v2`` operation.
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_paddle_TopK]
For TensorFlow framework, if an operation has more than one output, it is recommended to assign names to
those outputs using the ``NamedOutputVector`` structure which allows both indexed and named output access.
For a description of TensorFlow operations, including the names of their outputs, refer to the
`tf.raw_ops <https://www.tensorflow.org/api_docs/python/tf/raw_ops/>`__ documentation page.
The next example shows such conversion for the ``TopKV2`` operation.
.. doxygensnippet:: docs/snippets/ov_extensions.cpp
:language: cpp
:fragment: [frontend_extension_tf_TopK]
@endsphinxdirective

View File

@@ -1,45 +1,74 @@
# Asynchronous Inference Request {#openvino_docs_ov_plugin_dg_async_infer_request}
@sphinxdirective
Asynchronous Inference Request runs an inference pipeline asynchronously in one or several task executors depending on a device pipeline structure.
OpenVINO Runtime Plugin API provides the base ov::IAsyncInferRequest class:
- The class has the `m_pipeline` field of `std::vector<std::pair<std::shared_ptr<ov::threading::ITaskExecutor>, ov::threading::Task> >`, which contains pairs of an executor and executed task.
- All executors are passed as arguments to a class constructor and they are in the running state and ready to run tasks.
- The class has the ov::IAsyncInferRequest::stop_and_wait method, which waits for `m_pipeline` to finish in a class destructor. The method does not stop task executors and they are still in the running stage, because they belong to the compiled model instance and are not destroyed.
* The class has the ``m_pipeline`` field of ``std::vector<std::pair<std::shared_ptr<ov::threading::ITaskExecutor>, ov::threading::Task> >``, which contains pairs of an executor and executed task.
* All executors are passed as arguments to a class constructor and they are in the running state and ready to run tasks.
* The class has the ov::IAsyncInferRequest::stop_and_wait method, which waits for ``m_pipeline`` to finish in a class destructor. The method does not stop task executors and they are still in the running stage, because they belong to the compiled model instance and are not destroyed.
AsyncInferRequest Class
------------------------
#######################
OpenVINO Runtime Plugin API provides the base ov::IAsyncInferRequest class for a custom asynchronous inference request implementation:
@snippet src/async_infer_request.hpp async_infer_request:header
.. doxygensnippet:: src/plugins/template/src/async_infer_request.hpp
:language: cpp
:fragment: [async_infer_request:header]
### Class Fields
Class Fields
++++++++++++
- `m_wait_executor` - a task executor that waits for a response from a device about device tasks completion
* ``m_cancel_callback`` - a callback which allows to interrupt the execution
* ``m_wait_executor`` - a task executor that waits for a response from a device about device tasks completion
> **NOTE**: If a plugin can work with several instances of a device, `m_wait_executor` must be device-specific. Otherwise, having a single task executor for several devices does not allow them to work in parallel.
.. note::
If a plugin can work with several instances of a device, ``m_wait_executor`` must be device-specific. Otherwise, having a single task executor for several devices does not allow them to work in parallel.
### AsyncInferRequest()
AsyncInferRequest()
+++++++++++++++++++
The main goal of the `AsyncInferRequest` constructor is to define a device pipeline `m_pipeline`. The example below demonstrates `m_pipeline` creation with the following stages:
The main goal of the ``AsyncInferRequest`` constructor is to define a device pipeline ``m_pipeline``. The example below demonstrates ``m_pipeline`` creation with the following stages:
- `infer_preprocess_and_start_pipeline` is a CPU ligthweight task to submit tasks to a remote device.
- `wait_pipeline` is a CPU non-compute task that waits for a response from a remote device.
- `infer_postprocess` is a CPU compute task.
* ``infer_preprocess_and_start_pipeline`` is a CPU ligthweight task to submit tasks to a remote device.
* ``wait_pipeline`` is a CPU non-compute task that waits for a response from a remote device.
* ``infer_postprocess`` is a CPU compute task.
.. doxygensnippet:: src/plugins/template/src/async_infer_request.cpp
:language: cpp
:fragment: [async_infer_request:ctor]
@snippet src/async_infer_request.cpp async_infer_request:ctor
The stages are distributed among two task executors in the following way:
- `infer_preprocess_and_start_pipeline` prepare input tensors and run on `m_request_executor`, which computes CPU tasks.
- You need at least two executors to overlap compute tasks of a CPU and a remote device the plugin works with. Otherwise, CPU and device tasks are executed serially one by one.
- `wait_pipeline` is sent to `m_wait_executor`, which works with the device.
* ``infer_preprocess_and_start_pipeline`` prepare input tensors and run on ``m_request_executor``, which computes CPU tasks.
* You need at least two executors to overlap compute tasks of a CPU and a remote device the plugin works with. Otherwise, CPU and device tasks are executed serially one by one.
* ``wait_pipeline`` is sent to ``m_wait_executor``, which works with the device.
> **NOTE**: `m_callback_executor` is also passed to the constructor and it is used in the base ov::IAsyncInferRequest class, which adds a pair of `callback_executor` and a callback function set by the user to the end of the pipeline.
.. note::
``m_callback_executor`` is also passed to the constructor and it is used in the base ov::IAsyncInferRequest class, which adds a pair of ``callback_executor`` and a callback function set by the user to the end of the pipeline.
### ~AsyncInferRequest()
~AsyncInferRequest()
++++++++++++++++++++
In the asynchronous request destructor, it is necessary to wait for a pipeline to finish. It can be done using the ov::IAsyncInferRequest::stop_and_wait method of the base class.
@snippet src/async_infer_request.cpp async_infer_request:dtor
.. doxygensnippet:: src/plugins/template/src/async_infer_request.cpp
:language: cpp
:fragment: [async_infer_request:dtor]
cancel()
++++++++
The method allows to cancel the infer request execution:
.. doxygensnippet:: src/plugins/template/src/async_infer_request.cpp
:language: cpp
:fragment: [async_infer_request:cancel]
@endsphinxdirective

View File

@@ -1,69 +1,101 @@
# Build Plugin Using CMake {#openvino_docs_ov_plugin_dg_plugin_build}
@sphinxdirective
OpenVINO build infrastructure provides the OpenVINO Developer Package for plugin development.
OpenVINO Developer Package
------------------------
##########################
To automatically generate the OpenVINO Developer Package, run the `cmake` tool during a OpenVINO build:
To automatically generate the OpenVINO Developer Package, run the ``cmake`` tool during a OpenVINO build:
```bash
$ mkdir openvino-release-build
$ cd openvino-release-build
$ cmake -DCMAKE_BUILD_TYPE=Release ../openvino
```
.. code-block:: bash
Once the commands above are executed, the OpenVINO Developer Package is generated in the `openvino-release-build` folder. It consists of several files:
- `OpenVINODeveloperPackageConfig.cmake` - the main CMake script which imports targets and provides compilation flags and CMake options.
- `OpenVINODeveloperPackageConfig-version.cmake` - a file with a package version.
- `targets_developer.cmake` - an automatically generated file which contains all targets exported from the OpenVINO build tree. This file is included by `OpenVINODeveloperPackageConfig.cmake` to import the following targets:
- Libraries for plugin development:
* `openvino::runtime` - shared OpenVINO library
* `openvino::runtime::dev` - interface library with OpenVINO Developer API
* `openvino::pugixml` - static Pugixml library
* `openvino::xbyak` - interface library with Xbyak headers
* `openvino::itt` - static library with tools for performance measurement using Intel ITT
- Libraries for tests development:
* `openvino::gtest`, `openvino::gtest_main`, `openvino::gmock` - Google Tests framework libraries
* `openvino::commonTestUtils` - static library with common tests utilities
* `openvino::funcTestUtils` - static library with functional tests utilities
* `openvino::unitTestUtils` - static library with unit tests utilities
* `openvino::ngraphFunctions` - static library with the set of `ov::Model` builders
* `openvino::funcSharedTests` - static library with common functional tests
* `openvino::ngraph_reference` - static library with operation reference implementations.
$ mkdir openvino-release-build
$ cd openvino-release-build
$ cmake -DCMAKE_BUILD_TYPE=Release ../openvino
> **NOTE**: it's enough just to run `cmake --build . --target ov_dev_targets` command to build only targets from the
> OpenVINO Developer package.
Once the commands above are executed, the OpenVINO Developer Package is generated in the ``openvino-release-build`` folder. It consists of several files:
* ``OpenVINODeveloperPackageConfig.cmake`` - the main CMake script which imports targets and provides compilation flags and CMake options.
* ``OpenVINODeveloperPackageConfig-version.cmake`` - a file with a package version.
* ``targets_developer.cmake`` - an automatically generated file which contains all targets exported from the OpenVINO build tree. This file is included by ``OpenVINODeveloperPackageConfig.cmake`` to import the following targets:
* Libraries for plugin development:
* ``openvino::runtime`` - shared OpenVINO library
* ``openvino::runtime::dev`` - interface library with OpenVINO Developer API
* ``openvino::pugixml`` - static Pugixml library
* ``openvino::xbyak`` - interface library with Xbyak headers
* ``openvino::itt`` - static library with tools for performance measurement using Intel ITT
* Libraries for tests development:
* ``openvino::gtest``, ``openvino::gtest_main``, ``openvino::gmock`` - Google Tests framework libraries
* ``openvino::commonTestUtils`` - static library with common tests utilities
* ``openvino::funcTestUtils`` - static library with functional tests utilities
* ``openvino::unitTestUtils`` - static library with unit tests utilities
* ``openvino::ngraphFunctions`` - static library with the set of ``ov::Model`` builders
* ``openvino::funcSharedTests`` - static library with common functional tests
* ``openvino::ngraph_reference`` - static library with operation reference implementations.
.. note::
It's enough just to run ``cmake --build . --target ov_dev_targets`` command to build only targets from the OpenVINO Developer package.
Build Plugin using OpenVINO Developer Package
------------------------
#############################################
To build a plugin source tree using the OpenVINO Developer Package, run the commands below:
```cmake
$ mkdir template-plugin-release-build
$ cd template-plugin-release-build
$ cmake -DOpenVINODeveloperPackage_DIR=../openvino-release-build ../template-plugin
```
.. code-block:: bash
$ mkdir template-plugin-release-build
$ cd template-plugin-release-build
$ cmake -DOpenVINODeveloperPackage_DIR=../openvino-release-build ../template-plugin
A common plugin consists of the following components:
1. Plugin code in the `src` folder
2. Code of tests in the `tests` folder
1. Plugin code in the ``src`` folder
2. Code of tests in the ``tests`` folder
To build a plugin and its tests, run the following CMake scripts:
- Root `CMakeLists.txt`, which finds the OpenVINO Developer Package using the `find_package` CMake command and adds the `src` and `tests` subdirectories with plugin sources and their tests respectively:
@snippet template/CMakeLists.txt cmake:main
> **NOTE**: The default values of the `ENABLE_TESTS`, `ENABLE_FUNCTIONAL_TESTS` options are shared via the OpenVINO Developer Package and they are the same as for the main OpenVINO build tree. You can override them during plugin build using the command below:
```bash
$ cmake -DENABLE_FUNCTIONAL_TESTS=OFF -DOpenVINODeveloperPackage_DIR=../openvino-release-build ../template-plugin
```
- Root ``CMakeLists.txt``, which finds the OpenVINO Developer Package using the ``find_package`` CMake command and adds the ``src`` and ``tests`` subdirectories with plugin sources and their tests respectively:
- `src/CMakeLists.txt` to build a plugin shared library from sources:
@snippet template/src/CMakeLists.txt cmake:plugin
> **NOTE**: `openvino::...` targets are imported from the OpenVINO Developer Package.
.. doxygensnippet:: src/plugins/template/CMakeLists.txt
:language: cpp
:fragment: [cmake:main]
.. note::
The default values of the ``ENABLE_TESTS``, ``ENABLE_FUNCTIONAL_TESTS`` options are shared via the OpenVINO Developer Package and they are the same as for the main OpenVINO build tree. You can override them during plugin build using the command below:
.. code-block:: bash
$ cmake -DENABLE_FUNCTIONAL_TESTS=OFF -DOpenVINODeveloperPackage_DIR=../openvino-release-build ../template-plugin
* ``src/CMakeLists.txt`` to build a plugin shared library from sources:
.. doxygensnippet:: src/plugins/template/src/CMakeLists.txt
:language: cpp
:fragment: [cmake:plugin]
.. note::
``openvino::...`` targets are imported from the OpenVINO Developer Package.
* ``tests/functional/CMakeLists.txt`` to build a set of functional plugin tests:
.. doxygensnippet:: src/plugins/template/tests/functional/CMakeLists.txt
:language: cpp
:fragment: [cmake:functional_tests]
.. note::
The ``openvino::funcSharedTests`` static library with common functional OpenVINO Plugin tests is imported via the OpenVINO Developer Package.
@endsphinxdirective
- `tests/functional/CMakeLists.txt` to build a set of functional plugin tests:
@snippet template/tests/functional/CMakeLists.txt cmake:functional_tests
> **NOTE**: The `openvino::funcSharedTests` static library with common functional OpenVINO Plugin tests is imported via the OpenVINO Developer Package.

View File

@@ -1,89 +1,131 @@
# Compiled Model {#openvino_docs_ov_plugin_dg_compiled_model}
@sphinxdirective
ov::CompiledModel class functionality:
- Compile an ov::Model instance to a backend specific graph representation
- Create an arbitrary number of ov::InferRequest objects
- Hold some common resources shared between different instances of ov::InferRequest. For example:
- ov::ICompiledModel::m_task_executor task executor to implement asynchronous execution
- ov::ICompiledModel::m_callback_executor task executor to run an asynchronous inference request callback in a separate thread
* Compile an ov::Model instance to a backend specific graph representation
* Create an arbitrary number of ov::InferRequest objects
* Hold some common resources shared between different instances of ov::InferRequest. For example:
* ov::ICompiledModel::m_task_executor task executor to implement asynchronous execution
* ov::ICompiledModel::m_callback_executor task executor to run an asynchronous inference request callback in a separate thread
CompiledModel Class
------------------------
###################
OpenVINO Plugin API provides the interface ov::ICompiledModel which should be used as a base class for a compiled model. Based on that, a declaration of an compiled model class can look as follows:
@snippet src/compiled_model.hpp compiled_model:header
.. doxygensnippet:: src/plugins/template/src/compiled_model.hpp
:language: cpp
:fragment: [compiled_model:header]
### Class Fields
Class Fields
++++++++++++
The example class has several fields:
- `m_request_id` - Tracks a number of created inference requests, which is used to distinguish different inference requests during profiling via the Intel® Instrumentation and Tracing Technology (ITT) library.
- `m_cfg` - Defines a configuration a compiled model was compiled with.
- `m_model` - Keeps a reference to transformed `ov::Model` which is used in OpenVINO reference backend computations. Note, in case of other backends with backend specific graph representation `m_model` has different type and represents backend specific graph or just a set of computational kernels to perform an inference.
- `m_loaded_from_cache` - Allows to understand that model was loaded from cache.
* ``m_request_id`` - Tracks a number of created inference requests, which is used to distinguish different inference requests during profiling via the Intel® Instrumentation and Tracing Technology (ITT) library.
* ``m_cfg`` - Defines a configuration a compiled model was compiled with.
* ``m_model`` - Keeps a reference to transformed ``ov::Model`` which is used in OpenVINO reference backend computations. Note, in case of other backends with backend specific graph representation ``m_model`` has different type and represents backend specific graph or just a set of computational kernels to perform an inference.
* ``m_loaded_from_cache`` - Allows to understand that model was loaded from cache.
### CompiledModel Constructor
CompiledModel Constructor
+++++++++++++++++++++++++
This constructor accepts a generic representation of a model as an ov::Model and is compiled into a backend specific device graph:
@snippet src/compiled_model.cpp compiled_model:ctor
.. doxygensnippet:: src/plugins/template/src/compiled_model.cpp
:language: cpp
:fragment: [compiled_model:ctor]
The implementation `compile_model()` is fully device-specific.
The implementation ``compile_model()`` is fully device-specific.
### compile_model()
compile_model()
+++++++++++++++
The function accepts a const shared pointer to `ov::Model` object and applies OpenVINO passes using `transform_model()` function, which defines plugin-specific conversion pipeline. To support low precision inference, the pipeline can include Low Precision Transformations. These transformations are usually hardware specific. You can find how to use and configure Low Precisions Transformations in [Low Precision Transformations](@ref openvino_docs_OV_UG_lpt) guide.
The function accepts a const shared pointer to ``ov::Model`` object and applies OpenVINO passes using ``transform_model()`` function, which defines plugin-specific conversion pipeline. To support low precision inference, the pipeline can include Low Precision Transformations. These transformations are usually hardware specific. You can find how to use and configure Low Precisions Transformations in :doc:`Low Precision Transformations <openvino_docs_OV_UG_lpt>` guide.
@snippet src/compiled_model.cpp compiled_model:compile_model
.. doxygensnippet:: src/plugins/template/src/compiled_model.cpp
:language: cpp
:fragment: [compiled_model:compile_model]
> **NOTE**: After all these steps, the backend specific graph is ready to create inference requests and perform inference.
### export_model()
.. note::
After all these steps, the backend specific graph is ready to create inference requests and perform inference.
The implementation of the method should write all data to the `model_stream`, which is required to import a backend specific graph later in the `Plugin::import_model` method:
export_model()
++++++++++++++
@snippet src/compiled_model.cpp compiled_model:export_model
The implementation of the method should write all data to the ``model_stream``, which is required to import a backend specific graph later in the ``Plugin::import_model`` method:
### create_sync_infer_request()
.. doxygensnippet:: src/plugins/template/src/compiled_model.cpp
:language: cpp
:fragment: [compiled_model:export_model]
create_sync_infer_request()
+++++++++++++++++++++++++++
The method creates an synchronous inference request and returns it.
@snippet src/compiled_model.cpp compiled_model:create_sync_infer_request
.. doxygensnippet:: src/plugins/template/src/compiled_model.cpp
:language: cpp
:fragment: [compiled_model:create_sync_infer_request]
While the public OpenVINO API has a single interface for inference request, which can be executed in synchronous and asynchronous modes, a plugin library implementation has two separate classes:
- [Synchronous inference request](@ref openvino_docs_ov_plugin_dg_infer_request), which defines pipeline stages and runs them synchronously in the `infer` method.
- [Asynchronous inference request](@ref openvino_docs_ov_plugin_dg_async_infer_request), which is a wrapper for a synchronous inference request and can run a pipeline asynchronously. Depending on a device pipeline structure, it can has one or several stages:
- For single-stage pipelines, there is no need to define this method and create a class derived from ov::IAsyncInferRequest. For single stage pipelines, a default implementation of this method creates ov::IAsyncInferRequest wrapping a synchronous inference request and runs it asynchronously in the `m_request_executor` executor.
- For pipelines with multiple stages, such as performing some preprocessing on host, uploading input data to a device, running inference on a device, or downloading and postprocessing output data, schedule stages on several task executors to achieve better device use and performance. You can do it by creating a sufficient number of inference requests running in parallel. In this case, device stages of different inference requests are overlapped with preprocessing and postprocessing stage giving better performance.
> **IMPORTANT**: It is up to you to decide how many task executors you need to optimally execute a device pipeline.
* :doc:`Synchronous inference request <openvino_docs_ov_plugin_dg_infer_request>`, which defines pipeline stages and runs them synchronously in the ``infer`` method.
* :doc:`Asynchronous inference request <openvino_docs_ov_plugin_dg_async_infer_request>`, which is a wrapper for a synchronous inference request and can run a pipeline asynchronously. Depending on a device pipeline structure, it can have one or several stages:
* For single-stage pipelines, there is no need to define this method and create a class derived from ov::IAsyncInferRequest. For single stage pipelines, a default implementation of this method creates ov::IAsyncInferRequest wrapping a synchronous inference request and runs it asynchronously in the ``m_request_executor`` executor.
* For pipelines with multiple stages, such as performing some preprocessing on host, uploading input data to a device, running inference on a device, or downloading and postprocessing output data, schedule stages on several task executors to achieve better device use and performance. You can do it by creating a sufficient number of inference requests running in parallel. In this case, device stages of different inference requests are overlapped with preprocessing and postprocessing stage giving better performance.
.. important::
It is up to you to decide how many task executors you need to optimally execute a device pipeline.
### create_infer_request()
create_infer_request()
++++++++++++++++++++++
The method creates an asynchronous inference request and returns it.
@snippet src/compiled_model.cpp compiled_model:create_infer_request
.. doxygensnippet:: src/plugins/template/src/compiled_model.cpp
:language: cpp
:fragment: [compiled_model:create_infer_request]
### get_property()
get_property()
++++++++++++++
Returns a current value for a property with the name `name`. The method extracts configuration values a compiled model is compiled with.
Returns a current value for a property with the name ``name``. The method extracts configuration values a compiled model is compiled with.
@snippet src/compiled_model.cpp compiled_model:get_property
.. doxygensnippet:: src/plugins/template/src/compiled_model.cpp
:language: cpp
:fragment: [compiled_model:get_property]
This function is the only way to get configuration values when a model is imported and compiled by other developers and tools.
### set_property()
set_property()
++++++++++++++
The methods allows to set compiled model specific properties.
@snippet src/compiled_model.cpp compiled_model:set_property
.. doxygensnippet:: src/plugins/template/src/compiled_model.cpp
:language: cpp
:fragment: [compiled_model:set_property]
### get_runtime_model()
get_runtime_model()
+++++++++++++++++++
The methods returns the runtime model with backend specific information.
@snippet src/compiled_model.cpp compiled_model:get_runtime_model
.. doxygensnippet:: src/plugins/template/src/compiled_model.cpp
:language: cpp
:fragment: [compiled_model:get_runtime_model]
The next step in plugin library implementation is the [Synchronous Inference Request](@ref openvino_docs_ov_plugin_dg_infer_request) class.
The next step in plugin library implementation is the :doc:`Synchronous Inference Request <openvino_docs_ov_plugin_dg_infer_request>` class.
@endsphinxdirective

View File

@@ -1,92 +1,145 @@
# Synchronous Inference Request {#openvino_docs_ov_plugin_dg_infer_request}
`InferRequest` class functionality:
- Allocate input and output tensors needed for a backend-dependent network inference.
- Define functions for inference process stages (for example, `preprocess`, `upload`, `infer`, `download`, `postprocess`). These functions can later be used to define an execution pipeline during [Asynchronous Inference Request](@ref openvino_docs_ov_plugin_dg_async_infer_request) implementation.
- Call inference stages one by one synchronously.
@sphinxdirective
``InferRequest`` class functionality:
* Allocate input and output tensors needed for a backend-dependent network inference.
* Define functions for inference process stages (for example, ``preprocess``, ``upload``, ``infer``, ``download``, ``postprocess``). These functions can later be used to define an execution pipeline during :doc:`Asynchronous Inference Request <openvino_docs_ov_plugin_dg_async_infer_request>` implementation.
* Call inference stages one by one synchronously.
InferRequest Class
------------------------
##################
OpenVINO Plugin API provides the interface ov::ISyncInferRequest which should be
used as a base class for a synchronous inference request implementation. Based of that, a declaration
of a synchronous request class can look as follows:
@snippet src/sync_infer_request.hpp infer_request:header
.. doxygensnippet:: src/plugins/template/src/sync_infer_request.hpp
:language: cpp
:fragment: [infer_request:header]
### Class Fields
Class Fields
++++++++++++
The example class has several fields:
- `m_profiling_task` - array of the `std::array<openvino::itt::handle_t, numOfStages>` type. Defines names for pipeline stages. Used to profile an inference pipeline execution with the Intel® instrumentation and tracing technology (ITT).
- `m_durations` - array of durations of each pipeline stage.
- backend specific fields:
- `m_backend_input_tensors` - input backend tensors.
- `m_backend_output_tensors` - output backend tensors.
- `m_executable` - an executable object / backend computational graph.
- `m_eval_context` - an evaluation context to save backend states after the inference.
- `m_variable_states` - a vector of variable states.
* ``m_profiling_task`` - array of the ``std::array<openvino::itt::handle_t, numOfStages>`` type. Defines names for pipeline stages. Used to profile an inference pipeline execution with the Intel® instrumentation and tracing technology (ITT).
### InferRequest Constructor
* ``m_durations`` - array of durations of each pipeline stage.
* backend-specific fields:
* ``m_backend_input_tensors`` - input backend tensors.
* ``m_backend_output_tensors`` - output backend tensors.
* ``m_executable`` - an executable object / backend computational graph.
* ``m_eval_context`` - an evaluation context to save backend states after the inference.
* ``m_variable_states`` - a vector of variable states.
InferRequest Constructor
++++++++++++++++++++++++
The constructor initializes helper fields and calls methods which allocate tensors:
@snippet src/sync_infer_request.cpp infer_request:ctor
.. doxygensnippet:: src/plugins/template/src/sync_infer_request.cpp
:language: cpp
:fragment: [infer_request:ctor]
> **NOTE**: Use inputs/outputs information from the compiled model to understand shape and element type of tensors, which you can set with ov::InferRequest::set_tensor and get with ov::InferRequest::get_tensor. A plugin uses these hints to determine its internal layouts and element types for input and output tensors if needed.
.. note::
### ~InferRequest Destructor
Use inputs/outputs information from the compiled model to understand shape and element type of tensors, which you can set with ov::InferRequest::set_tensor and get with ov::InferRequest::get_tensor. A plugin uses these hints to determine its internal layouts and element types for input and output tensors if needed.
~InferRequest Destructor
++++++++++++++++++++++++
Destructor can contain plugin specific logic to finish and destroy infer request.
@snippet src/sync_infer_request.cpp infer_request:dtor
.. doxygensnippet:: src/plugins/template/src/sync_infer_request.cpp
:language: cpp
:fragment: [infer_request:dtor]
### set_tensors_impl()
set_tensors_impl()
+++++++++++++++++++
The method allows to set batched tensors in case if the plugin supports it.
@snippet src/sync_infer_request.cpp infer_request:set_tensors_impl
.. doxygensnippet:: src/plugins/template/src/sync_infer_request.cpp
:language: cpp
:fragment: [infer_request:set_tensors_impl]
### query_state()
query_state()
+++++++++++++
The method returns variable states from the model.
@snippet src/sync_infer_request.cpp infer_request:query_state
.. doxygensnippet:: src/plugins/template/src/sync_infer_request.cpp
:language: cpp
:fragment: [infer_request:query_state]
### infer()
infer()
+++++++
The method calls actual pipeline stages synchronously. Inside the method plugin should check input/output tensors, move external tensors to backend and run the inference.
@snippet src/sync_infer_request.cpp infer_request:infer
.. doxygensnippet:: src/plugins/template/src/sync_infer_request.cpp
:language: cpp
:fragment: [infer_request:infer]
#### 1. infer_preprocess()
1. infer_preprocess()
----------------------
Below is the code of the `infer_preprocess()` method. The method checks user input/output tensors and demonstrates conversion from user tensor to backend specific representation:
Below is the code of the ``infer_preprocess()`` method. The method checks user input/output tensors and demonstrates conversion from user tensor to backend specific representation:
@snippet src/sync_infer_request.cpp infer_request:infer_preprocess
.. doxygensnippet:: src/plugins/template/src/sync_infer_request.cpp
:language: cpp
:fragment: [infer_request:infer_preprocess]
#### 2. start_pipeline()
2. start_pipeline()
--------------------
Executes a pipeline synchronously using `m_executable` object:
Executes a pipeline synchronously using ``m_executable`` object:
@snippet src/sync_infer_request.cpp infer_request:start_pipeline
.. doxygensnippet:: src/plugins/template/src/sync_infer_request.cpp
:language: cpp
:fragment: [infer_request:start_pipeline]
#### 3. wait_pipeline()
3. wait_pipeline()
--------------------
Waits a pipeline in case of plugin asynchronous execution:
@snippet src/sync_infer_request.cpp infer_request:wait_pipeline
.. doxygensnippet:: src/plugins/template/src/sync_infer_request.cpp
:language: cpp
:fragment: [infer_request:wait_pipeline]
#### 4. infer_postprocess()
4. infer_postprocess()
----------------------
Converts backend specific tensors to tensors passed by user:
@snippet src/sync_infer_request.cpp infer_request:infer_postprocess
.. doxygensnippet:: src/plugins/template/src/sync_infer_request.cpp
:language: cpp
:fragment: [infer_request:infer_postprocess]
### get_profiling_info()
get_profiling_info()
+++++++++++++++++++++
The method returns the profiling info which was measured during pipeline stages execution:
@snippet src/sync_infer_request.cpp infer_request:get_profiling_info
.. doxygensnippet:: src/plugins/template/src/sync_infer_request.cpp
:language: cpp
:fragment: [infer_request:get_profiling_info]
The next step in the plugin library implementation is the [Asynchronous Inference Request](@ref openvino_docs_ov_plugin_dg_async_infer_request) class.
cancel()
+++++++++
The plugin specific method allows to interrupt the synchronous execution from the AsyncInferRequest:
.. doxygensnippet:: src/plugins/template/src/sync_infer_request.cpp
:language: cpp
:fragment: [infer_request:cancel]
The next step in the plugin library implementation is the :doc:`Asynchronous Inference Request <openvino_docs_ov_plugin_dg_async_infer_request>` class.
@endsphinxdirective

View File

@@ -19,55 +19,75 @@
openvino_docs_ie_plugin_detailed_guides
openvino_docs_ie_plugin_api_references
@endsphinxdirective
The plugin architecture of the OpenVINO allows to develop and plug independent inference
The plugin architecture of OpenVINO allows to develop and plug independent inference
solutions dedicated to different devices. Physically, a plugin is represented as a dynamic library
exporting the single `CreatePluginEngine` function that allows to create a new plugin instance.
exporting the single ``CreatePluginEngine`` function that allows to create a new plugin instance.
OpenVINO Plugin Library
-----------------------
#######################
OpenVINO plugin dynamic library consists of several main components:
1. [Plugin class](@ref openvino_docs_ov_plugin_dg_plugin):
- Provides information about devices of a specific type.
- Can create an [compiled model](@ref openvino_docs_ov_plugin_dg_compiled_model) instance which represents a Neural Network backend specific graph structure for a particular device in opposite to the ov::Model
which is backend-independent.
- Can import an already compiled graph structure from an input stream to an
[compiled model](@ref openvino_docs_ov_plugin_dg_compiled_model) object.
2. [Compiled Model class](@ref openvino_docs_ov_plugin_dg_compiled_model):
- Is an execution configuration compiled for a particular device and takes into account its capabilities.
- Holds a reference to a particular device and a task executor for this device.
- Can create several instances of [Inference Request](@ref openvino_docs_ov_plugin_dg_infer_request).
- Can export an internal backend specific graph structure to an output stream.
3. [Inference Request class](@ref openvino_docs_ov_plugin_dg_infer_request):
- Runs an inference pipeline serially.
- Can extract performance counters for an inference pipeline execution profiling.
4. [Asynchronous Inference Request class](@ref openvino_docs_ov_plugin_dg_async_infer_request):
- Wraps the [Inference Request](@ref openvino_docs_ov_plugin_dg_infer_request) class and runs pipeline stages in parallel on several task executors based on a device-specific pipeline structure.
5. [Plugin specific properties](@ref openvino_docs_ov_plugin_dg_properties):
- Provides the plugin specific properties.
6. [Remote Context](@ref openvino_docs_ov_plugin_dg_remote_context):
- Provides the device specific remote context. Context allows to create remote tensors.
7. [Remote Tensor](@ref openvino_docs_ov_plugin_dg_remote_tensor)
- Provides the device specific remote tensor API and implementation.
1. :doc:`Plugin class <openvino_docs_ov_plugin_dg_plugin>`:
> **NOTE**: This documentation is written based on the `Template` plugin, which demonstrates plugin development details. Find the complete code of the `Template`, which is fully compilable and up-to-date,
at `<openvino source dir>/src/plugins/template`.
* Provides information about devices of a specific type.
* Can create an :doc:`compiled model <openvino_docs_ov_plugin_dg_compiled_model>` instance which represents a Neural Network backend specific graph structure for a particular device in opposite to the ov::Model which is backend-independent.
* Can import an already compiled graph structure from an input stream to a :doc:`compiled model <openvino_docs_ov_plugin_dg_compiled_model>` object.
Detailed guides
-----------------------
2. :doc:`Compiled Model class <openvino_docs_ov_plugin_dg_compiled_model>`:
* [Build](@ref openvino_docs_ov_plugin_dg_plugin_build) a plugin library using CMake
* Plugin and its components [testing](@ref openvino_docs_ov_plugin_dg_plugin_testing)
* [Quantized networks](@ref openvino_docs_ov_plugin_dg_quantized_models)
* [Low precision transformations](@ref openvino_docs_OV_UG_lpt) guide
* [Writing OpenVINO™ transformations](@ref openvino_docs_transformations) guide
* Is an execution configuration compiled for a particular device and takes into account its capabilities.
* Holds a reference to a particular device and a task executor for this device.
* Can create several instances of :doc:`Inference Request <openvino_docs_ov_plugin_dg_infer_request>`.
* Can export an internal backend specific graph structure to an output stream.
3. :doc:`Inference Request class <openvino_docs_ov_plugin_dg_infer_request>`:
* Runs an inference pipeline serially.
* Can extract performance counters for an inference pipeline execution profiling.
4. :doc:`Asynchronous Inference Request class <openvino_docs_ov_plugin_dg_async_infer_request>`:
* Wraps the :doc:`Inference Request <openvino_docs_ov_plugin_dg_infer_request>` class and runs pipeline stages in parallel on several task executors based on a device-specific pipeline structure.
5. :doc:`Plugin specific properties <openvino_docs_ov_plugin_dg_properties>`:
* Provides the plugin specific properties.
6. :doc:`Remote Context <openvino_docs_ov_plugin_dg_remote_context>`:
* Provides the device specific remote context. Context allows to create remote tensors.
7. :doc:`Remote Tensor <openvino_docs_ov_plugin_dg_remote_tensor>`
* Provides the device specific remote tensor API and implementation.
.. note::
This documentation is written based on the ``Template`` plugin, which demonstrates plugin development details. Find the complete code of the ``Template``, which is fully compilable and up-to-date, at ``<openvino source dir>/src/plugins/template``.
Detailed Guides
###############
* :doc:`Build <openvino_docs_ov_plugin_dg_plugin_build>` a plugin library using CMake
* Plugin and its components :doc:`testing <openvino_docs_ov_plugin_dg_plugin_testing>`
* :doc:`Quantized networks <openvino_docs_ov_plugin_dg_quantized_models>`
* :doc:`Low precision transformations <openvino_docs_OV_UG_lpt>` guide
* :doc:`Writing OpenVINO™ transformations <openvino_docs_transformations>` guide
API References
-----------------------
##############
* [OpenVINO Plugin API](@ref ov_dev_api)
* [OpenVINO Transformation API](@ref ie_transformation_api)
* `OpenVINO Plugin API <https://docs.openvino.ai/2023.0/groupov_dev_api.html>`__
* `OpenVINO Transformation API <https://docs.openvino.ai/2023.0/groupie_transformation_api.html>`__
@endsphinxdirective

View File

@@ -1,171 +1,230 @@
# Plugin {#openvino_docs_ov_plugin_dg_plugin}
@sphinxdirective
OpenVINO Plugin usually represents a wrapper around a backend. Backends can be:
- OpenCL-like backend (e.g. clDNN library) for GPU devices.
- oneDNN backend for Intel CPU devices.
- NVIDIA cuDNN for NVIDIA GPUs.
* OpenCL-like backend (e.g. clDNN library) for GPU devices.
* oneDNN backend for Intel CPU devices.
* NVIDIA cuDNN for NVIDIA GPUs.
The responsibility of OpenVINO Plugin:
- Initializes a backend and throw exception in `Engine` constructor if backend cannot be initialized.
- Provides information about devices enabled by a particular backend, e.g. how many devices, their properties and so on.
- Loads or imports [compiled model](@ref openvino_docs_ov_plugin_dg_compiled_model) objects.
* Initializes a backend and throw exception in ``Engine`` constructor if backend cannot be initialized.
* Provides information about devices enabled by a particular backend, e.g. how many devices, their properties and so on.
* Loads or imports :doc:`compiled model <openvino_docs_ov_plugin_dg_compiled_model>` objects.
In addition to the OpenVINO Public API, the OpenVINO provides the Plugin API, which is a set of functions and helper classes that simplify new plugin development:
- header files in the `src/inference/dev_api/openvino` directory
- implementations in the `src/inference/src/dev/` directory
- symbols in the OpenVINO shared library
* header files in the ``src/inference/dev_api/openvino`` directory
* implementations in the ``src/inference/src/dev/`` directory
* symbols in the OpenVINO shared library
To build an OpenVINO plugin with the Plugin API, see the [OpenVINO Plugin Building](@ref openvino_docs_ov_plugin_dg_plugin_build) guide.
To build an OpenVINO plugin with the Plugin API, see the :doc:`OpenVINO Plugin Building <openvino_docs_ov_plugin_dg_plugin_build>` guide.
Plugin Class
------------------------
############
OpenVINO Plugin API provides the helper ov::IPlugin class recommended to use as a base class for a plugin.
Based on that, declaration of a plugin class can look as follows:
@snippet template/src/plugin.hpp plugin:header
.. doxygensnippet:: src/plugins/template/src/plugin.hpp
:language: cpp
:fragment: [plugin:header]
### Class Fields
Class Fields
++++++++++++
The provided plugin class also has several fields:
* `m_backend` - a backend engine that is used to perform actual computations for model inference. For `Template` plugin `ov::runtime::Backend` is used which performs computations using OpenVINO™ reference implementations.
* `m_waitExecutor` - a task executor that waits for a response from a device about device tasks completion.
* `m_cfg` of type `Configuration`:
* ``m_backend`` - a backend engine that is used to perform actual computations for model inference. For ``Template`` plugin ``ov::runtime::Backend`` is used which performs computations using OpenVINO™ reference implementations.
* ``m_waitExecutor`` - a task executor that waits for a response from a device about device tasks completion.
* ``m_cfg`` of type ``Configuration``:
@snippet template/src/config.hpp configuration:header
.. doxygensnippet:: src/plugins/template/src/config.hpp
:language: cpp
:fragment: [configuration:header]
As an example, a plugin configuration has three value parameters:
- `device_id` - particular device ID to work with. Applicable if a plugin supports more than one `Template` device. In this case, some plugin methods, like `set_property`, `query_model`, and `compile_model`, must support the ov::device::id property.
- `perf_counts` - boolean value to identify whether to collect performance counters during [Inference Request](@ref openvino_docs_ov_plugin_dg_infer_request) execution.
- `streams_executor_config` - configuration of `ov::threading::IStreamsExecutor` to handle settings of multi-threaded context.
- `performance_mode` - configuration of `ov::hint::PerformanceMode` to set the performance mode.
- `disable_transformations` - allows to disable transformations which are applied in the process of model compilation.
* ``device_id`` - particular device ID to work with. Applicable if a plugin supports more than one ``Template`` device. In this case, some plugin methods, like ``set_property``, ``query_model``, and ``compile_model``, must support the ov::device::id property.
* ``perf_counts`` - boolean value to identify whether to collect performance counters during :doc:`Inference Request <openvino_docs_ov_plugin_dg_infer_request>` execution.
* ``streams_executor_config`` - configuration of ``ov::threading::IStreamsExecutor`` to handle settings of multi-threaded context.
* ``performance_mode`` - configuration of ``ov::hint::PerformanceMode`` to set the performance mode.
* ``disable_transformations`` - allows to disable transformations which are applied in the process of model compilation.
* ``exclusive_async_requests`` - allows to use exclusive task executor for asynchronous infer requests.
### Plugin Constructor
Plugin Constructor
++++++++++++++++++
A plugin constructor must contain code that checks the ability to work with a device of the `Template`
A plugin constructor must contain code that checks the ability to work with a device of the ``Template``
type. For example, if some drivers are required, the code must check
driver availability. If a driver is not available (for example, OpenCL runtime is not installed in
case of a GPU device or there is an improper version of a driver is on a host machine), an exception
must be thrown from a plugin constructor.
A plugin must define a device name enabled via the `set_device_name()` method of a base class:
A plugin must define a device name enabled via the ``set_device_name()`` method of a base class:
@snippet template/src/plugin.cpp plugin:ctor
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:ctor]
### Plugin Destructor
Plugin Destructor
+++++++++++++++++
A plugin destructor must stop all plugins activities, and clean all allocated resources.
@snippet template/src/plugin.cpp plugin:dtor
### compile_model()
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:dtor]
The plugin should implement two `compile_model()` methods: the first one compiles model without remote context, the second one with remote context if plugin supports.
compile_model()
+++++++++++++++
This is the most important function of the `Plugin` class is to create an instance of compiled `CompiledModel`,
The plugin should implement two ``compile_model()`` methods: the first one compiles model without remote context, the second one with remote context if plugin supports.
This is the most important function of the ``Plugin`` class is to create an instance of compiled ``CompiledModel``,
which holds a backend-dependent compiled model in an internal representation:
@snippet template/src/plugin.cpp plugin:compile_model
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:compile_model]
@snippet template/src/plugin.cpp plugin:compile_model_with_remote
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:compile_model_with_remote]
Before a creation of an `CompiledModel` instance via a constructor, a plugin may check if a provided
Before a creation of an ``CompiledModel`` instance via a constructor, a plugin may check if a provided
ov::Model object is supported by a device if it is needed.
Actual model compilation is done in the `CompiledModel` constructor. Refer to the [CompiledModel Implementation Guide](@ref openvino_docs_ov_plugin_dg_compiled_model) for details.
Actual model compilation is done in the ``CompiledModel`` constructor. Refer to the :doc:`CompiledModel Implementation Guide <openvino_docs_ov_plugin_dg_compiled_model>` for details.
> **NOTE**: Actual configuration map used in `CompiledModel` is constructed as a base plugin
> configuration set via `Plugin::set_property`, where some values are overwritten with `config` passed to `Plugin::compile_model`.
> Therefore, the config of `Plugin::compile_model` has a higher priority.
.. note::
### transform_model()
Actual configuration map used in ``CompiledModel`` is constructed as a base plugin configuration set via ``Plugin::set_property``, where some values are overwritten with ``config`` passed to ``Plugin::compile_model``. Therefore, the config of ``Plugin::compile_model`` has a higher priority.
The function accepts a const shared pointer to `ov::Model` object and applies common and device-specific transformations on a copied model to make it more friendly to hardware operations. For details how to write custom device-specific transformation, please, refer to [Writing OpenVINO™ transformations](@ref openvino_docs_transformations) guide. See detailed topics about model representation:
* [Intermediate Representation and Operation Sets](@ref openvino_docs_MO_DG_IR_and_opsets)
* [Quantized models](@ref openvino_docs_ov_plugin_dg_quantized_models).
transform_model()
+++++++++++++++++
@snippet template/src/plugin.cpp plugin:transform_model
The function accepts a const shared pointer to `ov::Model` object and applies common and device-specific transformations on a copied model to make it more friendly to hardware operations. For details how to write custom device-specific transformation, refer to :doc:`Writing OpenVINO™ transformations <openvino_docs_transformations>` guide. See detailed topics about model representation:
> **NOTE**: After all these transformations, an `ov::Model` object contains operations which can be perfectly mapped to backend kernels. E.g. if backend has kernel computing `A + B` operations at once, the `transform_model` function should contain a pass which fuses operations `A` and `B` into a single custom operation `A + B` which fits backend kernels set.
* :doc:`Intermediate Representation and Operation Sets <openvino_docs_MO_DG_IR_and_opsets>`
* :doc:`Quantized models <openvino_docs_ov_plugin_dg_quantized_models>`.
### query_model()
Use the method with the `HETERO` mode, which allows to distribute model execution between different
devices based on the `ov::Node::get_rt_info()` map, which can contain the `"affinity"` key.
The `query_model` method analyzes operations of provided `model` and returns a list of supported
operations via the ov::SupportedOpsMap structure. The `query_model` firstly applies `transform_model` passes to input `ov::Model` argument. After this, the transformed model in ideal case contains only operations are 1:1 mapped to kernels in computational backend. In this case, it's very easy to analyze which operations is supposed (`m_backend` has a kernel for such operation or extensions for the operation is provided) and not supported (kernel is missed in `m_backend`):
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:transform_model]
1. Store original names of all operations in input `ov::Model`
2. Apply `transform_model` passes. Note, the names of operations in a transformed model can be different and we need to restore the mapping in the steps below.
3. Construct `supported` map which contains names of original operations. Note, that since the inference is performed using OpenVINO™ reference backend, the decision whether the operation is supported or not depends on whether the latest OpenVINO opset contains such operation.
4. `ov.SupportedOpsMap` contains only operations which are fully supported by `m_backend`.
.. note::
@snippet template/src/plugin.cpp plugin:query_model
After all these transformations, an ``ov::Model`` object contains operations which can be perfectly mapped to backend kernels. E.g. if backend has kernel computing ``A + B`` operations at once, the ``transform_model`` function should contain a pass which fuses operations ``A`` and ``B`` into a single custom operation `A + B` which fits backend kernels set.
### set_property()
query_model()
+++++++++++++
Use the method with the ``HETERO`` mode, which allows to distribute model execution between different
devices based on the ``ov::Node::get_rt_info()`` map, which can contain the ``affinity`` key.
The ``query_model`` method analyzes operations of provided ``model`` and returns a list of supported
operations via the ov::SupportedOpsMap structure. The ``query_model`` firstly applies ``transform_model`` passes to input ``ov::Model`` argument. After this, the transformed model in ideal case contains only operations are 1:1 mapped to kernels in computational backend. In this case, it's very easy to analyze which operations is supposed (``m_backend`` has a kernel for such operation or extensions for the operation is provided) and not supported (kernel is missed in ``m_backend``):
1. Store original names of all operations in input ``ov::Model``.
2. Apply ``transform_model`` passes. Note, the names of operations in a transformed model can be different and we need to restore the mapping in the steps below.
3. Construct ``supported`` map which contains names of original operations. Note that since the inference is performed using OpenVINO™ reference backend, the decision whether the operation is supported or not depends on whether the latest OpenVINO opset contains such operation.
4. ``ov.SupportedOpsMap`` contains only operations which are fully supported by ``m_backend``.
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:query_model]
set_property()
++++++++++++++
Sets new values for plugin property keys:
@snippet template/src/plugin.cpp plugin:set_property
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:set_property]
In the snippet above, the `Configuration` class overrides previous configuration values with the new
In the snippet above, the ``Configuration`` class overrides previous configuration values with the new
ones. All these values are used during backend specific model compilation and execution of inference requests.
> **NOTE**: The function must throw an exception if it receives an unsupported configuration key.
.. note::
The function must throw an exception if it receives an unsupported configuration key.
### get_property()
get_property()
++++++++++++++
Returns a current value for a specified property key:
@snippet template/src/plugin.cpp plugin:get_property
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:get_property]
The function is implemented with the `Configuration::Get` method, which wraps an actual configuration
The function is implemented with the ``Configuration::Get`` method, which wraps an actual configuration
key value to the ov::Any and returns it.
> **NOTE**: The function must throw an exception if it receives an unsupported configuration key.
.. note::
The function must throw an exception if it receives an unsupported configuration key.
### import_model()
import_model()
++++++++++++++
The importing of compiled model mechanism allows to import a previously exported backend specific model and wrap it
using an [CompiledModel](@ref openvino_docs_ov_plugin_dg_compiled_model) object. This functionality is useful if
using an :doc:`CompiledModel <openvino_docs_ov_plugin_dg_compiled_model>` object. This functionality is useful if
backend specific model compilation takes significant time and/or cannot be done on a target host
device due to other reasons.
During export of backend specific model using `CompiledModel::export_model`, a plugin may export any
During export of backend specific model using ``CompiledModel::export_model``, a plugin may export any
type of information it needs to import a compiled model properly and check its correctness.
For example, the export information may include:
- Compilation options (state of `Plugin::m_cfg` structure)
- Information about a plugin and a device type to check this information later during the import and
throw an exception if the `model` stream contains wrong data. For example, if devices have different
capabilities and a model compiled for a particular device cannot be used for another, such type of
information must be stored and checked during the import.
- Compiled backend specific model itself
* Compilation options (state of ``Plugin::m_cfg`` structure).
* Information about a plugin and a device type to check this information later during the import and throw an exception if the ``model`` stream contains wrong data. For example, if devices have different capabilities and a model compiled for a particular device cannot be used for another, such type of information must be stored and checked during the import.
* Compiled backend specific model itself.
@snippet template/src/plugin.cpp plugin:import_model
@snippet template/src/plugin.cpp plugin:import_model_with_remote
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:import_model]
### create_context()
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:import_model_with_remote]
The Plugin should implement `Plugin::create_context()` method which returns `ov::RemoteContext` in case if plugin supports remote context, in other case the plugin can throw an exception that this method is not implemented.
@snippet template/src/plugin.cpp plugin:create_context
create_context()
++++++++++++++++
### get_default_context()
The Plugin should implement ``Plugin::create_context()`` method which returns ``ov::RemoteContext`` in case if plugin supports remote context, in other case the plugin can throw an exception that this method is not implemented.
`Plugin::get_default_context()` also needed in case if plugin supports remote context, if the plugin doesn't support it, this method can throw an exception that functionality is not implemented.
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:create_context]
@snippet template/src/plugin.cpp plugin:get_default_context
get_default_context()
+++++++++++++++++++++
``Plugin::get_default_context()`` also needed in case if plugin supports remote context, if the plugin doesn't support it, this method can throw an exception that functionality is not implemented.
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:get_default_context]
Create Instance of Plugin Class
------------------------
###############################
OpenVINO plugin library must export only one function creating a plugin instance using OV_DEFINE_PLUGIN_CREATE_FUNCTION macro:
@snippet template/src/plugin.cpp plugin:create_plugin_engine
.. doxygensnippet:: src/plugins/template/src/plugin.cpp
:language: cpp
:fragment: [plugin:create_plugin_engine]
Next step in a plugin library implementation is the [CompiledModel](@ref openvino_docs_ov_plugin_dg_compiled_model) class.
Next step in a plugin library implementation is the :doc:`CompiledModel <openvino_docs_ov_plugin_dg_compiled_model>` class.
@endsphinxdirective

View File

@@ -1,45 +1,67 @@
# Plugin Testing {#openvino_docs_ov_plugin_dg_plugin_testing}
@sphinxdirective
OpenVINO tests infrastructure provides a predefined set of functional tests and utilities. They are used to verify a plugin using the OpenVINO public API.
All the tests are written in the [Google Test C++ framework](https://github.com/google/googletest).
All the tests are written in the `Google Test C++ framework <https://github.com/google/googletest>`__.
OpenVINO Plugin tests are included in the `openvino::funcSharedTests` CMake target which is built within the OpenVINO repository
(see [Build Plugin Using CMake](@ref openvino_docs_ov_plugin_dg_plugin_build) guide). This library contains tests definitions (the tests bodies) which can be parametrized and instantiated in plugins depending on whether a plugin supports a particular feature, specific sets of parameters for test on supported operation set and so on.
OpenVINO Plugin tests are included in the ``openvino::funcSharedTests`` CMake target which is built within the OpenVINO repository
(see :doc:`Build Plugin Using CMake <openvino_docs_ov_plugin_dg_plugin_build>` guide). This library contains tests definitions (the tests bodies) which can be parametrized and instantiated in plugins depending on whether a plugin supports a particular feature, specific sets of parameters for test on supported operation set and so on.
Test definitions are split into tests class declaration (see `src/tests/functional/plugin/shared/include`) and tests class implementation (see `src/tests/functional/plugin/shared/src`) and include the following scopes of plugin conformance tests:
Test definitions are split into tests class declaration (see ``src/tests/functional/plugin/shared/include``) and tests class implementation (see ``src/tests/functional/plugin/shared/src``) and include the following scopes of plugin conformance tests:
1. **Behavior tests** (`behavior` sub-folder), which are a separate test group to check that a plugin satisfies basic OpenVINO concepts: plugin creation, multiple compiled models support, multiple synchronous and asynchronous inference requests support, and so on. See the next section with details how to instantiate the tests definition class with plugin-specific parameters.
1. **Behavior tests** (``behavior`` sub-folder), which are a separate test group to check that a plugin satisfies basic OpenVINO concepts: plugin creation, multiple compiled models support, multiple synchronous and asynchronous inference requests support, and so on. See the next section with details how to instantiate the tests definition class with plugin-specific parameters.
2. **Single layer tests** (`single_layer_tests` sub-folder). This groups of tests checks that a particular single layer can be inferenced on a device. An example of test instantiation based on test definition from `openvino::funcSharedTests` library:
2. **Single layer tests** (``single_layer_tests`` sub-folder). This groups of tests checks that a particular single layer can be inferenced on a device. An example of test instantiation based on test definition from ``openvino::funcSharedTests`` library:
- From the declaration of convolution test class we can see that it's a parametrized GoogleTest based class with the `convLayerTestParamsSet` tuple of parameters:
@snippet single_layer/convolution.hpp test_convolution:definition
* From the declaration of convolution test class we can see that it's a parametrized GoogleTest based class with the ``convLayerTestParamsSet`` tuple of parameters:
.. doxygensnippet:: src/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/convolution.hpp
:language: cpp
:fragment: [test_convolution:definition]
- Based on that, define a set of parameters for `Template` plugin functional test instantiation:
@snippet single_layer_tests/convolution.cpp test_convolution:declare_parameters
* Based on that, define a set of parameters for ``Template`` plugin functional test instantiation:
.. doxygensnippet:: src/plugins/template/tests/functional/shared_tests_instances/single_layer_tests/convolution.cpp
:language: cpp
:fragment: [test_convolution:declare_parameters]
- Instantiate the test itself using standard GoogleTest macro `INSTANTIATE_TEST_SUITE_P`:
@snippet single_layer_tests/convolution.cpp test_convolution:instantiate
* Instantiate the test itself using standard GoogleTest macro ``INSTANTIATE_TEST_SUITE_P``:
3. **Sub-graph tests** (`subgraph_tests` sub-folder). This group of tests is designed to tests small patterns or combination of layers. E.g. when a particular topology is being enabled in a plugin e.g. TF ResNet-50, there is no need to add the whole topology to test tests. In opposite way, a particular repetitive subgraph or pattern can be extracted from `ResNet-50` and added to the tests. The instantiation of the sub-graph tests is done in the same way as for single layer tests.
> **Note**, such sub-graphs or patterns for sub-graph tests should be added to `openvino::ngraphFunctions` library first (this library is a pre-defined set of small `ov::Model`) and re-used in sub-graph tests after.
.. doxygensnippet:: src/plugins/template/tests/functional/shared_tests_instances/single_layer_tests/convolution.cpp
:language: cpp
:fragment: [test_convolution:instantiate]
4. **HETERO tests** (`subgraph_tests` sub-folder) contains tests for `HETERO` scenario (manual or automatic affinities settings, tests for `query_model`).
3. **Sub-graph tests** (``subgraph_tests`` sub-folder). This group of tests is designed to tests small patterns or combination of layers. E.g. when a particular topology is being enabled in a plugin e.g. TF ResNet-50, there is no need to add the whole topology to test tests. In opposite way, a particular repetitive subgraph or pattern can be extracted from ``ResNet-50`` and added to the tests. The instantiation of the sub-graph tests is done in the same way as for single layer tests.
.. note::
Such sub-graphs or patterns for sub-graph tests should be added to ``openvino::ngraphFunctions`` library first (this library is a pre-defined set of small ``ov::Model``) and re-used in sub-graph tests after.
4. **HETERO tests** (``subgraph_tests`` sub-folder) contains tests for ``HETERO`` scenario (manual or automatic affinities settings, tests for ``query_model``).
5. **Other tests**, which contain tests for other scenarios and has the following types of tests:
- Tests for execution graph
- Etc.
To use these tests for your own plugin development, link the `openvino::funcSharedTests` library to your test binary and instantiate required test cases with desired parameters values.
* Tests for execution graph
* Other
> **NOTE**: A plugin may contain its own tests for use cases that are specific to hardware or need to be extensively tested.
To use these tests for your own plugin development, link the ``openvino::funcSharedTests`` library to your test binary and instantiate required test cases with desired parameters values.
To build test binaries together with other build artifacts, use the `make all` command. For details, see
[Build Plugin Using CMake*](@ref openvino_docs_ov_plugin_dg_plugin_build).
.. note::
A plugin may contain its own tests for use cases that are specific to hardware or need to be extensively tested.
### How to Extend OpenVINO Plugin Tests
To build test binaries together with other build artifacts, use the ``make all`` command. For details, see :doc:`Build Plugin Using CMake <openvino_docs_ov_plugin_dg_plugin_build>`.
How to Extend OpenVINO Plugin Tests
+++++++++++++++++++++++++++++++++++
OpenVINO Plugin tests are open for contribution.
Add common test case definitions applicable for all plugins to the `openvino::funcSharedTests` target within the OpenVINO repository. Then, any other plugin supporting corresponding functionality can instantiate the new test.
Add common test case definitions applicable for all plugins to the ``openvino::funcSharedTests`` target within the OpenVINO repository. Then, any other plugin supporting corresponding functionality can instantiate the new test.
.. note::
When implementing a new subgraph test, add new single-layer tests for each operation of the subgraph if such test does not exist.
@endsphinxdirective
> **NOTE**: When implementing a new subgraph test, add new single-layer tests for each operation of the subgraph if such test does not exist.

View File

@@ -1,10 +1,17 @@
# Plugin Properties {#openvino_docs_ov_plugin_dg_properties}
Plugin can provide own device specific properties.
@sphinxdirective
Plugin can provide own device-specific properties.
Property Class
------------------------
##############
OpenVINO API provides the interface ov::Property which allows to define the property and access rights. Based on that, a declaration of plugin specific properties can look as follows:
@snippet include/template/properties.hpp properties:public_header
.. doxygensnippet:: src/plugins/template/include/template/properties.hpp
:language: cpp
:fragment: [properties:public_header]
@endsphinxdirective

View File

@@ -1,15 +1,20 @@
# Quantized models compute and restrictions {#openvino_docs_ov_plugin_dg_quantized_models}
@sphinxdirective
One of the feature of OpenVINO is the support of quantized models with different precisions: INT8, INT4, etc.
However, it is up to the plugin to define what exact precisions are supported by the particular HW.
All quantized models which can be expressed in IR have a unified representation by means of *FakeQuantize* operation.
For more details about low-precision model representation please refer to this [document](@ref openvino_docs_ie_plugin_dg_lp_representation).
For more details about low-precision model representation please refer to this :doc:`document <openvino_docs_ie_plugin_dg_lp_representation>`.
Interpreting FakeQuantize at runtime
####################################
### Interpreting FakeQuantize at runtime
During the model load each plugin can interpret quantization rules expressed in *FakeQuantize* operations:
- Independently based on the definition of *FakeQuantize* operation.
- Using a special library of low-precision transformations (LPT) which applies common rules for generic operations,
such as Convolution, Fully-Connected, Eltwise, etc., and translates "fake-quantized" models into models with low-precision operations.
* Independently based on the definition of *FakeQuantize* operation.
* Using a special library of low-precision transformations (LPT) which applies common rules for generic operations, such as Convolution, Fully-Connected, Eltwise, etc., and translates "fake-quantized" models into models with low-precision operations.
Here we provide only a high-level overview of the interpretation rules of FakeQuantize.
At runtime each FakeQuantize can be split into two independent operations: **Quantize** and **Dequantize**.
@@ -17,33 +22,47 @@ The former one is aimed to transform the input data into the target precision wh
In practice *Dequantize* operations can be propagated forward through the linear operations, such as *Convolution* or *Fully-Connected*,
and in some cases fused with the following *Quantize* operation for the next layer into the so-called *Requantize* operation (see Fig. 1).
![qdq_propagation]
<div align="center">Figure 1. Quantization operations propagation at runtime. Q, DQ, RQ stand for Quantize, Dequantize, and Requantize correspondingly.</div>
.. image:: _static/images/qdq_propagation.png
Figure 1. Quantization operations propagation at runtime. Q, DQ, RQ stand for Quantize, Dequantize, and Requantize correspondingly.
From the calculation standpoint, the FakeQuantize formula also is split into two parts accordingly:
`output = round((x - input_low) / (input_high - input_low) * (levels-1)) / (levels-1) * (output_high - output_low) + output_low`
``output = round((x - input_low) / (input_high - input_low) * (levels-1)) / (levels-1) * (output_high - output_low) + output_low``
The first part of this formula represents *Quantize* operation:
`q = round((x - input_low) / (input_high - input_low) * (levels-1))`
``q = round((x - input_low) / (input_high - input_low) * (levels-1))``
The second is responsible for the dequantization:
`r = q / (levels-1) * (output_high - output_low) + output_low`
``r = q / (levels-1) * (output_high - output_low) + output_low``
From the scale/zero-point notation standpoint the latter formula can be written as follows:
`r = (output_high - output_low) / (levels-1) * (q + output_low / (output_high - output_low) * (levels-1))`
``r = (output_high - output_low) / (levels-1) * (q + output_low / (output_high - output_low) * (levels-1))``
Thus we can define:
- **Scale** as `(output_high - output_low) / (levels-1)`
- **Zero-point** as `-output_low / (output_high - output_low) * (levels-1)`
> **NOTE**: During the quantization process the values `input_low`, `input_high`, `output_low`, `output_high` are selected so that to map a floating-point zero exactly to an integer value (zero-point) and vice versa.
* **Scale** as ``(output_high - output_low) / (levels-1)``
* **Zero-point** as ``-output_low / (output_high - output_low) * (levels-1)``
## Quantization specifics and restrictions
In general, OpenVINO can represent and execute quantized models from different sources. However, the Post-training Optimization Tool (POT)
is considered the default way to get optimized models. Since the POT supports HW-aware quantization it means that specific rules can be implemented in it for
.. note::
During the quantization process the values ``input_low``, ``input_high``, ``output_low``, ``output_high`` are selected so that to map a floating-point zero exactly to an integer value (zero-point) and vice versa.
Quantization specifics and restrictions
#######################################
In general, OpenVINO can represent and execute quantized models from different sources. However, the Neural Network Compression Framework (NNCF)
is considered the default way to get optimized models. Since the NNCF supports HW-aware quantization it means that specific rules can be implemented in it for
the particular HW. However, it is reasonable to have compatibility with general-purpose HW such as CPU and GPU and support their quantization schemes.
Below we define these rules as follows:
- Support of mixed-precision models where some layers can be kept in the floating-point precision.
- Per-channel quantization of weights of Convolutional and Fully-Connected layers.
- Per-channel quantization of activations for channel-wise and element-wise operations, e.g. Depthwise Convolution, Eltwise Add/Mul, ScaleShift.
- Symmetric and asymmetric quantization of weights and activations with the support of per-channel scales and zero-points.
- Non-unified quantization parameters for Eltwise and Concat operations.
- Non-quantized models output, i.e. there are no quantization parameters for it.
[qdq_propagation]: images/qdq_propagation.png
* Support of mixed-precision models where some layers can be kept in the floating-point precision.
* Per-channel quantization of weights of Convolutional and Fully-Connected layers.
* Per-channel quantization of activations for channel-wise and element-wise operations, e.g. Depthwise Convolution, Eltwise Add/Mul, ScaleShift.
* Symmetric and asymmetric quantization of weights and activations with the support of per-channel scales and zero-points.
* Non-unified quantization parameters for Eltwise and Concat operations.
* Non-quantized network output, i.e. there are no quantization parameters for it.
@endsphinxdirective

View File

@@ -1,49 +1,71 @@
# Remote Context {#openvino_docs_ov_plugin_dg_remote_context}
ov::RemoteContext class functionality:
- Represents device specific inference context.
- Allows to create remote device specific tensor.
@sphinxdirective
> **NOTE**: If plugin provides a public API for own Remote Context, the API should be header only and doesn't depend on the plugin library.
ov::RemoteContext class functionality:
* Represents device-specific inference context.
* Allows to create remote device specific tensor.
.. note::
If plugin provides a public API for own Remote Context, the API should be header only and does not depend on the plugin library.
RemoteContext Class
------------------------
###################
OpenVINO Plugin API provides the interface ov::IRemoteContext which should be used as a base class for a plugin specific remote context. Based on that, a declaration of an compiled model class can look as follows:
@snippet src/remote_context.hpp remote_context:header
.. doxygensnippet:: src/plugins/template/src/remote_context.hpp
:language: cpp
:fragment: [remote_context:header]
### Class Fields
Class Fields
++++++++++++
The example class has several fields:
- `m_name` - Device name.
- `m_property` - Device specific context properties. It can be used to cast RemoteContext to device specific type.
* ``m_name`` - Device name.
* ``m_property`` - Device-specific context properties. It can be used to cast RemoteContext to device specific type.
### RemoteContext Constructor
RemoteContext Constructor
+++++++++++++++++++++++++
This constructor should initialize the remote context device name and properties.
@snippet src/remote_context.cpp remote_context:ctor
.. doxygensnippet:: src/plugins/template/src/remote_context.cpp
:language: cpp
:fragment: [remote_context:ctor]
### get_device_name()
get_device_name()
++++++++++++++++++
The function returns the device name from the remote context.
@snippet src/remote_context.cpp remote_context:get_device_name
.. doxygensnippet:: src/plugins/template/src/remote_context.cpp
:language: cpp
:fragment: [remote_context:get_device_name]
### get_property()
get_property()
+++++++++++++++
The implementation returns the remote context properties.
@snippet src/remote_context.cpp remote_context:get_property
.. doxygensnippet:: src/plugins/template/src/remote_context.cpp
:language: cpp
:fragment: [remote_context:get_property]
### create_tensor()
create_tensor()
+++++++++++++++
The method creates device specific remote tensor.
@snippet src/remote_context.cpp remote_context:create_tensor
.. doxygensnippet:: src/plugins/template/src/remote_context.cpp
:language: cpp
:fragment: [remote_context:create_tensor]
The next step to support device specific tensors is a creation of device specific :doc:`Remote Tensor <openvino_docs_ov_plugin_dg_remote_tensor>` class.
@endsphinxdirective
The next step to support device specific tensors is a creation of device specific [Remote Tensor](@ref openvino_docs_ov_plugin_dg_remote_tensor) class.

View File

@@ -1,30 +1,39 @@
# Remote Tensor {#openvino_docs_ov_plugin_dg_remote_tensor}
ov::RemoteTensor class functionality:
- Provide an interface to work with device specific memory.
@sphinxdirective
> **NOTE**: If plugin provides a public API for own Remote Tensor, the API should be header only and doesn't depend on the plugin library.
ov::RemoteTensor class functionality:
* Provides an interface to work with device-specific memory.
.. note::
If plugin provides a public API for own Remote Tensor, the API should be header only and does not depend on the plugin library.
Device Specific Remote Tensor Public API
------------------------------------------
########################################
The public interface to work with device specific remote tensors should have header only implementation and doesn't depend on the plugin library.
@snippet include/template/remote_tensor.hpp remote_tensor:public_header
.. doxygensnippet:: src/plugins/template/include/template/remote_tensor.hpp
:language: cpp
:fragment: [remote_tensor:public_header]
The implementation below has several methods:
### type_check()
type_check()
+++++++++++++++++++++++++
Static method is used to understand that some abstract remote tensor can be casted to this particular remote tensor type.
### get_data()
get_data()
+++++++++++++++++++++++++
The set of methods (specific for the example, other implementation can have another API) which are helpers to get an access to remote data.
Device Specific Internal tensor implementation
-----------------------------------------------
Device-Specific Internal tensor implementation
##############################################
The plugin should have the internal implementation of remote tensor which can communicate with public API.
The example contains the implementation of remote tensor which wraps memory from stl vector.
@@ -33,55 +42,70 @@ OpenVINO Plugin API provides the interface ov::IRemoteTensor which should be use
The example implementation have two remote tensor classes:
- Internal type dependent implementation which has as an template argument the vector type and create the type specific tensor.
- The type independent implementation which works with type dependent tensor inside.
* Internal type dependent implementation which has as an template argument the vector type and create the type specific tensor.
* The type independent implementation which works with type dependent tensor inside.
Based on that, an implementation of a type independent remote tensor class can look as follows:
@snippet src/remote_context.cpp vector_impl:implementation
.. doxygensnippet:: src/plugins/template/src/remote_context.cpp
:language: cpp
:fragment: [vector_impl:implementation]
The implementation provides a helper to get wrapped stl tensor and overrides all important methods of ov::IRemoteTensor class and recall the type dependent implementation.
The type dependent remote tensor has the next implementation:
@snippet src/remote_context.cpp vector_impl_t:implementation
.. doxygensnippet:: src/plugins/template/src/remote_context.cpp
:language: cpp
:fragment: [vector_impl_t:implementation]
### Class Fields
Class Fields
++++++++++++
The class has several fields:
- `m_element_type` - Tensor element type.
- `m_shape` - Tensor shape.
- `m_strides` - Tensor strides.
- `m_data` - Wrapped vector.
- `m_dev_name` - Device name.
- `m_properties` - Remote tensor specific properties which can be used to detect the type of the remote tensor.
* ``m_element_type`` - Tensor element type.
* ``m_shape`` - Tensor shape.
* ``m_strides`` - Tensor strides.
* ``m_data`` - Wrapped vector.
* ``m_dev_name`` - Device name.
* ``m_properties`` - Remote tensor specific properties which can be used to detect the type of the remote tensor.
### VectorTensorImpl()
VectorTensorImpl()
++++++++++++++++++
The constructor of remote tensor implementation. Creates a vector with data, initialize device name and properties, updates shape, element type and strides.
### get_element_type()
get_element_type()
++++++++++++++++++
The method returns tensor element type.
### get_shape()
get_shape()
+++++++++++
The method returns tensor shape.
### get_strides()
get_strides()
+++++++++++++
The method returns tensor strides.
### set_shape()
set_shape()
+++++++++++
The method allows to set new shapes for the remote tensor.
### get_properties()
get_properties()
++++++++++++++++
The method returns tensor specific properties.
### get_device_name()
get_device_name()
+++++++++++++++++
The method returns tensor specific device name.
@endsphinxdirective

View File

@@ -9,10 +9,11 @@
openvino_docs_ov_plugin_dg_quantized_models
openvino_docs_OV_UG_lpt
@endsphinxdirective
The guides below provides extra information about specific features of OpenVINO needed for understanding during OpenVINO plugin development:
* [Quantized networks](@ref openvino_docs_ov_plugin_dg_quantized_models)
* [Low precision transformations](@ref openvino_docs_OV_UG_lpt) guide
* [Writing OpenVINO™ transformations](@ref openvino_docs_transformations) guide
* :doc:`Quantized networks <openvino_docs_ov_plugin_dg_quantized_models>`
* :doc:`Low precision transformations guide <openvino_docs_OV_UG_lpt>`
* :doc:`Writing OpenVINO™ transformations guide <openvino_docs_transformations>`
@endsphinxdirective

View File

@@ -9,9 +9,9 @@
../groupov_dev_api
../groupie_transformation_api
@endsphinxdirective
The guides below provides extra API references needed for OpenVINO plugin development:
* [OpenVINO Plugin API](@ref ov_dev_api)
* [OpenVINO Transformation API](@ref ie_transformation_api)
* `OpenVINO Plugin API <https://docs.openvino.ai/2023.0/groupov_dev_api.html>`__
* `OpenVINO Transformation API <https://docs.openvino.ai/2023.0/groupie_transformation_api.html>`__
@endsphinxdirective

View File

@@ -69,6 +69,7 @@
<tab type="user" title="VariadicSplitTransformation" url="@ref openvino_docs_OV_UG_lpt_VariadicSplitTransformation"/>
</tab>
<tab type="user" title="Step 4. Cleanup transformations" url="@ref openvino_docs_OV_UG_lpt_step4_cleanup">
<tab type="user" title="EliminateFakeQuantizeTransformation" url="@ref openvino_docs_OV_UG_lpt_EliminateFakeQuantizeTransformation"/>
<tab type="user" title="FoldConvertTransformation" url="@ref openvino_docs_OV_UG_lpt_FoldConvertTransformation"/>
<tab type="user" title="FoldFakeQuantizeTransformation" url="@ref openvino_docs_OV_UG_lpt_FoldFakeQuantizeTransformation"/>
<tab type="user" title="FuseConvertTransformation" url="@ref openvino_docs_OV_UG_lpt_FuseConvertTransformation"/>

View File

@@ -1,11 +1,21 @@
# AvgPoolPrecisionPreserved Attribute {#openvino_docs_OV_UG_lpt_AvgPoolPrecisionPreserved}
ngraph::AvgPoolPrecisionPreservedAttribute class represents the `AvgPoolPrecisionPreserved` attribute.
@sphinxdirective
Utility attribute, which is used only during `AvgPool` operation, precision preserved property definition.
:ref:`ngraph::AvgPoolPrecisionPreservedAttribute <doxid-classngraph_1_1_avg_pool_precision_preserved_attribute>` class represents the ``AvgPoolPrecisionPreserved`` attribute.
| Property name | Values |
|---------------|----------------------------------------------|
| Required | Yes |
| Defined | Operation |
| Properties | value (boolean) |
Utility attribute, which is used only during ``AvgPool`` operation, precision preserved property definition.
.. list-table::
:header-rows: 1
* - Property name
- Values
* - Required
- Yes
* - Defined
- Operation
* - Properties
- value (boolean)
@endsphinxdirective

View File

@@ -1,11 +1,21 @@
# IntervalsAlignment Attribute {#openvino_docs_OV_UG_lpt_IntervalsAlignment}
ngraph::IntervalsAlignmentAttribute class represents the `IntervalsAlignment` attribute.
@sphinxdirective
The attribute defines a subgraph with the same quantization intervals alignment. `FakeQuantize` operations are included. The attribute is used by quantization operations.
:ref:`ngraph::IntervalsAlignmentAttribute <doxid-classngraph_1_1_intervals_alignment_attribute>` class represents the ``IntervalsAlignment`` attribute.
| Property name | Values |
|---------------|----------------------------------------------|
| Required | Yes |
| Defined | Operation |
| Properties | combined interval, minimal interval, minimal levels, preferable precisions |
The attribute defines a subgraph with the same quantization intervals alignment. ``FakeQuantize`` operations are included. The attribute is used by quantization operations.
.. list-table::
:header-rows: 1
* - Property name
- Values
* - Required
- Yes
* - Defined
- Operation
* - Properties
- combined interval, minimal interval, minimal levels, preferable precisions
@endsphinxdirective

View File

@@ -1,11 +1,21 @@
# PrecisionPreserved Attribute {#openvino_docs_OV_UG_lpt_PrecisionPreserved}
ngraph::PrecisionPreservedAttribute class represents the `PrecisionPreserved` attribute.
@sphinxdirective
:ref:`ngraph::PrecisionPreservedAttribute <doxid-classngraph_1_1_precision_preserved_attribute>` class represents the ``PrecisionPreserved`` attribute.
The attribute defines a precision preserved operation. If the attribute is absent, then an operation is not precision preserved.
| Property name | Values |
|---------------|----------------------------------------------|
| Required | Yes |
| Defined | Operation |
| Properties | value (boolean) |
.. list-table::
:header-rows: 1
* - Property name
- Values
* - Required
- Yes
* - Defined
- Operation
* - Properties
- value (boolean)
@endsphinxdirective

View File

@@ -1,11 +1,21 @@
# Precisions Attribute {#openvino_docs_OV_UG_lpt_Precisions}
ngraph::PrecisionsAttribute class represents the `Precisions` attribute.
@sphinxdirective
:ref:`ngraph::PrecisionsAttribute <doxid-classngraph_1_1_precisions_attribute>` class represents the ``Precisions`` attribute.
The attribute defines precision which is required for input/output port or an operation.
| Property name | Values |
|---------------|----------------------------------------------|
| Required | Yes |
| Defined | Operation, input port, output port |
| Properties | precisions |
.. list-table::
:header-rows: 1
* - Property name
- Values
* - Required
- Yes
* - Defined
- Operation, input port, output port
* - Properties
- precisions
@endsphinxdirective

View File

@@ -1,11 +1,21 @@
# QuantizationAlignment Attribute {#openvino_docs_OV_UG_lpt_QuantizationAlignment}
ngraph::QuantizationAlignmentAttribute class represents the `QuantizationAlignment` attribute.
@sphinxdirective
The attribute defines a subgraph with the same quantization alignment. `FakeQuantize` operations are not included. The attribute is used by quantization operations.
:ref:`ngraph::QuantizationAlignmentAttribute <doxid-classngraph_1_1_quantization_alignment_attribute>` class represents the ``QuantizationAlignment`` attribute.
| Property name | Values |
|---------------|----------------------------------------------|
| Required | Yes |
| Defined | Operation |
| Properties | value (boolean) |
The attribute defines a subgraph with the same quantization alignment. ``FakeQuantize`` operations are not included. The attribute is used by quantization operations.
.. list-table::
:header-rows: 1
* - Property name
- Values
* - Required
- Yes
* - Defined
- Operation
* - Properties
- value (boolean)
@endsphinxdirective

View File

@@ -1,11 +1,21 @@
# QuantizationGranularity Attribute {#openvino_docs_OV_UG_lpt_QuantizationGranularity}
ngraph::QuantizationAttribute class represents the `QuantizationGranularity` attribute.
@sphinxdirective
ngraph::QuantizationAttribute class represents the ``QuantizationGranularity`` attribute.
The attribute defines quantization granularity of operation inputs.
| Property name | Values |
|---------------|----------------------------------------------|
| Required | No |
| Defined | Input ports |
| Properties | Quantization granularity |
.. list-table::
:header-rows: 1
* - Property name
- Values
* - Required
- No
* - Defined
- Input ports
* - Properties
- Quantization granularity
@endsphinxdirective

View File

@@ -15,305 +15,455 @@
Step 3. Main transformations <openvino_docs_OV_UG_lpt_step3_main>
Step 4. Cleanup transformations <openvino_docs_OV_UG_lpt_step4_cleanup>
@endsphinxdirective
## Introduction
Introduction
############
Low precision transformations (known as LPT) are a set of nGraph transformations, which are combined in one library. The library is mandatory part of OpenVINO to infer quantized model in low precision with the maximum performance on Intel CPU, GPU and ARM platforms. The library includes more than 45 transformations and supports more then 30 operations. Some transformations are mandatory, some of them are optional and developed for specific device.
The goal of Low Precision Transformations (LPT) is to transform a quantized model from its original precision (FP16 or FP32) to a low precision (INT8: `signed int8` or `unsigned int8`), so that it is prepared for low precision inference in OpenVINO™ plugin. It is achieved by two main principles:
1. `FakeQuantize` operation decomposition to two parts:
- part #1: quantize operation - new `FakeQuantize` operation with output quantization intervals in low precision range (signed int8: [-128, 127] or [-127, 127], unsigned int8: [0, 255] or [0, 256]) and with low precision output (`signed int8` or `unsigned int8`),
- part #2: dequantization operations with low precision input and original precision output.
The goal of Low Precision Transformations (LPT) is to transform a quantized model from its original precision (FP16 or FP32) to a low precision (INT8: ``signed int8`` or ``unsigned int8``), so that it is prepared for low precision inference in OpenVINO™ plugin. It is achieved by two main principles:
1. ``FakeQuantize`` operation decomposition to two parts:
* part 1: quantize operation - new ``FakeQuantize`` operation with output quantization intervals in low precision range (signed int8: [-128, 127] or [-127, 127], unsigned int8: [0, 255] or [0, 256]) and with low precision output (``signed int8`` or ``unsigned int8``).
* part 2: dequantization operations with low precision input and original precision output.
2. Propagation of the dequantization operation through original model's operations. It is done to avoid dequantization operations before original model operations, thus the quantize operations with low precision output remain before the original model operations.
As result, operation input tensor precisions will be changed from original to low precision and operations can be inferred by OpenVINO™ plugin in low precision.
For a more detailed description on how to quantize a model, see the [Low precision tools](#low-precision-tools) section below. For more information about model quantization, refer to **Brief History of Lower Precision in Deep Learning** section in [this whitepaper](https://software.intel.com/en-us/articles/lower-numerical-precision-deep-learning-inference-and-training).
For a more detailed description on how to quantize a model, see the `Low precision tools <#low-precision-tools>`__ section below. For more information about model quantization, refer to **Brief History of Lower Precision in Deep Learning** section in `this whitepaper <https://software.intel.com/en-us/articles/lower-numerical-precision-deep-learning-inference-and-training>`__.
## Input model requirements
Input model requirements
########################
LPT transformations propagate dequantization operations through the following operations:
* [Add-1](@ref openvino_docs_ops_arithmetic_Add_1)
* [AvgPool-1](@ref openvino_docs_ops_pooling_AvgPool_1)
* [Clamp-1](@ref openvino_docs_ops_activation_Clamp_1)
* [Concat-1](@ref openvino_docs_ops_movement_Concat_1)
* [Convolution-1](@ref openvino_docs_ops_convolution_Convolution_1)
* [ConvolutionBackpropData-1](@ref openvino_docs_ops_convolution_ConvolutionBackpropData_1)
* [DepthToSpace-1](@ref openvino_docs_ops_movement_DepthToSpace_1)
* [FakeQuantize-1](@ref openvino_docs_ops_quantization_FakeQuantize_1)
* [GroupConvolution-1](@ref openvino_docs_ops_convolution_GroupConvolution_1)
* [Interpolate-1](@ref openvino_docs_ops_image_Interpolate_1)
* [Interpolate-4](@ref openvino_docs_ops_image_Interpolate_4)
* [MatMul-1](@ref openvino_docs_ops_matrix_MatMul_1)
* [MaxPool-1](@ref openvino_docs_ops_pooling_MaxPool_1)
* [Multiply-1](@ref openvino_docs_ops_arithmetic_Multiply_1)
* [MVN-1](@ref openvino_docs_ops_normalization_MVN_1)
* [NormalizeL2-1](@ref openvino_docs_ops_normalization_NormalizeL2_1)
* [PRelu-1](@ref openvino_docs_ops_activation_PReLU_1)
* [ReduceMax-1](@ref openvino_docs_ops_reduction_ReduceMax_1)
* [ReduceMean-1](@ref openvino_docs_ops_reduction_ReduceMean_1)
* [ReduceMin-1](@ref openvino_docs_ops_reduction_ReduceMin_1)
* [ReduceSum-1](@ref openvino_docs_ops_reduction_ReduceSum_1)
* [Relu-1](@ref openvino_docs_ops_activation_ReLU_1)
* [Reshape-1](@ref openvino_docs_ops_shape_Reshape_1)
* [Split-1](@ref openvino_docs_ops_movement_Split_1)
* [Squeeze-1](@ref openvino_docs_ops_shape_Reshape_1)
* [StridedSlice-1](@ref openvino_docs_ops_movement_StridedSlice_1)
* [Transpose-1](@ref openvino_docs_ops_movement_Transpose_1)
* [Gather-7](@ref openvino_docs_ops_movement_Gather_7)
* [Gather-8](@ref openvino_docs_ops_movement_Gather_8)
* [Unsqueeze-1](@ref openvino_docs_ops_shape_Unsqueeze_1)
* [VariadicSplit-1](@ref openvino_docs_ops_movement_VariadicSplit_1)
* :doc:`Add-1 <openvino_docs_ops_arithmetic_Add_1>`
* :doc:`AvgPool-1 <openvino_docs_ops_pooling_AvgPool_1>`
* :doc:`Clamp-1 <openvino_docs_ops_activation_Clamp_1>`
* :doc:`Concat-1 <openvino_docs_ops_movement_Concat_1>`
* :doc:`Convolution-1 <openvino_docs_ops_convolution_Convolution_1>`
* :doc:`ConvolutionBackpropData-1 <openvino_docs_ops_convolution_ConvolutionBackpropData_1>`
* :doc:`DepthToSpace-1 <openvino_docs_ops_movement_DepthToSpace_1>`
* :doc:`FakeQuantize-1 <openvino_docs_ops_quantization_FakeQuantize_1>`
* :doc:`GroupConvolution-1 <openvino_docs_ops_convolution_GroupConvolution_1>`
* :doc:`Interpolate-1 <openvino_docs_ops_image_Interpolate_1>`
* :doc:`Interpolate-4 <openvino_docs_ops_image_Interpolate_4>`
* :doc:`MatMul-1 <openvino_docs_ops_matrix_MatMul_1>`
* :doc:`MaxPool-1 <openvino_docs_ops_pooling_MaxPool_1>`
* :doc:`Multiply-1 <openvino_docs_ops_arithmetic_Multiply_1>`
* :doc:`MVN-1 <openvino_docs_ops_normalization_MVN_1>`
* :doc:`NormalizeL2-1 <openvino_docs_ops_normalization_NormalizeL2_1>`
* :doc:`PRelu-1 <openvino_docs_ops_activation_PReLU_1>`
* :doc:`ReduceMax-1 <openvino_docs_ops_reduction_ReduceMax_1>`
* :doc:`ReduceMean-1 <openvino_docs_ops_reduction_ReduceMean_1>`
* :doc:`ReduceMin-1 <openvino_docs_ops_reduction_ReduceMin_1>`
* :doc:`ReduceSum-1 <openvino_docs_ops_reduction_ReduceSum_1>`
* :doc:`Relu-1 <openvino_docs_ops_activation_ReLU_1>`
* :doc:`Reshape-1 <openvino_docs_ops_shape_Reshape_1>`
* :doc:`Split-1 <openvino_docs_ops_movement_Split_1>`
* :doc:`Squeeze-1 <openvino_docs_ops_shape_Reshape_1>`
* :doc:`StridedSlice-1 <openvino_docs_ops_movement_StridedSlice_1>`
* :doc:`Transpose-1 <openvino_docs_ops_movement_Transpose_1>`
* :doc:`Gather-7 <openvino_docs_ops_movement_Gather_7>`
* :doc:`Gather-8 <openvino_docs_ops_movement_Gather_8>`
* :doc:`Unsqueeze-1 <openvino_docs_ops_shape_Unsqueeze_1>`
* :doc:`VariadicSplit-1 <openvino_docs_ops_movement_VariadicSplit_1>`
If operation is not supported by LPT then dequantization operation will not be propagated, input tensor precisions will not be changed to low precision and operation will be executed in original precision.
For example, if you would like to infer a model with `Convolution` operation in low precision then the model can look as on picture below:
For example, if you would like to infer a model with ``Convolution`` operation in low precision then the model can look as on picture below:
![Quantized Convolution](img/model_fq_and_convolution.common.png)
.. image:: _static/images/model_fq_and_convolution.common.svg
:alt: Quantized Convolution
> There are several supported quantization approaches on activations and on weights. All supported approaches are described in [Quantization approaches](#quantization-approaches) section below. In demonstrated model [FakeQuantize operation quantization](#fakequantize-operation) approach is used.
There are several supported quantization approaches on activations and on weights. All supported approaches are described in `Quantization approaches <#quantization-approaches>`__ section below. In demonstrated model `FakeQuantize operation quantization <#fakequantize-operation>`__ approach is used.
### <a name="low-precision-tools"></a> Low precision tools
For more details on how to get a quantized model, refer to [Model Optimization](@ref openvino_docs_model_optimization_guide) document.
Low precision tools
+++++++++++++++++++
For more details on how to get a quantized model, refer to :doc:`Model Optimization <openvino_docs_model_optimization_guide>` document.
Quantization approaches
#######################
## <a name="quantization-approaches"></a> Quantization approaches
LPT transformations support two quantization approaches:
1. `FakeQuantize` operation,
1. ``FakeQuantize`` operation,
2. Quantize and dequantization operations
Let's explore both approaches in details on `Convolution` operation.
### <a name="fakequantize-operation"></a> FakeQuantize operation
In this case `FakeQuantize` operation is used on activations and quantized constant on weights. Original input model:
Let's explore both approaches in details on ``Convolution`` operation.
![Original model with FakeQuantize](img/model_fq_and_convolution.common.png)
FakeQuantize operation
++++++++++++++++++++++
### Quantize and dequantization operations
In this case `FakeQuantize` operation and `Convert` are used as quantize operation and return quantized low precision tensor. After quantize operation on activations there are `Convert` and dequantization operations to compensate decomposition. Original input model:
In this case ``FakeQuantize`` operation is used on activations and quantized constant on weights. Original input model:
![Original model with Q/DQ](img/model_qdq_and_convolution.common.png)
.. image:: _static/images/model_fq_and_convolution.common.svg
:alt: Original model with FakeQuantize
In both cases result is the same. In LPT result model you can see, that:
1. if necessary, `FakeQuantize` operations on activations were decomposed to two part:
- new `FakeQuantize`operation with updated output intervals in low precision range and low precision output,
- dequantization operations on activations;
2. if necessary, an existing `FakeQuantize` decomposition can be reworked to get better precision;
3. dequantization operations were propagated through `Convolution`.
Quantize and dequantization operations
++++++++++++++++++++++++++++++++++++++
In this case ``FakeQuantize`` operation and ``Convert`` are used as quantize operation and return quantized low precision tensor. After quantize operation on activations there are ``Convert`` and dequantization operations to compensate decomposition. Original input model:
.. image:: _static/images/model_qdq_and_convolution.common.svg
:alt: Original model with Q/DQ
In both cases result is the same. In LPT result model you can see that:
1. if necessary, ``FakeQuantize`` operations on activations were decomposed to two part:
* new ``FakeQuantize`` operation with updated output intervals in low precision range and low precision output,
* dequantization operations on activations;
2. if necessary, an existing ``FakeQuantize`` decomposition can be reworked to get better precision;
3. dequantization operations were propagated through ``Convolution``.
LPT result model:
![Result model](img/model_fq_and_convolution.transformed.png)
.. image:: _static/images/model_fq_and_convolution.transformed.svg
:alt: Result model
Low precision transformations pipeline
++++++++++++++++++++++++++++++++++++++
### Low precision transformations pipeline
LPT transformation pipeline has several steps. For each transformation inside one step pattern matcher is unique per transformation, but each operation can be assigned to several transformations.
![Low precision transformations pipeline](img/low_precision_transformation_pipeline.png)
.. image:: _static/images/low_precision_transformation_pipeline.svg
:alt: Low precision transformations pipeline
Inside each step LPT transformations handle input model operation by operation, applying transformation matching pattern for each transformation from the step to an operation, and execute transformation if pattern is matched. Decomposition transformation decomposes `FakeQuantize` to quantize and dequantization operations. Dequantization operations from previous transformation result is used for the current one and so on, until the end of the model is achieved.
Inside each step LPT transformations handle input model operation by operation, applying transformation matching pattern for each transformation from the step to an operation, and execute transformation if pattern is matched. Decomposition transformation decomposes ``FakeQuantize`` to quantize and dequantization operations. Dequantization operations from previous transformation result is used for the current one and so on, until the end of the model is achieved.
As result, usually all operations are inferred by plugin in low precision. If plugin doesn't support an operation inference in low precision, then corresponding LPT transformation can be disabled, and input tensor precisions for the operation will not be changed. In this case the operation is inferred in the original precision.
Low precision transformations pipeline includes four steps:
* [Step #1: Prerequisites](@ref openvino_docs_OV_UG_lpt_step1_prerequisites)
* [Step #2: Markup transformations](@ref openvino_docs_OV_UG_lpt_step2_markup)
* [Step #3: Main transformations](@ref openvino_docs_OV_UG_lpt_step3_main)
* [Step #4: Cleanup transformations](@ref openvino_docs_OV_UG_lpt_step4_cleanup)
### Step 1. Prerequisites
* :doc:`Step 1: Prerequisites <openvino_docs_OV_UG_lpt_step1_prerequisites>`
* :doc:`Step 2: Markup transformations <openvino_docs_OV_UG_lpt_step2_markup>`
* :doc:`Step 3: Main transformations <openvino_docs_OV_UG_lpt_step3_main>`
* :doc:`Step 4: Cleanup transformations <openvino_docs_OV_UG_lpt_step4_cleanup>`
Step 1. Prerequisites
---------------------
This step fuses and propagates some operations in the model to prepare for the next step. It is required for OpenVINO plugins. Transformations:
* [PullReshapeThroughDequantization](@ref openvino_docs_OV_UG_lpt_PullReshapeThroughDequantization)
* [PullTransposeThroughDequantization](@ref openvino_docs_OV_UG_lpt_PullTransposeThroughDequantization)
* [LinOpSequenceFusion](@ref openvino_docs_OV_UG_lpt_LinOpSequenceFusion)
The model on this step is changed. There are more details in developer guide [Prerequisites transformations](@ref openvino_docs_OV_UG_lpt_step1_prerequisites).
* :doc:`PullReshapeThroughDequantization <openvino_docs_OV_UG_lpt_PullReshapeThroughDequantization>`
* :doc:`PullTransposeThroughDequantization <openvino_docs_OV_UG_lpt_PullTransposeThroughDequantization>`
* :doc:`LinOpSequenceFusion <openvino_docs_OV_UG_lpt_LinOpSequenceFusion>`
The model on this step is changed. There are more details in developer guide :doc:`Prerequisites transformations <openvino_docs_OV_UG_lpt_step1_prerequisites>`.
Step 2. Markup
--------------
### Step 2. Markup
This step creates runtime attributes for operations. These attributes will be used in next step. Transformations:
* [MarkupBias](@ref openvino_docs_OV_UG_lpt_MarkupBias)
* [MarkupCanBeQuantized](@ref openvino_docs_OV_UG_lpt_MarkupCanBeQuantized)
* [MarkupPrecisions](@ref openvino_docs_OV_UG_lpt_MarkupPrecisions)
* [MarkupPerTensorQuantization](@ref openvino_docs_OV_UG_lpt_MarkupPerTensorQuantization)
* [MarkupAvgPoolPrecisionPreserved](@ref openvino_docs_OV_UG_lpt_MarkupAvgPoolPrecisionPreserved)
* [PropagatePrecisions](@ref openvino_docs_OV_UG_lpt_PropagatePrecisions)
* [AlignQuantizationIntervals](@ref openvino_docs_OV_UG_lpt_AlignQuantizationIntervals)
* [AlignQuantizationParameters](@ref openvino_docs_OV_UG_lpt_AlignQuantizationParameters)
The model on this step is changed: only new attributes are added to some operations. There are more details in developer guide [Markup transformations](@ref openvino_docs_OV_UG_lpt_step2_markup).
* :doc:`MarkupBias <openvino_docs_OV_UG_lpt_MarkupBias>`
* :doc:`MarkupCanBeQuantized <openvino_docs_OV_UG_lpt_MarkupCanBeQuantized>`
* :doc:`MarkupPrecisions <openvino_docs_OV_UG_lpt_MarkupPrecisions>`
* :doc:`MarkupPerTensorQuantization <openvino_docs_OV_UG_lpt_MarkupPerTensorQuantization>`
* :doc:`MarkupAvgPoolPrecisionPreserved <openvino_docs_OV_UG_lpt_MarkupAvgPoolPrecisionPreserved>`
* :doc:`PropagatePrecisions <openvino_docs_OV_UG_lpt_PropagatePrecisions>`
* :doc:`AlignQuantizationIntervals <openvino_docs_OV_UG_lpt_AlignQuantizationIntervals>`
* :doc:`AlignQuantizationParameters <openvino_docs_OV_UG_lpt_AlignQuantizationParameters>`
### Step 3. Main transformations, FakeQuantize decomposition and dequantization operations handling
This step has the most transformations. These transformations can be separated in two groups: decomposition transformation and dequantization operations handling. There are more details in developer guide [Main transformations](@ref openvino_docs_OV_UG_lpt_step3_main). Transformations:
* [AddTransformation](@ref openvino_docs_OV_UG_lpt_AddTransformation)
* [AvgPoolTransformation](@ref openvino_docs_OV_UG_lpt_AvgPoolTransformation)
* [ClampTransformation](@ref openvino_docs_OV_UG_lpt_AvgPoolTransformation)
* [ConcatTransformation](@ref openvino_docs_OV_UG_lpt_ConcatTransformation)
* [ConvolutionTransformation](@ref openvino_docs_OV_UG_lpt_ConvolutionTransformation)
* [ConvolutionBackpropDataTransformation](@ref openvino_docs_OV_UG_lpt_ConvolutionBackpropDataTransformation)
* [DepthToSpaceTransformation](@ref openvino_docs_OV_UG_lpt_DepthToSpaceTransformation)
* [FakeQuantizeDecompositionTransformation](@ref openvino_docs_OV_UG_lpt_FakeQuantizeDecompositionTransformation)
* [FakeQuantizeTransformation](@ref openvino_docs_OV_UG_lpt_FakeQuantizeTransformation)
* [InterpolateTransformation](@ref openvino_docs_OV_UG_lpt_InterpolateTransformation)
* [GroupConvolutionTransformation](@ref openvino_docs_OV_UG_lpt_GroupConvolutionTransformation)
* [GatherTransformation](@ref openvino_docs_OV_UG_lpt_GatherTransformation)
* [MatMulTransformation](@ref openvino_docs_OV_UG_lpt_MatMulTransformation)
* [MaxPoolTransformation](@ref openvino_docs_OV_UG_lpt_MaxPoolTransformation)
* [MultiplyTransformation](@ref openvino_docs_OV_UG_lpt_MultiplyTransformation)
* [MVNTransformation](@ref openvino_docs_OV_UG_lpt_MVNTransformation)
* [NormalizeL2Transformation](@ref openvino_docs_OV_UG_lpt_NormalizeL2Transformation)
* [PReluTransformation](@ref openvino_docs_OV_UG_lpt_PReluTransformation)
* [ReduceMaxTransformation](@ref openvino_docs_OV_UG_lpt_ReduceMaxTransformation)
* [ReduceMeanTransformation](@ref openvino_docs_OV_UG_lpt_ReduceMeanTransformation)
* [ReduceMinTransformation](@ref openvino_docs_OV_UG_lpt_ReduceMinTransformation)
* [ReduceSumTransformation](@ref openvino_docs_OV_UG_lpt_ReduceSumTransformation)
* [ReluTransformation](@ref openvino_docs_OV_UG_lpt_ReluTransformation)
* [ReshapeTransformation](@ref openvino_docs_OV_UG_lpt_ReshapeTransformation)
* [SqueezeTransformation](@ref openvino_docs_OV_UG_lpt_SqueezeTransformation)
* [ShuffleChannelsTransformation](@ref openvino_docs_OV_UG_lpt_ShuffleChannelsTransformation)
* [SplitTransformation](@ref openvino_docs_OV_UG_lpt_SplitTransformation)
* [StridedSliceTransformation](@ref openvino_docs_OV_UG_lpt_StridedSliceTransformation)
* [TransposeTransformation](@ref openvino_docs_OV_UG_lpt_TransposeTransformation)
* [UnsqueezeTransformation](@ref openvino_docs_OV_UG_lpt_UnsqueezeTransformation)
* [VariadicSplitTransformation](@ref openvino_docs_OV_UG_lpt_VariadicSplitTransformation)
The model on this step is changed: only new attributes are added to some operations. There are more details in developer guide :doc:`Markup transformations <openvino_docs_OV_UG_lpt_step2_markup>`.
#### Decomposition transformations
Decomposition transformations decompose the `FakeQuantize` operation to: quantize (`FakeQuantize` with low precision output) and dequantization operations (opposite to quantize, with low precision input and the original precision output). For dequantization operations LPT uses three operations: `Convert`, `Subtract` and `Multiply`. Element-wise operations `Subtract` and `Multiply` have constants on the second branches. If dequantization operations are not handled at the end of LPT pipeline, then they will be fused back to the `FakeQuantize`.
Step 3. Main transformations, FakeQuantize decomposition and dequantization operations handling
-----------------------------------------------------------------------------------------------
This step has the most transformations. These transformations can be separated in two groups: decomposition transformation and dequantization operations handling. There are more details in developer guide :doc:`Main transformations <openvino_docs_OV_UG_lpt_step3_main>`.
Transformations:
* :doc:`AddTransformation <openvino_docs_OV_UG_lpt_AddTransformation>`
* :doc:`AvgPoolTransformation <openvino_docs_OV_UG_lpt_AvgPoolTransformation>`
* :doc:`ClampTransformation <openvino_docs_OV_UG_lpt_AvgPoolTransformation>`
* :doc:`ConcatTransformation <openvino_docs_OV_UG_lpt_ConcatTransformation>`
* :doc:`ConvolutionTransformation <openvino_docs_OV_UG_lpt_ConvolutionTransformation>`
* :doc:`ConvolutionBackpropDataTransformation <openvino_docs_OV_UG_lpt_ConvolutionBackpropDataTransformation>`
* :doc:`DepthToSpaceTransformation <openvino_docs_OV_UG_lpt_DepthToSpaceTransformation>`
* :doc:`FakeQuantizeDecompositionTransformation <openvino_docs_OV_UG_lpt_FakeQuantizeDecompositionTransformation>`
* :doc:`FakeQuantizeTransformation <openvino_docs_OV_UG_lpt_FakeQuantizeTransformation>`
* :doc:`InterpolateTransformation <openvino_docs_OV_UG_lpt_InterpolateTransformation>`
* :doc:`GroupConvolutionTransformation <openvino_docs_OV_UG_lpt_GroupConvolutionTransformation>`
* :doc:`GatherTransformation <openvino_docs_OV_UG_lpt_GatherTransformation>`
* :doc:`MatMulTransformation <openvino_docs_OV_UG_lpt_MatMulTransformation>`
* :doc:`MaxPoolTransformation <openvino_docs_OV_UG_lpt_MaxPoolTransformation>`
* :doc:`MultiplyTransformation <openvino_docs_OV_UG_lpt_MultiplyTransformation>`
* :doc:`MVNTransformation <openvino_docs_OV_UG_lpt_MVNTransformation>`
* :doc:`NormalizeL2Transformation <openvino_docs_OV_UG_lpt_NormalizeL2Transformation>`
* :doc:`PReluTransformation <openvino_docs_OV_UG_lpt_PReluTransformation>`
* :doc:`ReduceMaxTransformation <openvino_docs_OV_UG_lpt_ReduceMaxTransformation>`
* :doc:`ReduceMeanTransformation <openvino_docs_OV_UG_lpt_ReduceMeanTransformation>`
* :doc:`ReduceMinTransformation <openvino_docs_OV_UG_lpt_ReduceMinTransformation>`
* :doc:`ReduceSumTransformation <openvino_docs_OV_UG_lpt_ReduceSumTransformation>`
* :doc:`ReluTransformation <openvino_docs_OV_UG_lpt_ReluTransformation>`
* :doc:`ReshapeTransformation <openvino_docs_OV_UG_lpt_ReshapeTransformation>`
* :doc:`SqueezeTransformation <openvino_docs_OV_UG_lpt_SqueezeTransformation>`
* :doc:`ShuffleChannelsTransformation <openvino_docs_OV_UG_lpt_ShuffleChannelsTransformation>`
* :doc:`SplitTransformation <openvino_docs_OV_UG_lpt_SplitTransformation>`
* :doc:`StridedSliceTransformation <openvino_docs_OV_UG_lpt_StridedSliceTransformation>`
* :doc:`TransposeTransformation <openvino_docs_OV_UG_lpt_TransposeTransformation>`
* :doc:`UnsqueezeTransformation <openvino_docs_OV_UG_lpt_UnsqueezeTransformation>`
* :doc:`VariadicSplitTransformation <openvino_docs_OV_UG_lpt_VariadicSplitTransformation>`
Decomposition transformations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Decomposition transformations decompose the ``FakeQuantize`` operation to: quantize (``FakeQuantize`` with low precision output) and dequantization operations (opposite to quantize, with low precision input and the original precision output). For dequantization operations LPT uses three operations: ``Convert``, ``Subtract`` and ``Multiply``. Element-wise operations ``Subtract`` and ``Multiply`` have constants on the second branches. If dequantization operations are not handled at the end of LPT pipeline, then they will be fused back to the ``FakeQuantize``.
Original `FakeQuantize`:
![FakeQuantize operation before LPT](quantization/img/fq.common.png)
Original ``FakeQuantize``:
.. image:: _static/images/fq.common.svg
:alt: FakeQuantize operation before LPT
`FakeQuantize` after decomposition to quantization and dequantization operations:
![FakeQuantize operation after LPT](quantization/img/fq.transformed.png)
``FakeQuantize`` after decomposition to quantization and dequantization operations:
.. image:: _static/images/fq.transformed.svg
:alt: FakeQuantize operation after LPT
#### Dequantization operations handling transformations
Dequantization operations handling transformations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In this step, LPT transformations fuse dequantization operations or move them through existing model operations as much as possible.
Original `Convolution` operation in FP32 with dequantization operations before:
![Convolution operation before LPT](img/model_fq_and_convolution.common.png)
Original ``Convolution`` operation in FP32 with dequantization operations before:
`Convolution` operation in INT8 after decomposition and dequantization operations handling:
![Convolution operation after LPT](img/model_fq_and_convolution.transformed.png)
.. image:: _static/images/model_fq_and_convolution.common.svg
:alt: Convolution operation before LPT
### Step 4: Cleanup of the result model
LPT cleanup transformations is final stage in LPT pipeline. In this step LPT transformations clean up the result model to avoid not handled dequantization operations: fuse dequantization operations if possible (fuse at least `Convert` operations if not) to other model operations to cleanup result model. Transformations:
* [FoldConvertTransformation](@ref openvino_docs_OV_UG_lpt_FoldConvertTransformation)
* [FoldFakeQuantizeTransformation](@ref openvino_docs_OV_UG_lpt_FoldFakeQuantizeTransformation)
* [FuseConvertTransformation](@ref openvino_docs_OV_UG_lpt_FuseConvertTransformation)
* [FuseMultiplyToFakeQuantizeTransformation](@ref openvino_docs_OV_UG_lpt_FuseMultiplyToFakeQuantizeTransformation)
* [FuseSubtractToFakeQuantizeTransformation](@ref openvino_docs_OV_UG_lpt_FuseSubtractToFakeQuantizeTransformation)
* [MultiplyToGroupConvolutionTransformation](@ref openvino_docs_OV_UG_lpt_MultiplyToGroupConvolutionTransformation)
``Convolution`` operation in INT8 after decomposition and dequantization operations handling:
There are more details in developer guide [Cleanup transformations](@ref openvino_docs_OV_UG_lpt_step4_cleanup).
`FakeQuantize` operation with not handled dequantization operations:
![TODO: FakeQuantize operation with dequantization operations before LPT](quantization/img/fq.transformed.png)
`FakeQuantize` operation with fused dequantization operations:
![TODO: FakeQuantize operation with fused operations after LPT](quantization/img/fq.common.png)
.. image:: _static/images/model_fq_and_convolution.transformed.svg
:alt: Convolution operation after LPT
Step 4: Cleanup of the result model
-----------------------------------
LPT cleanup transformations is final stage in LPT pipeline. In this step LPT transformations clean up the result model to avoid not handled dequantization operations: fuse dequantization operations if possible (fuse at least ``Convert`` operations if not` to other model operations to cleanup result model).
Transformations:
* :doc:`EliminateFakeQuantizeTransformation <openvino_docs_OV_UG_lpt_EliminateFakeQuantizeTransformation>`
* :doc:`FoldConvertTransformation <openvino_docs_OV_UG_lpt_FoldConvertTransformation>`
* :doc:`FoldFakeQuantizeTransformation <openvino_docs_OV_UG_lpt_FoldFakeQuantizeTransformation>`
* :doc:`FuseConvertTransformation <openvino_docs_OV_UG_lpt_FuseConvertTransformation>`
* :doc:`FuseMultiplyToFakeQuantizeTransformation <openvino_docs_OV_UG_lpt_FuseMultiplyToFakeQuantizeTransformation>`
* :doc:`FuseSubtractToFakeQuantizeTransformation <openvino_docs_OV_UG_lpt_FuseSubtractToFakeQuantizeTransformation>`
* :doc:`MultiplyToGroupConvolutionTransformation <openvino_docs_OV_UG_lpt_MultiplyToGroupConvolutionTransformation>`
There are more details in developer guide :doc:`Cleanup transformations <openvino_docs_OV_UG_lpt_step4_cleanup>`.
``FakeQuantize`` operation with not handled dequantization operations:
.. image:: _static/images/fq.transformed.svg
:alt: TODO: FakeQuantize operation with dequantization operations before LPT
``FakeQuantize`` operation with fused dequantization operations:
.. image:: _static/images/fq.common.svg
:alt: TODO: FakeQuantize operation with fused operations after LPT
Low precision transformations in plugin transformation pipeline
###############################################################
## Low precision transformations in plugin transformation pipeline
Typical transformation pipeline described below.
### Step 1. Common optimizations
Step 1. Common optimizations
++++++++++++++++++++++++++++
This step is optional for LPT but typically is presented in OpenVINO™ plugins. The step doesn't use any LPT transformation. Firstly, the step disables dequantization operations constant folding on constant subgraph on weights to prevent the lost of dequantization info on the next plugin transformations. After that, it optimizes nGraph function and convert operations to operation set 1. Typically, usage of this step is the simplest way to meet LPT requirements for the input quantized model. If plugin can guarantee that LPT input requirements are met, then this step can be skipped.
@snippet snippets/lpt_intel_cpu_plugin.cpp lpt_common
.. doxygensnippet:: docs/snippets/lpt_intel_cpu_plugin.cpp
:language: cpp
:fragment: [lpt_common]
### Step 2. Low precision transformations execution
Step 2. Low precision transformations execution
+++++++++++++++++++++++++++++++++++++++++++++++
This step is mandatory. It configures and runs LPT transformations.
@snippet snippets/lpt_intel_cpu_plugin.cpp lpt_execution
.. doxygensnippet:: docs/snippets/lpt_intel_cpu_plugin.cpp
:language: cpp
:fragment: [lpt_execution]
Step 3. Plugin-specific transformations
+++++++++++++++++++++++++++++++++++++++
### Step 3. Plugin-specific transformations
This step is optional. It modifies the nGraph function to a device-specific operation set.
@snippet snippets/lpt_intel_cpu_plugin.cpp lpt_device
.. doxygensnippet:: docs/snippets/lpt_intel_cpu_plugin.cpp
:language: cpp
:fragment: [lpt_device]
## Result model overview
Result model overview
#####################
Let's explore quantized [TensorFlow* implementation of ResNet-50](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/resnet-50-tf) model. Use [Model Downloader](@ref omz_tools_downloader) tool to download the `fp16` model from [OpenVINO™ Toolkit - Open Model Zoo repository](https://github.com/openvinotoolkit/open_model_zoo):
```sh
omz_downloader --name resnet-50-tf --precisions FP16-INT8
```
After that you should quantize model by the [Model Quantizer](@ref omz_tools_downloader) tool.
```sh
omz_quantizer --model_dir public/resnet-50-tf --dataset_dir <DATASET_DIR> --precisions=FP16-INT8
```
Let's explore quantized `TensorFlow implementation of ResNet-50 <https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/resnet-50-tf>`__ model. Use :doc:`Model Downloader <omz_tools_downloader>` tool to download the ``fp16`` model from `OpenVINO™ Toolkit - Open Model Zoo repository <https://github.com/openvinotoolkit/open_model_zoo>`__:
### Inference
.. code-block:: sh
omz_downloader --name resnet-50-tf --precisions FP16-INT8
After that you should quantize model by the :doc:`Model Quantizer <omz_tools_downloader>` tool.
.. code-block:: sh
omz_quantizer --model_dir public/resnet-50-tf --dataset_dir <DATASET_DIR> --precisions=FP16-INT8
Inference
+++++++++
The simplest way to infer the model and collect performance counters is :doc:`Benchmark Application <openvino_inference_engine_samples_benchmark_app_README>`.
.. code-block:: sh
./benchmark_app -m resnet-50-tf.xml -d CPU -niter 1 -api sync -report_type average_counters -report_folder pc_report_dir
The simplest way to infer the model and collect performance counters is [Benchmark Application](../../../../samples/cpp/benchmark_app/README.md).
```sh
./benchmark_app -m resnet-50-tf.xml -d CPU -niter 1 -api sync -report_type average_counters -report_folder pc_report_dir
```
If you infer the model with the OpenVINO™ CPU plugin and collect performance counters, all operations (except last not quantized SoftMax) are executed in INT8 precision.
### Results analysis
Results analysis
++++++++++++++++
Result model depends on different factors:
* The original model quantization possibility and quantization quality. For some models, some operations are not possible to be quantized by POT and NNCF tools. In this case `FakeQuantize` operations are absent before these operations and they will be inferred in original precision.
* The original model quantization possibility and quantization quality. For some models, some operations are not possible to be quantized by NNCF tool. In this case ``FakeQuantize`` operations are absent before these operations and they will be inferred in original precision.
* LPT customization and plugin supported operations. If plugin doesn't support INT8 inference for some operation then corresponding LPT transformation should be disabled and the operation will be inferred in original precision.
Information about layer precision is stored in the performance counters that are
available from the OpenVINO Runtime API. For example, the part of performance counters table for quantized [TensorFlow* implementation of ResNet-50](https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/resnet-50-tf) model inference on CPU Plugin looks as follows:
available from the OpenVINO Runtime API. For example, the part of performance counters table for quantized `TensorFlow implementation of ResNet-50 <https://github.com/openvinotoolkit/open_model_zoo/tree/master/models/public/resnet-50-tf>`__ model inference on CPU Plugin looks as follows:
.. list-table::
:header-rows: 1
* - layerName
- execStatus
- layerType
- execType
- realTime (ms)
- cpuTime (ms)
* - resnet_model/batch_normalization_15/FusedBatchNorm/Add
- EXECUTED
- Convolution
- jit_avx512_1x1_I8
- 0.377
- 0.377
* - resnet_model/conv2d_16/Conv2D/fq_input_0
- NOT_RUN
- FakeQuantize
- undef
- 0
- 0
* - resnet_model/batch_normalization_16/FusedBatchNorm/Add
- EXECUTED
- Convolution
- jit_avx512_I8
- 0.499
- 0.499
* - resnet_model/conv2d_17/Conv2D/fq_input_0
- NOT_RUN
- FakeQuantize
- undef
- 0
- 0
* - resnet_model/batch_normalization_17/FusedBatchNorm/Add
- EXECUTED
- Convolution
- jit_avx512_1x1_I8
- 0.399
- 0.399
* - resnet_model/add_4/fq_input_0
- NOT_RUN
- FakeQuantize
- undef
- 0
- 0
* - resnet_model/add_4
- NOT_RUN
- Eltwise
- undef
- 0
- 0
* - resnet_model/add_5/fq_input_1
- NOT_RUN
- FakeQuantize
- undef
- 0
- 0
| layerName | execStatus | layerType | execType | realTime (ms) | cpuTime (ms) |
| --------------------------------------------------------- | ---------- | ------------ | -------------------- | ------------- | ------------ |
| resnet\_model/batch\_normalization\_15/FusedBatchNorm/Add | EXECUTED | Convolution | jit\_avx512\_1x1\_I8 | 0.377 | 0.377 |
| resnet\_model/conv2d\_16/Conv2D/fq\_input\_0 | NOT\_RUN | FakeQuantize | undef | 0 | 0 |
| resnet\_model/batch\_normalization\_16/FusedBatchNorm/Add | EXECUTED | Convolution | jit\_avx512\_I8 | 0.499 | 0.499 |
| resnet\_model/conv2d\_17/Conv2D/fq\_input\_0 | NOT\_RUN | FakeQuantize | undef | 0 | 0 |
| resnet\_model/batch\_normalization\_17/FusedBatchNorm/Add | EXECUTED | Convolution | jit\_avx512\_1x1\_I8 | 0.399 | 0.399 |
| resnet\_model/add\_4/fq\_input\_0 | NOT\_RUN | FakeQuantize | undef | 0 | 0 |
| resnet\_model/add\_4 | NOT\_RUN | Eltwise | undef | 0 | 0 |
| resnet\_model/add\_5/fq\_input\_1 | NOT\_RUN | FakeQuantize | undef | 0 | 0 |
The ``execStatus`` column of the table includes possible values:
* ``EXECUTED`` - layer was executed by standalone primitive,
* ``NOT_RUN`` - layer was not executed by standalone primitive or was fused with another operation and executed in another layer primitive.
> The `execStatus` column of the table includes possible values:
> - `EXECUTED` - layer was executed by standalone primitive,
> - `NOT_RUN` - layer was not executed by standalone primitive or was fused with another operation and executed in another layer primitive.
>
> The `execType` column of the table includes inference primitives with specific suffixes. The layers have the following marks:
> * Suffix `I8` for layers that had 8-bit data type input and were computed in 8-bit precision
> * Suffix `FP32` for layers computed in 32-bit precision
The ``execType`` column of the table includes inference primitives with specific suffixes. The layers have the following marks:
As result all operations (except not quantized `SoftMax` at the end of the model) in OpenVINO™ CPU plugin are inferred in low precision. Note, please, in the result model there are `FakeQuantize` operations in FP32 but the plugin responsibility is fuse these operations with previous operations. OpenVINO™ CPU plugin achieves maximum optimized inference for all operations by fusing INT8 `Convolution` with FP32 output with `FakeQuantize` operation with FP32 input and INT8 output. In this case OpenVINO™ CPU plugin uses INT8 and FP32 vectorized instructions but reports about one INT8 kernel usage for inference, which is the most optimized for this case.
* Suffix ``I8`` for layers that had 8-bit data type input and were computed in 8-bit precision
* Suffix ``FP32`` for layers computed in 32-bit precision
## Mixed precision
If LPT input model operation output has `fp16` precision then dequantization computations still occurs in `fp32` precision. This approach is used to avoid accuracy loss in `fp16` arithmetic computations. The ultimate output of the dequantization operation will have the `fp16` precision, as expected.
As result all operations (except not quantized ``SoftMax`` at the end of the model) in OpenVINO™ CPU plugin are inferred in low precision. Note, please, in the result model there are ``FakeQuantize`` operations in FP32 but the plugin responsibility is fuse these operations with previous operations. OpenVINO™ CPU plugin achieves maximum optimized inference for all operations by fusing INT8 ``Convolution`` with FP32 output with ``FakeQuantize`` operation with FP32 input and INT8 output. In this case OpenVINO™ CPU plugin uses INT8 and FP32 vectorized instructions but reports about one INT8 kernel usage for inference, which is the most optimized for this case.
Mixed precision
###############
If LPT input model operation output has ``fp16`` precision then dequantization computations still occurs in ``fp32`` precision. This approach is used to avoid accuracy loss in ``fp16`` arithmetic computations. The ultimate output of the dequantization operation will have the ``fp16`` precision, as expected.
Customization
#############
## Customization
Low Precision Transformations can be customizable. Build-in customization options:
* operation precision restrictions,
* operation per tensor quantization restrictions,
* update precisions,
* dequantization precision.
Operation precision restrictions
++++++++++++++++++++++++++++++++
### Operation precision restrictions
This option defines precisions which allowed for the operation input ports. The option value is passed as input argument for `LowPrecision` constructor. For example:
This option defines precisions which allowed for the operation input ports. The option value is passed as input argument for ``LowPrecision`` constructor. For example:
@snippet snippets/lpt_intel_cpu_plugin.cpp lpt_supported_precisions
.. doxygensnippet:: docs/snippets/lpt_intel_cpu_plugin.cpp
:language: cpp
:fragment: [lpt_supported_precisions]
In provided example in result model ``Convolution`` operation inputs must have specific precisions: ``u8`` (unsigned int8) precision on input 0 (on activations) and ``i8`` (signed int8) precision on input 1 (on weights).
In provided example in result model `Convolution` operation inputs must have specific precisions: `u8` (unsigned int8) precision on input 0 (on activations) and `i8` (signed int8) precision on input 1 (on weights).
Operation per tensor quantization restrictions
++++++++++++++++++++++++++++++++++++++++++++++
### Operation per tensor quantization restrictions
This option defines if operation supports per-tensor quantization only. The option value is passed as input argument for `LowPrecision` constructor. For example:
This option defines if operation supports per-tensor quantization only. The option value is passed as input argument for ``LowPrecision`` constructor. For example:
@snippet snippets/lpt_intel_cpu_plugin.cpp per_tensor_quantization
.. doxygensnippet:: docs/snippets/lpt_intel_cpu_plugin.cpp
:language: cpp
:fragment: [per_tensor_quantization]
In provided example in result model `Convolution` operations must have per-tensor quantization on input 0 (on activations).
In provided example in result model ``Convolution`` operations must have per-tensor quantization on input 0 (on activations).
### Update precisions
This option defines if each LPT transformation updates precision or not. The option value is boolean and is passed as `updatePrecisions` member of `LayerTransformation::Params` which is input argument for `LowPrecision` constructor. All transformations are affected. If `true` then low precision transformations update precisions to low precision and doesn't if `false`. Typically this option is used for plugin debugging.
Update precisions
++++++++++++++++++
### Typical customization use cases
This option defines if each LPT transformation updates precision or not. The option value is boolean and is passed as ``updatePrecisions`` member of ``LayerTransformation::Params`` which is input argument for ``LowPrecision`` constructor. All transformations are affected. If ``true`` then low precision transformations update precisions to low precision and doesn't if ``false``. Typically this option is used for plugin debugging.
Plugin specific customization can be implemented via nGraph transformation callbacks. For example: asymmetric quantization support can be easily customizable via `LayerTransformation::isAsymmetricQuantization` and `WeightableLayerTransformation::isAsymmetricOnWeights` methods usage in callbacks. For example:
Typical customization use cases
+++++++++++++++++++++++++++++++
@snippet snippets/lpt_intel_cpu_plugin.cpp asymmetric_quantization
Plugin specific customization can be implemented via nGraph transformation callbacks. For example: asymmetric quantization support can be easily customizable via ``LayerTransformation::isAsymmetricQuantization`` and ``WeightableLayerTransformation::isAsymmetricOnWeights`` methods usage in callbacks. For example:
.. doxygensnippet:: docs/snippets/lpt_intel_cpu_plugin.cpp
:language: cpp
:fragment: [asymmetric_quantization]
@endsphinxdirective

View File

@@ -14,44 +14,89 @@
QuantizationAlignment <openvino_docs_OV_UG_lpt_QuantizationAlignment>
QuantizationGranularity <openvino_docs_OV_UG_lpt_QuantizationGranularity>
@endsphinxdirective
Introduction
############
## Introduction
.. list-table::
:header-rows: 1
| Name | Target | Required | Mutable |
|-------------------------------------------------------------------------------------|--------------------------|----------|---------|
| [AvgPoolPrecisionPreserved](@ref openvino_docs_OV_UG_lpt_AvgPoolPrecisionPreserved) | Precision | No | Yes |
| [IntervalsAlignment](@ref openvino_docs_OV_UG_lpt_IntervalsAlignment) | Quantization interval | Yes | Yes |
| [PrecisionPreserved](@ref openvino_docs_OV_UG_lpt_PrecisionPreserved) | Precision | Yes | Yes |
| [Precisions](@ref openvino_docs_OV_UG_lpt_Precisions) | Precision | Yes | Yes |
| [QuantizationAlignment](@ref openvino_docs_OV_UG_lpt_QuantizationAlignment) | Quantization granularity | Yes | Yes |
| [QuantizationGranularity](@ref openvino_docs_OV_UG_lpt_QuantizationGranularity) | Quantization granularity | Yes | No |
* - Name
- Target
- Required
- Mutable
* - :doc:`AvgPoolPrecisionPreserved <openvino_docs_OV_UG_lpt_AvgPoolPrecisionPreserved>`
- Precision
- No
- Yes
* - :doc:`IntervalsAlignment <openvino_docs_OV_UG_lpt_IntervalsAlignment>`
- Quantization interval
- Yes
- Yes
* - :doc:`PrecisionPreserved <openvino_docs_OV_UG_lpt_PrecisionPreserved>`
- Precision
- Yes
- Yes
* - :doc:`Precisions <openvino_docs_OV_UG_lpt_Precisions>`
- Precision
- Yes
- Yes
* - :doc:`QuantizationAlignment <openvino_docs_OV_UG_lpt_QuantizationAlignment>`
- Quantization granularity
- Yes
- Yes
* - :doc:`QuantizationGranularity <openvino_docs_OV_UG_lpt_QuantizationGranularity>`
- Quantization granularity
- Yes
- No
> `Target` attribute group defines attribute usage during model transformation for the best performance:
> - `Precision` - the attribute defines the most optimal output port precision.
> - `Quantization interval` - the attribute defines quantization interval.
> - `Quantization alignment` - the attribute defines quantization granularity in runtime: per-channel or per-tensor quantization.
> - `Quantization granularity` - the attribute is set by plugin to define quantization granularity: per-channel or per-tensor quantization.
>
> `Required` attribute group defines if attribute usage is required to get an optimal model during transformation:
> - `Yes` - the attribute is used by all OpenVINO plugins for low-precision optimization.
> - `No` - the attribute is used in a specific OpenVINO plugin.
>
> `Mutable` attribute group defines if transformation can update an existing attribute:
> - `Yes` - the attribute can be updated by the next transformations in the pipeline. But attribute update order is still important.
> - `No` - existing attribute can not be updated by the next transformation. Previous handled transformation has optimized a model according to the current value.
``Target`` attribute group defines attribute usage during model transformation for the best performance:
`FakeQuantize` decomposition is a mandatory part of low precision transformations. Attributes used during decomposition are mandatory. Optional attributes are required only for certain operations.
* ``Precision`` - the attribute defines the most optimal output port precision.
* ``Quantization interval`` - the attribute defines quantization interval.
* ``Quantization alignment`` - the attribute defines quantization granularity in runtime: per-channel or per-tensor quantization.
* ``Quantization granularity`` - the attribute is set by plugin to define quantization granularity: per-channel or per-tensor quantization.
``Required`` attribute group defines if attribute usage is required to get an optimal model during transformation:
* ``Yes`` - the attribute is used by all OpenVINO plugins for low-precision optimization.
* ``No`` - the attribute is used in a specific OpenVINO plugin.
``Mutable`` attribute group defines if transformation can update an existing attribute:
* ``Yes`` - the attribute can be updated by the next transformations in the pipeline. But attribute update order is still important.
* ``No`` - existing attribute can not be updated by the next transformation. Previous handled transformation has optimized a model according to the current value.
``FakeQuantize`` decomposition is a mandatory part of low precision transformations. Attributes used during decomposition are mandatory. Optional attributes are required only for certain operations.
Attributes usage by transformations:
| Attribute name | Created by transformations | Used by transformations |
|---------------------------|---------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|
| PrecisionPreserved | MarkupPrecisions, MarkupAvgPoolPrecisionPreserved | AlignQuantizationIntervals, AlignQuantizationParameters, FakeQuantizeDecompositionTransformation, MarkupAvgPoolPrecisionPreserved |
| AvgPoolPrecisionPreserved | MarkupAvgPoolPrecisionPreserved | |
| Precisions | MarkupCanBeQuantized, MarkupPrecisions | FakeQuantizeDecompositionTransformation |
| PerTensorQuantization | MarkupPerTensorQuantization | |
| IntervalsAlignment | AlignQuantizationIntervals | FakeQuantizeDecompositionTransformation |
| QuantizationAlignment | AlignQuantizationParameters | FakeQuantizeDecompositionTransformation |
.. list-table::
:header-rows: 1
> **NOTE**: The same type of attribute instances can be created in different transformations. This approach is the result of the transformation single-responsibility principle. For example, `Precision` attribute instances are created in `MarkupCanBeQuantized` and `MarkupPrecisions` transformations, but the reasons for their creation are different.
* - Attribute name
- Created by transformations
- Used by transformations
* - PrecisionPreserved
- MarkupPrecisions, MarkupAvgPoolPrecisionPreserved
- AlignQuantizationIntervals, AlignQuantizationParameters, FakeQuantizeDecompositionTransformation, MarkupAvgPoolPrecisionPreserved
* - AvgPoolPrecisionPreserved
- MarkupAvgPoolPrecisionPreserved
-
* - Precisions
- MarkupCanBeQuantized, MarkupPrecisions
- FakeQuantizeDecompositionTransformation
* - PerTensorQuantization
- MarkupPerTensorQuantization
-
* - IntervalsAlignment
- AlignQuantizationIntervals
- FakeQuantizeDecompositionTransformation
* - QuantizationAlignment
- AlignQuantizationParameters
- FakeQuantizeDecompositionTransformation
.. note::
The same type of attribute instances can be created in different transformations. This approach is the result of the transformation single-responsibility principle. For example, ``Precision`` attribute instances are created in ``MarkupCanBeQuantized`` and ``MarkupPrecisions`` transformations, but the reasons for their creation are different.
@endsphinxdirective

View File

@@ -1,6 +1,11 @@
# Step 1. Prerequisites Transformations {#openvino_docs_OV_UG_lpt_step1_prerequisites}
@sphinxdirective
Prerequisites transformations are optional. The transformations prepare a model before running other low precision transformations. The transformations do not operate with dequantization operations or update precisions. Prerequisites transformations include:
* [PullReshapeThroughDequantization](@ref openvino_docs_OV_UG_lpt_PullReshapeThroughDequantization)
* [PullTransposeThroughDequantization](@ref openvino_docs_OV_UG_lpt_PullTransposeThroughDequantization)
* [LinOpSequenceFusion](@ref openvino_docs_OV_UG_lpt_LinOpSequenceFusion)
* :doc:`PullReshapeThroughDequantization <openvino_docs_OV_UG_lpt_PullReshapeThroughDequantization>`
* :doc:`PullTransposeThroughDequantization <openvino_docs_OV_UG_lpt_PullTransposeThroughDequantization>`
* :doc:`LinOpSequenceFusion <openvino_docs_OV_UG_lpt_LinOpSequenceFusion>`
@endsphinxdirective

View File

@@ -1,142 +1,207 @@
# Step 2. Markup Transformations {#openvino_docs_OV_UG_lpt_step2_markup}
This step defines the optimal `FakeQuantize` decomposition precisions for the best inference performance via operations markup with runtime attribute instances. Attributes are created for input and output ports and operations. Transformations do not change the operation output port precisions. A model markup low precision logic is decomposed and implemented into the following common markup transformations. The order of transformations is important:
@sphinxdirective
1. [MarkupBias](@ref openvino_docs_OV_UG_lpt_MarkupBias)
2. [MarkupCanBeQuantized](@ref openvino_docs_OV_UG_lpt_MarkupCanBeQuantized)
3. [MarkupPrecisions](@ref openvino_docs_OV_UG_lpt_MarkupPrecisions)
4. [MarkupPerTensorQuantization](@ref openvino_docs_OV_UG_lpt_MarkupPerTensorQuantization)
5. [MarkupAvgPoolPrecisionPreserved](@ref openvino_docs_OV_UG_lpt_MarkupAvgPoolPrecisionPreserved)
6. [PropagatePrecisions](@ref openvino_docs_OV_UG_lpt_PropagatePrecisions)
7. [AlignQuantizationIntervals](@ref openvino_docs_OV_UG_lpt_AlignQuantizationIntervals)
8. [AlignQuantizationParameters](@ref openvino_docs_OV_UG_lpt_AlignQuantizationParameters)
This step defines the optimal ``FakeQuantize`` decomposition precisions for the best inference performance via operations markup with runtime attribute instances. Attributes are created for input and output ports and operations. Transformations do not change the operation output port precisions. A model markup low precision logic is decomposed and implemented into the following common markup transformations. The order of transformations is important:
The table of transformations and used attributes:
1. :doc:`MarkupBias <openvino_docs_OV_UG_lpt_MarkupBias>`
2. :doc:`MarkupCanBeQuantized <openvino_docs_OV_UG_lpt_MarkupCanBeQuantized>`
3. :doc:`MarkupPrecisions <openvino_docs_OV_UG_lpt_MarkupPrecisions>`
4. :doc:`MarkupPerTensorQuantization <openvino_docs_OV_UG_lpt_MarkupPerTensorQuantization>`
5. :doc:`MarkupAvgPoolPrecisionPreserved <openvino_docs_OV_UG_lpt_MarkupAvgPoolPrecisionPreserved>`
6. :doc:`PropagatePrecisions <openvino_docs_OV_UG_lpt_PropagatePrecisions>`
7. :doc:`AlignQuantizationIntervals <openvino_docs_OV_UG_lpt_AlignQuantizationIntervals>`
8. :doc:`AlignQuantizationParameters <openvino_docs_OV_UG_lpt_AlignQuantizationParameters>`
| Transformation name | Create attributes | Use attributes |
|---------------------------------|-------------------------------|-------------------------------------------|
| MarkupBias | Bias | |
| MarkupCanBeQuantized | Precisions | |
| MarkupPrecisions | Precisions,PrecisionPreserved | |
| MarkupPerTensorQuantization | PerTensorQuantization | |
| MarkupAvgPoolPrecisionPreserved | AvgPoolPrecisionPreserved | Precisions, PrecisionPreserved |
| PropagatePrecisions | Precisions | Precisions, PrecisionPreserved |
| AlignQuantizationIntervals | IntervalsAlignment | PrecisionPreserved |
| AlignQuantizationParameters | QuantizationAlignment | PrecisionPreserved, PerTensorQuantization |
.. list-table::
:header-rows: 1
> **NOTE**: The same type of attribute instances can be created in different transformations. This approach is the result of the transformation single-responsibility principle. For example, `Precision` attribute instances are created in `MarkupCanBeQuantized` and `MarkupPrecisions` transformations, but the reasons for their creation are different
* - Transformation name
- Create attributes
- Use attributes
* - MarkupBias
- Bias
-
* - MarkupCanBeQuantized
- Precisions
-
* - MarkupPrecisions
- Precisions,PrecisionPreserved
-
* - MarkupPerTensorQuantization
- PerTensorQuantization
-
* - MarkupAvgPoolPrecisionPreserved
- AvgPoolPrecisionPreserved
- Precisions, PrecisionPreserved
* - PropagatePrecisions
- Precisions
- Precisions, PrecisionPreserved
* - AlignQuantizationIntervals
- IntervalsAlignment
- PrecisionPreserved
* - AlignQuantizationParameters
- QuantizationAlignment
- PrecisionPreserved, PerTensorQuantization
.. note::
The same type of attribute instances can be created in different transformations. This approach is the result of the transformation single-responsibility principle. For example, ``Precision`` attribute instances are created in ``MarkupCanBeQuantized`` and ``MarkupPrecisions`` transformations, but the reasons for their creation are different
Common markup transformations can be decomposed into simpler utility markup transformations. The order of Markup utility transformations is not important:
* [CreateAttribute](@ref openvino_docs_OV_UG_lpt_CreateAttribute)
* [CreatePrecisionsDependentAttribute](@ref openvino_docs_OV_UG_lpt_CreatePrecisionsDependentAttribute)
* [PropagateThroughPrecisionPreserved](@ref openvino_docs_OV_UG_lpt_PropagateThroughPrecisionPreserved)
* [PropagateToInput](@ref openvino_docs_OV_UG_lpt_PropagateToInput)
* [UpdateSharedPrecisionPreserved](@ref openvino_docs_OV_UG_lpt_UpdateSharedPrecisionPreserved)
* :doc:`CreateAttribute <openvino_docs_OV_UG_lpt_CreateAttribute>`
* :doc:`CreatePrecisionsDependentAttribute <openvino_docs_OV_UG_lpt_CreatePrecisionsDependentAttribute>`
* :doc:`PropagateThroughPrecisionPreserved <openvino_docs_OV_UG_lpt_PropagateThroughPrecisionPreserved>`
* :doc:`PropagateToInput <openvino_docs_OV_UG_lpt_PropagateToInput>`
* :doc:`UpdateSharedPrecisionPreserved <openvino_docs_OV_UG_lpt_UpdateSharedPrecisionPreserved>`
Let's explore all transformations and their relations in detail, using one and the same model:
![](img/step2_markup_original.png)
.. image:: _static/images/step2_markup_original.svg
The original model key features:
* The first `concat1` concatenation operation has not quantized `convolution1` consumer.
* The second `concat2` concatenation operation has quantized `convolution2` consumer with requirements:
- support `unsigned int8` on activations,
- per-tensor quantization.
* Between the `concat2` concatenation operation and `Convolution` there is an `AvgPool` operation, which mathematically should return an `f32` tensor. But the `MarkupAvgPoolPrecisionPreserved` transformation is active. This allows the low precision transformation, that goes after the `AvgPool`, to propagate low precision tensor to the next consumer.
* The first ``concat1`` concatenation operation has not quantized ``convolution1`` consumer.
* The second ``concat2`` concatenation operation has quantized ``convolution2`` consumer with requirements:
* support ``unsigned int8`` on activations,
* per-tensor quantization.
* Between the ``concat2`` concatenation operation and ``Convolution`` there is an ``AvgPool`` operation, which mathematically should return an ``f32`` tensor. But the ``MarkupAvgPoolPrecisionPreserved`` transformation is active. This allows the low precision transformation, that goes after the ``AvgPool``, to propagate low precision tensor to the next consumer.
Transformations are run with the following parameters:
@snippet snippets/lpt_intel_cpu_plugin.cpp lpt_markup_pipeline
.. doxygensnippet:: docs/snippets/lpt_intel_cpu_plugin.cpp
:language: cpp
:fragment: [lpt_markup_pipeline]
1. MarkupCanBeQuantized
#######################
## 1. MarkupCanBeQuantized
The transformation marks operations that cannot be quantized. No attributes are required before the transformation.
Changes in the example model after `MarkupCanBeQuantized` transformation:
* Not quantized `convolution1` operation is marked by the `Precisions` attribute with empty values. This attribute allows the next transformation to ignore not quantized operation.
Changes in the example model after ``MarkupCanBeQuantized`` transformation:
* Not quantized ``convolution1`` operation is marked by the ``Precisions`` attribute with empty values. This attribute allows the next transformation to ignore not quantized operation.
Result model:
![MarkupCanBeQuantized](img/step2_markup1.png)
.. image:: _static/images/step2_markup1.svg
:alt: MarkupCanBeQuantize
Model display features (here and below):
* The attributes added by the current transformation are marked in bold.
* If attributes do not fit into one line, then one line consists of only one attribute.
## 2. MarkupPrecisions
2. MarkupPrecisions
###################
The transformation is required and includes two tasks:
1. Mark operation input ports (create `Precision` attribute instance) by provided restrictions: input port index and required precisions. Restrictions are provided as input argument in `ngraph::pass::low_precision::LowPrecision` constructor.
1. Mark operation input ports (create ``Precision`` attribute instance) by provided restrictions: input port index and required precisions. Restrictions are provided as input argument in ``:ref:`ngraph::pass::low_precision::LowPrecision <doxid-classngraph_1_1pass_1_1low__precision_1_1_low_precision>``` constructor.
2. Mark precision preserved operations.
No attributes are required before the transformation. Changes in the example model after `MarkupPrecisions` transformation:
No attributes are required before the transformation. Changes in the example model after ``MarkupPrecisions`` transformation:
* Both concatenation operations are marked as precision preserved operations. It allows to propagate precision via these operations.
* Quantized `convolution2` operation is marked by the `Precisions` attribute with `u8` precision on activations and `i8` precisions on weights according to the provided restrictions. This attribute instance allows to specify which precisions are required for quantized `Convolution` operation.
* Quantized ``convolution2`` operation is marked by the ``Precisions`` attribute with ``u8`` precision on activations and ``i8`` precisions on weights according to the provided restrictions. This attribute instance allows to specify which precisions are required for quantized ``Convolution`` operation.
Result model:
![MarkupPrecisions result](img/step2_markup2.png)
.. image:: _static/images/step2_markup2.svg
:alt: MarkupPrecisions result
## 3. MarkupPerTensorQuantization
The transformation is required and marks operations (create `PerTensorQuantization` attribute instance) by provided restrictions: an operation that requires per-tensor quantization. No attributes are required before the transformation.
3. MarkupPerTensorQuantization
##############################
Changes in the example model after `MarkupPerTensorQuantization` transformation:
* both `Convolution` operations are marked by `PerTensorQuantization`
The transformation is required and marks operations (create ``PerTensorQuantization`` attribute instance) by provided restrictions: an operation that requires per-tensor quantization. No attributes are required before the transformation.
Changes in the example model after ``MarkupPerTensorQuantization`` transformation:
* both ``Convolution`` operations are marked by ``PerTensorQuantization``
Result model:
![MarkupPerTensorQuantization result](img/step2_markup3.png)
.. image:: _static/images/step2_markup3.svg
:alt: MarkupPerTensorQuantization result
4. MarkupAvgPoolPrecisionPreserved
##################################
The transformation is optional. ``MarkupAvgPoolPrecisionPreserved`` marks ``AvgPool`` operations as precision preserved or not precision preserved. ``AvgPool`` operation is precision preserved if next not precision preserved operation can be inferred in low precision. In other words, ``AvgPool`` operations become precision preserved operations to speed up model inference. The transformation uses ``PrecisionPreserved`` attributes created before. The transformation is combined and uses:
## 4. MarkupAvgPoolPrecisionPreserved
The transformation is optional. `MarkupAvgPoolPrecisionPreserved` marks `AvgPool` operations as precision preserved or not precision preserved. `AvgPool` operation is precision preserved if next not precision preserved operation can be inferred in low precision. In other words, `AvgPool` operations become precision preserved operations to speed up model inference. The transformation uses `PrecisionPreserved` attributes created before. The transformation is combined and uses:
* CreatePrecisionsDependentAttribute
* PropagateThroughPrecisionPreserved
* UpdateSharedPrecisionPreserved
Changes in the example model after `MarkupAvgPoolPrecisionPreserved` transformation:
* `AvgPool` operations are marked by `PrecisionPreserved` and `AvgPoolPrecisionPreserved` (not used below).
Changes in the example model after ``MarkupAvgPoolPrecisionPreserved`` transformation:
* ``AvgPool`` operations are marked by ``PrecisionPreserved`` and ``AvgPoolPrecisionPreserved`` (not used below).
Result model:
![MarkupAvgPoolPrecisionPreserved](img/step2_markup4.png)
.. image:: _static/images/step2_markup4.svg
:alt: arkupAvgPoolPrecisionPreserved
## 5. PropagatePrecisions
The transformation is required. `PropagatePrecision` is a key transformation in the markup pipeline, which marks `FakeQuantize` output port precisions. The transformation uses `PrecisionPreserved` attribute instances created before. The transformation is combined and uses:
5. PropagatePrecisions
######################
The transformation is required. ``PropagatePrecision`` is a key transformation in the markup pipeline, which marks ``FakeQuantize`` output port precisions. The transformation uses ``PrecisionPreserved`` attribute instances created before. The transformation is combined and uses:
* CreateAttribute
* PropagateThroughPrecisionPreserved
* PropagateToInput
Changes in the example model after `PropagatePrecisions` transformation:
* All precision preserved operations are marked by the `Precisions` attribute instance, which defines the required precision for the operation.
* `FakeQuantize` operation output ports are marked by `Precisions` attribute instances, which define target precision for decomposition. In the sample model, `FakeQuantize` operations have signed intervals, but the `Precisions` attributes are initialized by `u8` (`unsigned int8`) values as the result applied during transformations restrictions for `Convolution` operations.
Changes in the example model after ``PropagatePrecisions`` transformation:
* All precision preserved operations are marked by the ``Precisions`` attribute instance, which defines the required precision for the operation.
* ``FakeQuantize`` operation output ports are marked by ``Precisions`` attribute instances, which define target precision for decomposition. In the sample model, ``FakeQuantize`` operations have signed intervals, but the ``Precisions`` attributes are initialized by ``u8`` (``unsigned int8``) values as the result applied during transformations restrictions for ``Convolution`` operations.
Result model:
![PropagatePrecisions](img/step2_markup5.png)
.. image:: _static/images/step2_markup5.svg
:alt: PropagatePrecisions
> **NOTE**: `AlignQuantizationIntervals` and `AlignQuantizationParameters` transformations are required if the model has quantized concatenation operations.
.. note::
``AlignQuantizationIntervals`` and ``AlignQuantizationParameters`` transformations are required if the model has quantized concatenation operations.
6. AlignQuantizationIntervals
#############################
The transformation is required for models with the quantized operation. The transformation marks ``FakeQuantize`` operation and precision preserved consumers to combine quantization information from different ``FakeQuantize`` operations for future quantization intervals alignment. The transformation is combined and uses:
## 6. AlignQuantizationIntervals
The transformation is required for models with the quantized operation. The transformation marks `FakeQuantize` operation and precision preserved consumers to combine quantization information from different `FakeQuantize` operations for future quantization intervals alignment. The transformation is combined and uses:
* CreateAttribute
* PropagateThroughPrecisionPreserved
Changes in the example model after `AlignQuantizationIntervals` transformation:
* All `FakeQuantize` operations and their precision preserved consumers are marked by the `IntervalsAlignment` attribute instance.
Changes in the example model after ``AlignQuantizationIntervals`` transformation:
* All ``FakeQuantize`` operations and their precision preserved consumers are marked by the ``IntervalsAlignment`` attribute instance.
Result model:
![AlignQuantizationIntervals](img/step2_markup6.png)
.. image:: _static/images/step2_markup6.svg
:alt: AlignQuantizationIntervals
7. AlignQuantizationParameters
##############################
## 7. AlignQuantizationParameters
The transformation is required for models with quantized concatenation operation. The transformation marks `FakeQuantize` precision preserved consumers to align quantization intervals. The transformation is combined and uses:
* CreateAttribute
* PropagateThroughPrecisionPreserved
* UpdateSharedPrecisionPreserved
Changes in the example model after `AlignQuantizationParameters` transformation:
* All `FakeQuantize` precision preserved consumers are marked by `QuantizationAlignment` attribute instance. `convolution1` input ports are marked by `Precisions` attribute instances with empty precisions collection. As a result, the `convolution1` operation was detected as not quantized, and the `QuantizationAlignment` attribute default value `false` does not change. `convolution2` input ports are marked by `Precisions` attribute instances with not empty precisions collection. `convolution2` operation was detected as quantized with the `PerTensorQuantization` attribute, and the `QuantizationAlignment` attribute default value changed to `true`.
Changes in the example model after ``AlignQuantizationParameters`` transformation:
* All ``FakeQuantize`` precision preserved consumers are marked by ``QuantizationAlignment`` attribute instance. ``convolution1`` input ports are marked by ``Precisions`` attribute instances with empty precisions collection. As a result, the ``convolution1`` operation was detected as not quantized, and the ``QuantizationAlignment`` attribute default value ``false`` does not change. ``convolution2`` input ports are marked by ``Precisions`` attribute instances with not empty precisions collection. ``convolution2`` operation was detected as quantized with the ``PerTensorQuantization`` attribute, and the ``QuantizationAlignment`` attribute default value changed to ``true``.
Final model:
![AlignQuantizationParameters](img/step2_markup7.png)
.. image:: _static/images/step2_markup7.svg
:alt: AlignQuantizationParameters
@endsphinxdirective

View File

@@ -1,50 +1,62 @@
# Step 3. Main Transformations {#openvino_docs_OV_UG_lpt_step3_main}
@sphinxdirective
Main transformations are the majority of low precision transformations. Transformations operate with dequantization operations. Main transformations include:
* [AddTransformation](@ref openvino_docs_OV_UG_lpt_AddTransformation)
* [AvgPoolTransformation](@ref openvino_docs_OV_UG_lpt_AvgPoolTransformation)
* [ClampTransformation](@ref openvino_docs_OV_UG_lpt_AvgPoolTransformation)
* [ConcatTransformation](@ref openvino_docs_OV_UG_lpt_ConcatTransformation)
* [ConvolutionTransformation](@ref openvino_docs_OV_UG_lpt_ConvolutionTransformation)
* [ConvolutionBackpropDataTransformation](@ref openvino_docs_OV_UG_lpt_ConvolutionBackpropDataTransformation)
* [DepthToSpaceTransformation](@ref openvino_docs_OV_UG_lpt_DepthToSpaceTransformation)
* [FakeQuantizeDecompositionTransformation](@ref openvino_docs_OV_UG_lpt_FakeQuantizeDecompositionTransformation)
* [FakeQuantizeTransformation](@ref openvino_docs_OV_UG_lpt_FakeQuantizeTransformation)
* [InterpolateTransformation](@ref openvino_docs_OV_UG_lpt_InterpolateTransformation)
* [GroupConvolutionTransformation](@ref openvino_docs_OV_UG_lpt_GroupConvolutionTransformation)
* [GatherTransformation](@ref openvino_docs_OV_UG_lpt_GatherTransformation)
* [MatMulTransformation](@ref openvino_docs_OV_UG_lpt_MatMulTransformation)
* [MaxPoolTransformation](@ref openvino_docs_OV_UG_lpt_MaxPoolTransformation)
* [MultiplyTransformation](@ref openvino_docs_OV_UG_lpt_MultiplyTransformation)
* [MVNTransformation](@ref openvino_docs_OV_UG_lpt_MVNTransformation)
* [NormalizeL2Transformation](@ref openvino_docs_OV_UG_lpt_NormalizeL2Transformation)
* [PReluTransformation](@ref openvino_docs_OV_UG_lpt_PReluTransformation)
* [ReduceMaxTransformation](@ref openvino_docs_OV_UG_lpt_ReduceMaxTransformation)
* [ReduceMeanTransformation](@ref openvino_docs_OV_UG_lpt_ReduceMeanTransformation)
* [ReduceMinTransformation](@ref openvino_docs_OV_UG_lpt_ReduceMinTransformation)
* [ReduceSumTransformation](@ref openvino_docs_OV_UG_lpt_ReduceSumTransformation)
* [ReluTransformation](@ref openvino_docs_OV_UG_lpt_ReluTransformation)
* [ReshapeTransformation](@ref openvino_docs_OV_UG_lpt_ReshapeTransformation)
* [SqueezeTransformation](@ref openvino_docs_OV_UG_lpt_SqueezeTransformation)
* [ShuffleChannelsTransformation](@ref openvino_docs_OV_UG_lpt_ShuffleChannelsTransformation)
* [SplitTransformation](@ref openvino_docs_OV_UG_lpt_SplitTransformation)
* [StridedSliceTransformation](@ref openvino_docs_OV_UG_lpt_StridedSliceTransformation)
* [TransposeTransformation](@ref openvino_docs_OV_UG_lpt_TransposeTransformation)
* [UnsqueezeTransformation](@ref openvino_docs_OV_UG_lpt_UnsqueezeTransformation)
* [VariadicSplitTransformation](@ref openvino_docs_OV_UG_lpt_VariadicSplitTransformation)
* :doc:`AddTransformation <openvino_docs_OV_UG_lpt_AddTransformation>`
* :doc:`AvgPoolTransformation <openvino_docs_OV_UG_lpt_AvgPoolTransformation>`
* :doc:`ClampTransformation <openvino_docs_OV_UG_lpt_AvgPoolTransformation>`
* :doc:`ConcatTransformation <openvino_docs_OV_UG_lpt_ConcatTransformation>`
* :doc:`ConvolutionTransformation <openvino_docs_OV_UG_lpt_ConvolutionTransformation>`
* :doc:`ConvolutionBackpropDataTransformation <openvino_docs_OV_UG_lpt_ConvolutionBackpropDataTransformation>`
* :doc:`DepthToSpaceTransformation <openvino_docs_OV_UG_lpt_DepthToSpaceTransformation>`
* :doc:`FakeQuantizeDecompositionTransformation <openvino_docs_OV_UG_lpt_FakeQuantizeDecompositionTransformation>`
* :doc:`FakeQuantizeTransformation <openvino_docs_OV_UG_lpt_FakeQuantizeTransformation>`
* :doc:`InterpolateTransformation <openvino_docs_OV_UG_lpt_InterpolateTransformation>`
* :doc:`GroupConvolutionTransformation <openvino_docs_OV_UG_lpt_GroupConvolutionTransformation>`
* :doc:`GatherTransformation <openvino_docs_OV_UG_lpt_GatherTransformation>`
* :doc:`MatMulTransformation <openvino_docs_OV_UG_lpt_MatMulTransformation>`
* :doc:`MaxPoolTransformation <openvino_docs_OV_UG_lpt_MaxPoolTransformation>`
* :doc:`MultiplyTransformation <openvino_docs_OV_UG_lpt_MultiplyTransformation>`
* :doc:`MVNTransformation <openvino_docs_OV_UG_lpt_MVNTransformation>`
* :doc:`NormalizeL2Transformation <openvino_docs_OV_UG_lpt_NormalizeL2Transformation>`
* :doc:`PReluTransformation <openvino_docs_OV_UG_lpt_PReluTransformation>`
* :doc:`ReduceMaxTransformation <openvino_docs_OV_UG_lpt_ReduceMaxTransformation>`
* :doc:`ReduceMeanTransformation <openvino_docs_OV_UG_lpt_ReduceMeanTransformation>`
* :doc:`ReduceMinTransformation <openvino_docs_OV_UG_lpt_ReduceMinTransformation>`
* :doc:`ReduceSumTransformation <openvino_docs_OV_UG_lpt_ReduceSumTransformation>`
* :doc:`ReluTransformation <openvino_docs_OV_UG_lpt_ReluTransformation>`
* :doc:`ReshapeTransformation <openvino_docs_OV_UG_lpt_ReshapeTransformation>`
* :doc:`SqueezeTransformation <openvino_docs_OV_UG_lpt_SqueezeTransformation>`
* :doc:`ShuffleChannelsTransformation <openvino_docs_OV_UG_lpt_ShuffleChannelsTransformation>`
* :doc:`SplitTransformation <openvino_docs_OV_UG_lpt_SplitTransformation>`
* :doc:`StridedSliceTransformation <openvino_docs_OV_UG_lpt_StridedSliceTransformation>`
* :doc:`TransposeTransformation <openvino_docs_OV_UG_lpt_TransposeTransformation>`
* :doc:`UnsqueezeTransformation <openvino_docs_OV_UG_lpt_UnsqueezeTransformation>`
* :doc:`VariadicSplitTransformation <openvino_docs_OV_UG_lpt_VariadicSplitTransformation>`
Let's explore some main transformations on the example model. Original model:
![Original model](img/step3_original.png)
.. image:: _static/images/step3_original.svg
:alt: Original model
Result model after main transformations:
![Original model](img/step3_transformed.png)
.. image:: _static/images/step3_transformed.svg
:alt: Transformed model
Changes in the example model after main transformation:
* All `FakeQuantize` operations (`fakeQuantize1`, `fakeQuantize2` and `fakeQuantize3`) were decomposed:
- original `FakeQuantize` operations were replaced with new operations with other output intervals and output port precision,
- dequantization operations.
* Dequantization operations were moved via precision preserved (`concat1` and `concat2`) and quantized (`convolution2`) operations.
> **NOTE**: The left branch (branch #1) does not require per-tensor quantization. As a result, the `fakeQuantize1`output interval is [0, 255]. But quantized `convolution2` requires per-tensor quantization on the right branch (branch #2). Then all connected `FakeQuantize` interval operations (`fakeQuantize1` and `fakeQuantize2`) are aligned to have per-tensor quantization after the concatenation (`concat2`) operation.
* All ``FakeQuantize`` operations (``fakeQuantize1``, ``fakeQuantize2`` and ``fakeQuantize3``) were decomposed:
* original ``FakeQuantize`` operations were replaced with new operations with other output intervals and output port precision,
* dequantization operations.
* Dequantization operations were moved via precision preserved (``concat1`` and ``concat2``) and quantized (``convolution2``) operations.
.. note::
The left branch (branch #1) does not require per-tensor quantization. As a result, the ``fakeQuantize1``output interval is [0, 255]. But quantized ``convolution2`` requires per-tensor quantization on the right branch (branch #2). Then all connected ``FakeQuantize`` interval operations (``fakeQuantize1`` and ``fakeQuantize2``) are aligned to have per-tensor quantization after the concatenation (``concat2``) operation.
@endsphinxdirective

View File

@@ -1,8 +1,13 @@
# Step 4. Cleanup Transformations {#openvino_docs_OV_UG_lpt_step4_cleanup}
* [FoldConvertTransformation](@ref openvino_docs_OV_UG_lpt_FoldConvertTransformation)
* [FoldFakeQuantizeTransformation](@ref openvino_docs_OV_UG_lpt_FoldFakeQuantizeTransformation)
* [FuseConvertTransformation](@ref openvino_docs_OV_UG_lpt_FuseConvertTransformation)
* [FuseMultiplyToFakeQuantizeTransformation](@ref openvino_docs_OV_UG_lpt_FuseMultiplyToFakeQuantizeTransformation)
* [FuseSubtractToFakeQuantizeTransformation](@ref openvino_docs_OV_UG_lpt_FuseSubtractToFakeQuantizeTransformation)
* [MultiplyToGroupConvolutionTransformation](@ref openvino_docs_OV_UG_lpt_MultiplyToGroupConvolutionTransformation)
@sphinxdirective
* :doc:`EliminateFakeQuantizeTransformation <openvino_docs_OV_UG_lpt_EliminateFakeQuantizeTransformation>`
* :doc:`FoldConvertTransformation <openvino_docs_OV_UG_lpt_FoldConvertTransformation>`
* :doc:`FoldFakeQuantizeTransformation <openvino_docs_OV_UG_lpt_FoldFakeQuantizeTransformation>`
* :doc:`FuseConvertTransformation <openvino_docs_OV_UG_lpt_FuseConvertTransformation>`
* :doc:`FuseMultiplyToFakeQuantizeTransformation <openvino_docs_OV_UG_lpt_FuseMultiplyToFakeQuantizeTransformation>`
* :doc:`FuseSubtractToFakeQuantizeTransformation <openvino_docs_OV_UG_lpt_FuseSubtractToFakeQuantizeTransformation>`
* :doc:`MultiplyToGroupConvolutionTransformation <openvino_docs_OV_UG_lpt_MultiplyToGroupConvolutionTransformation>`
@endsphinxdirective

View File

@@ -0,0 +1,3 @@
# EliminateFakeQuantizeTransformation transformation {#openvino_docs_OV_UG_lpt_EliminateFakeQuantizeTransformation}
ngraph::pass::low_precision::EliminateFakeQuantizeTransformation class represents the `EliminateFakeQuantizeTransformation` transformation.

View File

@@ -3,7 +3,7 @@
@sphinxdirective
Performance varies by use, configuration and other factors. Learn more at [www.intel.com/PerformanceIndex](https://www.intel.com/PerformanceIndex).
Performance varies by use, configuration and other factors. Learn more at `www.intel.com/PerformanceIndex <https://www.intel.com/PerformanceIndex>`__.
Performance results are based on testing as of dates shown in configurations and may not reflect all publicly available updates. See backup for configuration details. No product or component can be absolutely secure.

View File

@@ -1,4 +1,4 @@
# Model Optimizer Usage {#openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide}
# Convert a Model {#openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide}
@sphinxdirective
@@ -8,90 +8,134 @@
:maxdepth: 1
:hidden:
openvino_docs_model_inputs_outputs
openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model
openvino_docs_MO_DG_prepare_model_convert_model_Cutting_Model
openvino_docs_MO_DG_Additional_Optimization_Use_Cases
openvino_docs_MO_DG_FP16_Compression
openvino_docs_MO_DG_Python_API
openvino_docs_MO_DG_prepare_model_Model_Optimizer_FAQ
To convert a model to OpenVINO model format (``ov.Model``), you can use the following command:
Model Optimizer is a cross-platform command-line tool that facilitates the transition between training and deployment environments, performs static model analysis, and adjusts deep learning models for optimal execution on end-point target devices.
.. tab-set::
To use it, you need a pre-trained deep learning model in one of the supported formats: TensorFlow, PyTorch, PaddlePaddle, MXNet, Caffe, Kaldi, or ONNX. Model Optimizer converts the model to the OpenVINO Intermediate Representation format (IR), which you can infer later with :doc:`OpenVINO™ Runtime <openvino_docs_OV_UG_OV_Runtime_User_Guide>`.
.. tab-item:: Python
:sync: mo-python-api
Note that Model Optimizer does not infer models.
.. code-block:: python
The figure below illustrates the typical workflow for deploying a trained deep learning model:
from openvino.tools.mo import convert_model
ov_model = convert_model(INPUT_MODEL)
.. image:: _static/images/BASIC_FLOW_MO_simplified.svg
.. tab-item:: CLI
:sync: cli-tool
where IR is a pair of files describing the model:
.. code-block:: sh
* ``.xml`` - Describes the network topology.
* ``.bin`` - Contains the weights and biases binary data.
The OpenVINO IR can be additionally optimized for inference by :doc:`Post-training optimization <pot_introduction>` that applies post-training quantization methods.
How to Run Model Optimizer
##########################
To convert a model to IR, you can run Model Optimizer by using the following command:
.. code-block:: sh
mo --input_model INPUT_MODEL
mo --input_model INPUT_MODEL
If the out-of-the-box conversion (only the ``--input_model`` parameter is specified) is not successful, use the parameters mentioned below to override input shapes and cut the model:
If the out-of-the-box conversion (only the ``input_model`` parameter is specified) is not successful, use the parameters mentioned below to override input shapes and cut the model:
- Model Optimizer provides two parameters to override original input shapes for model conversion: ``--input`` and ``--input_shape``.
- model conversion API provides two parameters to override original input shapes for model conversion: ``input`` and ``input_shape``.
For more information about these parameters, refer to the :doc:`Setting Input Shapes <openvino_docs_MO_DG_prepare_model_convert_model_Converting_Model>` guide.
- To cut off unwanted parts of a model (such as unsupported operations and training sub-graphs),
use the ``--input`` and ``--output`` parameters to define new inputs and outputs of the converted model.
use the ``input`` and ``output`` parameters to define new inputs and outputs of the converted model.
For a more detailed description, refer to the :doc:`Cutting Off Parts of a Model <openvino_docs_MO_DG_prepare_model_convert_model_Cutting_Model>` guide.
You can also insert additional input pre-processing sub-graphs into the converted model by using
the ``--mean_values``, ``scales_values``, ``--layout``, and other parameters described
the ``mean_values``, ``scales_values``, ``layout``, and other parameters described
in the :doc:`Embedding Preprocessing Computation <openvino_docs_MO_DG_Additional_Optimization_Use_Cases>` article.
The ``--compress_to_fp16`` compression parameter in Model Optimizer allows generating IR with constants (for example, weights for convolutions and matrix multiplications) compressed to ``FP16`` data type. For more details, refer to the :doc:`Compression of a Model to FP16 <openvino_docs_MO_DG_FP16_Compression>` guide.
The ``compress_to_fp16`` compression parameter in ``mo`` command-line tool allows generating IR with constants (for example, weights for convolutions and matrix multiplications) compressed to ``FP16`` data type. For more details, refer to the :doc:`Compression of a Model to FP16 <openvino_docs_MO_DG_FP16_Compression>` guide.
To get the full list of conversion parameters available in Model Optimizer, run the following command:
To get the full list of conversion parameters, run the following command:
.. code-block:: sh
.. tab-set::
mo --help
.. tab-item:: Python
:sync: mo-python-api
.. code-block:: python
from openvino.tools.mo import convert_model
ov_model = convert_model(help=True)
.. tab-item:: CLI
:sync: cli-tool
.. code-block:: sh
mo --help
Examples of CLI Commands
########################
Examples of model conversion parameters
#######################################
Below is a list of separate examples for different frameworks and Model Optimizer parameters:
Below is a list of separate examples for different frameworks and model conversion parameters:
1. Launch Model Optimizer for a TensorFlow MobileNet model in the binary protobuf format:
1. Launch model conversion for a TensorFlow MobileNet model in the binary protobuf format:
.. code-block:: sh
.. tab-set::
mo --input_model MobileNet.pb
.. tab-item:: Python
:sync: mo-python-api
.. code-block:: python
from openvino.tools.mo import convert_model
ov_model = convert_model("MobileNet.pb")
.. tab-item:: CLI
:sync: cli-tool
.. code-block:: sh
mo --input_model MobileNet.pb
Launch Model Optimizer for a TensorFlow BERT model in the SavedModel format with three inputs. Specify input shapes explicitly where the batch size and the sequence length equal 2 and 30 respectively:
Launch model conversion for a TensorFlow BERT model in the SavedModel format with three inputs. Specify input shapes explicitly where the batch size and the sequence length equal 2 and 30 respectively:
.. code-block:: sh
.. tab-set::
mo --saved_model_dir BERT --input mask,word_ids,type_ids --input_shape [2,30],[2,30],[2,30]
.. tab-item:: Python
:sync: mo-python-api
For more information, refer to the :doc:`Converting a TensorFlow Model <openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_TensorFlow>` guide.
.. code-block:: python
2. Launch Model Optimizer for an ONNX OCR model and specify new output explicitly:
from openvino.tools.mo import convert_model
ov_model = convert_model("BERT", input_shape=[[2,30],[2,30],[2,30]])
.. code-block:: sh
.. tab-item:: CLI
:sync: cli-tool
mo --input_model ocr.onnx --output probabilities
.. code-block:: sh
mo --saved_model_dir BERT --input_shape [2,30],[2,30],[2,30]
For more information, refer to the :doc:`Converting a TensorFlow Model <openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_TensorFlow>` guide.
2. Launch model conversion for an ONNX OCR model and specify new output explicitly:
.. tab-set::
.. tab-item:: Python
:sync: mo-python-api
.. code-block:: python
from openvino.tools.mo import convert_model
ov_model = convert_model("ocr.onnx", output="probabilities")
.. tab-item:: CLI
:sync: cli-tool
.. code-block:: sh
mo --input_model ocr.onnx --output probabilities
For more information, refer to the :doc:`Converting an ONNX Model <openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_ONNX>` guide.
@@ -100,43 +144,30 @@ Below is a list of separate examples for different frameworks and Model Optimize
PyTorch models must be exported to the ONNX format before conversion into IR. More information can be found in :doc:`Converting a PyTorch Model <openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_PyTorch>`.
3. Launch Model Optimizer for a PaddlePaddle UNet model and apply mean-scale normalization to the input:
3. Launch model conversion for a PaddlePaddle UNet model and apply mean-scale normalization to the input:
.. code-block:: sh
.. tab-set::
mo --input_model unet.pdmodel --mean_values [123,117,104] --scale 255
.. tab-item:: Python
:sync: mo-python-api
.. code-block:: python
from openvino.tools.mo import convert_model
ov_model = convert_model("unet.pdmodel", mean_values=[123,117,104], scale=255)
.. tab-item:: CLI
:sync: cli-tool
.. code-block:: sh
mo --input_model unet.pdmodel --mean_values [123,117,104] --scale 255
For more information, refer to the :doc:`Converting a PaddlePaddle Model <openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_Paddle>` guide.
4. Launch Model Optimizer for an Apache MXNet SSD Inception V3 model and specify first-channel layout for the input:
.. code-block:: sh
mo --input_model ssd_inception_v3-0000.params --layout NCHW
For more information, refer to the :doc:`Converting an Apache MXNet Model <openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_MxNet>` guide.
5. Launch Model Optimizer for a Caffe AlexNet model with input channels in the RGB format which needs to be reversed:
.. code-block:: sh
mo --input_model alexnet.caffemodel --reverse_input_channels
For more information, refer to the :doc:`Converting a Caffe Model <openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_Caffe>` guide.
6. Launch Model Optimizer for a Kaldi LibriSpeech nnet2 model:
.. code-block:: sh
mo --input_model librispeech_nnet2.mdl --input_shape [1,140]
For more information, refer to the :doc:`Converting a Kaldi Model <openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_Kaldi>` guide.
- To get conversion recipes for specific TensorFlow, ONNX, PyTorch, Apache MXNet, and Kaldi models, refer to the :doc:`Model Conversion Tutorials <openvino_docs_MO_DG_prepare_model_convert_model_tutorials>`.
- To get conversion recipes for specific TensorFlow, ONNX, and PyTorch models, refer to the :doc:`Model Conversion Tutorials <openvino_docs_MO_DG_prepare_model_convert_model_tutorials>`.
- For more information about IR, see :doc:`Deep Learning Network Intermediate Representation and Operation Sets in OpenVINO™ <openvino_docs_MO_DG_IR_and_opsets>`.
- For more information about support of neural network models trained with various frameworks, see :doc:`OpenVINO Extensibility Mechanism <openvino_docs_Extensibility_UG_Intro>`
@endsphinxdirective

View File

@@ -1,179 +1,85 @@
# Deep Learning Network Intermediate Representation and Operation Sets in OpenVINO {#openvino_docs_MO_DG_IR_and_opsets}
# Operation Sets in OpenVINO {#openvino_docs_MO_DG_IR_and_opsets}
@sphinxdirective
.. toctree::
:maxdepth: 1
:hidden:
openvino_docs_ops_opset
openvino_docs_operations_specifications
openvino_docs_ops_broadcast_rules
This article provides essential information on the format used for representation of deep learning models in OpenVINO toolkit and supported operation sets.
## Overview of Artificial Neural Networks Representation
Overview of Artificial Neural Networks Representation
#####################################################
A deep learning network is usually represented as a directed graph describing the flow of data from the network input data to the inference results.
Input data can be in the form of images, video, audio, or preprocessed information representing objects from the target area of interest.
Input data can be in the form of images, video, text, audio, or preprocessed information representing objects from the target area of interest.
Here is an illustration of a small graph representing a model that consists of a single Convolutional layer and activation function:
Here is an illustration sof a small graph representing a model that consists of a single Convolutional layer and activation function:
![](img/small_IR_graph_demonstration.png)
.. image:: _static/images/small_IR_graph_demonstration.png
Vertices in the graph represent layers or operation instances such as convolution, pooling, and element-wise operations with tensors.
The terms of "layer" and "operation" are used interchangeably within OpenVINO documentation and define how input data is processed to produce output data for a node in a graph.
The terms of "layer" and "operation" are used interchangeably within OpenVINO documentation and define how the input data is processed to produce output data for a node in a graph.
An operation node in a graph may consume data at one or multiple input ports.
For example, an element-wise addition operation has two input ports which accept tensors that are to be summed.
Some operations do not have any input ports, for example the `Const` operation, which knows the data to be produced without any input.
For example, an element-wise addition operation has two input ports that accept tensors to be summed.
Some operations do not have any input ports, for example the ``Const`` operation which produces without any input.
An edge between operations represents data flow or data dependency implied from one operation node to another.
Each operation produces data on one or multiple output ports. For example, convolution produces output tensor with activations at a single output port. Split operation usually has multiple output ports, each producing part of an input tensor.
Each operation produces data on one or multiple output ports. For example, convolution produces an output tensor with activations at a single output port. The ``Split`` operation usually has multiple output ports, each producing part of an input tensor.
Depending on a deep learning framework, the graph can also contain extra nodes that explicitly represent tensors between operations.
In such representations, operation nodes are not connected to each other directly. They are rather using data nodes as intermediate stops for data flow.
If data nodes are not used, the produced data is associated with an output port of a corresponding operation node that produces the data.
If data nodes are not used, the produced data is associated with an output port of the corresponding operation node that produces the data.
A set of various operations used in a network is usually fixed for each deep learning framework.
It determines expressiveness and level of representation available in that framework.
Sometimes, a network that can be represented in one framework is hard or impossible to be represented in another one or should use significantly different graph, because operation sets used in those two frameworks do not match.
## Intermediate Representation Used in OpenVINO
OpenVINO toolkit introduces its own format of graph representation and its own operation set.
A graph is represented with two files: an XML file and a binary file.
This representation is commonly referred to as the *Intermediate Representation* or *IR*.
The XML file describes a network topology using a `<layer>` tag for an operation node and an `<edge>` tag for a data-flow connection.
Each operation has a fixed number of attributes that define operation flavor used for a node.
For example, the `Convolution` operation has such attributes as `dilation`, `stride`, `pads_begin`, and `pads_end`.
The XML file does not have big constant values like convolution weights.
Instead, it refers to a part of the accompanying binary file that stores such values in a binary format.
Here is an example of a small IR XML file that corresponds to a graph from the previous section:
```xml
<?xml version="1.0" ?>
<net name="model_file_name" version="10">
<layers>
<layer id="0" name="input" type="Parameter" version="opset1">
<data element_type="f32" shape="1,3,32,100"/> <!-- attributes of operation -->
<output>
<!-- description of output ports with type of element and tensor dimensions -->
<port id="0" precision="FP32">
<dim>1</dim>
<dim>3</dim>
<dim>32</dim>
<dim>100</dim>
</port>
</output>
</layer>
<layer id="1" name="conv1/weights" type="Const" version="opset1">
<!-- Const is only operation from opset1 that refers to the IR binary file by specifying offset and size in bytes relative to the beginning of the file. -->
<data element_type="f32" offset="0" shape="64,3,3,3" size="6912"/>
<output>
<port id="1" precision="FP32">
<dim>64</dim>
<dim>3</dim>
<dim>3</dim>
<dim>3</dim>
</port>
</output>
</layer>
<layer id="2" name="conv1" type="Convolution" version="opset1">
<data auto_pad="same_upper" dilations="1,1" output_padding="0,0" pads_begin="1,1" pads_end="1,1" strides="1,1"/>
<input>
<port id="0">
<dim>1</dim>
<dim>3</dim>
<dim>32</dim>
<dim>100</dim>
</port>
<port id="1">
<dim>64</dim>
<dim>3</dim>
<dim>3</dim>
<dim>3</dim>
</port>
</input>
<output>
<port id="2" precision="FP32">
<dim>1</dim>
<dim>64</dim>
<dim>32</dim>
<dim>100</dim>
</port>
</output>
</layer>
<layer id="3" name="conv1/activation" type="ReLU" version="opset1">
<input>
<port id="0">
<dim>1</dim>
<dim>64</dim>
<dim>32</dim>
<dim>100</dim>
</port>
</input>
<output>
<port id="1" precision="FP32">
<dim>1</dim>
<dim>64</dim>
<dim>32</dim>
<dim>100</dim>
</port>
</output>
</layer>
<layer id="4" name="output" type="Result" version="opset1">
<input>
<port id="0">
<dim>1</dim>
<dim>64</dim>
<dim>32</dim>
<dim>100</dim>
</port>
</input>
</layer>
</layers>
<edges>
<!-- Connections between layer nodes: based on ids for layers and ports used in the descriptions above -->
<edge from-layer="0" from-port="0" to-layer="2" to-port="0"/>
<edge from-layer="1" from-port="1" to-layer="2" to-port="1"/>
<edge from-layer="2" from-port="2" to-layer="3" to-port="0"/>
<edge from-layer="3" from-port="1" to-layer="4" to-port="0"/>
</edges>
<meta_data>
<!-- This section that is not related to a topology; contains auxiliary information that serves for the debugging purposes. -->
<MO_version value="2019.1"/>
<cli_parameters>
<blobs_as_inputs value="True"/>
<caffe_parser_path value="DIR"/>
<data_type value="float"/>
...
<!-- Omitted a long list of CLI options that always are put here by MO for debugging purposes. -->
</cli_parameters>
</meta_data>
</net>
```
The IR does not use explicit data nodes described in the previous section.
In contrast, properties of data such as tensor dimensions and their data types are described as properties of input and output ports of operations.
## Operation Sets
Operation Sets
##############
Operations in OpenVINO Operation Sets are selected based on capabilities of supported deep learning frameworks and hardware capabilities of the target inference device.
It consists of several groups of operations:
A set consists of several groups of operations:
* Conventional deep learning layers such as `Convolution`, `MaxPool`, and `MatMul` (also known as `FullyConnected`).
* Conventional deep learning layers such as ``Convolution``, ``MaxPool``, and ``MatMul`` (also known as ``FullyConnected``).
* Various activation functions such as `ReLU`, `Tanh`, and `PReLU`.
* Various activation functions such as ``ReLU``, ``Tanh``, and ``PReLU``.
* Generic element-wise arithmetic tensor operations such as `Add`, `Subtract`, and `Multiply`.
* Generic element-wise arithmetic tensor operations such as ``Add``, ``Subtract``, and ``Multiply``.
* Comparison operations that compare two numeric tensors and produce boolean tensors, for example, `Less`, `Equeal`, `Greater`.
* Comparison operations that compare two numeric tensors and produce boolean tensors, for example, ``Less``, ``Equeal``, ``Greater``.
* Logical operations that are dealing with boolean tensors, for example, `And`, `Xor`, `Not`.
* Logical operations that are dealing with boolean tensors, for example, ``And``, ``Xor``, ``Not``.
* Data movement operations which are dealing with parts of tensors, for example, `Concat`, `Split`, `StridedSlice`, `Select`.
* Data movement operations which are dealing with parts of tensors, for example, ``Concat``, ``Split``, ``StridedSlice``, ``Select``.
* Specialized operations that implement complex algorithms dedicated for models of specific type, for example, `DetectionOutput`, `RegionYolo`, `PriorBox`.
* Specialized operations that implement complex algorithms dedicated for models of specific type, for example, ``DetectionOutput``, ``RegionYolo``, ``PriorBox``.
For more information, refer to the complete description of the supported operation sets in the [Available Operation Sets](../ops/opset.md) article.
For more information, refer to the complete description of the supported operation sets in the :doc:`Available Operation Sets <openvino_docs_ops_opset>` article.
## IR Versions vs Operation Set Versions
How to Read Opset Specification
###############################
In the :doc:`Available Operation Sets <openvino_docs_ops_opset>` there are opsets and there are operations.
Each opset specification has a list of links to operations descriptions that are included into that specific opset.
Two or more opsets may refer to the same operation.
That means an operation is kept unchanged from one operation set to another.
The description of each operation has a ``Versioned name`` field.
For example, the `ReLU` entry point in :doc:`opset1 <openvino_docs_ops_opset1>` refers to :doc:`ReLU-1 <openvino_docs_ops_activation_ReLU_1>` as the versioned name.
Meanwhile, `ReLU` in `opset2` refers to the same `ReLU-1` and both `ReLU` operations are the same operation and it has a single :doc:`description <openvino_docs_ops_activation_ReLU_1>`, which means that ``opset1`` and ``opset2`` share the same operation ``ReLU``.
To differentiate versions of the same operation type such as ``ReLU``, the ``-N`` suffix is used in a versioned name of the operation.
The ``N`` suffix usually refers to the first occurrence of ``opsetN`` where this version of the operation is introduced.
There is no guarantee that new operations will be named according to that rule. The naming convention might be changed, but not for old operations which are frozen completely.
IR Versions vs Operation Set Versions
######################################
The expressiveness of operations in OpenVINO is highly dependent on the supported frameworks and target hardware capabilities.
As the frameworks and hardware capabilities grow over time, the operation set is constantly evolving to support new models.
@@ -183,60 +89,45 @@ Version of IR specifies the rules which are used to read the XML and binary file
Historically, there are two major IR version epochs:
1. The older one includes IR versions from version 1 to version 7 without versioning of the operation set. During that epoch, the operation set has been growing evolutionally accumulating more layer types and extending existing layer semantics. Changing of the operation set for those versions meant increasing of IR version.
1. The older one includes IR versions from version 1 to version 7 without versioning of the operation set. During that epoch, the operation set has been growing evolutionally accumulating more layer types and extending existing layer semantics. Changing of the operation set for those versions meant increasing of the IR version.
2. OpenVINO 2020.1 is the starting point of the next epoch. With IR version 10 introduced in OpenVINO 2020.1, the versioning of the operation set is tracked separately from the IR versioning. Also, the operation set was significantly reworked as the result of nGraph integration to the OpenVINO.
The first supported operation set in the new epoch is `opset1`.
The number after `opset` is going to be increased each time new operations are added or old operations deleted at the release cadence.
The first supported operation set in the new epoch is ``opset1``.
The number after ``opset`` is going to be increased each time new operations are added or old operations deleted at the release cadence.
The operations from the new epoch cover more TensorFlow and ONNX operators in a form that is closer to the original operation semantics from the frameworks in comparison to the operation set used in former versions of IR (7 and lower).
The operations from the new epoch cover more TensorFlow and ONNX operations that better match the original operation semantics from the frameworks, compared to the operation set used in the older IR versions (7 and lower).
The name of the opset is specified for each operation in IR.
The IR version is specified once per whole IR.
The IR version is specified once.
Here is an example from the IR snippet:
```xml
<?xml version="1.0" ?>
<net name="model_file_name" version="10"> <!-- Version of the whole IR file is here; it is 10 -->
<layers>
<!-- Version of operation set that the layer belongs to is described in <layer>
tag attributes. For this operation, it is version="opset1". -->
<layer id="0" name="input" type="Parameter" version="opset1">
<data element_type="f32" shape="1,3,32,100"/> <!-- attributes of operation -->
<output>
<!-- description of output ports with type of element and tensor dimensions -->
<port id="0" precision="FP32">
<dim>1</dim>
<dim>3</dim>
.. code-block:: cpp
...
```
<?xml version="1.0" ?>
<net name="model_file_name" version="10"> <!-- Version of the whole IR file is here; it is 10 -->
<layers>
<!-- Version of operation set that the layer belongs to is described in <layer>
tag attributes. For this operation, it is version="opset1". -->
<layer id="0" name="input" type="Parameter" version="opset1">
<data element_type="f32" shape="1,3,32,100"/> <!-- attributes of operation -->
<output>
<!-- description of output ports with type of element and tensor dimensions -->
<port id="0" precision="FP32">
<dim>1</dim>
<dim>3</dim>
The `type="Parameter"` and `version="opset1"` attributes in the example above mean "use that version of the `Parameter` operation that is included in the `opset1` operation set. "
...
The ``type="Parameter"`` and ``version="opset1"`` attributes in the example above mean "use that version of the ``Parameter`` operation that is included in the ``opset1`` operation set. "
When a new operation set is introduced, most of the operations remain unchanged and are just aliased from the previous operation set within a new one.
The goal of operation set version evolution is to add new operations, and probably change small fractions of existing operations (fixing bugs and extending semantics).
The goal of operation set version evolution is to add new operations, and change small fractions of existing operations (fixing bugs and extending semantics).
However, such changes affect only new versions of operations from a new operation set, while old operations are used by specifying an appropriate `version`.
When an old `version` is specified, the behavior will be kept unchanged from that specified version to provide backward compatibility with older IRs.
A single `xml` file with IR may contain operations from different opsets.
An operation that is included in several opsets may be referred to with `version` which points to any opset that includes that operation.
For example, the same `Convolution` can be used with `version="opset1"` and `version="opset2"` because both opsets have the same `Convolution` operations.
## How to Read Opset Specification
In the [Available Operation Sets](../ops/opset.md) there are opsets and there are operations.
Each opset specification has a list of links to operations descriptions that are included into that specific opset.
Two or more opsets may refer to the same operation.
That means an operation is kept unchanged from one operation set to another.
The description of each operation has a `Versioned name` field.
For example, the `ReLU` entry point in [`opset1`](../ops/opset1.md) refers to [`ReLU-1`](../ops/activation/ReLU_1.md) as the versioned name.
Meanwhile, `ReLU` in `opset2` refers to the same `ReLU-1` and both `ReLU` operations are the same operation and it has a single [description](../ops/activation/ReLU_1.md), which means that `opset1` and `opset2` share the same operation `ReLU`.
To differentiate versions of the same operation type such as `ReLU`, the `-N` suffix is used in a versioned name of the operation.
The `N` suffix usually refers to the first occurrence of `opsetN` where this version of the operation is introduced.
There is no guarantee that new operations will be named according to that rule. The naming convention might be changed, but not for old operations which are frozen completely.
A single ``xml`` file with IR may contain operations from different opsets.
An operation that is included in several opsets may be referred to with ``version`` which points to any opset that includes that operation.
For example, the same ``Convolution`` can be used with ``version="opset1"`` and ``version="opset2"`` because both opsets have the same ``Convolution`` operations.
@endsphinxdirective

View File

@@ -2,149 +2,237 @@
@sphinxdirective
Input data for inference can be different from the training dataset and requires
additional preprocessing before inference. To accelerate the whole pipeline including
preprocessing and inference, Model Optimizer provides special parameters such as ``--mean_values``,
Input data for inference can be different from the training dataset and requires
additional preprocessing before inference. To accelerate the whole pipeline including
preprocessing and inference, model conversion API provides special parameters such as ``mean_values``,
``--scale_values``, ``--reverse_input_channels``, and ``--layout``. Based on these
parameters, Model Optimizer generates OpenVINO IR with additionally inserted sub-graphs
to perform the defined preprocessing. This preprocessing block can perform mean-scale
normalization of input data, reverting data along channel dimension, and changing
the data layout. See the following sections for details on the parameters, or the
:doc:`Overview of Preprocessing API <openvino_docs_OV_UG_Preprocessing_Overview>`
``scale_values``, ``reverse_input_channels``, and ``layout``. Based on these
parameters, model conversion API generates OpenVINO IR with additionally inserted sub-graphs
to perform the defined preprocessing. This preprocessing block can perform mean-scale
normalization of input data, reverting data along channel dimension, and changing
the data layout. See the following sections for details on the parameters, or the
:doc:`Overview of Preprocessing API <openvino_docs_OV_UG_Preprocessing_Overview>`
for the same functionality in OpenVINO Runtime.
Specifying Layout
#################
You may need to set input layouts, as it is required by some preprocessing, for
You may need to set input layouts, as it is required by some preprocessing, for
example, setting a batch, applying mean or scales, and reversing input channels (BGR<->RGB).
Layout defines the meaning of dimensions in shape and can be specified for both
inputs and outputs. Some preprocessing requires to set input layouts, for example,
Layout defines the meaning of dimensions in shape and can be specified for both
inputs and outputs. Some preprocessing requires to set input layouts, for example,
setting a batch, applying mean or scales, and reversing input channels (BGR<->RGB).
For the layout syntax, check the :doc:`Layout API overview <openvino_docs_OV_UG_Layout_Overview>`.
To specify the layout, you can use the ``--layout`` option followed by the layout value.
To specify the layout, you can use the ``layout`` option followed by the layout value.
For example, the following command specifies the ``NHWC`` layout for a Tensorflow
For example, the following command specifies the ``NHWC`` layout for a Tensorflow
``nasnet_large`` model that was exported to the ONNX format:
.. code-block:: sh
mo --input_model tf_nasnet_large.onnx --layout nhwc
.. tab-set::
.. tab-item:: Python
:sync: mo-python-api
.. code-block:: python
from openvino.tools.mo import convert_model
ov_model = convert_model("tf_nasnet_large.onnx", layout="nhwc")
.. tab-item:: CLI
:sync: cli-tool
.. code-block:: sh
mo --input_model tf_nasnet_large.onnx --layout nhwc
Additionally, if a model has more than one input or needs both input and output
Additionally, if a model has more than one input or needs both input and output
layouts specified, you need to provide the name of each input or output to apply the layout.
For example, the following command specifies the layout for an ONNX ``Yolo v3 Tiny``
model with its first input ``input_1`` in ``NCHW`` layout and second input ``image_shape``
For example, the following command specifies the layout for an ONNX ``Yolo v3 Tiny``
model with its first input ``input_1`` in ``NCHW`` layout and second input ``image_shape``
having two dimensions: batch and size of the image expressed as the ``N?`` layout:
.. code-block:: sh
.. tab-set::
mo --input_model yolov3-tiny.onnx --layout input_1(nchw),image_shape(n?)
.. tab-item:: Python
:sync: mo-python-api
.. code-block:: python
from openvino.tools.mo import convert_model
ov_model = convert_model("yolov3-tiny.onnx", layout={"input_1": "nchw", "image_shape": "n?"})
.. tab-item:: CLI
:sync: cli-tool
.. code-block:: sh
mo --input_model yolov3-tiny.onnx --layout input_1(nchw),image_shape(n?)
Changing Model Layout
#####################
Changing the model layout may be necessary if it differs from the one presented by input data.
Use either ``--layout`` or ``--source_layout`` with ``--target_layout`` to change the layout.
Changing the model layout may be necessary if it differs from the one presented by input data.
Use either ``layout`` or ``source_layout`` with ``target_layout`` to change the layout.
For example, for the same ``nasnet_large`` model mentioned previously, you can use
For example, for the same ``nasnet_large`` model mentioned previously, you can use
the following commands to provide data in the ``NCHW`` layout:
.. code-block:: sh
mo --input_model tf_nasnet_large.onnx --source_layout nhwc --target_layout nchw
mo --input_model tf_nasnet_large.onnx --layout "nhwc->nchw"
.. tab-set::
.. tab-item:: Python
:sync: mo-python-api
.. code-block:: python
from openvino.tools.mo import convert_model
ov_model = convert_model("tf_nasnet_large.onnx", source_layout="nhwc", target_layout="nchw")
ov_model = convert_model("tf_nasnet_large.onnx", layout="nhwc->nchw")
.. tab-item:: CLI
:sync: cli-tool
.. code-block:: sh
mo --input_model tf_nasnet_large.onnx --source_layout nhwc --target_layout nchw
mo --input_model tf_nasnet_large.onnx --layout "nhwc->nchw"
Again, if a model has more than one input or needs both input and output layouts
Again, if a model has more than one input or needs both input and output layouts
specified, you need to provide the name of each input or output to apply the layout.
For example, to provide data in the ``NHWC`` layout for the `Yolo v3 Tiny` model
For example, to provide data in the ``NHWC`` layout for the `Yolo v3 Tiny` model
mentioned earlier, use the following commands:
.. code-block:: sh
.. tab-set::
mo --input_model yolov3-tiny.onnx --source_layout "input_1(nchw),image_shape(n?)" --target_layout "input_1(nhwc)"
mo --input_model yolov3-tiny.onnx --layout "input_1(nchw->nhwc),image_shape(n?)"
.. tab-item:: Python
:sync: mo-python-api
.. code-block:: python
from openvino.tools.mo import convert_model
ov_model = convert_model("yolov3-tiny.onnx", source_layout={"input_1": "nchw", "image_shape": "n?"}, target_layout={"input_1": "nhwc"})
ov_model = convert_model("yolov3-tiny.onnx", layout={"input_1": "nchw->nhwc", "image_shape": "n?"}
.. tab-item:: CLI
:sync: cli-tool
.. code-block:: sh
mo --input_model yolov3-tiny.onnx --source_layout "input_1(nchw),image_shape(n?)" --target_layout "input_1(nhwc)"
mo --input_model yolov3-tiny.onnx --layout "input_1(nchw->nhwc),image_shape(n?)"
Specifying Mean and Scale Values
################################
Neural network models are usually trained with the normalized input data. This
means that the input data values are converted to be in a specific range, for example,
``[0, 1]`` or ``[-1, 1]``. Sometimes, the mean values (mean images) are subtracted
Neural network models are usually trained with the normalized input data. This
means that the input data values are converted to be in a specific range, for example,
``[0, 1]`` or ``[-1, 1]``. Sometimes, the mean values (mean images) are subtracted
from the input data values as part of the preprocessing.
There are two cases of how the input data preprocessing is implemented.
* The input preprocessing operations are a part of a model.
In this case, the application does not perform a separate preprocessing step:
everything is embedded into the model itself. Model Optimizer will generate the
OpenVINO IR format with required preprocessing operations, and no ``mean`` and
In this case, the application does not perform a separate preprocessing step:
everything is embedded into the model itself. ``convert_model()`` will generate the
ov.Model with required preprocessing operations, and no ``mean`` and
``scale`` parameters are required.
* The input preprocessing operations are not a part of a model and the preprocessing
* The input preprocessing operations are not a part of a model and the preprocessing
is performed within the application which feeds the model with input data.
In this case, information about mean/scale values should be provided to Model
Optimizer to embed it to the generated OpenVINO IR format.
In this case, information about mean/scale values should be provided to ``convert_model()``
to embed it to the generated ``ov.Model``.
Model Optimizer provides command-line parameters to specify the values: ``--mean_values``,
``--scale_values``, ``--scale``. Using these parameters, Model Optimizer embeds the
corresponding preprocessing block for mean-value normalization of the input data
and optimizes this block so that the preprocessing takes negligible time for inference.
Model conversion API represented by ``convert_model()`` provides command-line parameters
to specify the values: ``mean_values``, ``scale_values``, ``scale``. Using these parameters,
model conversion API embeds the corresponding preprocessing block for mean-value
normalization of the input data and optimizes this block so that the preprocessing
takes negligible time for inference.
For example, the following command runs Model Optimizer for the PaddlePaddle UNet
For example, the following command runs model conversion for the PaddlePaddle UNet
model and applies mean-scale normalization to the input data:
.. code-block:: sh
.. tab-set::
mo --input_model unet.pdmodel --mean_values [123,117,104] --scale 255
.. tab-item:: Python
:sync: mo-python-api
.. code-block:: python
from openvino.tools.mo import convert_model
ov_model = convert_model("unet.pdmodel", mean_values=[123,117,104], scale=255)
.. tab-item:: CLI
:sync: cli-tool
.. code-block:: sh
mo --input_model unet.pdmodel --mean_values [123,117,104] --scale 255
Reversing Input Channels
########################
Sometimes, input images for your application can be of the RGB (or BGR) format
and the model is trained on images of the BGR (or RGB) format, which is in the
opposite order of color channels. In this case, it is important to preprocess the
Sometimes, input images for your application can be of the RGB (or BGR) format
and the model is trained on images of the BGR (or RGB) format, which is in the
opposite order of color channels. In this case, it is important to preprocess the
input images by reverting the color channels before inference.
To embed this preprocessing step into OpenVINO IR, Model Optimizer provides the
``--reverse_input_channels`` command-line parameter to shuffle the color channels.
To embed this preprocessing step into ``ov.Model``, model conversion API provides the
``reverse_input_channels`` command-line parameter to shuffle the color channels.
The ``--reverse_input_channels`` parameter can be used to preprocess the model
The ``reverse_input_channels`` parameter can be used to preprocess the model
input in the following cases:
* Only one dimension in the input shape has a size equal to ``3``.
* One dimension has an undefined size and is marked as ``C`` channel using ``layout`` parameters.
Using the ``--reverse_input_channels`` parameter, Model Optimizer embeds the corresponding
preprocessing block for reverting the input data along channel dimension and optimizes
Using the ``reverse_input_channels`` parameter, model conversion API embeds the corresponding
preprocessing block for reverting the input data along channel dimension and optimizes
this block so that the preprocessing takes only negligible time for inference.
For example, the following command launches Model Optimizer for the TensorFlow AlexNet
For example, the following command launches model conversion for the TensorFlow AlexNet
model and embeds the ``reverse_input_channel`` preprocessing block into OpenVINO IR:
.. code-block:: sh
mo --input_model alexnet.pb --reverse_input_channels
.. tab-set::
.. tab-item:: Python
:sync: mo-python-api
.. code-block:: python
from openvino.tools.mo import convert_model
ov_model = convert_model("alexnet.pb", reverse_input_channels=True)
.. tab-item:: CLI
:sync: cli-tool
.. code-block:: sh
mo --input_model alexnet.pb --reverse_input_channels
.. note::
If both mean and scale values are specified, the mean is subtracted first and
then the scale is applied regardless of the order of options in the command-line.
Input values are *divided* by the scale value(s). If the ``--reverse_input_channels``
option is also used, ``reverse_input_channels`` will be applied first, then ``mean``
and after that ``scale``. The data flow in the model looks as follows:
If both mean and scale values are specified, the mean is subtracted first and
then the scale is applied regardless of the order of options in the command-line.
Input values are *divided* by the scale value(s). If the ``reverse_input_channels``
option is also used, ``reverse_input_channels`` will be applied first, then ``mean``
and after that ``scale``. The data flow in the model looks as follows:
``Parameter -> ReverseInputChannels -> Mean apply-> Scale apply -> the original body of the model``.
Additional Resources
@@ -153,4 +241,3 @@ Additional Resources
* :doc:`Overview of Preprocessing API <openvino_docs_OV_UG_Preprocessing_Overview>`
@endsphinxdirective

View File

@@ -2,18 +2,29 @@
@sphinxdirective
Model Optimizer by default converts all floating-point weights to ``FP16`` data type.
The resulting IR is called compressed ``FP16`` model. The resulting model will occupy
about twice as less space in the file system, but it may have some accuracy drop.
For most models, the accuracy drop is negligible. But in case if accuracy drop is
significant user can disable compression explicitly.
Optionally all relevant floating-point weights can be compressed to ``FP16`` data type during the model conversion.
It results in creating a "compressed ``FP16`` model", which occupies about half of
the original space in the file system. The compression may introduce a drop in accuracy.
but it is negligible for most models.
By default, models are compressed to ``FP16``, but you can disable compression by
specifying ``--compress_to_fp16=False``:
To compress the model, use the ``compress_to_fp16=True`` option:
.. code-block:: sh
.. tab-set::
mo --input_model INPUT_MODEL --compress_to_fp16=False
.. tab-item:: Python
:sync: mo-python-api
.. code-block:: python
from openvino.tools.mo import convert_model
ov_model = convert_model(INPUT_MODEL, compress_to_fp16=False)
.. tab-item:: CLI
:sync: cli-tool
.. code-block:: sh
mo --input_model INPUT_MODEL --compress_to_fp16=False
For details on how plugins handle compressed ``FP16`` models, see
@@ -26,4 +37,11 @@ For details on how plugins handle compressed ``FP16`` models, see
information about that.
.. note::
Some large models (larger than a few GB) when compressed to ``FP16`` may consume enormous amount of RAM on the loading
phase of the inference. In case if you are facing such problems, please try to convert them without compression:
``convert_model(INPUT_MODEL, compress_to_fp16=False)`` or ``convert_model(INPUT_MODEL)``
@endsphinxdirective

View File

@@ -0,0 +1,115 @@
# Convert Models Represented as Python Objects {#openvino_docs_MO_DG_Python_API}
@sphinxdirective
Model conversion API is represented by ``convert_model()`` method in openvino.tools.mo namespace. ``convert_model()`` is compatible with types from openvino.runtime, like PartialShape, Layout, Type, etc.
``convert_model()`` has the ability available from the command-line tool, plus the ability to pass Python model objects, such as a Pytorch model or TensorFlow Keras model directly, without saving them into files and without leaving the training environment (Jupyter Notebook or training scripts). In addition to input models consumed directly from Python, ``convert_model`` can take OpenVINO extension objects constructed directly in Python for easier conversion of operations that are not supported in OpenVINO.
.. note::
Model conversion can be performed by the ``convert_model()`` method and MO command line tool. The functionality from this article is applicable for ``convert_model()`` only and it is not present in command line tool.
``convert_model()`` returns an openvino.runtime.Model object which can be compiled and inferred or serialized to IR.
Example of converting a PyTorch model directly from memory:
.. code-block:: python
import torchvision
model = torchvision.models.resnet50(pretrained=True)
ov_model = convert_model(model)
The following types are supported as an input model for ``convert_model()``:
* PyTorch - ``torch.nn.Module``, ``torch.jit.ScriptModule``, ``torch.jit.ScriptFunction``. Refer to the :doc:`Converting a PyTorch Model<openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_PyTorch>` article for more details.
* TensorFlow / TensorFlow 2 / Keras - ``tf.keras.Model``, ``tf.keras.layers.Layer``, ``tf.compat.v1.Graph``, ``tf.compat.v1.GraphDef``, ``tf.Module``, ``tf.function``, ``tf.compat.v1.session``, ``tf.train.checkpoint``. Refer to the :doc:`Converting a TensorFlow Model<openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_TensorFlow>` article for more details.
``convert_model()`` accepts all parameters available in the MO command-line tool. Parameters can be specified by Python classes or string analogs, similar to the command-line tool.
Example of using native Python classes to set ``input_shape``, ``mean_values`` and ``layout``:
.. code-block:: python
from openvino.runtime import PartialShape, Layout
ov_model = convert_model(model, input_shape=PartialShape([1,3,100,100]), mean_values=[127, 127, 127], layout=Layout("NCHW"))
Example of using strings for setting ``input_shape``, ``mean_values`` and ``layout``:
.. code-block:: python
ov_model = convert_model(model, input_shape="[1,3,100,100]", mean_values="[127,127,127]", layout="NCHW")
The ``input`` parameter can be set by a ``tuple`` with a name, shape, and type. The input name of the type string is required in the tuple. The shape and type are optional.
The shape can be a ``list`` or ``tuple`` of dimensions (``int`` or ``openvino.runtime.Dimension``), or ``openvino.runtime.PartialShape``, or ``openvino.runtime.Shape``. The type can be of numpy type or ``openvino.runtime.Type``.
Example of using a tuple in the ``input`` parameter to cut a model:
.. code-block:: python
ov_model = convert_model(model, input=("input_name", [3], np.float32))
For complex cases, when a value needs to be set in the ``input`` parameter, the ``InputCutInfo`` class can be used. ``InputCutInfo`` accepts four parameters: ``name``, ``shape``, ``type``, and ``value``.
``InputCutInfo("input_name", [3], np.float32, [0.5, 2.1, 3.4])`` is equivalent of ``InputCutInfo(name="input_name", shape=[3], type=np.float32, value=[0.5, 2.1, 3.4])``.
Supported types for ``InputCutInfo``:
* name: ``string``.
* shape: ``list`` or ``tuple`` of dimensions (``int`` or ``openvino.runtime.Dimension``), ``openvino.runtime.PartialShape``, ``openvino.runtime.Shape``.
* type: ``numpy type``, ``openvino.runtime.Type``.
* value: ``numpy.ndarray``, ``list`` of numeric values, ``bool``.
Example of using ``InputCutInfo`` to freeze an input with value:
.. code-block:: python
from openvino.tools.mo import convert_model, InputCutInfo
ov_model = convert_model(model, input=InputCutInfo("input_name", [3], np.float32, [0.5, 2.1, 3.4]))
To set parameters for models with multiple inputs, use ``list`` of parameters.
Parameters supporting ``list``:
* input
* input_shape
* layout
* source_layout
* dest_layout
* mean_values
* scale_values
Example of using lists to set shapes, types and layout for multiple inputs:
.. code-block:: python
ov_model = convert_model(model, input=[("input1", [1,3,100,100], np.float32), ("input2", [1,3,100,100], np.float32)], layout=[Layout("NCHW"), LayoutMap("NCHW", "NHWC")])
``layout``, ``source_layout`` and ``dest_layout`` accept an ``openvino.runtime.Layout`` object or ``string``.
Example of using the ``Layout`` class to set the layout of a model input:
.. code-block:: python
from openvino.runtime import Layout
from openvino.tools.mo import convert_model
ov_model = convert_model(model, source_layout=Layout("NCHW"))
To set both source and destination layouts in the ``layout`` parameter, use the ``LayoutMap`` class. ``LayoutMap`` accepts two parameters: ``source_layout`` and ``target_layout``.
``LayoutMap("NCHW", "NHWC")`` is equivalent to ``LayoutMap(source_layout="NCHW", target_layout="NHWC")``.
Example of using the ``LayoutMap`` class to change the layout of a model input:
.. code-block:: python
from openvino.tools.mo import convert_model, LayoutMap
ov_model = convert_model(model, layout=LayoutMap("NCHW", "NHWC"))
@endsphinxdirective

Some files were not shown because too many files have changed in this diff Show More