diff --git a/.ci/azure/linux.yml b/.ci/azure/linux.yml index 146775f6189..24f59d96be3 100644 --- a/.ci/azure/linux.yml +++ b/.ci/azure/linux.yml @@ -30,8 +30,8 @@ jobs: WORK_DIR: $(Pipeline.Workspace)/_w BUILD_DIR: $(WORK_DIR)/build BUILD_SAMPLES_DIR: $(WORK_DIR)/build_samples - BIN_DIR: $(REPO_DIR)/bin/intel64/$(BUILD_TYPE) INSTALL_DIR: $(WORK_DIR)/install_pkg + INSTALL_TEST_DIR: $(INSTALL_DIR)/tests SETUPVARS: $(INSTALL_DIR)/bin/setupvars.sh steps: @@ -103,7 +103,6 @@ jobs: cmakeArgs: > -GNinja -DVERBOSE_BUILD=ON - -DENABLE_TEMPLATE_PLUGIN=ON -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DENABLE_PYTHON=ON -DPYTHON_EXECUTABLE=/usr/bin/python3.6 @@ -117,6 +116,9 @@ jobs: $(REPO_DIR) workingDirectory: $(BUILD_DIR) + - script: ls -alR $(REPO_DIR)/inference-engine/temp/ + displayName: 'List temp SDKs' + - script: ninja workingDirectory: $(BUILD_DIR) displayName: 'Build Lin' @@ -131,6 +133,15 @@ jobs: - script: ls -alR $(INSTALL_DIR) displayName: 'List install files' + - script: | + mkdir $(INSTALL_DIR)/opencv/ + cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P cmake_install.cmake && cp -R $(REPO_DIR)/inference-engine/temp/opencv_4.5.2_ubuntu18/opencv/* $(INSTALL_DIR)/opencv/ + workingDirectory: $(BUILD_DIR) + displayName: 'Install tests' + + - script: ls -alR $(INSTALL_DIR) + displayName: 'List install files' + - script: $(INSTALL_DIR)/deployment_tools/inference_engine/samples/cpp/build_samples.sh workingDirectory: $(BUILD_SAMPLES_DIR) displayName: 'Build cpp samples' @@ -139,62 +150,59 @@ jobs: workingDirectory: $(BUILD_SAMPLES_DIR) displayName: 'Build c samples' - - script: $(BIN_DIR)/unit-test --gtest_print_time=1 --gtest_filter=-backend_api.config_unsupported:*IE_GPU* --gtest_output=xml:TEST-NGraphUT.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/unit-test --gtest_print_time=1 --gtest_filter=-backend_api.config_unsupported:*IE_GPU* --gtest_output=xml:TEST-NGraphUT.xml displayName: 'nGraph UT' continueOnError: false - # python3 $(WORK_DIR)/gtest-parallel/gtest_parallel.py $(BIN_DIR)/InferenceEngineUnitTests --workers=$(WORKERS_NUMBER) --dump_json_test_results=InferenceEngineUnitTests.json --gtest_filter=*smoke* -- --gtest_print_time=1 - - script: $(BIN_DIR)/InferenceEngineUnitTests --gtest_print_time=1 --gtest_output=xml:TEST-InferenceEngineUnitTests.xml + # . $(SETUPVARS) && python3 $(WORK_DIR)/gtest-parallel/gtest_parallel.py $(INSTALL_TEST_DIR)/InferenceEngineUnitTests --workers=$(WORKERS_NUMBER) --dump_json_test_results=InferenceEngineUnitTests.json --gtest_filter=*smoke* -- --gtest_print_time=1 + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineUnitTests --gtest_print_time=1 --gtest_output=xml:TEST-InferenceEngineUnitTests.xml displayName: 'IE UT old' continueOnError: false - - script: $(BIN_DIR)/ieUnitTests --gtest_output=xml:TEST-ieUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieUnitTests --gtest_output=xml:TEST-ieUnitTests.xml displayName: 'IE UT' continueOnError: false - - script: $(BIN_DIR)/cpuUnitTests --gtest_output=xml:TEST-cpuUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuUnitTests --gtest_output=xml:TEST-cpuUnitTests.xml displayName: 'CPU UT' continueOnError: false - - script: $(BIN_DIR)/gnaUnitTests --gtest_output=xml:TEST-gnaUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/gnaUnitTests --gtest_output=xml:TEST-gnaUnitTests.xml displayName: 'GNA UT' continueOnError: false - - script: $(BIN_DIR)/vpuUnitTests --gtest_output=xml:TEST-vpuUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/vpuUnitTests --gtest_output=xml:TEST-vpuUnitTests.xml displayName: 'VPU UT' continueOnError: false - - script: $(BIN_DIR)/onnxImporterUnitTests --gtest_output=xml:TEST-onnxImporterUnitTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/onnxImporterUnitTests --gtest_output=xml:TEST-onnxImporterUnitTests.xml displayName: 'ONNX Importer UT' continueOnError: false - - script: $(BIN_DIR)/ieFuncTests --gtest_output=xml:TEST-ieFuncTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/ieFuncTests --gtest_output=xml:TEST-ieFuncTests.xml displayName: 'IE FuncTests' continueOnError: false - - script: $(BIN_DIR)/templateFuncTests --gtest_filter=*smoke* --gtest_output=xml:TEST-templateFuncTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/templateFuncTests --gtest_filter=*smoke* --gtest_output=xml:TEST-templateFuncTests.xml displayName: 'TEMPLATE FuncTests' continueOnError: false - - script: $(BIN_DIR)/cpuFuncTests --gtest_filter=*smoke* --gtest_print_time=1 --gtest_output=xml:TEST-cpuFuncTests.xml + - script: . $(SETUPVARS) && $(INSTALL_TEST_DIR)/cpuFuncTests --gtest_filter=*smoke* --gtest_print_time=1 --gtest_output=xml:TEST-cpuFuncTests.xml displayName: 'CPU FuncTests' continueOnError: false - script: | export DATA_PATH=$(MODELS_PATH) export MODELS_PATH=$(MODELS_PATH) - $(BIN_DIR)/InferenceEngineCAPITests --gtest_output=xml:TEST-InferenceEngineCAPITests.xml + . $(SETUPVARS) && $(INSTALL_TEST_DIR)/InferenceEngineCAPITests --gtest_output=xml:TEST-InferenceEngineCAPITests.xml displayName: 'IE CAPITests' continueOnError: false - script: | export DATA_PATH=$(MODELS_PATH) export MODELS_PATH=$(MODELS_PATH) - export LD_LIBRARY_PATH=$(BIN_DIR)/lib - export PYTHONPATH=$(BIN_DIR)/lib/python_api/python3.6 - env cd $(REPO_DIR)/inference-engine/ie_bridges/python/tests - pytest pytest --junitxml=TEST-PythonAPI.xml + . $(SETUPVARS) -pyver 3.6 && pytest pytest --junitxml=TEST-PythonAPI.xml displayName: 'Python API Tests' continueOnError: false enabled: false diff --git a/.ci/azure/windows.yml b/.ci/azure/windows.yml index f5e5d7673c2..c368776c8f4 100644 --- a/.ci/azure/windows.yml +++ b/.ci/azure/windows.yml @@ -30,14 +30,13 @@ jobs: WORK_DIR: $(Pipeline.Workspace)\_w BUILD_DIR: D:\build BUILD_SAMPLES_DIR: D:\build_samples - BIN_DIR: $(REPO_DIR)\bin\intel64 MSVS_VARS_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat MSVC_COMPILER_PATH: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.24.28314\bin\Hostx64\x64\cl.exe INSTALL_DIR: $(WORK_DIR)\install_pkg + INSTALL_TEST_DIR: $(INSTALL_DIR)\tests SETUPVARS: $(INSTALL_DIR)\bin\setupvars.bat IB_DIR: C:\Program Files (x86)\IncrediBuild IB_TESTCONSOLE: $(IB_DIR)\IBTestConsole.exe - TEST_ENV_PATH: $(REPO_DIR)\inference-engine\temp\tbb\bin;$(REPO_DIR)\inference-engine\temp\opencv_4.5.2\opencv\bin;$(IB_DIR);%PATH% steps: - script: | @@ -96,6 +95,9 @@ jobs: workingDirectory: $(BUILD_DIR) displayName: 'CMake' + - script: dir $(REPO_DIR)\inference-engine\temp\ /s + displayName: 'List temp SDKs' + - script: | set PATH=$(WORK_DIR)\ninja-win;%PATH% call "$(MSVS_VARS_PATH)" && "C:\Program Files (x86)\IncrediBuild\BuildConsole.exe" /COMMAND="ninja" @@ -112,6 +114,13 @@ jobs: - script: dir $(INSTALL_DIR) /s displayName: 'List install files' + - script: cmake -DCMAKE_INSTALL_PREFIX=$(INSTALL_DIR) -DCOMPONENT=tests -P cmake_install.cmake && xcopy $(REPO_DIR)\inference-engine\temp\opencv_4.5.2\opencv\* $(INSTALL_DIR)\opencv\ /e /h /y + workingDirectory: $(BUILD_DIR) + displayName: 'Install tests' + + - script: dir $(INSTALL_DIR) /s + displayName: 'List install files' + - script: $(INSTALL_DIR)\deployment_tools\inference_engine\samples\cpp\build_samples_msvc.bat workingDirectory: $(BUILD_SAMPLES_DIR) displayName: 'Build cpp samples' @@ -120,71 +129,55 @@ jobs: workingDirectory: $(BUILD_SAMPLES_DIR) displayName: 'Build c samples' - - script: | - set PATH=$(TEST_ENV_PATH) - $(BIN_DIR)\unit-test --gtest_print_time=1 --gtest_filter=-backend_api.config_unsupported:*IE_GPU* --gtest_output=xml:TEST-NGraphUT.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\unit-test --gtest_print_time=1 --gtest_filter=-backend_api.config_unsupported:*IE_GPU* --gtest_output=xml:TEST-NGraphUT.xml displayName: 'nGraph UT' continueOnError: false - script: | - set PATH=$(TEST_ENV_PATH) - "$(IB_TESTCONSOLE)" $(BIN_DIR)\InferenceEngineUnitTests.exe --gtest_output=xml:TEST-InferenceEngineUnitTests-IB.xml + set PATH=$(IB_DIR);%PATH% + call $(SETUPVARS) && "$(IB_TESTCONSOLE)" $(INSTALL_TEST_DIR)\InferenceEngineUnitTests.exe --gtest_output=xml:TEST-InferenceEngineUnitTests-IB.xml displayName: 'IE UT old - IB' + continueOnError: false - - script: | - set PATH=$(TEST_ENV_PATH) - $(BIN_DIR)\ieUnitTests --gtest_output=xml:TEST-ieUnitTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ieUnitTests --gtest_output=xml:TEST-ieUnitTests.xml displayName: 'IE UT' continueOnError: false - - script: | - set PATH=$(TEST_ENV_PATH) - $(BIN_DIR)\cpuUnitTests --gtest_output=xml:TEST-cpuUnitTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\cpuUnitTests --gtest_output=xml:TEST-cpuUnitTests.xml displayName: 'CPU UT' continueOnError: false - - script: | - set PATH=$(TEST_ENV_PATH) - $(BIN_DIR)\gnaUnitTests --gtest_output=xml:TEST-gnaUnitTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\gnaUnitTests --gtest_output=xml:TEST-gnaUnitTests.xml displayName: 'GNA UT' continueOnError: false - - script: | - set PATH=$(TEST_ENV_PATH) - $(BIN_DIR)\vpuUnitTests --gtest_output=xml:TEST-vpuUnitTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\vpuUnitTests --gtest_output=xml:TEST-vpuUnitTests.xml displayName: 'VPU UT' continueOnError: false - - script: | - set PATH=$(TEST_ENV_PATH) - $(BIN_DIR)\onnxImporterUnitTests --gtest_output=xml:TEST-onnxImporterUnitTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\onnxImporterUnitTests --gtest_output=xml:TEST-onnxImporterUnitTests.xml displayName: 'ONNX Importer UT' continueOnError: false - - script: | - set PATH=$(TEST_ENV_PATH) - $(BIN_DIR)\ieFuncTests --gtest_output=xml:TEST-ieFuncTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\ieFuncTests --gtest_output=xml:TEST-ieFuncTests.xml displayName: 'IE FuncTests' continueOnError: false - - script: | - set PATH=$(TEST_ENV_PATH) - $(BIN_DIR)\templateFuncTests --gtest_output=xml:TEST-templateFuncTests.xml + - script: call $(SETUPVARS) && $(INSTALL_TEST_DIR)\templateFuncTests --gtest_output=xml:TEST-templateFuncTests.xml displayName: 'TEMPLATE FuncTests' continueOnError: false + # call $(SETUPVARS) && $(INSTALL_TEST_DIR)\cpuFuncTests.exe --gtest_filter=*smoke* --gtest_output=xml:TEST-cpuFuncTests.xml - script: | - set PATH=$(TEST_ENV_PATH) - rem $(BIN_DIR)\cpuFuncTests.exe --gtest_filter=*smoke* --gtest_output=xml:TEST-cpuFuncTests.xml - "$(IB_TESTCONSOLE)" $(BIN_DIR)\cpuFuncTests.exe --gtest_filter=*smoke*:-*CompareWithRefs/base_size=16_pre_nms_topn=100_post_nms_topn=100_nms_thresh=0.7_feat_stride=1_min_size=1_ratio*:*smoke_GRUSequenceCommonZeroClip/GRUSequenceTest.CompareWithRefs/mode=CONVERT_TO_TI_MAX_SEQ_LEN_CONST_seq_lengths* --gtest_output=xml:TEST-cpuFuncTests-IB.xml /testlevel=24 + set PATH=$(IB_DIR);%PATH% + call $(SETUPVARS) && "$(IB_TESTCONSOLE)" $(INSTALL_TEST_DIR)\cpuFuncTests.exe --gtest_filter=*smoke*:-*CompareWithRefs/base_size=16_pre_nms_topn=100_post_nms_topn=100_nms_thresh=0.7_feat_stride=1_min_size=1_ratio*:*smoke_GRUSequenceCommonZeroClip/GRUSequenceTest.CompareWithRefs/mode=CONVERT_TO_TI_MAX_SEQ_LEN_CONST_seq_lengths* --gtest_output=xml:TEST-cpuFuncTests-IB.xml /testlevel=24 displayName: 'CPU FuncTests - IB' continueOnError: false - script: | - set PATH=$(TEST_ENV_PATH) set DATA_PATH=$(MODELS_PATH) set MODELS_PATH=$(MODELS_PATH) - $(BIN_DIR)\InferenceEngineCAPITests --gtest_output=xml:TEST-InferenceEngineCAPITests.xml + call $(SETUPVARS) && $(INSTALL_TEST_DIR)\InferenceEngineCAPITests --gtest_output=xml:TEST-InferenceEngineCAPITests.xml displayName: 'IE CAPITests' continueOnError: false diff --git a/.github/org_control/config.json b/.github/org_control/config.json index ed6a1e1f5aa..e013ab30923 100644 --- a/.github/org_control/config.json +++ b/.github/org_control/config.json @@ -33,6 +33,7 @@ "openvino-mo-maintainers": "category: MO", "openvino-ngraph-maintainers": "category: nGraph", "openvino-tests-maintainers": "category: IE Tests", - "openvino-tools-maintainers": "category: tools" + "openvino-tools-maintainers": "category: tools", + "openvino-configuration-mgmt": "category: dependency_changes" } } diff --git a/CODEOWNERS b/CODEOWNERS index f6cef156f27..d47170c4716 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -73,3 +73,8 @@ azure-pipelines.yml @openvinotoolkit/openvino-admins # Documentation /docs/ @openvinotoolkit/openvino-docs-maintainers *.md @openvinotoolkit/openvino-docs-maintainers + +# Control 3d party dependencies +*requirements* @openvino-configuration-mgmt +*setup.py @openvino-configuration-mgmt +/scripts/install_dependencies/ @openvino-configuration-mgmt \ No newline at end of file diff --git a/cmake/features.cmake b/cmake/features.cmake index 6042d9d2238..1f0c198913c 100644 --- a/cmake/features.cmake +++ b/cmake/features.cmake @@ -24,8 +24,6 @@ Supported values:\ ie_option (ENABLE_PROFILING_FIRST_INFERENCE "Build with ITT tracing of first inference time." ON) -ie_option(ENABLE_TEMPLATE_PLUGIN "Register template plugin into plugins.xml" OFF) - ie_option_enum(SELECTIVE_BUILD "Enable OpenVINO conditional compilation or statistics collection. \ In case SELECTIVE_BUILD is enabled, the SELECTIVE_BUILD_STAT variable should contain the path to the collected InelSEAPI statistics. \ Usage: -DSELECTIVE_BUILD=ON -DSELECTIVE_BUILD_STAT=/path/*.csv" OFF diff --git a/docs/MO_DG/prepare_model/convert_model/Convert_Model_From_PyTorch.md b/docs/MO_DG/prepare_model/convert_model/Convert_Model_From_PyTorch.md index 0898fd7e222..fdf5dcbb983 100644 --- a/docs/MO_DG/prepare_model/convert_model/Convert_Model_From_PyTorch.md +++ b/docs/MO_DG/prepare_model/convert_model/Convert_Model_From_PyTorch.md @@ -1,36 +1,45 @@ # Converting a PyTorch* Model {#openvino_docs_MO_DG_prepare_model_convert_model_Convert_Model_From_PyTorch} +## Supported Topologies + +Here is the list of models that are tested and guaranteed to be supported. However, you can also use these instructions to convert PyTorch\* models that are not presented in the list. + +* [Torchvision Models](https://pytorch.org/docs/stable/torchvision/index.html): alexnet, densenet121, densenet161, + densenet169, densenet201, resnet101, resnet152, resnet18, resnet34, resnet50, vgg11, vgg13, vgg16, vgg19. + The models can be converted using [regular instructions](#typical-pytorch). +* [Cadene Pretrained Models](https://github.com/Cadene/pretrained-models.pytorch): alexnet, fbresnet152, resnet101, + resnet152, resnet18, resnet34, resnet152, resnet18, resnet34, resnet50, resnext101_32x4d, resnext101_64x4d, vgg11. + The models can be converted using [regular instructions](#typical-pytorch). +* [ESPNet Models](https://github.com/sacmehta/ESPNet/tree/master/pretrained) can be converted using [regular instructions](#typical-pytorch). +* [MobileNetV3](https://github.com/d-li14/mobilenetv3.pytorch) can be converted using [regular instructions](#typical-pytorch). +* [iSeeBetter](https://github.com/amanchadha/iSeeBetter) can be converted using [regular instructions](#typical-pytorch). + Please refer to [`iSeeBetterTest.py`](https://github.com/amanchadha/iSeeBetter/blob/master/iSeeBetterTest.py) script for code to initialize the model. +* F3Net topology can be converted using steps described in [Convert PyTorch\* F3Net to the IR](pytorch_specific/Convert_F3Net.md) + instruction which is used instead of steps 2 and 3 of [regular instructions](#typical-pytorch). +* QuartzNet topologies from [NeMo project](https://github.com/NVIDIA/NeMo) can be converted using steps described in + [Convert PyTorch\* QuartzNet to the IR](pytorch_specific/Convert_QuartzNet.md) instruction which is used instead of + steps 2 and 3 of [regular instructions](#typical-pytorch). +* YOLACT topology can be converted using steps described in [Convert PyTorch\* YOLACT to the IR](pytorch_specific/Convert_YOLACT.md) + instruction which is used instead of steps 2 and 3 of [regular instructions](#typical-pytorch). +* [RCAN](https://github.com/yulunzhang/RCAN) topology can be converted using steps described in [Convert PyTorch\* RCAN to the IR](pytorch_specific/Convert_RCAN.md) + instruction which is used instead of steps 2 and 3 of [regular instructions](#typical-pytorch). +* [BERT_NER](https://github.com/kamalkraj/BERT-NER) topology can be converted using steps described in [Convert PyTorch* BERT-NER to the IR](pytorch_specific/Convert_Bert_ner.md) + instruction which is used instead of steps 2 and 3 of [regular instructions](#typical-pytorch). + +## Typical steps to convert PyTorch\* model + PyTorch* framework is supported through export to ONNX\* format. A summary of the steps for optimizing and deploying a model that was trained with the PyTorch\* framework: -1. [Export PyTorch model to ONNX\*](#export-to-onnx). -2. [Configure the Model Optimizer](../Config_Model_Optimizer.md) for ONNX\*. +1. [Configure the Model Optimizer](../Config_Model_Optimizer.md) for ONNX\*. +2. [Export PyTorch model to ONNX\*](#export-to-onnx). 3. [Convert an ONNX\* model](Convert_Model_From_ONNX.md) to produce an optimized [Intermediate Representation (IR)](../../IR_and_opsets.md) of the model based on the trained network topology, weights, and biases values. 4. Test the model in the Intermediate Representation format using the [Inference Engine](../../../IE_DG/Deep_Learning_Inference_Engine_DevGuide.md) in the target environment via provided [sample applications](../../../IE_DG/Samples_Overview.md). 5. [Integrate](../../../IE_DG/Samples_Overview.md) the Inference Engine in your application to deploy the model in the target environment. -## Supported Topologies - -Here is the list of models that were tested and are guaranteed to be supported. -It is not a full list of models that can be converted to ONNX\* and to IR. - -|Package Name|Supported Models| -|:----|:----| -| [Torchvision Models](https://pytorch.org/docs/stable/torchvision/index.html) | alexnet, densenet121, densenet161, densenet169, densenet201, resnet101, resnet152, resnet18, resnet34, resnet50, vgg11, vgg13, vgg16, vgg19 | -| [Pretrained Models](https://github.com/Cadene/pretrained-models.pytorch) | alexnet, fbresnet152, resnet101, resnet152, resnet18, resnet34, resnet152, resnet18, resnet34, resnet50, resnext101_32x4d, resnext101_64x4d, vgg11 | - -**Other supported topologies** - -* [ESPNet Models](https://github.com/sacmehta/ESPNet/tree/master/pretrained) -* [MobileNetV3](https://github.com/d-li14/mobilenetv3.pytorch) -* F3Net topology can be converted using [Convert PyTorch\* F3Net to the IR](pytorch_specific/Convert_F3Net.md) instruction. -* QuartzNet topologies from [NeMo project](https://github.com/NVIDIA/NeMo) can be converted using [Convert PyTorch\* QuartzNet to the IR](pytorch_specific/Convert_QuartzNet.md) instruction. -* YOLACT topology can be converted using [Convert PyTorch\* YOLACT to the IR](pytorch_specific/Convert_YOLACT.md) instruction. -* [RCAN](https://github.com/yulunzhang/RCAN) topologies can be converted using [Convert PyTorch\* RCAN to the IR](pytorch_specific/Convert_RCAN.md) instruction. -* [BERT_NER](https://github.com/kamalkraj/BERT-NER) can be converted using [Convert PyTorch* BERT-NER to the IR](pytorch_specific/Convert_Bert_ner.md) instruction. - ## Export PyTorch\* Model to ONNX\* Format -PyTorch models are defined in a Python\* code, to export such models use `torch.onnx.export()` method. +PyTorch models are defined in a Python\* code, to export such models use `torch.onnx.export()` method. Usually code to +evaluate or test the model is provided with the model code and can be used to initialize and export model. Only the basics will be covered here, the step to export to ONNX\* is crucial but it is covered by PyTorch\* framework. For more information, please refer to [PyTorch\* documentation](https://pytorch.org/docs/stable/onnx.html). diff --git a/docs/MO_DG/prepare_model/convert_model/onnx_specific/Convert_Faster_RCNN.md b/docs/MO_DG/prepare_model/convert_model/onnx_specific/Convert_Faster_RCNN.md index e749e37780d..fc5920970ce 100644 --- a/docs/MO_DG/prepare_model/convert_model/onnx_specific/Convert_Faster_RCNN.md +++ b/docs/MO_DG/prepare_model/convert_model/onnx_specific/Convert_Faster_RCNN.md @@ -8,7 +8,8 @@ These instructions are applicable only to the Faster R-CNN model converted to th ```sh python3 ./mo_onnx.py --input_model FasterRCNN-10.onnx \ ---input_shape [3,800,800] \ +--input_shape [1,3,800,800] \ +--input 0:2 \ --mean_values [102.9801,115.9465,122.7717] \ --transformations_config ./extensions/front/onnx/faster_rcnn.json ``` diff --git a/docs/install_guides/installing-openvino-apt.md b/docs/install_guides/installing-openvino-apt.md index 982d71102b3..ae50dd84976 100644 --- a/docs/install_guides/installing-openvino-apt.md +++ b/docs/install_guides/installing-openvino-apt.md @@ -4,7 +4,16 @@ This guide provides installation steps for Intel® Distribution of OpenVINO™ t > **IMPORTANT**: By downloading and using this container and the included software, you agree to the terms and conditions of the [software license agreements](https://software.intel.com/content/dam/develop/external/us/en/documents/intel-openvino-license-agreements.pdf). Please, review the content inside the `/licensing` folder for more details. -> **NOTE**: Intel® Graphics Compute Runtime for OpenCL™ is not a part of OpenVINO™ APT distribution. You can install it from the [Intel® Graphics Compute Runtime for OpenCL™ GitHub repo](https://github.com/intel/compute-runtime). +> **NOTE**: Intel® Graphics Compute Runtime for OpenCL™ is not a part of OpenVINO™ APT distribution. You can install it from the [Intel® Graphics Compute Runtime for OpenCL™ GitHub repo](https://github.com/intel/compute-runtime). + +## System Requirements + +The complete list of supported hardware is available in the [Release Notes](https://software.intel.com/content/www/us/en/develop/articles/openvino-relnotes.html#inpage-nav-8). + +**Operating Systems** + +- Ubuntu 18.04.x long-term support (LTS), 64-bit +- Ubuntu 20.04.0 long-term support (LTS), 64-bit ## Included with Runtime Package @@ -31,50 +40,46 @@ The following components are installed with the OpenVINO developer package: | [Documentation for Pre-Trained Models ](@ref omz_models_group_intel) | Documentation for the pre-trained models available in the [Open Model Zoo repo](https://github.com/openvinotoolkit/open_model_zoo). | | Deep Learning Streamer (DL Streamer) | Streaming analytics framework, based on GStreamer\*, for constructing graphs of media analytics components. For the DL Streamer documentation, see [DL Streamer Samples](@ref gst_samples_README), [API Reference](https://openvinotoolkit.github.io/dlstreamer_gst/), [Elements](https://github.com/openvinotoolkit/dlstreamer_gst/wiki/Elements), [Tutorial](https://github.com/openvinotoolkit/dlstreamer_gst/wiki/DL-Streamer-Tutorial). | -## Set up the Repository -### Install the GPG key for the repository + +## Install Packages + +### Set up the OpenVINO™ Toolkit APT Repository + +#### Install the GPG key for the Repository 1. Download the public key from [https://apt.repos.intel.com/openvino/2021/GPG-PUB-KEY-INTEL-OPENVINO-2021](https://apt.repos.intel.com/openvino/2021/GPG-PUB-KEY-INTEL-OPENVINO-2021) and save it to a file. 2. Add this key to the system keyring: ```sh sudo apt-key add ``` +> **NOTE**: You might need to install GnuPG: `sudo apt-get install gnupg` + 3. Check the list of APT keys running the following command: ```sh sudo apt-key list ``` -### Add the APT Repository +#### Add the Repository Run the following command: ```sh echo "deb https://apt.repos.intel.com/openvino/2021 all main" | sudo tee /etc/apt/sources.list.d/intel-openvino-2021.list ``` -### Update the list of packages +#### Update the List of Packages Run the `update` command: ```sh sudo apt update ``` -There are full release Runtime and Developer packages, and also some available components. -**Runtime Packages** -- Ubuntu 18.04: `intel-openvino-runtime-ubuntu18` -- Ubuntu 20.04: `intel-openvino-runtime-ubuntu20` - -**Developer Packages** -- Ubuntu 18.04: `intel-openvino-dev-ubuntu18` -- Ubuntu 20.04: `intel-openvino-dev-ubuntu20` - -### Get the list of available packages +#### Verify that the APT Repository is Properly Set Up Run the `apt-cache` command to see a list of all available OpenVINO packages and components: ```sh apt-cache search openvino ``` - -#### Examples +See the example commands below: * **Runtime Packages** @@ -97,29 +102,23 @@ apt-cache search openvino sudo apt-cache search intel-openvino-dev-ubuntu20 ``` - -## Install the runtime or developer packages using the APT Package Manager -Intel® OpenVINO will be installed in: `/opt/intel/openvino_..` +### Install Runtime or Developer Packages using the APT Package Manager +Intel® OpenVINO™ Toolkit will be installed in: `/opt/intel/openvino_..` A symlink will be created: `/opt/intel/openvino_` ---- -### To Install a specific version - -To get a list of OpenVINO packages available for installation: +#### To Install a Specific Version +1. Get a list of OpenVINO packages available for installation: ```sh sudo apt-cache search intel-openvino-runtime-ubuntu18 ``` - -To install a specific version of an OpenVINO package: +2. Install a specific version of an OpenVINO package: ```sh sudo apt install intel-openvino--ubuntu-.. ``` - -#### Examples -* **Runtime Package** - +See the example commands below: +* **Runtime Package**
On Ubuntu 18.04: ```sh sudo apt install intel-openvino-runtime-ubuntu18-2021.1.105 @@ -138,10 +137,17 @@ sudo apt install intel-openvino--ubuntu-.-ubuntu-.. ``` diff --git a/docs/install_guides/installing-openvino-conda.md b/docs/install_guides/installing-openvino-conda.md index a5cefbfb97e..b231b8b93d0 100644 --- a/docs/install_guides/installing-openvino-conda.md +++ b/docs/install_guides/installing-openvino-conda.md @@ -2,22 +2,39 @@ This guide provides installation steps for Intel® Distribution of OpenVINO™ toolkit distributed through the Anaconda* Cloud. +> **NOTE**: Only runtime packages are available from Anaconda* Cloud. + +## Introduction + +OpenVINO™ toolkit is a comprehensive toolkit for quickly developing applications and solutions that solve a variety of tasks including emulation of human vision, automatic speech recognition, natural language processing, recommendation systems, and many others. Based on latest generations of artificial neural networks, including Convolutional Neural Networks (CNNs), recurrent and attention-based networks, the toolkit extends computer vision and non-vision workloads across Intel® hardware, maximizing performance. It accelerates applications with high-performance, AI and deep learning inference deployed from edge to cloud. + +The Intel® Distribution of OpenVINO™ toolkit\*: +- Enables CNN-based deep learning inference on the edge +- Supports heterogeneous execution across Intel® CPU, Intel® Integrated Graphics, Intel® Neural Compute Stick 2, and Intel® Vision Accelerator Design with Intel® Movidius™ VPUs +- Speeds time-to-market via an easy-to-use library of computer vision functions and pre-optimized kernels +The **runtime package** includes the following components installed by default: + +| Component | Description | +|-----------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +| [Inference Engine](../IE_DG/Deep_Learning_Inference_Engine_DevGuide.md) | This is the engine that runs the deep learning model. It includes a set of libraries for an easy inference integration into your applications. | ## System Requirements +**Software** + - [Anaconda* distribution](https://www.anaconda.com/products/individual/) **Operating Systems** -- Ubuntu* 18.04 long-term support (LTS), 64-bit -- CentOS* 7.6, 64-bit -- macOS* 10.14.x versions. -- Windows 10*, 64-bit Pro, Enterprise or Education (1607 Anniversary Update, Build 14393 or higher) editions -- Windows Server* 2016 or higher +| Supported Operating System | [Python* Version (64-bit)](https://www.python.org/) | +| :------------------------------------------------------------| :---------------------------------------------------| +| Ubuntu* 18.04 long-term support (LTS), 64-bit | 3.6, 3.7 | +| Ubuntu* 20.04 long-term support (LTS), 64-bit | 3.6, 3.7 | +| CentOS* 7.6, 64-bit | 3.6, 3.7 | +| macOS* 10.15.x | 3.6, 3.7 | +| Windows 10*, 64-bit | 3.6, 3.7 | - - -## Install the runtime package using the Anaconda* Package Manager +## Install the Runtime Package using the Anaconda* Package Manager 1. Set up the Anaconda* environment:  ```sh @@ -26,11 +43,19 @@ This guide provides installation steps for Intel® Distribution of OpenVINO™ t ```sh conda activate py37 ``` -2. Updated conda to the latest version: +2. Update Anaconda environment to the latest version: ```sh conda update --all ``` -3. Install the Intel® Distribution of OpenVINO™ Toolkit: +3. Install pre-requisites: + ```sh + conda install numpy + ``` +4. Install the Intel® Distribution of OpenVINO™ Toolkit: + - Ubuntu* 20.04 + ```sh + conda install openvino-ie4py-ubuntu20 -c intel + ``` - Ubuntu* 18.04 ```sh conda install openvino-ie4py-ubuntu18 -c intel @@ -43,19 +68,13 @@ This guide provides installation steps for Intel® Distribution of OpenVINO™ t ```sh conda install openvino-ie4py -c intel ``` -4. Verify the package installed: +5. Verify the package is installed: ```sh - python -c "import openvino" + python -c "from openvino.inference_engine import IECore" ``` - -Now you can start to develop and run your application. - - -## Known Issues and Limitations - -- You cannot use Python bindings included in Intel® Distribution of OpenVINO™ toolkit with [Anaconda* distribution](https://www.anaconda.com/products/individual/) -- You cannot use Python OpenVINO™ bindings included in Anaconda* package with official [Python distribution](https://www.python.org/). + If installation was successful, you will not see any error messages (no console output). +Now you can start developing your application. ## Additional Resources diff --git a/docs/install_guides/installing-openvino-yum.md b/docs/install_guides/installing-openvino-yum.md index ae34d202293..d92e7e891d1 100644 --- a/docs/install_guides/installing-openvino-yum.md +++ b/docs/install_guides/installing-openvino-yum.md @@ -8,6 +8,14 @@ This guide provides installation steps for the Intel® Distribution of OpenVINO > **NOTE**: Only runtime packages are available via the YUM repository. +## System Requirements + +The complete list of supported hardware is available in the [Release Notes](https://software.intel.com/content/www/us/en/develop/articles/openvino-relnotes.html#inpage-nav-8). + +**Operating Systems** + +- CentOS 7.6, 64-bit + ## Included with Runtime Package The following components are installed with the OpenVINO runtime package: @@ -18,6 +26,8 @@ The following components are installed with the OpenVINO runtime package: | [OpenCV*](https://docs.opencv.org/master/) | OpenCV* community version compiled for Intel® hardware. | | Deep Learning Stream (DL Streamer) | Streaming analytics framework, based on GStreamer, for constructing graphs of media analytics components. For the DL Streamer documentation, see [DL Streamer Samples](@ref gst_samples_README), [API Reference](https://openvinotoolkit.github.io/dlstreamer_gst/), [Elements](https://github.com/openvinotoolkit/dlstreamer_gst/wiki/Elements), [Tutorial](https://github.com/openvinotoolkit/dlstreamer_gst/wiki/DL-Streamer-Tutorial). | +## Install Packages + ## Set up the Repository > **NOTE:** You must be logged in as root to set up and install the repository. @@ -39,25 +49,23 @@ Configure YUM with the OpenVINO repository to install OpenVINO. You have two opt ``` * **OPTION 2:** Create the repository file manually: - 1. Navigate to the repository directory: - ```sh - cd /etc/yum.repos.d - ``` - 2. Edit the repo file: - ```sh - vi intel-openvino-2021.repo - ``` - 3. Append the following code: + + 1. Create the YUM repo file in the /tmp directory as a normal user: ```sh + tee > /tmp/openvino-2021.repo << EOF [intel-openvino-2021] name=Intel(R) Distribution of OpenVINO 2021 baseurl=https://yum.repos.intel.com/openvino/2021 enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-INTEL-OPENVINO-2021 + EOF ``` - 4. Save and close the `intel-openvino-2021.repo` file. - 5. Import the gpg public key for the repository: + 2. Move the newly created openvino-2021.repo file to the YUM configuration directory /etc/yum.repos.d: + ```sh + sudo mv /tmp/openvino-2021.repo /etc/yum.repos.d + ``` + 3. Import the gpg public key for the repository: ```sh sudo rpm --import https://yum.repos.intel.com/openvino/2021/setup/RPM-GPG-KEY-INTEL-OPENVINO-2021 ``` @@ -103,6 +111,21 @@ To install the full runtime version of the OpenVINO package: sudo yum install intel-openvino-runtime-centos7-.. ``` +#### Examples + +```sh +sudo yum install intel-openvino-runtime-centos7-2021.3.394 + ``` + +--- + +### To check for installed packages and version + +To check a specific version of an OpenVINO package: +```sh +yum list installed intel-openvino* +``` + --- ### To Uninstall a specific version diff --git a/docs/install_guides/pypi-openvino-dev.md b/docs/install_guides/pypi-openvino-dev.md index 89bb5f3db61..01616f7e85e 100644 --- a/docs/install_guides/pypi-openvino-dev.md +++ b/docs/install_guides/pypi-openvino-dev.md @@ -15,11 +15,11 @@ The **developer package** includes the following components installed by default | Component | Console Script | Description | |------------------|---------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| [Model Optimizer](https://docs.openvinotoolkit.org/latest/openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html) | `mo` |**Model Optimizer** imports, converts, and optimizes models that were trained in popular frameworks to a format usable by Intel tools, especially the Inference Engine. 
Popular frameworks include Caffe\*, TensorFlow\*, MXNet\*, and ONNX\*. | +| [Model Optimizer](https://docs.openvinotoolkit.org/latest/openvino_docs_MO_DG_Deep_Learning_Model_Optimizer_DevGuide.html) | `mo` |**Model Optimizer** imports, converts, and optimizes models that were trained in popular frameworks to a format usable by Intel tools, especially the Inference Engine. 
Supported frameworks include Caffe\*, TensorFlow\*, MXNet\*, and ONNX\*. | | [Benchmark Tool](https://docs.openvinotoolkit.org/latest/openvino_inference_engine_tools_benchmark_tool_README.html)| `benchmark_app` | **Benchmark Application** allows you to estimate deep learning inference performance on supported devices for synchronous and asynchronous modes. | -| [Accuracy Checker](https://docs.openvinotoolkit.org/latest/omz_tools_accuracy_checker.html) and
[Annotation Converter](https://docs.openvinotoolkit.org/latest/omz_tools_accuracy_checker_annotation_converters.html) | `accuracy_check`
`convert_annotation` |**Accuracy Checker** is a deep learning accuracy validation tool that allows you to collect accuracy metrics against popular datasets. The main advantages of the tool are the flexibility of configuration and an impressive set of supported datasets, preprocessing, postprocessing, and metrics.
**Annotation Converter** is a utility for offline conversion of datasets to the format suitable for metric evaluation used in Accuracy Checker. | +| [Accuracy Checker](https://docs.openvinotoolkit.org/latest/omz_tools_accuracy_checker.html) and
[Annotation Converter](https://docs.openvinotoolkit.org/latest/omz_tools_accuracy_checker_annotation_converters.html) | `accuracy_check`
`convert_annotation` |**Accuracy Checker** is a deep learning accuracy validation tool that allows you to collect accuracy metrics against popular datasets. The main advantages of the tool are the flexibility of configuration and a set of supported datasets, preprocessing, postprocessing, and metrics.
**Annotation Converter** is a utility that prepares datasets for evaluation with Accuracy Checker. | | [Post-Training Optimization Tool](https://docs.openvinotoolkit.org/latest/pot_README.html)| `pot` |**Post-Training Optimization Tool** allows you to optimize trained models with advanced capabilities, such as quantization and low-precision optimizations, without the need to retrain or fine-tune models. Optimizations are also available through the [API](https://docs.openvinotoolkit.org/latest/pot_compression_api_README.html). | -| [Model Downloader and other Open Model Zoo tools](https://docs.openvinotoolkit.org/latest/omz_tools_downloader.html)| `omz_downloader`
`omz_converter`
`omz_quantizer`
`omz_info_dumper`| **Model Downloader** is a tool for getting access to the collection of high-quality and extremely fast pre-trained deep learning [public](https://docs.openvinotoolkit.org/latest/omz_models_group_public.html) and [intel](https://docs.openvinotoolkit.org/latest/omz_models_group_intel.html)-trained models. Use these free pre-trained models instead of training your own models to speed up the development and production deployment process. The principle of the tool is as follows: it downloads model files from online sources and, if necessary, patches them with Model Optimizer to make them more usable. A number of additional tools are also provided to automate the process of working with downloaded models:
**Model Converter** is a tool for converting the models stored in a format other than the Intermediate Representation (IR) into that format using Model Optimizer.
**Model Quantizer** is a tool for automatic quantization of full-precision IR models into low-precision versions using Post-Training Optimization Tool.
**Model Information Dumper** is a helper utility for dumping information about the models in a stable machine-readable format.| +| [Model Downloader and other Open Model Zoo tools](https://docs.openvinotoolkit.org/latest/omz_tools_downloader.html)| `omz_downloader`
`omz_converter`
`omz_quantizer`
`omz_info_dumper`| **Model Downloader** is a tool for getting access to the collection of high-quality and extremely fast pre-trained deep learning [public](https://docs.openvinotoolkit.org/latest/omz_models_group_public.html) and [Intel](https://docs.openvinotoolkit.org/latest/omz_models_group_intel.html)-trained models. These free pre-trained models can be used to speed up the development and production deployment process without training your own models. The tool downloads model files from online sources and, if necessary, patches them to make them more usable with Model Optimizer. A number of additional tools are also provided to automate the process of working with downloaded models:
**Model Converter** is a tool for converting Open Model Zoo models that are stored in an original deep learning framework format into the Inference Engine Intermediate Representation (IR) using Model Optimizer.
**Model Quantizer** is a tool for automatic quantization of full-precision models in the IR format into low-precision versions using the Post-Training Optimization Tool.
**Model Information Dumper** is a helper utility for dumping information about the models to a stable, machine-readable format. **Developer package** also provides the **runtime package** installed as a dependency. The runtime package includes the following components: @@ -54,17 +54,14 @@ To avoid dependency conflicts, use a virtual environment. Skip this Create virtual environment: -On Linux and macOS: -```sh -# Depending on your OS, this step may require installing python3-venv -python3 -m venv openvino_env -``` - -On Windows: ```sh +python -m pip install --user virtualenv python -m venv openvino_env ``` +> **NOTE**: On Linux and macOS, you may need to type `python3` instead of +`python`. You may also need to [install pip](https://pip.pypa.io/en/stable/installing/). For example, on Ubuntu execute the following command to get pip installed: `sudo apt install python3-venv python3-pip`. + ### Step 2. Activate Virtual Environment On Linux and macOS: @@ -87,11 +84,11 @@ python -m pip install --upgrade pip To install and configure the components of the development package for working with specific frameworks, use the `pip install openvino-dev[extras]` command, where `extras` is a list of extras from the table below: -| DL Framework | Extra | +| DL Framework | Extra | | :------------------------------------------------------------------------------- | :-------------------------------| | [Caffe*](https://caffe.berkeleyvision.org/) | caffe | -| [Caffe2*](https://caffe2.ai/) | caffe2 | -| [Kaldi*](https://kaldi-asr.org/) | kaldi | +| [Caffe2*](https://github.com/pytorch/pytorch) | caffe2 | +| [Kaldi*](https://github.com/kaldi-asr/kaldi) | kaldi | | [MXNet*](https://mxnet.apache.org/) | mxnet | | [ONNX*](https://github.com/microsoft/onnxruntime/) | onnx | | [PyTorch*](https://pytorch.org/) | pytorch | diff --git a/docs/install_guides/pypi-openvino-rt.md b/docs/install_guides/pypi-openvino-rt.md index 7c20f9167b0..a41c02e7b2d 100644 --- a/docs/install_guides/pypi-openvino-rt.md +++ b/docs/install_guides/pypi-openvino-rt.md @@ -51,7 +51,7 @@ python -m venv openvino_env ``` > **NOTE**: On Linux and macOS, you may need to type `python3` instead of -`python`. You may also need to [install pip](https://pip.pypa.io/en/stable/installing/). +`python`. You may also need to [install pip](https://pip.pypa.io/en/stable/installing/). For example, on Ubuntu execute the following command to get pip installed: `sudo apt install python3-venv python3-pip`. ### Step 2. Activate Virtual Environment diff --git a/docs/ops/activation/Clamp_1.md b/docs/ops/activation/Clamp_1.md index 22d956cfc10..b391371f2d4 100644 --- a/docs/ops/activation/Clamp_1.md +++ b/docs/ops/activation/Clamp_1.md @@ -25,7 +25,6 @@ clamp( x_{i} )=\min\big( \max\left( x_{i}, min\_value \right), max\_value \big) * **Description**: *min* is the lower bound of values in the output. * **Range of values**: arbitrary floating point number * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *max* @@ -33,7 +32,6 @@ clamp( x_{i} )=\min\big( \max\left( x_{i}, min\_value \right), max\_value \big) * **Description**: *max* is the upper bound of values in the output. * **Range of values**: arbitrary floating point number * **Type**: `float` - * **Default value**: None * **Required**: *yes* **Inputs**: diff --git a/docs/ops/activation/Elu_1.md b/docs/ops/activation/Elu_1.md index ad09c00556e..7635e62ce54 100644 --- a/docs/ops/activation/Elu_1.md +++ b/docs/ops/activation/Elu_1.md @@ -29,7 +29,6 @@ where α corresponds to *alpha* attribute. * **Description**: scale for the negative factor * **Range of values**: non-negative arbitrary floating-point number * **Type**: `float` - * **Default value**: none * **Required**: *yes* **Inputs**: diff --git a/docs/ops/convolution/BinaryConvolution_1.md b/docs/ops/convolution/BinaryConvolution_1.md index 314e9aad029..3ef2034a2d5 100644 --- a/docs/ops/convolution/BinaryConvolution_1.md +++ b/docs/ops/convolution/BinaryConvolution_1.md @@ -6,13 +6,13 @@ **Short description**: Computes 2D convolution of binary input and binary kernel tensors. -**Detailed description**: The operation behaves as regular *Convolution* but uses specialized algorithm for computations on binary data. More thorough explanation can be found in [Understanding Binary Neural Networks](https://sushscience.wordpress.com/2017/10/01/understanding-binary-neural-networks/) and [Bitwise Neural Networks](https://saige.sice.indiana.edu/wp-content/uploads/icml2015_mkim.pdf). +**Detailed description**: The operation behaves as regular *Convolution* but uses specialized algorithm for computations on binary data. More thorough explanation can be found in [Understanding Binary Neural Networks](https://sushscience.wordpress.com/2017/10/01/understanding-binary-neural-networks/) and [Bitwise Neural Networks](https://saige.sice.indiana.edu/wp-content/uploads/icml2015_mkim.pdf). -Computation algorithm for mode *xnor-popcount*: +Computation algorithm for mode *xnor-popcount*: - `X = XNOR(input_patch, filter)`, where XNOR is bitwise operation on two bit streams -- `P = popcount(X)`, where popcount is the number of `1` bits in the `X` bit stream -- `Output = 2 * P - B`, where `B` is the total number of bits in the `P` bit stream +- `P = popcount(X)`, where popcount is the number of `1` bits in the `X` bit stream +- `Output = 2 * P - B`, where `B` is the total number of bits in the `P` bit stream **Attributes**: @@ -21,7 +21,6 @@ Computation algorithm for mode *xnor-popcount*: * **Description**: *strides* is a distance (in pixels) to slide the filter on the feature map over the `(y, x)` axes for 2D convolutions. For example, *strides* equal `2,1` means sliding the filter 2 pixel at a time over height dimension and 1 over width dimension. * **Range of values**: integer values starting from 0 * **Type**: int[] - * **Default value**: None * **Required**: *yes* * *pads_begin* @@ -29,7 +28,6 @@ Computation algorithm for mode *xnor-popcount*: * **Description**: *pads_begin* is a number of pixels to add to the beginning along each axis. For example, *pads_begin* equal `1,2` means adding 1 pixel to the top of the input and 2 to the left of the input. * **Range of values**: integer values starting from 0 * **Type**: int[] - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -38,7 +36,6 @@ Computation algorithm for mode *xnor-popcount*: * **Description**: *pads_end* is a number of pixels to add to the ending along each axis. For example, *pads_end* equal `1,2` means adding 1 pixel to the bottom of the input and 2 to the right of the input. * **Range of values**: integer values starting from 0 * **Type**: int[] - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -47,7 +44,6 @@ Computation algorithm for mode *xnor-popcount*: * **Description**: *dilations* denotes the distance in width and height between elements (weights) in the filter. For example, *dilation* equal `1,1` means that all the elements in the filter are neighbors, so it is the same as for the usual convolution. *dilation* equal `2,2` means that all the elements in the filter are matched not to adjacent elements in the input matrix, but to those that are adjacent with distance 1. * **Range of values**: integer value starting from 0 * **Type**: int[] - * **Default value**: None * **Required**: *yes* * *mode* @@ -56,7 +52,6 @@ Computation algorithm for mode *xnor-popcount*: * **Range of values**: * *xnor-popcount* * **Type**: `string` - * **Default value**: None * **Required**: *yes* * **Note**: value `0` in inputs is interpreted as `-1`, value `1` as `1` @@ -65,7 +60,6 @@ Computation algorithm for mode *xnor-popcount*: * **Description**: *pad_value* is a floating-point value used to fill pad area. * **Range of values**: a floating-point number * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *auto_pad* @@ -79,7 +73,7 @@ Computation algorithm for mode *xnor-popcount*: * **Default value**: explicit * **Required**: *no* * **Note**: *pads_begin* and *pads_end* attributes are ignored when *auto_pad* is specified. - + **Inputs**: * **1**: Input tensor of type *T1* and rank 4. Layout is `[N, C_IN, Y, X]` (number of batches, number of channels, spatial axes Y, X). Required. @@ -89,7 +83,7 @@ Computation algorithm for mode *xnor-popcount*: **Outputs**: * **1**: Output tensor of type *T3* and rank 4. Layout is `[N, C_OUT, Y, X]` (number of batches, number of kernel output channels, spatial axes Y, X). - + **Types**: * *T1*: any numeric type with values `0` or `1`. diff --git a/docs/ops/convolution/ConvolutionBackpropData_1.md b/docs/ops/convolution/ConvolutionBackpropData_1.md index f29ce44e259..117ff744995 100644 --- a/docs/ops/convolution/ConvolutionBackpropData_1.md +++ b/docs/ops/convolution/ConvolutionBackpropData_1.md @@ -43,7 +43,6 @@ else: * **Description**: *strides* has the same definition as *strides* for a regular Convolution but applied in the backward way, for the output tensor. * **Range of values**: positive integers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *pads_begin* @@ -51,7 +50,6 @@ else: * **Description**: *pads_begin* has the same definition as *pads_begin* for a regular Convolution but applied in the backward way, for the output tensor. May be omitted specified, in which case pads are calculated automatically. * **Range of values**: non-negative integers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -60,21 +58,19 @@ else: * **Description**: *pads_end* has the same definition as *pads_end* for a regular Convolution but applied in the backward way, for the output tensor. May be omitted, in which case pads are calculated automatically. * **Range of values**: non-negative integers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. - + * *dilations* * **Description**: *dilations* has the same definition as *dilations* for a regular Convolution but applied in the backward way, for the output tensor. * **Range of values**: positive integers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *auto_pad* - * **Description**: *auto_pad* has the same definition as *auto_pad* for a regular Convolution but applied in the backward way, for the output tensor. + * **Description**: *auto_pad* has the same definition as *auto_pad* for a regular Convolution but applied in the backward way, for the output tensor. * *explicit*: use explicit padding values from `pads_begin` and `pads_end`. * *same_upper* the input is padded to match the output size. In case of odd padding value an extra padding is added at the end. * *same_lower* the input is padded to match the output size. In case of odd padding value an extra padding is added at the beginning. diff --git a/docs/ops/convolution/Convolution_1.md b/docs/ops/convolution/Convolution_1.md index 8e50b3ffada..64971670154 100644 --- a/docs/ops/convolution/Convolution_1.md +++ b/docs/ops/convolution/Convolution_1.md @@ -6,27 +6,27 @@ **Short description**: Computes 1D, 2D or 3D convolution (cross-correlation to be precise) of input and kernel tensors. -**Detailed description**: Basic building block of convolution is a dot product of input patch and kernel. Whole operation consist of multiple such computations over multiple input patches and kernels. More thorough explanation can be found in [Convolutional Neural Networks](http://cs231n.github.io/convolutional-networks/#conv) and [Convolution operation](https://medium.com/apache-mxnet/convolutions-explained-with-ms-excel-465d6649831c). +**Detailed description**: Basic building block of convolution is a dot product of input patch and kernel. Whole operation consist of multiple such computations over multiple input patches and kernels. More thorough explanation can be found in [Convolutional Neural Networks](http://cs231n.github.io/convolutional-networks/#conv) and [Convolution operation](https://medium.com/apache-mxnet/convolutions-explained-with-ms-excel-465d6649831c). -For the convolutional layer, the number of output features in each dimension is calculated using the formula: +For the convolutional layer, the number of output features in each dimension is calculated using the formula: \f[ n_{out} = \left ( \frac{n_{in} + 2p - k}{s} \right ) + 1 -\f] +\f] -The receptive field in each layer is calculated using the formulas: -* Jump in the output feature map: +The receptive field in each layer is calculated using the formulas: +* Jump in the output feature map: \f[ j_{out} = j_{in} * s \f] -* Size of the receptive field of output feature: +* Size of the receptive field of output feature: \f[ r_{out} = r_{in} + ( k - 1 ) * j_{in} \f] -* Center position of the receptive field of the first output feature: +* Center position of the receptive field of the first output feature: \f[ start_{out} = start_{in} + ( \frac{k - 1}{2} - p ) * j_{in} \f] -* Output is calculated using the following formula: +* Output is calculated using the following formula: \f[ out = \sum_{i = 0}^{n}w_{i}x_{i} + b \f] @@ -38,7 +38,6 @@ The receptive field in each layer is calculated using the formulas: * **Description**: *strides* is a distance (in pixels) to slide the filter on the feature map over the `(z, y, x)` axes for 3D convolutions and `(y, x)` axes for 2D convolutions. For example, *strides* equal `4,2,1` means sliding the filter 4 pixel at a time over depth dimension, 2 over height dimension and 1 over width dimension. * **Range of values**: integer values starting from 0 * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *pads_begin* @@ -46,7 +45,6 @@ The receptive field in each layer is calculated using the formulas: * **Description**: *pads_begin* is a number of pixels to add to the beginning along each axis. For example, *pads_begin* equal `1,2` means adding 1 pixel to the top of the input and 2 to the left of the input. * **Range of values**: integer values starting from 0 * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -55,7 +53,6 @@ The receptive field in each layer is calculated using the formulas: * **Description**: *pads_end* is a number of pixels to add to the ending along each axis. For example, *pads_end* equal `1,2` means adding 1 pixel to the bottom of the input and 2 to the right of the input. * **Range of values**: integer values starting from 0 * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -64,7 +61,6 @@ The receptive field in each layer is calculated using the formulas: * **Description**: *dilations* denotes the distance in width and height between elements (weights) in the filter. For example, *dilation* equal `1,1` means that all the elements in the filter are neighbors, so it is the same as for the usual convolution. *dilation* equal `2,2` means that all the elements in the filter are matched not to adjacent elements in the input matrix, but to those that are adjacent with distance 1. * **Range of values**: integer value starting from 0 * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *auto_pad* @@ -182,4 +178,4 @@ The receptive field in each layer is calculated using the formulas: -``` \ No newline at end of file +``` diff --git a/docs/ops/convolution/DeformableConvolution_1.md b/docs/ops/convolution/DeformableConvolution_1.md index 612d3c419d4..69dd28342d1 100644 --- a/docs/ops/convolution/DeformableConvolution_1.md +++ b/docs/ops/convolution/DeformableConvolution_1.md @@ -8,15 +8,15 @@ **Detailed description**: *Deformable Convolution* is similar to regular *Convolution* but its receptive field is deformed because of additional spatial offsets used during input sampling. More thorough explanation can be found in [Deformable Convolutions Demystified](https://towardsdatascience.com/deformable-convolutions-demystified-2a77498699e8) and [Deformable Convolutional Networks](https://arxiv.org/abs/1703.06211). -Output is calculated using the following formula: +Output is calculated using the following formula: \f[ y(p) = \sum_{k = 1}^{K}w_{k}x(p + p_{k} + {\Delta}p_{k}) - + \f] -Where +Where * K is a number of sampling locations, e.g. for kernel 3x3 and dilation = 1, K = 9 * \f$x(p)\f$ and \f$y(p)\f$ denote the features at location p from the input feature maps x and output feature maps y @@ -35,7 +35,6 @@ Where * **Description**: *strides* is a distance (in pixels) to slide the filter on the feature map over the `(y,x)` axes. For example, *strides* equal `2,1` means sliding the filter 2 pixel at a time over height dimension and 1 over width dimension. * **Range of values**: integer values starting from `0` * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *pads_begin* @@ -43,7 +42,6 @@ Where * **Description**: *pads_begin* is a number of pixels to add to the beginning along each axis. For example, *pads_begin* equal `1,2` means adding 1 pixel to the top of the input and 2 to the left of the input. * **Range of values**: integer values starting from `0` * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -52,7 +50,6 @@ Where * **Description**: *pads_end* is a number of pixels to add to the ending along each axis. For example, *pads_end* equal `1,2` means adding 1 pixel to the bottom of the input and 2 to the right of the input. * **Range of values**: integer values starting from `0` * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -61,7 +58,6 @@ Where * **Description**: *dilations* denotes the distance in width and height between elements (weights) in the filter. For example, *dilation* equal `1,1` means that all the elements in the filter are neighbors, so it is the same as for the usual convolution. *dilation* equal `2,2` means that all the elements in the filter are matched not to adjacent elements in the input matrix, but to those that are adjacent with distance 1. * **Range of values**: integer value starting from `0` * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *auto_pad* @@ -109,7 +105,7 @@ Where **Types**: * *T*: Any numeric type. - + **Example** 2D DeformableConvolution (deformable_group=1) diff --git a/docs/ops/convolution/DeformableConvolution_8.md b/docs/ops/convolution/DeformableConvolution_8.md index a9ae67d790d..0474a71193d 100644 --- a/docs/ops/convolution/DeformableConvolution_8.md +++ b/docs/ops/convolution/DeformableConvolution_8.md @@ -10,14 +10,14 @@ Modification of DeformableConvolution using modulating scalars is also supported. Please refer to [Deformable ConvNets v2: More Deformable, Better Results](https://arxiv.org/pdf/1811.11168.pdf). -Output is calculated using the following formula: +Output is calculated using the following formula: \f[ y(p) = \sum_{k = 1}^{K}w_{k}x(p + p_{k} + {\Delta}p_{k}) * {\Delta}m_{k} - + \f] -Where +Where * K is a number of sampling locations, e.g. for kernel 3x3 and dilation = 1, K = 9 * \f$x(p)\f$ and \f$y(p)\f$ denote the features at location p from the input feature maps x and output feature maps y @@ -38,7 +38,6 @@ Where * **Description**: *strides* is a distance (in pixels) to slide the filter on the feature map over the `(y,x)` axes. For example, *strides* equal `2,1` means sliding the filter 2 pixel at a time over height dimension and 1 over width dimension. * **Range of values**: integer values starting from `0` * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *pads_begin* @@ -46,7 +45,6 @@ Where * **Description**: *pads_begin* is a number of pixels to add to the beginning along each axis. For example, *pads_begin* equal `1,2` means adding 1 pixel to the top of the input and 2 to the left of the input. * **Range of values**: integer values starting from `0` * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -55,7 +53,6 @@ Where * **Description**: *pads_end* is a number of pixels to add to the ending along each axis. For example, *pads_end* equal `1,2` means adding 1 pixel to the bottom of the input and 2 to the right of the input. * **Range of values**: integer values starting from `0` * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -64,7 +61,6 @@ Where * **Description**: *dilations* denotes the distance in width and height between elements (weights) in the filter. For example, *dilation* equal `1,1` means that all the elements in the filter are neighbors, so it is the same as for the usual convolution. *dilation* equal `2,2` means that all the elements in the filter are matched not to adjacent elements in the input matrix, but to those that are adjacent with distance 1. * **Range of values**: integer value starting from `0` * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *auto_pad* @@ -103,7 +99,7 @@ Where * **Type**: `boolean` * **Default value**: `False` * **Required**: *no* - + **Inputs**: * **1**: Input tensor of type *T* and rank 4. Layout is `NCYX` (number of batches, number of channels, spatial axes Y and X). **Required.** @@ -122,7 +118,7 @@ Where **Types**: * *T*: Any numeric type. - + **Example** 2D DeformableConvolution (deformable_group=1) diff --git a/docs/ops/convolution/GroupConvolutionBackpropData_1.md b/docs/ops/convolution/GroupConvolutionBackpropData_1.md index 2d76aa905ea..f56ff5a8fa5 100644 --- a/docs/ops/convolution/GroupConvolutionBackpropData_1.md +++ b/docs/ops/convolution/GroupConvolutionBackpropData_1.md @@ -8,14 +8,13 @@ **Detailed description**: Splits input and filters into multiple groups, computes *ConvolutionBackpropData* on them and concatenates the results. It is equivalent to GroupConvolution and Convolution relationship. -**Attributes**: The operation has the same attributes as a *ConvolutionBackpropData*. Number of groups is derived from the kernel shape. +**Attributes**: The operation has the same attributes as a *ConvolutionBackpropData*. Number of groups is derived from the kernel shape. * *strides* * **Description**: *strides* has the same definition as *strides* for a regular Convolution but applied in the backward way, for the output tensor. * **Range of values**: positive integers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *pads_begin* @@ -23,7 +22,6 @@ * **Description**: *pads_begin* has the same definition as *pads_begin* for a regular Convolution but applied in the backward way, for the output tensor. May be omitted, in which case pads are calculated automatically. * **Range of values**: non-negative integers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -32,7 +30,6 @@ * **Description**: *pads_end* has the same definition as *pads_end* for a regular Convolution but applied in the backward way, for the output tensor. May be omitted, in which case pads are calculated automatically. * **Range of values**: non-negative integers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -41,12 +38,11 @@ * **Description**: *dilations* has the same definition as *dilations* for a regular Convolution but applied in the backward way, for the output tensor. * **Range of values**: positive integers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *auto_pad* - * **Description**: *auto_pad* has the same definition as *auto_pad* for a regular Convolution but applied in the backward way, for the output tensor. + * **Description**: *auto_pad* has the same definition as *auto_pad* for a regular Convolution but applied in the backward way, for the output tensor. * *explicit* - use explicit padding values from *pads_begin* and *pads_end*. * *same_upper* - the input is padded to match the output size. In case of odd padding value an extra padding is added at the end. * *same_lower* - the input is padded to match the output size. In case of odd padding value an extra padding is added at the beginning. @@ -71,12 +67,12 @@ * **2**: Kernel tensor of type `T1` and rank 4, 5 or 6. Layout is `[GROUPS, C_IN, C_OUT, X, Y, Z]` (number of groups, number of input channels, number of output channels, spatial axes X, Y, Z). Required. * **3**: Output shape tensor of type `T2` and rank 1. It specifies spatial shape of the output. Optional. -* **Note** Number of groups is derived from the shape of the kernel and not specified by any attribute. +* **Note** Number of groups is derived from the shape of the kernel and not specified by any attribute. * **Note**: Type of the convolution (1D, 2D or 3D) is derived from the rank of the input tensors and not specified by any attribute: * 1D convolution (input tensors rank 3) means that there is only one spatial axis X * 2D convolution (input tensors rank 4) means that there are two spatial axes Y, X * 3D convolution (input tensors rank 5) means that there are three spatial axes Z, Y, X - + **Outputs**: * **1**: Output tensor of type `T1` and rank 3, 4 or 5 (the same as input *1*). Layout is `[N, GROUPS * C_OUT, Z, Y, X]` (number of batches, number of kernel output channels, spatial axes Z, Y, X). diff --git a/docs/ops/convolution/GroupConvolution_1.md b/docs/ops/convolution/GroupConvolution_1.md index 49d6d9c05a8..632bd6f136f 100644 --- a/docs/ops/convolution/GroupConvolution_1.md +++ b/docs/ops/convolution/GroupConvolution_1.md @@ -4,19 +4,18 @@ **Category**: Convolution -**Short description**: Computes 1D, 2D or 3D GroupConvolution of input and kernel tensors. +**Short description**: Computes 1D, 2D or 3D GroupConvolution of input and kernel tensors. **Detailed description**: Splits input into multiple groups, convolves them with group filters as in regular convolution and concatenates the results. More thorough explanation can be found in [ImageNet Classification with Deep Convolutional Neural Networks](https://proceedings.neurips.cc/paper/2012/file/c399862d3b9d6b76c8436e924a68c45b-Paper.pdf) -**Attributes**: The operation has the same attributes as a regular _Convolution_. Number of groups is derived from the kernel shape. +**Attributes**: The operation has the same attributes as a regular _Convolution_. Number of groups is derived from the kernel shape. * *strides* * **Description**: *strides* is a distance (in pixels) to slide the filter on the feature map over the `(z, y, x)` axes for 3D convolutions and `(y, x)` axes for 2D convolutions. For example, *strides* equal `4,2,1` means sliding the filter 4 pixel at a time over depth dimension, 2 over height dimension and 1 over width dimension. * **Range of values**: positive integer numbers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *pads_begin* @@ -24,25 +23,22 @@ Neural Networks](https://proceedings.neurips.cc/paper/2012/file/c399862d3b9d6b76 * **Description**: *pads_begin* is a number of pixels to add to the beginning along each axis. For example, *pads_begin* equal `1,2` means adding 1 pixel to the top of the input and 2 to the left of the input. * **Range of values**: positive integer numbers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* - * **Note**: the attribute is ignored when *auto_pad* attribute is specified. + * **Note**: the attribute is ignored when *auto_pad* attribute is specified. * *pads_end* * **Description**: *pads_end* is a number of pixels to add to the ending along each axis. For example, *pads_end* equal `1,2` means adding 1 pixel to the bottom of the input and 2 to the right of the input. * **Range of values**: positive integer numbers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* - * **Note**: the attribute is ignored when *auto_pad* attribute is specified. + * **Note**: the attribute is ignored when *auto_pad* attribute is specified. * *dilations* * **Description**: *dilations* denotes the distance in width and height between elements (weights) in the filter. For example, *dilation* equal `1,1` means that all the elements in the filter are neighbors, so it is the same as for the usual convolution. *dilation* equal `2,2` means that all the elements in the filter are matched not to adjacent elements in the input matrix, but to those that are adjacent with distance 1. * **Range of values**: positive integer numbers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *auto_pad* @@ -61,7 +57,7 @@ Neural Networks](https://proceedings.neurips.cc/paper/2012/file/c399862d3b9d6b76 * **1**: Input tensor of type *T* and rank 3, 4 or 5. Layout is `[N, GROUPS * C_IN, Z, Y, X]` (number of batches, number of channels, spatial axes Z, Y, X). Required. * **2**: Convolution kernel tensor of type *T* and rank 4, 5 or 6. Layout is `[GROUPS, C_OUT, C_IN, Z, Y, X]` (number of groups, number of output channels, number of input channels, spatial axes Z, Y, X), - * **Note** Number of groups is derived from the shape of the kernel and not specified by any attribute. + * **Note** Number of groups is derived from the shape of the kernel and not specified by any attribute. * **Note**: Type of the convolution (1D, 2D or 3D) is derived from the rank of the input tensors and not specified by any attribute: * 1D convolution (input tensors rank 3) means that there is only one spatial axis X * 2D convolution (input tensors rank 4) means that there are two spatial axes Y, X @@ -75,7 +71,7 @@ Neural Networks](https://proceedings.neurips.cc/paper/2012/file/c399862d3b9d6b76 * *T*: any numeric type. -**Example**: +**Example**: 1D GroupConvolution ```xml @@ -161,4 +157,4 @@ Neural Networks](https://proceedings.neurips.cc/paper/2012/file/c399862d3b9d6b76 224 -``` \ No newline at end of file +``` diff --git a/docs/ops/detection/DeformablePSROIPooling_1.md b/docs/ops/detection/DeformablePSROIPooling_1.md index e9786a0b25a..0008f28eda6 100644 --- a/docs/ops/detection/DeformablePSROIPooling_1.md +++ b/docs/ops/detection/DeformablePSROIPooling_1.md @@ -22,15 +22,13 @@ This operation is compatible with [MXNet DeformablePSROIPooling](https://mxnet.a * **Description**: *output_dim* is the number of the output channels, size of output `C` dimension. * **Range of values**: a positive integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *spatial_scale* - * **Description**: *spatial_scale* is a multiplicative spatial scale factor to translate ROI coordinates from their input original size to the pooling input. Ratio of the input score map size to the original image size. + * **Description**: *spatial_scale* is a multiplicative spatial scale factor to translate ROI coordinates from their input original size to the pooling input. Ratio of the input score map size to the original image size. * **Range of values**: a positive floating-point number * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *group_size* @@ -74,7 +72,7 @@ This operation is compatible with [MXNet DeformablePSROIPooling](https://mxnet.a * **Required**: *no* * *part_size* - * **Description**: *part_size* is the size of `H` and `W` dimensions of the third input (offsets). Basically it is the height and width of the third input + * **Description**: *part_size* is the size of `H` and `W` dimensions of the third input (offsets). Basically it is the height and width of the third input with transformation values. * **Range of values**: positive integer number * **Type**: `int` @@ -96,7 +94,7 @@ Batch indices must be in the range of `[0, N_in-1]`. **Types**: * *T*: Any floating point type. - + **Example** diff --git a/docs/ops/detection/DetectionOutput_1.md b/docs/ops/detection/DetectionOutput_1.md index 363ef6ae4ea..7615ca830b0 100644 --- a/docs/ops/detection/DetectionOutput_1.md +++ b/docs/ops/detection/DetectionOutput_1.md @@ -17,7 +17,6 @@ At each feature map cell, *DetectionOutput* predicts the offsets relative to the * **Description**: number of classes to be predicted * **Range of values**: positive integer number * **Type**: int - * **Default value**: None * **Required**: *yes* * *background_label_id* @@ -49,7 +48,6 @@ At each feature map cell, *DetectionOutput* predicts the offsets relative to the * **Description**: maximum number of bounding boxes per batch to be kept after NMS step. -1 means keeping all bounding boxes after NMS step. * **Range of values**: integer values * **Type**: int[] - * **Default value**: None * **Required**: *yes* * *code_type* @@ -73,7 +71,6 @@ At each feature map cell, *DetectionOutput* predicts the offsets relative to the * **Description**: threshold to be used in the NMS stage * **Range of values**: floating point values * **Type**: float - * **Default value**: None * **Required**: *yes* * *confidence_threshold* diff --git a/docs/ops/detection/PSROIPooling_1.md b/docs/ops/detection/PSROIPooling_1.md index 98841ccf4dc..487a5453059 100644 --- a/docs/ops/detection/PSROIPooling_1.md +++ b/docs/ops/detection/PSROIPooling_1.md @@ -8,8 +8,8 @@ **Detailed description**: [Reference](https://arxiv.org/pdf/1703.06211.pdf). -*PSROIPooling* operation takes two input blobs: with feature maps and with regions of interests (box coordinates). -The latter is specified as five element tuples: *[batch_id, x_1, y_1, x_2, y_2]*. +*PSROIPooling* operation takes two input blobs: with feature maps and with regions of interests (box coordinates). +The latter is specified as five element tuples: *[batch_id, x_1, y_1, x_2, y_2]*. ROIs coordinates are specified in absolute values for the average mode and in normalized values (to *[0,1]* interval) for bilinear interpolation. **Attributes** @@ -19,7 +19,6 @@ ROIs coordinates are specified in absolute values for the average mode and in no * **Description**: *output_dim* is a pooled output channel number. * **Range of values**: a positive integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *group_size* @@ -35,7 +34,6 @@ ROIs coordinates are specified in absolute values for the average mode and in no * **Description**: *spatial_scale* is a multiplicative spatial scale factor to translate ROI coordinates from their input scale to the scale used when pooling. * **Range of values**: a positive floating-point number * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *mode* diff --git a/docs/ops/detection/PriorBoxClustered_1.md b/docs/ops/detection/PriorBoxClustered_1.md index b2047c242ff..3ce48827581 100644 --- a/docs/ops/detection/PriorBoxClustered_1.md +++ b/docs/ops/detection/PriorBoxClustered_1.md @@ -28,7 +28,7 @@ * *step (step_w, step_h)* - * **Description**: *step (step_w, step_h)* is a distance between box centers. For example, *step* equal 85 means that the distance between neighborhood prior boxes centers is 85. If both *step_h* and *step_w* are 0 then they are updated with value of *step*. If after that they are still 0 then they are calculated as input image width(height) divided with first input width(height). + * **Description**: *step (step_w, step_h)* is a distance between box centers. For example, *step* equal 85 means that the distance between neighborhood prior boxes centers is 85. If both *step_h* and *step_w* are 0 then they are updated with value of *step*. If after that they are still 0 then they are calculated as input image width(height) divided with first input width(height). * **Range of values**: floating point positive number * **Type**: float * **Default value**: 0.0 @@ -39,7 +39,6 @@ * **Description**: *offset* is a shift of box respectively to top left corner. For example, *offset* equal 85 means that the shift of neighborhood prior boxes centers is 85. * **Range of values**: floating point positive number * **Type**: float - * **Default value**: None * **Required**: *yes* * *variance* @@ -126,4 +125,4 @@ If *clip* is defined, the coordinates of prior boxes are recalculated with the f -``` \ No newline at end of file +``` diff --git a/docs/ops/detection/PriorBox_1.md b/docs/ops/detection/PriorBox_1.md index 0cc07eb04dd..b278252dbc6 100644 --- a/docs/ops/detection/PriorBox_1.md +++ b/docs/ops/detection/PriorBox_1.md @@ -92,7 +92,6 @@ * **Description**: *offset* is a shift of box respectively to top left corner. * **Range of values**: floating point non-negative number * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *variance* @@ -172,4 +171,4 @@ -``` \ No newline at end of file +``` diff --git a/docs/ops/detection/Proposal_1.md b/docs/ops/detection/Proposal_1.md index be197259123..d7dcece4e64 100644 --- a/docs/ops/detection/Proposal_1.md +++ b/docs/ops/detection/Proposal_1.md @@ -28,21 +28,18 @@ * **Description**: *base_size* is the size of the anchor to which *scale* and *ratio* attributes are applied. * **Range of values**: a positive integer number * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *pre_nms_topn* * **Description**: *pre_nms_topn* is the number of bounding boxes before the NMS operation. For example, *pre_nms_topn* equal to 15 means to take top 15 boxes with the highest scores. * **Range of values**: a positive integer number * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *post_nms_topn* * **Description**: *post_nms_topn* is the number of bounding boxes after the NMS operation. For example, *post_nms_topn* equal to 15 means to take after NMS top 15 boxes with the highest scores. * **Range of values**: a positive integer number * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *nms_thresh* @@ -50,7 +47,6 @@ * **Description**: *nms_thresh* is the minimum value of the proposal to be taken into consideration. For example, *nms_thresh* equal to 0.5 means that all boxes with prediction probability less than 0.5 are filtered out. * **Range of values**: a positive floating-point number * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *feat_stride* @@ -58,7 +54,6 @@ * **Description**: *feat_stride* is the step size to slide over boxes (in pixels). For example, *feat_stride* equal to 16 means that all boxes are analyzed with the slide 16. * **Range of values**: a positive integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *min_size* @@ -66,7 +61,6 @@ * **Description**: *min_size* is the minimum size of box to be taken into consideration. For example, *min_size* equal 35 means that all boxes with box size less than 35 are filtered out. * **Range of values**: a positive integer number * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *ratio* @@ -74,7 +68,6 @@ * **Description**: *ratio* is the ratios for anchor generation. * **Range of values**: a list of floating-point numbers * **Type**: `float[]` - * **Default value**: None * **Required**: *yes* * *scale* @@ -82,7 +75,6 @@ * **Description**: *scale* is the scales for anchor generation. * **Range of values**: a list of floating-point numbers * **Type**: `float[]` - * **Default value**: None * **Required**: *yes* * *clip_before_nms* diff --git a/docs/ops/detection/Proposal_4.md b/docs/ops/detection/Proposal_4.md index 7402cf2ff55..e3f4fa7fd5b 100644 --- a/docs/ops/detection/Proposal_4.md +++ b/docs/ops/detection/Proposal_4.md @@ -8,12 +8,12 @@ **Detailed description** -*Proposal* has three inputs: a 4D tensor of shape `[num_batches, 2*K, H, W]` with probabilities whether particular -bounding box corresponds to background or foreground, a 4D tensor of shape `[num_batches, 4*K, H, W]` with deltas for each -of the bound box, and a tensor with input image size in the `[image_height, image_width, scale_height_and_width]` or -`[image_height, image_width, scale_height, scale_width]` format. `K` is number of anchors and `H, W` are height and -width of the feature map. Operation produces two tensors: -the first mandatory tensor of shape `[batch_size * post_nms_topn, 5]` with proposed boxes and +*Proposal* has three inputs: a 4D tensor of shape `[num_batches, 2*K, H, W]` with probabilities whether particular +bounding box corresponds to background or foreground, a 4D tensor of shape `[num_batches, 4*K, H, W]` with deltas for each +of the bound box, and a tensor with input image size in the `[image_height, image_width, scale_height_and_width]` or +`[image_height, image_width, scale_height, scale_width]` format. `K` is number of anchors and `H, W` are height and +width of the feature map. Operation produces two tensors: +the first mandatory tensor of shape `[batch_size * post_nms_topn, 5]` with proposed boxes and the second optional tensor of shape `[batch_size * post_nms_topn]` with probabilities (sometimes referred as scores). *Proposal* layer does the following with the input tensor: @@ -37,21 +37,18 @@ the second optional tensor of shape `[batch_size * post_nms_topn]` with probabil * **Description**: *base_size* is the size of the anchor to which *scale* and *ratio* attributes are applied. * **Range of values**: a positive integer number * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *pre_nms_topn* * **Description**: *pre_nms_topn* is the number of bounding boxes before the NMS operation. For example, *pre_nms_topn* equal to 15 means to take top 15 boxes with the highest scores. * **Range of values**: a positive integer number * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *post_nms_topn* * **Description**: *post_nms_topn* is the number of bounding boxes after the NMS operation. For example, *post_nms_topn* equal to 15 means to take after NMS top 15 boxes with the highest scores. * **Range of values**: a positive integer number * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *nms_thresh* @@ -59,7 +56,6 @@ the second optional tensor of shape `[batch_size * post_nms_topn]` with probabil * **Description**: *nms_thresh* is the minimum value of the proposal to be taken into consideration. For example, *nms_thresh* equal to 0.5 means that all boxes with prediction probability less than 0.5 are filtered out. * **Range of values**: a positive floating-point number * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *feat_stride* @@ -67,7 +63,6 @@ the second optional tensor of shape `[batch_size * post_nms_topn]` with probabil * **Description**: *feat_stride* is the step size to slide over boxes (in pixels). For example, *feat_stride* equal to 16 means that all boxes are analyzed with the slide 16. * **Range of values**: a positive integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *min_size* @@ -75,7 +70,6 @@ the second optional tensor of shape `[batch_size * post_nms_topn]` with probabil * **Description**: *min_size* is the minimum size of box to be taken into consideration. For example, *min_size* equal 35 means that all boxes with box size less than 35 are filtered out. * **Range of values**: a positive integer number * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *ratio* @@ -83,7 +77,6 @@ the second optional tensor of shape `[batch_size * post_nms_topn]` with probabil * **Description**: *ratio* is the ratios for anchor generation. * **Range of values**: a list of floating-point numbers * **Type**: `float[]` - * **Default value**: None * **Required**: *yes* * *scale* @@ -91,7 +84,6 @@ the second optional tensor of shape `[batch_size * post_nms_topn]` with probabil * **Description**: *scale* is the scales for anchor generation. * **Range of values**: a list of floating-point numbers * **Type**: `float[]` - * **Default value**: None * **Required**: *yes* * *clip_before_nms* diff --git a/docs/ops/detection/ROIAlign_3.md b/docs/ops/detection/ROIAlign_3.md index 533a84a021d..1bcec40a059 100644 --- a/docs/ops/detection/ROIAlign_3.md +++ b/docs/ops/detection/ROIAlign_3.md @@ -20,7 +20,6 @@ * **Description**: *pooled_h* is the height of the ROI output feature map. * **Range of values**: a positive integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *pooled_w* @@ -28,7 +27,6 @@ * **Description**: *pooled_w* is the width of the ROI output feature map. * **Range of values**: a positive integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *sampling_ratio* @@ -37,7 +35,6 @@ is equal to 0 then use adaptive number of elements over height and width: `ceil(roi_height / pooled_h)` and `ceil(roi_width / pooled_w)` respectively. * **Range of values**: a non-negative integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *spatial_scale* @@ -45,17 +42,15 @@ * **Description**: *spatial_scale* is a multiplicative spatial scale factor to translate ROI coordinates from their input spatial scale to the scale used when pooling. * **Range of values**: a positive floating-point number * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *mode* * **Description**: *mode* specifies a method to perform pooling to produce output feature map elements. - * **Range of values**: + * **Range of values**: * *max* - maximum pooling - * *avg* - average pooling + * *avg* - average pooling * **Type**: string - * **Default value**: None * **Required**: *yes* **Inputs**: @@ -63,7 +58,7 @@ * **1**: 4D input tensor of shape `[N, C, H, W]` with feature maps of type *T*. Required. * **2**: 2D input tensor of shape `[NUM_ROIS, 4]` describing box consisting of 4 element tuples: `[x_1, y_1, x_2, y_2]` in relative coordinates of type *T*. -The box height and width are calculated the following way: `roi_width = max(spatial_scale * (x_2 - x_1), 1.0)`, +The box height and width are calculated the following way: `roi_width = max(spatial_scale * (x_2 - x_1), 1.0)`, `roi_height = max(spatial_scale * (y_2 - y_1), 1.0)`, so the malformed boxes are expressed as a box of size `1 x 1`. Required. * **3**: 1D input tensor of shape `[NUM_ROIS]` with batch indices of type *IND_T*. Required. @@ -106,7 +101,6 @@ The box height and width are calculated the following way: `roi_width = max(spat 6 6 - + ``` - diff --git a/docs/ops/detection/ROIPooling_1.md b/docs/ops/detection/ROIPooling_1.md index 7699b133f3c..7114aee0d6c 100644 --- a/docs/ops/detection/ROIPooling_1.md +++ b/docs/ops/detection/ROIPooling_1.md @@ -26,7 +26,6 @@ The box height and width have different representation based on **method** attri * **Description**: *pooled_h* is the height of the ROI output feature map. For example, *pooled_h* equal to 6 means that the height of the output of *ROIPooling* is 6. * **Range of values**: a non-negative integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *pooled_w* @@ -34,7 +33,6 @@ The box height and width have different representation based on **method** attri * **Description**: *pooled_w* is the width of the ROI output feature map. For example, *pooled_w* equal to 6 means that the width of the output of *ROIPooling* is 6. * **Range of values**: a non-negative integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *spatial_scale* @@ -42,7 +40,6 @@ The box height and width have different representation based on **method** attri * **Description**: *spatial_scale* is the ratio of the input feature map over the input image size. * **Range of values**: a positive floating-point number * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *method* diff --git a/docs/ops/detection/RegionYolo_1.md b/docs/ops/detection/RegionYolo_1.md index 68826178b47..776d4b8af1b 100644 --- a/docs/ops/detection/RegionYolo_1.md +++ b/docs/ops/detection/RegionYolo_1.md @@ -23,7 +23,6 @@ * **Description**: starting axis index in the input tensor `data` shape that will be flattened in the output; the end of flattened range is defined by `end_axis` attribute. * **Range of values**: `-rank(data) .. rank(data)-1` * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *coords* @@ -31,7 +30,6 @@ * **Description**: *coords* is the number of coordinates for each region. * **Range of values**: an integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *classes* @@ -39,7 +37,6 @@ * **Description**: *classes* is the number of classes for each region. * **Range of values**: an integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *end_axis* @@ -47,7 +44,6 @@ * **Description**: ending axis index in the input tensor `data` shape that will be flattened in the output; the beginning of the flattened range is defined by `axis` attribute. * **Range of values**: `-rank(data)..rank(data)-1` * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *num* @@ -55,7 +51,6 @@ * **Description**: *num* is the number of regions. * **Range of values**: an integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *do_softmax* diff --git a/docs/ops/detection/ReorgYolo_1.md b/docs/ops/detection/ReorgYolo_1.md index 156657a98ba..0c20ed9ee3b 100644 --- a/docs/ops/detection/ReorgYolo_1.md +++ b/docs/ops/detection/ReorgYolo_1.md @@ -17,7 +17,6 @@ * **Description**: *stride* is the distance between cut throws in output blobs. * **Range of values**: positive integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* **Inputs**: diff --git a/docs/ops/generation/Range_4.md b/docs/ops/generation/Range_4.md index 037784b8576..df4ebb2a9e5 100644 --- a/docs/ops/generation/Range_4.md +++ b/docs/ops/generation/Range_4.md @@ -13,8 +13,7 @@ * **Description**: the output tensor type * **Range of values**: any numeric type * **Type**: string - * **Default value**: None - * **Required**: *Yes* + * **Required**: *yes* **Inputs**: diff --git a/docs/ops/image/Interpolate_1.md b/docs/ops/image/Interpolate_1.md index b3a45838394..a4c5e77a43f 100644 --- a/docs/ops/image/Interpolate_1.md +++ b/docs/ops/image/Interpolate_1.md @@ -13,7 +13,6 @@ * **Description**: `axes` specify spatial dimension indices where interpolation is applied. Other dimensions are treated as batch dimensions. The order of elements in `axes` attribute matters and mapped directly to elements with the same indices in the 2nd input `target_spatial_shape`. * **Range of values**: list of non-negative integer numbers * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* * *mode* @@ -21,7 +20,6 @@ * **Description**: specifies type of interpolation * **Range of values**: one of `nearest`, `linear`, `cubic`, `area` * **Type**: string - * **Default value**: none * **Required**: *yes* * *align_corners* @@ -95,4 +93,4 @@ This is a scalar that specifies padding for each spatial dimension. -``` \ No newline at end of file +``` diff --git a/docs/ops/image/Interpolate_4.md b/docs/ops/image/Interpolate_4.md index b0c9c846f53..375691e1d87 100644 --- a/docs/ops/image/Interpolate_4.md +++ b/docs/ops/image/Interpolate_4.md @@ -13,7 +13,6 @@ * **Description**: specifies type of interpolation * **Range of values**: one of `nearest`, `linear`, `linear_onnx`, `cubic` * **Type**: string - * **Default value**: none * **Required**: *yes* **Note**: Only 2D, 3D, 4D, 5D tensors with `axes = {0, 1}`, `axes = {0, 1, 2}`, `axes = {2, 3}`, `axes = {2, 3, 4}` respectively are supported for `"mode" == "linear_onnx"`. @@ -24,7 +23,6 @@ * `sizes` - an output shape is calculated as `output_shape[axes[i]] = sizes[i]` for all `i in range(0, len(axes))` and `output_shape[j] = input_shape[j] + pads_begin[j] + pads_end[j]` for `j not in axes`, `j in range(0, rank(data))`. * `scales` - an output shape is calculated as `output_shape[axes[i]] = floor(scales[i] * (input_shape[axes[i]] + pads_begin[axes[i]] + pads_end[axes[i]]))` for all `i in range(0, len(axes))` and `output_shape[j] = input_shape[j] + pads_begin[j] + pads_end[j]` for `j not in axes`, `j in range(0, rank(data))` * **Type**: string - * **Default value**: none * **Required**: *yes* * *coordinate_transformation_mode* diff --git a/docs/ops/infrastructure/Assign_3.md b/docs/ops/infrastructure/Assign_3.md index 783492f3e82..5d74add67b3 100644 --- a/docs/ops/infrastructure/Assign_3.md +++ b/docs/ops/infrastructure/Assign_3.md @@ -9,18 +9,17 @@ **Detailed description**: *Assign* operation sets an input value to the `variable_id` variable. This value will be returned by *ReadValue* operation on next infer if variable was not reset. -The operation checks that the type and shape of the input are the same as +The operation checks that the type and shape of the input are the same as declared in `variable_id` and returns an error otherwise. -**Attributes**: +**Attributes**: * *variable_id* * **Description**: identificator of the variable to be updated * **Range of values**: any non-empty string * **Type**: string - * **Default value**: None - * **Required**: *Yes* + * **Required**: *yes* **Inputs** @@ -44,4 +43,4 @@ declared in `variable_id` and returns an error otherwise. -``` \ No newline at end of file +``` diff --git a/docs/ops/infrastructure/Constant_1.md b/docs/ops/infrastructure/Constant_1.md index ea3cbc87c2d..b9211590e72 100644 --- a/docs/ops/infrastructure/Constant_1.md +++ b/docs/ops/infrastructure/Constant_1.md @@ -13,7 +13,6 @@ * **Description**: specifies position in binary file with weights where the content of the constant begins; value in bytes * **Range of values**: non-negative integer value * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *size* @@ -21,7 +20,6 @@ * **Description**: size of constant content in binary files; value in bytes * **Range of values**: positive integer bigger than zero * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *element_type* @@ -29,16 +27,14 @@ * **Description**: the type of element of output tensor * **Range of values**: u1, u8, u16, u32, u64, i8, i16, i32, i64, f16, f32, boolean, bf16 * **Type**: `string` - * **Default value**: None - * **Required**: *Yes* + * **Required**: *yes* * *shape* * **Description**: the shape of the output tensor * **Range of values**: list of non-negative integers, empty list is allowed, which means 0D or scalar tensor * **Type**: `int[]` - * **Default value**: None - * **Required**: *Yes* + * **Required**: *yes* **Outputs** diff --git a/docs/ops/infrastructure/Parameter_1.md b/docs/ops/infrastructure/Parameter_1.md index 879880002e6..373e8ed2b15 100644 --- a/docs/ops/infrastructure/Parameter_1.md +++ b/docs/ops/infrastructure/Parameter_1.md @@ -13,7 +13,6 @@ * **Description**: the type of element of output tensor * **Range of values**: u1, u4, u8, u16, u32, u64, i4, i8, i16, i32, i64, f16, f32, boolean, bf16 * **Type**: `string` - * **Default value**: None * **Required**: *yes* * *shape* @@ -21,7 +20,6 @@ * **Description**: the shape of the output tensor * **Range of values**: list of non-negative integers, empty list is allowed, which means 0D or scalar tensor * **Type**: `int[]` - * **Default value**: None * **Required**: *yes* diff --git a/docs/ops/infrastructure/ReadValue_3.md b/docs/ops/infrastructure/ReadValue_3.md index d62113f0d7b..c60ac71dd84 100644 --- a/docs/ops/infrastructure/ReadValue_3.md +++ b/docs/ops/infrastructure/ReadValue_3.md @@ -6,9 +6,9 @@ **Short description**: *ReadValue* returns value of the `variable_id` variable. -**Detailed description**: +**Detailed description**: -*ReadValue* returns value from the corresponding `variable_id` variable if the variable was set already by *Assign* operation and was not reset. +*ReadValue* returns value from the corresponding `variable_id` variable if the variable was set already by *Assign* operation and was not reset. The operation checks that the type and shape of the output are the same as declared in `variable_id` and returns an error otherwise. If the corresponding variable was not set or was reset, the operation returns the value from the 1 input, and initializes the `variable_id` shape and type @@ -21,8 +21,7 @@ with the shape and type from the 1 input. * **Description**: identificator of the variable to be read * **Range of values**: any non-empty string * **Type**: string - * **Default value**: None - * **Required**: *Yes* + * **Required**: *yes* **Inputs** @@ -54,4 +53,4 @@ with the shape and type from the 1 input. -``` \ No newline at end of file +``` diff --git a/docs/ops/movement/Concat_1.md b/docs/ops/movement/Concat_1.md index 6a8bdb6ab4c..36f2ba620c7 100644 --- a/docs/ops/movement/Concat_1.md +++ b/docs/ops/movement/Concat_1.md @@ -13,7 +13,6 @@ * **Description**: *axis* specifies dimension to concatenate along * **Range of values**: integer number. Negative value means counting dimension from the end. The range is `[-R, R-1]`, where `R` is the rank of all inputs. * **Type**: int - * **Default value**: None * **Required**: *yes* **Inputs**: diff --git a/docs/ops/movement/DepthToSpace_1.md b/docs/ops/movement/DepthToSpace_1.md index 3fcb223c47f..8aa6b54fd19 100644 --- a/docs/ops/movement/DepthToSpace_1.md +++ b/docs/ops/movement/DepthToSpace_1.md @@ -43,7 +43,6 @@ If `mode = depth_first`: * *blocks_first*: the input depth is divided to `[block_size, ..., block_size, new_depth]` * *depth_first*: the input depth is divided to `[new_depth, block_size, ..., block_size]` * **Type**: `string` - * **Default value**: None * **Required**: *yes* **Inputs** diff --git a/docs/ops/movement/ExtractImagePatches_3.md b/docs/ops/movement/ExtractImagePatches_3.md index 5046854ee22..fc1d724f701 100644 --- a/docs/ops/movement/ExtractImagePatches_3.md +++ b/docs/ops/movement/ExtractImagePatches_3.md @@ -22,7 +22,6 @@ The "auto_pad" attribute has no effect on the size of each patch, it determines * **Description**: *sizes* is a size `[size_rows, size_cols]` of the extracted patches. * **Range of values**: non-negative integer number * **Type**: int[] - * **Default value**: None * **Required**: *yes* * *strides* @@ -30,15 +29,13 @@ The "auto_pad" attribute has no effect on the size of each patch, it determines * **Description**: *strides* is a distance `[stride_rows, stride_cols]` between centers of two consecutive patches in an input tensor. * **Range of values**: non-negative integer number * **Type**: int[] - * **Default value**: None * **Required**: *yes* * *rates* - * **Description**: *rates* is the input stride `[rate_rows, rate_cols]`, specifying how far two consecutive patch samples are in the input. Equivalent to extracting patches with `patch_sizes_eff = patch_sizes + (patch_sizes - 1) * (rates - 1)`, followed by subsampling them spatially by a factor of rates. This is equivalent to rate in dilated (a.k.a. Atrous) convolutions. + * **Description**: *rates* is the input stride `[rate_rows, rate_cols]`, specifying how far two consecutive patch samples are in the input. Equivalent to extracting patches with `patch_sizes_eff = patch_sizes + (patch_sizes - 1) * (rates - 1)`, followed by subsampling them spatially by a factor of rates. This is equivalent to rate in dilated (a.k.a. Atrous) convolutions. * **Range of values**: non-negative integer number * **Type**: int[] - * **Default value**: None * **Required**: *yes* * *auto_pad* @@ -47,7 +44,6 @@ The "auto_pad" attribute has no effect on the size of each patch, it determines * *same_upper (same_lower)* the input is padded by zeros to match the output size. In case of odd padding value an extra padding is added at the end (at the beginning). * *valid* - do not use padding. * **Type**: string - * **Default value**: None * **Required**: *yes* **Inputs** @@ -77,7 +73,7 @@ The "auto_pad" attribute has no effect on the size of each patch, it determines - + 64 27 2 @@ -105,7 +101,7 @@ Image is a `1 x 1 x 10 x 10` array that contains the numbers 1 through 100. We u \end{bmatrix} \f] - output: + output: ``` [[[[ 1 6] [51 56]] @@ -132,10 +128,10 @@ Image is a `1 x 1 x 10 x 10` array that contains the numbers 1 through 100. We u [72 77]] [[23 28] - [73 78]]]] + [73 78]]]] ``` output shape: `[1, 9, 2, 2]` - + 2. `sizes="4,4", strides="8,8", rates="1,1", auto_pad="valid"` \f[ \begin{bmatrix} @@ -151,9 +147,9 @@ Image is a `1 x 1 x 10 x 10` array that contains the numbers 1 through 100. We u 91 & 92 & 93 & 94 & 95 & 96 & 79 & 98 & 99 & 100 \end{bmatrix} \f] - - output: -``` + + output: +``` [[[[ 1]] [[ 2]] @@ -206,7 +202,7 @@ Image is a `1 x 1 x 10 x 10` array that contains the numbers 1 through 100. We u x & x & x & x & 0 & 0 & 0 & 0 & 0 & x & x & x & x \end{bmatrix} \f] - output: + output: ``` [[[[ 0 0] [ 0 89]] @@ -254,11 +250,11 @@ Image is a `1 x 1 x 10 x 10` array that contains the numbers 1 through 100. We u [ 0 0]] [[ 23 0] - [ 0 0]]]] + [ 0 0]]]] ``` output shape: `[1, 16, 2, 2]` -4. `sizes="3,3", strides="5,5", rates="2,2", auto_pad="valid"` +4. `sizes="3,3", strides="5,5", rates="2,2", auto_pad="valid"` This time we use the symbols `x`, `y`, `z` and `k` to distinguish the patches: \f[ \begin{bmatrix} @@ -302,12 +298,12 @@ This time we use the symbols `x`, `y`, `z` and `k` to distinguish the patches: [ 93 98]] [[ 45 50] - [ 95 100]]]] + [ 95 100]]]] ``` output_shape: `[1, 9, 2, 2]` -5. `sizes="2,2", strides="3,3", rates="1,1", auto_pad="valid"` -Image is a `1 x 2 x 5 x 5` array that contains two feature maps where feature map with coordinate 0 contains numbers in a range `[1, 25]` and feature map with coordinate 1 contains numbers in a range `[26, 50]` +5. `sizes="2,2", strides="3,3", rates="1,1", auto_pad="valid"` +Image is a `1 x 2 x 5 x 5` array that contains two feature maps where feature map with coordinate 0 contains numbers in a range `[1, 25]` and feature map with coordinate 1 contains numbers in a range `[26, 50]` \f[ \begin{bmatrix} @@ -349,6 +345,6 @@ Image is a `1 x 2 x 5 x 5` array that contains two feature maps where feature ma [22 25]] [[32 35] - [47 50]]]] -``` + [47 50]]]] +``` output shape: `[1, 8, 2, 2]` diff --git a/docs/ops/movement/Pad_1.md b/docs/ops/movement/Pad_1.md index 853d94eac52..08c00c4400d 100644 --- a/docs/ops/movement/Pad_1.md +++ b/docs/ops/movement/Pad_1.md @@ -69,7 +69,6 @@ OUTPUT = * `reflect` - padded values are a reflection of the input `data` tensor; values on the edges are not duplicated. `pads_begin[D]` and `pads_end[D]` must be not greater than `data.shape[D] – 1` for any valid `D`. * `symmetric` - padded values are symmetrically added from the input `data` tensor. This method is similar to the `reflect`, but values on edges are duplicated. Refer to the examples above for more details. `pads_begin[D]` and `pads_end[D]` must be not greater than `data.shape[D]` for any valid `D`. * **Type**: `string` - * **Default value**: None * **Required**: *yes* **Inputs** diff --git a/docs/ops/movement/Reverse_1.md b/docs/ops/movement/Reverse_1.md index aef9a5320c7..a75bf520bcc 100644 --- a/docs/ops/movement/Reverse_1.md +++ b/docs/ops/movement/Reverse_1.md @@ -6,7 +6,7 @@ **Short description**: *Reverse* operations reverse specified axis in an input tensor. -**Detailed description**: *Reverse* produces a tensor with the same shape as the first input tensor and with elements reversed along dimensions specified in the second input tensor. The axes can be represented either by dimension indices or as a mask. The interpretation of the second input is determined by *mode* attribute. +**Detailed description**: *Reverse* produces a tensor with the same shape as the first input tensor and with elements reversed along dimensions specified in the second input tensor. The axes can be represented either by dimension indices or as a mask. The interpretation of the second input is determined by *mode* attribute. If `index` mode is used, the second tensor should contain indices of axes that should be reversed. The length of the second tensor should be in a range from 0 to rank of the 1st input tensor. @@ -21,7 +21,6 @@ If no axis specified, that means either the second input is empty if `index` mod * **Description**: specifies how the second input tensor should be interpreted: as a set of indices or a mask * **Range of values**: `index`, `mask` * **Type**: `string` - * **Default value**: None * **Required**: *yes* **Inputs**: @@ -65,4 +64,4 @@ If no axis specified, that means either the second input is empty if `index` mod -``` \ No newline at end of file +``` diff --git a/docs/ops/movement/SpaceToDepth_1.md b/docs/ops/movement/SpaceToDepth_1.md index 42ade5d6528..6733faefbd8 100644 --- a/docs/ops/movement/SpaceToDepth_1.md +++ b/docs/ops/movement/SpaceToDepth_1.md @@ -44,7 +44,6 @@ If `mode = depth_first`: * *blocks_first*: the output depth is gathered from `[block_size, ..., block_size, C]` * *depth_first*: the output depth is gathered from `[C, block_size, ..., block_size]` * **Type**: `string` - * **Default value**: None * **Required**: *yes* **Inputs** diff --git a/docs/ops/movement/Split_1.md b/docs/ops/movement/Split_1.md index 6664393d7e0..7dd0ed6f102 100644 --- a/docs/ops/movement/Split_1.md +++ b/docs/ops/movement/Split_1.md @@ -24,7 +24,6 @@ Where D is the rank of input tensor `data`. The axis being split must be evenly * **Description**: number of outputs into which the input tensor `data` will be split along `axis` dimension. The dimension of `data` shape along `axis` must be evenly divisible by *num_splits* * **Range of values**: an integer within the range `[1, data.shape[axis]]` * **Type**: `int` - * **Default value**: none * **Required**: *yes* **Inputs** diff --git a/docs/ops/normalization/BatchNormInference_1.md b/docs/ops/normalization/BatchNormInference_1.md index 694a9989e9f..a0a9cac3fa1 100644 --- a/docs/ops/normalization/BatchNormInference_1.md +++ b/docs/ops/normalization/BatchNormInference_1.md @@ -60,7 +60,6 @@ For a particular activation, consider a mini-batch \f$\mathcal{B}\f$ of m values * **Description**: *epsilon* is a constant added to the variance for numerical stability. * **Range of values**: a floating-point number greater than or equal to zero * **Type**: `float` - * **Default value**: none * **Required**: *yes* **Inputs** diff --git a/docs/ops/normalization/BatchNormInference_5.md b/docs/ops/normalization/BatchNormInference_5.md index f5019d08b2d..61a9c252603 100644 --- a/docs/ops/normalization/BatchNormInference_5.md +++ b/docs/ops/normalization/BatchNormInference_5.md @@ -60,7 +60,6 @@ For a particular activation, consider a mini-batch \f$\mathcal{B}\f$ of m values * **Description**: *epsilon* is a constant added to the variance for numerical stability. * **Range of values**: a floating-point number greater than or equal to zero * **Type**: `float` - * **Default value**: none * **Required**: *yes* **Inputs** diff --git a/docs/ops/normalization/GRN_1.md b/docs/ops/normalization/GRN_1.md index 656a46e3cc1..7a068e8e3c9 100644 --- a/docs/ops/normalization/GRN_1.md +++ b/docs/ops/normalization/GRN_1.md @@ -19,7 +19,6 @@ * **Description**: *bias* is added to the variance. * **Range of values**: a non-negative floating point value * **Type**: `float` - * **Default value**: None * **Required**: *yes* **Inputs** @@ -52,4 +51,4 @@ -``` \ No newline at end of file +``` diff --git a/docs/ops/normalization/LRN_1.md b/docs/ops/normalization/LRN_1.md index 2e7f049dbfe..0cc8d07d618 100644 --- a/docs/ops/normalization/LRN_1.md +++ b/docs/ops/normalization/LRN_1.md @@ -34,7 +34,6 @@ output = data / (bias + (alpha / size ** len(axes)) * sqr_sum) ** beta * **Description**: *alpha* represents the scaling attribute for the normalizing sum. For example, *alpha* equal `0.0001` means that the normalizing sum is multiplied by `0.0001`. * **Range of values**: no restrictions * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *beta* @@ -42,7 +41,6 @@ output = data / (bias + (alpha / size ** len(axes)) * sqr_sum) ** beta * **Description**: *beta* represents the exponent for the normalizing sum. For example, *beta* equal `0.75` means that the normalizing sum is raised to the power of `0.75`. * **Range of values**: positive number * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *bias* @@ -50,7 +48,6 @@ output = data / (bias + (alpha / size ** len(axes)) * sqr_sum) ** beta * **Description**: *bias* represents the offset. Usually positive number to avoid dividing by zero. * **Range of values**: no restrictions * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *size* @@ -58,7 +55,6 @@ output = data / (bias + (alpha / size ** len(axes)) * sqr_sum) ** beta * **Description**: *size* represents the side length of the region to be used for the normalization sum. The region can have one or more dimensions depending on the second input axes indices. * **Range of values**: positive integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* **Inputs** diff --git a/docs/ops/normalization/MVN_1.md b/docs/ops/normalization/MVN_1.md index 1c55d626679..4f0c5dec07c 100644 --- a/docs/ops/normalization/MVN_1.md +++ b/docs/ops/normalization/MVN_1.md @@ -44,7 +44,6 @@ o_{i}=\frac{o_{i}}{\sum \sqrt {o_{k}^2}+\epsilon} * **Description**: *eps* is the number to be added to the variance to avoid division by zero when normalizing the value. For example, *epsilon* equal to 0.001 means that 0.001 is added to the variance. * **Range of values**: a positive floating-point number * **Type**: `float` - * **Default value**: None * **Required**: *yes* **Inputs** @@ -77,4 +76,4 @@ o_{i}=\frac{o_{i}}{\sum \sqrt {o_{k}^2}+\epsilon} -``` \ No newline at end of file +``` diff --git a/docs/ops/normalization/MVN_6.md b/docs/ops/normalization/MVN_6.md index cb6ebeaf4d6..3d9f04f19e9 100644 --- a/docs/ops/normalization/MVN_6.md +++ b/docs/ops/normalization/MVN_6.md @@ -33,7 +33,6 @@ o_{i}=\frac{o_{i}}{\sqrt {\sum {o_{k}^2}}+\epsilon} * `false` -- Do not normalize variance * `true` -- Normalize variance * **Type**: `boolean` - * **Default value**: None * **Required**: *yes* * *eps* @@ -41,7 +40,6 @@ o_{i}=\frac{o_{i}}{\sqrt {\sum {o_{k}^2}}+\epsilon} * **Description**: *eps* is the number to be added to the variance to avoid division by zero when normalizing the value. * **Range of values**: a positive floating-point number * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *eps_mode* @@ -51,7 +49,6 @@ o_{i}=\frac{o_{i}}{\sqrt {\sum {o_{k}^2}}+\epsilon} * `inside_sqrt` -- Add epsilon inside sqrt * `outside_sqrt` -- Add epsilon outside of sqrt * **Type**: `string` - * **Default value**: None * **Required**: *yes* **Inputs** @@ -95,4 +92,4 @@ o_{i}=\frac{o_{i}}{\sqrt {\sum {o_{k}^2}}+\epsilon} -``` \ No newline at end of file +``` diff --git a/docs/ops/normalization/NormalizeL2_1.md b/docs/ops/normalization/NormalizeL2_1.md index 56fd13092ad..4668519030f 100644 --- a/docs/ops/normalization/NormalizeL2_1.md +++ b/docs/ops/normalization/NormalizeL2_1.md @@ -4,47 +4,57 @@ **Category**: *Normalization* -**Short description**: *NormalizeL2* operation performs L2 normalization of the 1st input tensor in slices specified by the 2nd input. +**Short description**: *NormalizeL2* operation performs L2 normalization on a given input `data` along dimensions specified by `axes` input. + +**Detailed Description** + +Each element in the output is the result of dividing the corresponding element of `data` input by the result of L2 reduction along dimensions specified by the `axes` input: + + output[i0, i1, ..., iN] = x[i0, i1, ..., iN] / sqrt(eps_mode(sum[j0,..., jN](x[j0, ..., jN]**2), eps)) + +Where indices `i0, ..., iN` run through all valid indices for the `data` input and summation `sum[j0, ..., jN]` has `jk = ik` for those dimensions `k` that are not in the set of indices specified by the `axes` input of the operation. +`eps_mode` selects how the reduction value and `eps` are combined. It can be `max` or `add` depending on `eps_mode` attribute value. + +Particular cases: + +1. If `axes` is an empty list, then each input element is divided by itself resulting value `1` for all non-zero elements. +2. If `axes` contains all dimensions of input `data`, a single L2 reduction value is calculated for the entire input tensor and each input element is divided by that value. + **Attributes** * *eps* - * **Description**: *eps* is the number to be added/maximized to/with the variance to avoid division by zero when normalizing the value. For example, *eps* equal to 0.001 means that 0.001 is used if all the values in normalization are equal to zero. + * **Description**: *eps* is the number applied by *eps_mode* function to the sum of squares to avoid division by zero when normalizing the value. * **Range of values**: a positive floating-point number * **Type**: `float` - * **Default value**: None * **Required**: *yes* * *eps_mode* - * **Description**: Specifies how *eps* is combined with L2 value calculated before division. - * **Range of values**: `add`, `max` + * **Description**: Specifies how *eps* is combined with the sum of squares to avoid division by zero. + * **Range of values**: `add` or `max` * **Type**: `string` - * **Default value**: None * **Required**: *yes* **Inputs** -* **1**: `data` - input tensor to be normalized. Type of elements is any floating point type. Required. +* **1**: `data` - A tensor of type *T* and arbitrary shape. **Required.** -* **2**: `axes` - scalar or 1D tensor with axis indices for the `data` input along which L2 reduction is calculated. Required. +* **2**: `axes` - Axis indices of `data` input tensor, along which L2 reduction is calculated. A scalar or 1D tensor of unique elements and type *T_IND*. The range of elements is `[-r, r-1]`, where `r` is the rank of `data` input tensor. **Required.** **Outputs** -* **1**: Tensor of the same shape and type as the `data` input and normalized slices defined by `axes` input. +* **1**: The result of *NormalizeL2* function applied to `data` input tensor. Normalized tensor of the same type and shape as the data input. -**Detailed Description** +**Types** -Each element in the output is the result of division of corresponding element from the `data` input tensor by the result of L2 reduction along dimensions specified by the `axes` input: +* *T*: arbitrary supported floating-point type. +* *T_IND*: any supported integer type. - output[i0, i1, ..., iN] = x[i0, i1, ..., iN] / sqrt(eps_mode(sum[j0,..., jN](x[j0, ..., jN]**2), eps)) +**Examples** -Where indices `i0, ..., iN` run through all valid indices for the 1st input and summation `sum[j0, ..., jN]` have `jk = ik` for those dimensions `k` that are not in the set of indices specified by the `axes` input of the operation. One of the corner cases is when `axes` is an empty list, then we divide each input element by itself resulting value 1 for all non-zero elements. Another corner case is where `axes` input contains all dimensions from `data` tensor, which means that a single L2 reduction value is calculated for entire input tensor and each input element is divided by that value. - -`eps_mode` selects how the reduction value and `eps` are combined. It can be `max` or `add` depending on `eps_mode` attribute value. - -**Example** +*Example: Normalization over channel dimension for `NCHW` layout* ```xml @@ -57,7 +67,7 @@ Where indices `i0, ..., iN` run through all valid indices for the 1st input and 24 - 2 + 1 @@ -69,4 +79,31 @@ Where indices `i0, ..., iN` run through all valid indices for the 1st input and -``` \ No newline at end of file +``` + +*Example: Normalization over channel and spatial dimensions for `NCHW` layout* + +```xml + + + + + 6 + 12 + 10 + 24 + + + 3 + + + + + 6 + 12 + 10 + 24 + + + +``` diff --git a/docs/ops/pooling/AvgPool_1.md b/docs/ops/pooling/AvgPool_1.md index 78792d77d11..c698f38afd1 100644 --- a/docs/ops/pooling/AvgPool_1.md +++ b/docs/ops/pooling/AvgPool_1.md @@ -6,11 +6,11 @@ **Short description**: [Reference](http://caffe.berkeleyvision.org/tutorial/layers/pooling.html) -**Detailed description**: [Reference](http://cs231n.github.io/convolutional-networks/#pool). Average Pool is a pooling operation that performs down-sampling by dividing the input into pooling regions of size specified by kernel attribute and computing the average values of each region. Output shape is calculated as follows: - `H_out = (H + pads_begin[0] + pads_end[0] - kernel[0] / strides[0]) + 1` - `W_out = (H + pads_begin[1] + pads_end[1] - kernel[1] / strides[1]) + 1` - `D_out = (H + pads_begin[2] + pads_end[2] - kernel[2] / strides[2]) + 1` - +**Detailed description**: [Reference](http://cs231n.github.io/convolutional-networks/#pool). Average Pool is a pooling operation that performs down-sampling by dividing the input into pooling regions of size specified by kernel attribute and computing the average values of each region. Output shape is calculated as follows: + `H_out = (H + pads_begin[0] + pads_end[0] - kernel[0] / strides[0]) + 1` + `W_out = (H + pads_begin[1] + pads_end[1] - kernel[1] / strides[1]) + 1` + `D_out = (H + pads_begin[2] + pads_end[2] - kernel[2] / strides[2]) + 1` + **Attributes**: *Pooling* attributes are specified in the `data` node, which is a child of the layer node. @@ -19,7 +19,6 @@ * **Description**: *strides* is a distance (in pixels) to slide the window on the feature map over the (z, y, x) axes for 3D poolings and (y, x) axes for 2D poolings. For example, *strides* equal "4,2,1" means sliding the window 4 pixel at a time over depth dimension, 2 over height dimension and 1 over width dimension. * **Range of values**: integer values starting from 0 * **Type**: int[] - * **Default value**: None * **Required**: *yes* * *pads_begin* @@ -27,7 +26,6 @@ * **Description**: *pads_begin* is a number of pixels to add to the beginning along each axis. For example, *pads_begin* equal "1,2" means adding 1 pixel to the top of the input and 2 to the left of the input. * **Range of values**: integer values starting from 0 * **Type**: int[] - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -36,7 +34,6 @@ * **Description**: *pads_end* is a number of pixels to add to the ending along each axis. For example, *pads_end* equal "1,2" means adding 1 pixel to the bottom of the input and 2 to the right of the input. * **Range of values**: integer values starting from 0 * **Type**: int[] - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -45,15 +42,13 @@ * **Description**: *kernel* is a size of each filter. For example, *kernel* equal (2, 3) means that each filter has height equal to 2 and width equal to 3. * **Range of values**: integer values starting from 1 * **Type**: int[] - * **Default value**: None * **Required**: *yes* - + * *exclude-pad* * **Description**: *exclude-pad* is a type of pooling strategy for values in the padding area. For example, if *exclude-pad* is "true", then zero-values that came from padding are not included in averaging calculation. - * **Range of values**: true or false + * **Range of values**: true or false * **Type**: boolean - * **Default value**: None * **Required**: *yes* * *rounding_type* @@ -95,7 +90,7 @@ output_{j} = \frac{\sum_{i = 0}^{n}x_{i}}{n} ```xml - + 1 3 @@ -115,7 +110,7 @@ output_{j} = \frac{\sum_{i = 0}^{n}x_{i}}{n} - + 1 3 @@ -135,7 +130,7 @@ output_{j} = \frac{\sum_{i = 0}^{n}x_{i}}{n} - + 1 3 @@ -155,7 +150,7 @@ output_{j} = \frac{\sum_{i = 0}^{n}x_{i}}{n} - + 1 3 @@ -175,7 +170,7 @@ output_{j} = \frac{\sum_{i = 0}^{n}x_{i}}{n} - + 1 3 @@ -192,4 +187,4 @@ output_{j} = \frac{\sum_{i = 0}^{n}x_{i}}{n} -``` \ No newline at end of file +``` diff --git a/docs/ops/pooling/MaxPool_1.md b/docs/ops/pooling/MaxPool_1.md index 8ebc653c18d..8e774821310 100644 --- a/docs/ops/pooling/MaxPool_1.md +++ b/docs/ops/pooling/MaxPool_1.md @@ -15,7 +15,6 @@ * **Description**: *strides* is a distance (in pixels) to slide the window on the feature map over the (z, y, x) axes for 3D poolings and (y, x) axes for 2D poolings. For example, *strides* equal "4,2,1" means sliding the window 4 pixel at a time over depth dimension, 2 over height dimension and 1 over width dimension. * **Range of values**: integer values starting from 0 * **Type**: int[] - * **Default value**: None * **Required**: *yes* * *pads_begin* @@ -23,7 +22,6 @@ * **Description**: *pads_begin* is a number of pixels to add to the beginning along each axis. For example, *pads_begin* equal "1,2" means adding 1 pixel to the top of the input and 2 to the left of the input. * **Range of values**: integer values starting from 0 * **Type**: int[] - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -32,7 +30,6 @@ * **Description**: *pads_end* is a number of pixels to add to the ending along each axis. For example, *pads_end* equal "1,2" means adding 1 pixel to the bottom of the input and 2 to the right of the input. * **Range of values**: integer values starting from 0 * **Type**: int[] - * **Default value**: None * **Required**: *yes* * **Note**: the attribute is ignored when *auto_pad* attribute is specified. @@ -41,7 +38,6 @@ * **Description**: *kernel* is a size of each filter. For example, *kernel* equal (2, 3) means that each filter has height equal to 2 and width equal to 3. * **Range of values**: integer values starting from 1 * **Type**: int[] - * **Default value**: None * **Required**: *yes* * *rounding_type* diff --git a/docs/ops/quantization/FakeQuantize_1.md b/docs/ops/quantization/FakeQuantize_1.md index 70670b6c83b..9a203283974 100644 --- a/docs/ops/quantization/FakeQuantize_1.md +++ b/docs/ops/quantization/FakeQuantize_1.md @@ -29,7 +29,6 @@ else: * **Description**: *levels* is the number of quantization levels (e.g. 2 is for binarization, 255/256 is for int8 quantization) * **Range of values**: an integer greater than or equal to 2 * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *auto_broadcast* diff --git a/docs/ops/sequence/GRUCell_3.md b/docs/ops/sequence/GRUCell_3.md index c154c686238..3b5d2256d0a 100644 --- a/docs/ops/sequence/GRUCell_3.md +++ b/docs/ops/sequence/GRUCell_3.md @@ -13,7 +13,6 @@ * **Description**: *hidden_size* specifies hidden state size. * **Range of values**: a positive integer * **Type**: `int` - * **Default value**: None * **Required**: *yes* * *activations* diff --git a/docs/ops/sequence/GRUSequence_5.md b/docs/ops/sequence/GRUSequence_5.md index f44a1d71078..a18df16bbdc 100644 --- a/docs/ops/sequence/GRUSequence_5.md +++ b/docs/ops/sequence/GRUSequence_5.md @@ -18,7 +18,6 @@ A single cell in the sequence is implemented in the same way as in + +#include "transformations/utils/utils.hpp" + +using namespace InferenceEngine; + +CommonReferenceTest::CommonReferenceTest(): targetDevice("TEMPLATE") { + core = PluginCache::get().ie(targetDevice); +} + +void CommonReferenceTest::Exec() { + LoadNetwork(); + FillInputs(); + Infer(); + Validate(); +} + +void CommonReferenceTest::LoadNetwork() { + InferenceEngine::CNNNetwork cnnNetwork(function); + auto inputInfo = cnnNetwork.getInputsInfo(); + auto outputInfo = cnnNetwork.getOutputsInfo(); + for (const auto& param : function->get_parameters()) { + inputInfo[param->get_friendly_name()]->setPrecision(InferenceEngine::details::convertPrecision(param->get_element_type())); + } + for (const auto& result : function->get_results()) { + outputInfo[ngraph::op::util::create_ie_output_name(result->input_value(0))]->setPrecision( + InferenceEngine::details::convertPrecision(result->get_element_type())); + } + executableNetwork = core->LoadNetwork(cnnNetwork, targetDevice); +} + +void CommonReferenceTest::FillInputs() { + const auto& inputInfo = executableNetwork.GetInputsInfo(); + const auto& params = function->get_parameters(); + ASSERT_EQ(params.size(), inputData.size()); + ASSERT_EQ(inputInfo.size(), inputData.size()); + + for (size_t i = 0; i < params.size(); i++) { + const auto& param = params[i]; + const auto infoIt = inputInfo.find(param->get_friendly_name()); + GTEST_ASSERT_NE(infoIt, inputInfo.cend()); + + const auto& info = infoIt->second; + auto blob = make_blob_with_precision(info->getTensorDesc()); + blob->allocate(); + + ASSERT_EQ(blob->byteSize(), inputData[i]->byteSize()); + + MemoryBlob::Ptr mInputData = as(inputData[i]); + ASSERT_NE(mInputData, nullptr); + auto minputDataHolder = mInputData->rmap(); + + MemoryBlob::Ptr mBlob = as(blob); + ASSERT_NE(mBlob, nullptr); + auto mBlobHolder = mBlob->wmap(); + + std::memcpy(mBlobHolder.as(), minputDataHolder.as(), inputData[i]->byteSize()); + inputData[i] = blob; + } +} + +void CommonReferenceTest::Infer() { + inferRequest = executableNetwork.CreateInferRequest(); + + const auto& inputsInfo = executableNetwork.GetInputsInfo(); + const auto& functionParams = function->get_parameters(); + for (size_t i = 0; i < functionParams.size(); ++i) { + const auto& param = functionParams[i]; + const auto infoIt = inputsInfo.find(param->get_friendly_name()); + GTEST_ASSERT_NE(infoIt, inputsInfo.cend()); + + const auto& info = infoIt->second; + auto blob = inputData[i]; + + inferRequest.SetBlob(info->name(), blob); + } + inferRequest.Infer(); +} + +void CommonReferenceTest::Validate() { + ASSERT_EQ(executableNetwork.GetOutputsInfo().size(), refOutData.size()); + std::vector outputs; + for (const auto& result : function->get_results()) { + auto name = ngraph::op::util::create_ie_output_name(result->input_value(0)); + outputs.emplace_back(inferRequest.GetBlob(name)); + } + + ASSERT_EQ(refOutData.size(), outputs.size()); + for (size_t i = 0; i < refOutData.size(); i++) { + ValidateBlobs(refOutData[i], outputs[i]); + } +} +void CommonReferenceTest::ValidateBlobs(const InferenceEngine::Blob::Ptr& refBlob, const InferenceEngine::Blob::Ptr& outBlob) { + ASSERT_TRUE(refBlob != nullptr); + ASSERT_TRUE(outBlob != nullptr); + ASSERT_EQ(refBlob->getTensorDesc().getPrecision(), outBlob->getTensorDesc().getPrecision()); + ASSERT_EQ(refBlob->byteSize(), outBlob->byteSize()); + + auto mRef = as(refBlob); + IE_ASSERT(mRef); + const auto refLockMemory = mRef->rmap(); + const auto refBuffer = refLockMemory.as(); + + auto mOut = as(outBlob); + IE_ASSERT(mOut); + const auto outLockMemory = mOut->rmap(); + const auto outBuffer = outLockMemory.as(); + + const auto& precision = refBlob->getTensorDesc().getPrecision(); + switch (precision) { + case InferenceEngine::Precision::BF16: + LayerTestsUtils::LayerTestsCommon::Compare( + reinterpret_cast(refBuffer), reinterpret_cast(outBuffer), refBlob->size(), threshold); + break; + case InferenceEngine::Precision::FP16: + LayerTestsUtils::LayerTestsCommon::Compare( + reinterpret_cast(refBuffer), reinterpret_cast(outBuffer), refBlob->size(), threshold); + break; + case InferenceEngine::Precision::FP32: + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(refBuffer), reinterpret_cast(outBuffer), + refBlob->size(), threshold); + break; + case InferenceEngine::Precision::I8: + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(refBuffer), reinterpret_cast(outBuffer), + refBlob->size(), threshold); + break; + case InferenceEngine::Precision::I16: + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(refBuffer), reinterpret_cast(outBuffer), + refBlob->size(), threshold); + break; + case InferenceEngine::Precision::I32: + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(refBuffer), reinterpret_cast(outBuffer), + refBlob->size(), threshold); + break; + case InferenceEngine::Precision::I64: + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(refBuffer), reinterpret_cast(outBuffer), + refBlob->size(), threshold); + break; + case InferenceEngine::Precision::BOOL: + case InferenceEngine::Precision::U8: + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(refBuffer), reinterpret_cast(outBuffer), + refBlob->size(), threshold); + break; + case InferenceEngine::Precision::U16: + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(refBuffer), + reinterpret_cast(outBuffer), refBlob->size(), threshold); + break; + case InferenceEngine::Precision::U32: + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(refBuffer), + reinterpret_cast(outBuffer), refBlob->size(), threshold); + break; + case InferenceEngine::Precision::U64: + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(refBuffer), + reinterpret_cast(outBuffer), refBlob->size(), threshold); + break; + case InferenceEngine::Precision::I4: + case InferenceEngine::Precision::U4: + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(refBuffer), reinterpret_cast(outBuffer), + refBlob->size() / 2, threshold); + break; + case InferenceEngine::Precision::BIN: + LayerTestsUtils::LayerTestsCommon::Compare(reinterpret_cast(refBuffer), reinterpret_cast(outBuffer), + refBlob->size() / 8, threshold); + break; + default: + FAIL() << "Comparator for " << precision << " precision isn't supported"; + } +} diff --git a/docs/template_plugin/tests/functional/op_reference/base_reference_test.hpp b/docs/template_plugin/tests/functional/op_reference/base_reference_test.hpp new file mode 100644 index 00000000000..6e3fd942a9e --- /dev/null +++ b/docs/template_plugin/tests/functional/op_reference/base_reference_test.hpp @@ -0,0 +1,53 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include +#include +#include +#include + +class CommonReferenceTest { +public: + CommonReferenceTest(); + + void Exec(); + + void LoadNetwork(); + + void FillInputs(); + + void Infer(); + + void Validate(); + +private: + void ValidateBlobs(const InferenceEngine::Blob::Ptr& refBlob, const InferenceEngine::Blob::Ptr& outBlob); + +protected: + const std::string targetDevice; + std::shared_ptr core; + std::shared_ptr function; + + InferenceEngine::ExecutableNetwork executableNetwork; + InferenceEngine::InferRequest inferRequest; + std::vector inputData; + std::vector refOutData; + float threshold = 1e-2f; +}; + +template +InferenceEngine::Blob::Ptr CreateBlob(const ngraph::element::Type& element_type, const std::vector& values, size_t size = 0) { + size_t real_size = size ? size : values.size() * sizeof(T) / element_type.size(); + auto blob = make_blob_with_precision( + InferenceEngine::TensorDesc(InferenceEngine::details::convertPrecision(element_type), {real_size}, InferenceEngine::Layout::C)); + blob->allocate(); + InferenceEngine::MemoryBlob::Ptr minput = InferenceEngine::as(blob); + IE_ASSERT(minput); + auto minputHolder = minput->wmap(); + + std::memcpy(minputHolder.as(), values.data(), std::min(real_size * element_type.size(), sizeof(T) * values.size())); + + return blob; +} + diff --git a/docs/template_plugin/tests/functional/op_reference/convert.cpp b/docs/template_plugin/tests/functional/op_reference/convert.cpp new file mode 100644 index 00000000000..fb32fda4cbb --- /dev/null +++ b/docs/template_plugin/tests/functional/op_reference/convert.cpp @@ -0,0 +1,441 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include +#include +#include +#include +#include + +#include "base_reference_test.hpp" + +using namespace ngraph; +using namespace InferenceEngine; + +struct ConvertParams { + template + ConvertParams(const ngraph::PartialShape& shape, const ngraph::element::Type& iType, const ngraph::element::Type& oType, const std::vector& iValues, + const std::vector& oValues, size_t iSize = 0, size_t oSize = 0) + : pshape(shape), inType(iType), outType(oType), inputData(CreateBlob(iType, iValues, iSize)), refData(CreateBlob(oType, oValues, oSize)) {} + ngraph::PartialShape pshape; + ngraph::element::Type inType; + ngraph::element::Type outType; + InferenceEngine::Blob::Ptr inputData; + InferenceEngine::Blob::Ptr refData; +}; + +class ReferenceConvertLayerTest : public testing::TestWithParam, public CommonReferenceTest { +public: + void SetUp() override { + auto params = GetParam(); + function = CreateFunction(params.pshape, params.inType, params.outType); + inputData = {params.inputData}; + refOutData = {params.refData}; + } + static std::string getTestCaseName(const testing::TestParamInfo& obj) { + auto param = obj.param; + std::ostringstream result; + result << "shape=" << param.pshape << "_"; + result << "iType=" << param.inType << "_"; + result << "oType=" << param.outType; + return result.str(); + } + +private: + static std::shared_ptr CreateFunction(const PartialShape& input_shape, const element::Type& input_type, + const element::Type& expected_output_type) { + const auto in = std::make_shared(input_type, input_shape); + const auto convert = std::make_shared(in, expected_output_type); + return std::make_shared(NodeVector {convert}, ParameterVector {in}); + } +}; + +TEST_P(ReferenceConvertLayerTest, CompareWithHardcodedRefs) { + Exec(); +} + +INSTANTIATE_TEST_SUITE_P( + smoke_Convert_With_Hardcoded_Refs, ReferenceConvertLayerTest, + ::testing::Values( + // destination boolean + ConvertParams(ngraph::PartialShape {2, 3}, ngraph::element::u8, ngraph::element::boolean, + std::vector {0, 12, 23, 0, std::numeric_limits::lowest(), std::numeric_limits::max()}, + std::vector {0, 1, 1, 0, 0, 1}), + ConvertParams(ngraph::PartialShape {2, 3}, ngraph::element::i32, ngraph::element::boolean, + std::vector {0, -12, 23, 0, std::numeric_limits::lowest(), std::numeric_limits::max()}, + std::vector {0, 1, 1, 0, 1, 1}), + ConvertParams(ngraph::PartialShape {3, 3}, ngraph::element::f32, ngraph::element::boolean, + std::vector {0.f, 1.5745f, 0.12352f, 0.f, std::numeric_limits::lowest(), std::numeric_limits::max(), + std::numeric_limits::min(), std::numeric_limits::infinity(), -std::numeric_limits::infinity()}, + std::vector {0, 1, 1, 0, 1, 1, 1, 1, 1}), + + // destination bf16 + ConvertParams(ngraph::PartialShape {1, 1, 3, 5}, ngraph::element::f32, ngraph::element::bf16, + std::vector {0.5f, 1.5f, 0.5f, 2.5f, 1.5f, 0.5f, 3.5f, 2.5f, 0.5f, 0.5f, 2.5f, 0.5f, 0.5f, 0.5f, 1.5f}, + std::vector {0.5f, 1.5f, 0.5f, 2.5f, 1.5f, 0.5f, 3.5f, 2.5f, 0.5f, 0.5f, 2.5f, 0.5f, 0.5f, 0.5f, 1.5f}), + ConvertParams(ngraph::PartialShape {11}, ngraph::element::u8, ngraph::element::bf16, + std::vector {0, 10, 15, 20, 43, 56, 78, 99, 102, 130, 142}, + std::vector {0, 10, 15, 20, 43, 56, 78, 99, 102, 130, 142}), + + // destination f16 + ConvertParams(ngraph::PartialShape {1, 1, 3, 5}, ngraph::element::f32, ngraph::element::f16, + std::vector {0.5f, 1.5f, 0.5f, 2.5f, 1.5f, 0.5f, 3.5f, 2.5f, 0.5f, 0.5f, 2.5f, 0.5f, 0.5f, 0.5f, 1.5f}, + std::vector {0.5f, 1.5f, 0.5f, 2.5f, 1.5f, 0.5f, 3.5f, 2.5f, 0.5f, 0.5f, 2.5f, 0.5f, 0.5f, 0.5f, 1.5f}), + ConvertParams(ngraph::PartialShape {11}, ngraph::element::u8, ngraph::element::f16, std::vector {0, 10, 15, 20, 43, 56, 78, 99, 102, 130, 142}, + std::vector {0, 10, 15, 20, 43, 56, 78, 99, 102, 130, 142}), + + // destination f32 + ConvertParams(ngraph::PartialShape {2, 2}, ngraph::element::u1, ngraph::element::f32, std::vector {0xA0}, + std::vector {1.0f, 0.0f, 1.0f, 0.0f}, 4), + ConvertParams(ngraph::PartialShape {2, 2}, ngraph::element::u4, ngraph::element::f32, std::vector {0xFB, 0x0A}, + std::vector {15.0f, 11.0f, 0.0f, 10.0f}, 4), + ConvertParams(ngraph::PartialShape {2, 2}, ngraph::element::u8, ngraph::element::f32, std::vector {255, 128, 32, 0}, + std::vector {255.0f, 128.0f, 32.0f, 0.0f}), + ConvertParams(ngraph::PartialShape {2, 2}, ngraph::element::u16, ngraph::element::f32, std::vector {64000, 32000, 128, 0}, + std::vector {64000.0f, 32000.0f, 128.0f, 0.0f}), + ConvertParams(ngraph::PartialShape {2, 2}, ngraph::element::u32, ngraph::element::f32, std::vector {4000000, 2000000, 128, 0}, + std::vector {4000000.0f, 2000000.0f, 128.0f, 0.0f}), + ConvertParams(ngraph::PartialShape {2, 2}, ngraph::element::u64, ngraph::element::f32, std::vector {4000000, 2000000, 128, 0}, + std::vector {4000000.0f, 2000000.0f, 128.0f, 0.0f}), + ConvertParams(ngraph::PartialShape {2, 2}, ngraph::element::i4, ngraph::element::f32, std::vector {0xFE, 0xF2}, + std::vector {-1.0f, -2.0f, -1.0f, 2.0f}, 4), + ConvertParams(ngraph::PartialShape {2, 2}, ngraph::element::i8, ngraph::element::f32, std::vector {-127, -0, 0, 127}, + std::vector {-127.0f, -0.0f, 0.0f, 127.0f}), + ConvertParams(ngraph::PartialShape {2, 2}, ngraph::element::i16, ngraph::element::f32, std::vector {-32000, -0, 0, 32000}, + std::vector {-32000.0f, -0.0f, 0.0f, 32000.0f}), + ConvertParams(ngraph::PartialShape {2, 2}, ngraph::element::i32, ngraph::element::f32, std::vector {-64000, -0, 0, 64000}, + std::vector {-64000.0f, -0.0f, 0.0f, 64000.0f}), + ConvertParams(ngraph::PartialShape {2, 2}, ngraph::element::i64, ngraph::element::f32, std::vector {-64000, -0, 0, 64000}, + std::vector {-64000.0f, -0.0f, 0.0f, 64000.0f}), + ConvertParams(ngraph::PartialShape {1, 1, 3, 5}, ngraph::element::bf16, ngraph::element::f32, + std::vector {0.5f, 1.5f, 0.5f, 2.5f, 1.5f, 0.5f, 3.5f, 2.5f, 0.5f, 0.5f, 2.5f, 0.5f, 0.5f, 0.5f, 1.5f}, + std::vector {0.5f, 1.5f, 0.5f, 2.5f, 1.5f, 0.5f, 3.5f, 2.5f, 0.5f, 0.5f, 2.5f, 0.5f, 0.5f, 0.5f, 1.5f}), + ConvertParams(ngraph::PartialShape {1, 1, 3, 5}, ngraph::element::f16, ngraph::element::f32, + std::vector {0.5f, 1.5f, 0.5f, 2.5f, 1.5f, 0.5f, 3.5f, 2.5f, 0.5f, 0.5f, 2.5f, 0.5f, 0.5f, 0.5f, 1.5f}, + std::vector {0.5f, 1.5f, 0.5f, 2.5f, 1.5f, 0.5f, 3.5f, 2.5f, 0.5f, 0.5f, 2.5f, 0.5f, 0.5f, 0.5f, 1.5f}), + ConvertParams(ngraph::PartialShape {1, 1, 3, 5}, ngraph::element::f32, ngraph::element::f32, + std::vector {0.5f, 1.5f, 0.5f, 2.5f, 1.5f, 0.5f, 3.5f, 2.5f, 0.5f, 0.5f, 2.5f, 0.5f, 0.5f, 0.5f, 1.5f}, + std::vector {0.5f, 1.5f, 0.5f, 2.5f, 1.5f, 0.5f, 3.5f, 2.5f, 0.5f, 0.5f, 2.5f, 0.5f, 0.5f, 0.5f, 1.5f}), + + // destination i4 + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u1, ngraph::element::i4, std::vector {0xA0}, std::vector {0x10, 0x10}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u4, ngraph::element::i4, std::vector {0x12, 0x03}, std::vector {0x12, 0x03}, + 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u8, ngraph::element::i4, std::vector {1, 2, 0, 3}, std::vector {0x12, 0x03}, + 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u16, ngraph::element::i4, std::vector {1, 2, 0, 3}, + std::vector {0x12, 0x03}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u32, ngraph::element::i4, std::vector {1, 2, 0, 3}, + std::vector {0x12, 0x03}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u64, ngraph::element::i4, std::vector {1, 2, 0, 3}, + std::vector {0x12, 0x03}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i4, ngraph::element::i4, std::vector {0xFE, 0x03}, std::vector {0xFE, 0x03}, + 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i8, ngraph::element::i4, std::vector {-1, -2, 2, 3}, std::vector {0xFE, 0x23}, + 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i16, ngraph::element::i4, std::vector {-1, -2, 2, 3}, + std::vector {0xFE, 0x23}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i32, ngraph::element::i4, std::vector {-1, -2, 2, 3}, + std::vector {0xFE, 0x23}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i64, ngraph::element::i4, std::vector {-1, -2, 2, 3}, + std::vector {0xFE, 0x23}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f16, ngraph::element::i4, std::vector {-1, -2, 0, 3}, + std::vector {0xFE, 0x03}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::bf16, ngraph::element::i4, std::vector {-1, -2, 0, 3}, + std::vector {0xFE, 0x03}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f32, ngraph::element::i4, std::vector {-1, -2, 2, 3}, std::vector {0xFE, 0x23}, + 4, 4), + // destination i8 + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u1, ngraph::element::i8, std::vector {0x81}, + std::vector {1, 0, 0, 0, 0, 0, 0, 1}, 8), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u4, ngraph::element::i8, std::vector {0x21, 0x43}, std::vector {2, 1, 4, 3}, + 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u8, ngraph::element::i8, std::vector {1, 2, 0, 3}, std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u16, ngraph::element::i8, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u32, ngraph::element::i8, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u64, ngraph::element::i8, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i4, ngraph::element::i8, std::vector {0x21, 0x43}, std::vector {2, 1, 4, 3}, + 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i8, ngraph::element::i8, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i16, ngraph::element::i8, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i32, ngraph::element::i8, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i64, ngraph::element::i8, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f16, ngraph::element::i8, std::vector {-1, -2, 0, 3}, + std::vector {-1, -2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::bf16, ngraph::element::i8, std::vector {-1, -2, 0, 3}, + std::vector {-1, -2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f32, ngraph::element::i8, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + // destination i16 + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u1, ngraph::element::i16, std::vector {0x81}, + std::vector {1, 0, 0, 0, 0, 0, 0, 1}, 8), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u4, ngraph::element::i16, std::vector {0x21, 0x43}, std::vector {2, 1, 4, 3}, + 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u8, ngraph::element::i16, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u16, ngraph::element::i16, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u32, ngraph::element::i16, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u64, ngraph::element::i16, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i4, ngraph::element::i16, std::vector {0x21, 0x43}, std::vector {2, 1, 4, 3}, + 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i8, ngraph::element::i16, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i16, ngraph::element::i16, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i32, ngraph::element::i16, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i64, ngraph::element::i16, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f16, ngraph::element::i16, std::vector {-1, -2, 0, 3}, + std::vector {-1, -2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::bf16, ngraph::element::i16, std::vector {-1, -2, 0, 3}, + std::vector {-1, -2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f32, ngraph::element::i16, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + // destination i32 + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u1, ngraph::element::i32, std::vector {0x81}, + std::vector {1, 0, 0, 0, 0, 0, 0, 1}, 8), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u4, ngraph::element::i32, std::vector {0x21, 0x43}, std::vector {2, 1, 4, 3}, + 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u8, ngraph::element::i32, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u16, ngraph::element::i32, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u32, ngraph::element::i32, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u64, ngraph::element::i32, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i4, ngraph::element::i32, std::vector {0x21, 0x43}, std::vector {2, 1, 4, 3}, + 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i8, ngraph::element::i32, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i16, ngraph::element::i32, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i32, ngraph::element::i32, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i64, ngraph::element::i32, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f16, ngraph::element::i32, std::vector {-1, -2, 0, 3}, + std::vector {-1, -2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::bf16, ngraph::element::i32, std::vector {-1, -2, 0, 3}, + std::vector {-1, -2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f32, ngraph::element::i32, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + // destination i64 + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u1, ngraph::element::i64, std::vector {0x81}, + std::vector {1, 0, 0, 0, 0, 0, 0, 1}, 8), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u4, ngraph::element::i64, std::vector {0x21, 0x43}, std::vector {2, 1, 4, 3}, + 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u8, ngraph::element::i64, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u16, ngraph::element::i64, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u32, ngraph::element::i64, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u64, ngraph::element::i64, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i4, ngraph::element::i64, std::vector {0x21, 0x43}, std::vector {2, 1, 4, 3}, + 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i8, ngraph::element::i64, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i16, ngraph::element::i64, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i32, ngraph::element::i64, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i64, ngraph::element::i64, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f16, ngraph::element::i64, std::vector {-1, -2, 0, 3}, + std::vector {-1, -2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::bf16, ngraph::element::i64, std::vector {-1, -2, 0, 3}, + std::vector {-1, -2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f32, ngraph::element::i64, std::vector {-1, -2, 2, 3}, + std::vector {-1, -2, 2, 3}), + + // destination u1 + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u1, ngraph::element::u1, std::vector {0xA0}, std::vector {0xA0}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u4, ngraph::element::u1, std::vector {0x10, 0x01, 0x00, 0x00}, + std::vector {0x90}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u8, ngraph::element::u1, std::vector {1, 0, 1, 0, 0, 0, 0, 1}, + std::vector {0xA1}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u16, ngraph::element::u1, std::vector {1, 0, 1, 0, 0, 0, 0, 1}, + std::vector {0xA1}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u32, ngraph::element::u1, std::vector {1, 0, 1, 0, 0, 0, 0, 1}, + std::vector {0xA1}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u64, ngraph::element::u1, std::vector {1, 0, 1, 0, 0, 0, 0, 1}, + std::vector {0xA1}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::i4, ngraph::element::u1, std::vector {0x10, 0x01, 0x00, 0x00}, + std::vector {0x90}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::i8, ngraph::element::u1, std::vector {1, 0, 1, 0, 0, 0, 0, 1}, + std::vector {0xA1}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::i16, ngraph::element::u1, std::vector {1, 0, 1, 0, 0, 0, 0, 1}, + std::vector {0xA1}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::i32, ngraph::element::u1, std::vector {1, 0, 1, 0, 0, 0, 0, 1}, + std::vector {0xA1}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::i64, ngraph::element::u1, std::vector {1, 0, 1, 0, 0, 0, 0, 1}, + std::vector {0xA1}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::f16, ngraph::element::u1, std::vector {1, 0, 1, 0, 0, 0, 0, 1}, + std::vector {0xA1}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::bf16, ngraph::element::u1, std::vector {1, 0, 1, 0, 0, 0, 0, 1}, + std::vector {0xA1}, 8, 8), + ConvertParams(ngraph::PartialShape {8}, ngraph::element::f32, ngraph::element::u1, std::vector {1, 0, 1, 0, 0, 0, 0, 1}, + std::vector {0xA1}, 8, 8), + + // destination u4 + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u1, ngraph::element::u4, std::vector {0xA0}, std::vector {0x10, 0x10}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u4, ngraph::element::u4, std::vector {0x12, 0x03}, std::vector {0x12, 0x03}, + 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u8, ngraph::element::u4, std::vector {1, 2, 0, 3}, std::vector {0x12, 0x03}, + 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u16, ngraph::element::u4, std::vector {1, 2, 0, 3}, + std::vector {0x12, 0x03}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u32, ngraph::element::u4, std::vector {1, 2, 0, 3}, + std::vector {0x12, 0x03}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u64, ngraph::element::u4, std::vector {1, 2, 0, 3}, + std::vector {0x12, 0x03}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i4, ngraph::element::u4, std::vector {0xFE, 0x03}, std::vector {0xFE, 0x03}, + 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i8, ngraph::element::u4, std::vector {-1, -2, 2, 3}, std::vector {0xFE, 0x23}, + 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i16, ngraph::element::u4, std::vector {-1, -2, 2, 3}, + std::vector {0xFE, 0x23}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i32, ngraph::element::u4, std::vector {-1, -2, 2, 3}, + std::vector {0xFE, 0x23}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i64, ngraph::element::u4, std::vector {-1, -2, 2, 3}, + std::vector {0xFE, 0x23}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f16, ngraph::element::u4, std::vector {-1, -2, 0, 3}, + std::vector {0xFE, 0x03}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::bf16, ngraph::element::u4, std::vector {-1, -2, 0, 3}, + std::vector {0xFE, 0x03}, 4, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f32, ngraph::element::u4, std::vector {-1, -2, 2, 3}, std::vector {0xFE, 0x23}, + 4, 4), + + // destination u8 + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u1, ngraph::element::u8, std::vector {0x81}, + std::vector {1, 0, 0, 0, 0, 0, 0, 1}, 8), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u4, ngraph::element::u8, std::vector {0x21, 0x43}, std::vector {2, 1, 4, 3}, + 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u8, ngraph::element::u8, std::vector {1, 2, 0, 3}, std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u16, ngraph::element::u8, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u32, ngraph::element::u8, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u64, ngraph::element::u8, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i4, ngraph::element::u8, std::vector {0x21, 0x43}, std::vector {2, 1, 4, 3}, + 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i8, ngraph::element::u8, std::vector {1, 2, 2, 3}, std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i16, ngraph::element::u8, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i32, ngraph::element::u8, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i64, ngraph::element::u8, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f16, ngraph::element::u8, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::bf16, ngraph::element::u8, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f32, ngraph::element::u8, std::vector {1, 2, 2, 3}, std::vector {1, 2, 2, 3}), + + // destination u16 + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u1, ngraph::element::u16, std::vector {0x81}, + std::vector {1, 0, 0, 0, 0, 0, 0, 1}, 8), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u4, ngraph::element::u16, std::vector {0x21, 0x43}, + std::vector {2, 1, 4, 3}, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u8, ngraph::element::u16, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u16, ngraph::element::u16, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u32, ngraph::element::u16, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u64, ngraph::element::u16, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i4, ngraph::element::u16, std::vector {0x21, 0x43}, + std::vector {2, 1, 4, 3}, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i8, ngraph::element::u16, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i16, ngraph::element::u16, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i32, ngraph::element::u16, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i64, ngraph::element::u16, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f16, ngraph::element::u16, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::bf16, ngraph::element::u16, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f32, ngraph::element::u16, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + + // destination u32 + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u1, ngraph::element::u32, std::vector {0x81}, + std::vector {1, 0, 0, 0, 0, 0, 0, 1}, 8), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u4, ngraph::element::u32, std::vector {0x21, 0x43}, + std::vector {2, 1, 4, 3}, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u8, ngraph::element::u32, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u16, ngraph::element::u32, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u32, ngraph::element::u32, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u64, ngraph::element::u32, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i4, ngraph::element::u32, std::vector {0x21, 0x43}, + std::vector {2, 1, 4, 3}, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i8, ngraph::element::u32, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i16, ngraph::element::u32, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i32, ngraph::element::u32, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i64, ngraph::element::u32, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f16, ngraph::element::u32, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::bf16, ngraph::element::u32, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f32, ngraph::element::u32, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + + // destination u64 + ConvertParams(ngraph::PartialShape {8}, ngraph::element::u1, ngraph::element::u64, std::vector {0x81}, + std::vector {1, 0, 0, 0, 0, 0, 0, 1}, 8), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u4, ngraph::element::u64, std::vector {0x21, 0x43}, + std::vector {2, 1, 4, 3}, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u8, ngraph::element::u64, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u16, ngraph::element::u64, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u32, ngraph::element::u64, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::u64, ngraph::element::u64, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i4, ngraph::element::u64, std::vector {0x21, 0x43}, + std::vector {2, 1, 4, 3}, 4), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i8, ngraph::element::u64, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i16, ngraph::element::u64, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i32, ngraph::element::u64, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::i64, ngraph::element::u64, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f16, ngraph::element::u64, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::bf16, ngraph::element::u64, std::vector {1, 2, 0, 3}, + std::vector {1, 2, 0, 3}), + ConvertParams(ngraph::PartialShape {4}, ngraph::element::f32, ngraph::element::u64, std::vector {1, 2, 2, 3}, + std::vector {1, 2, 2, 3})), + ReferenceConvertLayerTest::getTestCaseName); diff --git a/docs/template_plugin/tests/functional/shared_tests_instances/behavior/core_integration.cpp b/docs/template_plugin/tests/functional/shared_tests_instances/behavior/core_integration.cpp index 2c067aaf7b6..60ffbf04893 100644 --- a/docs/template_plugin/tests/functional/shared_tests_instances/behavior/core_integration.cpp +++ b/docs/template_plugin/tests/functional/shared_tests_instances/behavior/core_integration.cpp @@ -73,7 +73,7 @@ using IEClassSetConfigTestHETERO = IEClassNetworkTest; TEST_F(IEClassSetConfigTestHETERO, smoke_SetConfigNoThrow) { { - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(ie.SetConfig({{HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), CONFIG_VALUE(YES)}}, "HETERO")); @@ -84,7 +84,7 @@ TEST_F(IEClassSetConfigTestHETERO, smoke_SetConfigNoThrow) { } { - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(ie.SetConfig({{HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), CONFIG_VALUE(NO)}}, "HETERO")); @@ -95,7 +95,7 @@ TEST_F(IEClassSetConfigTestHETERO, smoke_SetConfigNoThrow) { } { - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(ie.GetMetric("HETERO", METRIC_KEY(SUPPORTED_CONFIG_KEYS))); @@ -118,7 +118,7 @@ INSTANTIATE_TEST_SUITE_P( using IEClassGetConfigTestTEMPLATE = IEClassNetworkTest; TEST_F(IEClassGetConfigTestTEMPLATE, smoke_GetConfigNoThrow) { - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; std::string deviceName = CommonTestUtils::DEVICE_TEMPLATE; @@ -209,4 +209,4 @@ INSTANTIATE_TEST_SUITE_P( ::testing::Values(CommonTestUtils::DEVICE_TEMPLATE)); #endif // ENABLE_MKL_DNN -} // namespace \ No newline at end of file +} // namespace diff --git a/inference-engine/ie_bridges/c/samples/hello_classification/README.md b/inference-engine/ie_bridges/c/samples/hello_classification/README.md index 26babb9c20c..2b0ca163ac0 100644 --- a/inference-engine/ie_bridges/c/samples/hello_classification/README.md +++ b/inference-engine/ie_bridges/c/samples/hello_classification/README.md @@ -47,33 +47,45 @@ To run the sample, you need specify a model and image: > > - The sample accepts models in ONNX format (\*.onnx) that do not require preprocessing. -You can do inference of an image using a trained AlexNet network on a GPU using the following command: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name alexnet +``` -```sh -./hello_classification_c /alexnet_fp32.xml /cat.png GPU +2. If a model is not in the Inference Engine IR or ONNX format, it must be converted. You can do this using the model converter script: + +``` +python /converter.py --name alexnet +``` + +3. Perform inference of `car.bmp` using `alexnet` model on a `GPU`, for example: + +``` +/hello_classification_c /alexnet.xml /car.bmp GPU ``` ## Sample Output The application outputs top-10 inference results. -```sh +``` Top 10 results: -Image /opt/intel/openvino/deployment_tools/demo/car.png +Image C:\images\car.bmp classid probability ------- ----------- -479 0.7562205 -511 0.0760381 -436 0.0724111 -817 0.0462140 -656 0.0301231 -661 0.0056171 -581 0.0031622 -468 0.0029917 -717 0.0023081 -627 0.0016193 +656 0.666479 +654 0.112940 +581 0.068487 +874 0.033385 +436 0.026132 +817 0.016731 +675 0.010980 +511 0.010592 +569 0.008178 +717 0.006336 This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool ``` diff --git a/inference-engine/ie_bridges/c/samples/hello_nv12_input_classification/README.md b/inference-engine/ie_bridges/c/samples/hello_nv12_input_classification/README.md index 1456c87a6db..0479ae90278 100644 --- a/inference-engine/ie_bridges/c/samples/hello_nv12_input_classification/README.md +++ b/inference-engine/ie_bridges/c/samples/hello_nv12_input_classification/README.md @@ -62,17 +62,29 @@ ffmpeg -i cat.jpg -pix_fmt nv12 cat.yuv > > - The sample accepts models in ONNX format (.onnx) that do not require preprocessing. -You can perform inference on an NV12 image using a trained AlexNet network on a CPU with the following command: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name alexnet +``` -```sh -./hello_nv12_input_classification_c /alexnet_fp32.xml /cat.yuv 300x300 CPU +2. If a model is not in the Inference Engine IR or ONNX format, it must be converted. You can do this using the model converter script: + +``` +python /converter.py --name alexnet +``` + +3. Perform inference of NV12 image using `alexnet` model on a `CPU`, for example: + +``` +/hello_nv12_input_classification_c /alexnet.xml /cat.yuv 300x300 CPU ``` ## Sample Output The application outputs top-10 inference results. -```sh +``` Top 10 results: Image ./cat.yuv diff --git a/inference-engine/ie_bridges/c/samples/object_detection_sample_ssd/README.md b/inference-engine/ie_bridges/c/samples/object_detection_sample_ssd/README.md index 1a046ebe32c..f253da02ec2 100644 --- a/inference-engine/ie_bridges/c/samples/object_detection_sample_ssd/README.md +++ b/inference-engine/ie_bridges/c/samples/object_detection_sample_ssd/README.md @@ -45,10 +45,10 @@ To run the sample, you need specify a model and image: - you can use [public](@ref omz_models_public_index) or [Intel's](@ref omz_models_intel_index) pre-trained models from the Open Model Zoo. The models can be downloaded using the [Model Downloader](@ref omz_tools_downloader_README). - you can use images from the media files collection available at https://storage.openvinotoolkit.org/data/test_data. -Running the application with the -h option yields the following usage message: +Running the application with the `-h` option yields the following usage message: -```sh -./object_detection_sample_ssd_c -h +``` +/object_detection_sample_ssd_c -h [ INFO ] InferenceEngine: [ INFO ] Parsing input parameters @@ -76,24 +76,36 @@ Options: > > - The sample accepts models in ONNX format (.onnx) that do not require preprocessing. -For example, to perform inference on a CPU with the OpenVINO™ toolkit person detection SSD models, run one of the following commands: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name person-detection-retail-0013 +``` + +2. `person-detection-retail-0013` model does not need to be converted, because it is already in necessary format, so you can skip this step. If you want to use a other model that is not in the Inference Engine IR or ONNX format, you can convert it using the model converter script: + +``` +python /converter.py --name +``` + +3. For example, to perform inference on a CPU with the OpenVINO™ toolkit person detection SSD models, run one of the following commands: - with one image and [person-detection-retail-0013](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_retail_0013_description_person_detection_retail_0013.html) model -```sh -./object_detection_sample_ssd_c -i /inputImage.bmp -m /person-detection-retail-0013.xml -d CPU +``` +/object_detection_sample_ssd_c -i /inputImage.bmp -m /person-detection-retail-0013.xml -d CPU ``` - with some images and [person-detection-retail-0013](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_retail_0013_description_person_detection_retail_0013.html) model -```sh -./object_detection_sample_ssd_c -i /inputImage1.bmp /inputImage2.bmp ... -m /person-detection-retail-0013.xml -d CPU +``` +/object_detection_sample_ssd_c -i /inputImage1.bmp /inputImage2.bmp ... -m /person-detection-retail-0013.xml -d CPU ``` - with [person-detection-retail-0002](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_retail_0002_description_person_detection_retail_0002.html) model -```sh -./object_detection_sample_ssd_c -i -m /person-detection-retail-0002.xml -d CPU +``` +/object_detection_sample_ssd_c -i -m /person-detection-retail-0002.xml -d CPU ``` ## Sample Output @@ -101,8 +113,8 @@ For example, to perform inference on a CPU with the OpenVINO™ toolkit pers The application outputs several images (`out_0.bmp`, `out_1.bmp`, ... ) with detected objects enclosed in rectangles. It outputs the list of classes of the detected objects along with the respective confidence values and the coordinates of the rectangles to the standard output stream. -```sh -object_detection_sample_ssd_c -m person-detection-retail-0013.xml -i image_1.png image_2.jpg +``` +/object_detection_sample_ssd_c -m person-detection-retail-0013.xml -i image_1.png image_2.jpg [ INFO ] InferenceEngine: diff --git a/inference-engine/ie_bridges/python/sample/classification_sample_async/README.md b/inference-engine/ie_bridges/python/sample/classification_sample_async/README.md index c757df57d44..67a8282beaa 100644 --- a/inference-engine/ie_bridges/python/sample/classification_sample_async/README.md +++ b/inference-engine/ie_bridges/python/sample/classification_sample_async/README.md @@ -28,15 +28,15 @@ each sample step at [Integration Steps](../../../../../docs/IE_DG/Integrate_with ## Running -Run the application with the -h option to see the usage message: +Run the application with the `-h` option to see the usage message: -```sh -python classification_sample_async.py -h +``` +python /classification_sample_async.py -h ``` Usage message: -```sh +``` usage: classification_sample_async.py [-h] -m MODEL -i INPUT [INPUT ...] [-l EXTENSION] [-c CONFIG] [-d DEVICE] [--labels LABELS] [-nt NUMBER_TOP] @@ -79,55 +79,67 @@ To run the sample, you need specify a model and image: > > - The sample accepts models in ONNX format (.onnx) that do not require preprocessing. -You can do inference of an image using a pre-trained model on a GPU using the following command: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name alexnet +``` -```sh -python classification_sample_async.py -m /alexnet.xml -i /cat.bmp /car.bmp -d GPU +2. If a model is not in the Inference Engine IR or ONNX format, it must be converted. You can do this using the model converter script: + +``` +python /converter.py --name alexnet +``` + +3. Perform inference of `car.bmp` and `cat.jpg` using `alexnet` model on a `GPU`, for example: + +``` +python /classification_sample_async.py -m /alexnet.xml -i /car.bmp /cat.jpg -d GPU ``` ## Sample Output The sample application logs each step in a standard output stream and outputs top-10 inference results. -```sh +``` [ INFO ] Creating Inference Engine -[ INFO ] Reading the network: models\alexnet.xml +[ INFO ] Reading the network: c:\openvino\deployment_tools\open_model_zoo\tools\downloader\public\alexnet\FP32\alexnet.xml [ INFO ] Configuring input and output blobs [ INFO ] Loading the model to the plugin -[ WARNING ] Image images\cat.bmp is resized from (300, 300) to (227, 227) -[ WARNING ] Image images\car.bmp is resized from (259, 787) to (227, 227) +[ WARNING ] Image c:\images\car.bmp is resized from (637, 749) to (227, 227) +[ WARNING ] Image c:\images\cat.jpg is resized from (300, 300) to (227, 227) [ INFO ] Starting inference in asynchronous mode [ INFO ] Infer request 0 returned 0 -[ INFO ] Image path: images\cat.bmp +[ INFO ] Image path: c:\images\car.bmp [ INFO ] Top 10 results: [ INFO ] classid probability [ INFO ] ------------------- -[ INFO ] 435 0.0996898 -[ INFO ] 876 0.0900239 -[ INFO ] 999 0.0691452 -[ INFO ] 587 0.0390186 -[ INFO ] 666 0.0360390 -[ INFO ] 419 0.0308306 -[ INFO ] 285 0.0306287 -[ INFO ] 700 0.0293007 -[ INFO ] 696 0.0202707 -[ INFO ] 631 0.0199126 +[ INFO ] 656 0.6645315 +[ INFO ] 654 0.1121185 +[ INFO ] 581 0.0698451 +[ INFO ] 874 0.0334973 +[ INFO ] 436 0.0259718 +[ INFO ] 817 0.0173190 +[ INFO ] 675 0.0109321 +[ INFO ] 511 0.0109075 +[ INFO ] 569 0.0083093 +[ INFO ] 717 0.0063173 [ INFO ] [ INFO ] Infer request 1 returned 0 -[ INFO ] Image path: images\car.bmp +[ INFO ] Image path: c:\images\cat.jpg [ INFO ] Top 10 results: [ INFO ] classid probability [ INFO ] ------------------- -[ INFO ] 479 0.7561803 -[ INFO ] 511 0.0755696 -[ INFO ] 436 0.0730265 -[ INFO ] 817 0.0460268 -[ INFO ] 656 0.0303792 -[ INFO ] 661 0.0055282 -[ INFO ] 581 0.0031296 -[ INFO ] 468 0.0029875 -[ INFO ] 717 0.0022792 -[ INFO ] 627 0.0016297 +[ INFO ] 876 0.1320105 +[ INFO ] 435 0.1210389 +[ INFO ] 285 0.0712640 +[ INFO ] 282 0.0570528 +[ INFO ] 281 0.0319335 +[ INFO ] 999 0.0285931 +[ INFO ] 94 0.0270323 +[ INFO ] 36 0.0240510 +[ INFO ] 335 0.0198461 +[ INFO ] 186 0.0183939 [ INFO ] [ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool ``` diff --git a/inference-engine/ie_bridges/python/sample/hello_classification/README.md b/inference-engine/ie_bridges/python/sample/hello_classification/README.md index f5ba3e1ff5a..19bfcacddb0 100644 --- a/inference-engine/ie_bridges/python/sample/hello_classification/README.md +++ b/inference-engine/ie_bridges/python/sample/hello_classification/README.md @@ -13,7 +13,7 @@ The following Inference Engine Python API is used in the application: | Options | Values | | :------------------------- | :-------------------------------------------------------------------------------------------------------- | -| Validated Models | [alexnet](@ref omz_models_model_alexnet) | +| Validated Models | [alexnet](@ref omz_models_model_alexnet), [googlenet-v1](@ref omz_models_model_googlenet_v1) | | Model Format | Inference Engine Intermediate Representation (.xml + .bin), ONNX (.onnx) | | Supported devices | [All](../../../../../docs/IE_DG/supported_plugins/Supported_Devices.md) | | Other language realization | [C++](../../../../samples/hello_classification/README.md), [C](../../../c/samples/hello_classification/README.md) | @@ -29,13 +29,13 @@ each sample step at [Integration Steps](../../../../../docs/IE_DG/Integrate_with Run the application with the `-h` option to see the usage message: -```sh -python hello_classification.py -h +``` +python /hello_classification.py -h ``` Usage message: -```sh +``` usage: hello_classification.py [-h] -m MODEL -i INPUT [-d DEVICE] [--labels LABELS] [-nt NUMBER_TOP] @@ -68,37 +68,49 @@ To run the sample, you need specify a model and image: > > - The sample accepts models in ONNX format (.onnx) that do not require preprocessing. -For example, to perform inference of an image using a pre-trained model on a GPU, run the following command: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name alexnet +``` -```sh -python hello_classification.py -m /alexnet.xml -i /cat.bmp -d GPU +2. If a model is not in the Inference Engine IR or ONNX format, it must be converted. You can do this using the model converter script: + +``` +python /converter.py --name alexnet +``` + +3. Perform inference of `car.bmp` using `alexnet` model on a `GPU`, for example: + +``` +python /hello_classification.py -m /alexnet.xml -i /car.bmp -d GPU ``` ## Sample Output The sample application logs each step in a standard output stream and outputs top-10 inference results. -```sh +``` [ INFO ] Creating Inference Engine -[ INFO ] Reading the network: models\alexnet.xml +[ INFO ] Reading the network: c:\openvino\deployment_tools\open_model_zoo\tools\downloader\public\alexnet\FP32\alexnet.xml [ INFO ] Configuring input and output blobs [ INFO ] Loading the model to the plugin -[ WARNING ] Image images\cat.bmp is resized from (300, 300) to (227, 227) +[ WARNING ] Image c:\images\car.bmp is resized from (637, 749) to (227, 227) [ INFO ] Starting inference in synchronous mode -[ INFO ] Image path: images\cat.bmp -[ INFO ] Top 10 results: +[ INFO ] Image path: c:\images\car.bmp +[ INFO ] Top 10 results: [ INFO ] classid probability [ INFO ] ------------------- -[ INFO ] 435 0.0996890 -[ INFO ] 876 0.0900242 -[ INFO ] 999 0.0691449 -[ INFO ] 587 0.0390189 -[ INFO ] 666 0.0360393 -[ INFO ] 419 0.0308307 -[ INFO ] 285 0.0306287 -[ INFO ] 700 0.0293009 -[ INFO ] 696 0.0202707 -[ INFO ] 631 0.0199126 +[ INFO ] 656 0.6645315 +[ INFO ] 654 0.1121185 +[ INFO ] 581 0.0698451 +[ INFO ] 874 0.0334973 +[ INFO ] 436 0.0259718 +[ INFO ] 817 0.0173190 +[ INFO ] 675 0.0109321 +[ INFO ] 511 0.0109075 +[ INFO ] 569 0.0083093 +[ INFO ] 717 0.0063173 [ INFO ] [ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool ``` diff --git a/inference-engine/ie_bridges/python/sample/hello_query_device/README.md b/inference-engine/ie_bridges/python/sample/hello_query_device/README.md index 41ef7451a94..52bf3e32114 100644 --- a/inference-engine/ie_bridges/python/sample/hello_query_device/README.md +++ b/inference-engine/ie_bridges/python/sample/hello_query_device/README.md @@ -22,15 +22,15 @@ The sample queries all available Inference Engine devices and prints their suppo The sample has no command-line parameters. To see the report, run the following command: -```sh -python hello_query_device.py +``` +python /hello_query_device.py ``` ## Sample Output The application prints all available devices with their supported metrics and default values for configuration parameters. (Some lines are not shown due to length.) For example: -```sh +``` [ INFO ] Creating Inference Engine [ INFO ] Available devices: [ INFO ] CPU : diff --git a/inference-engine/ie_bridges/python/sample/hello_reshape_ssd/README.md b/inference-engine/ie_bridges/python/sample/hello_reshape_ssd/README.md index e35804abdc2..ec8903c442c 100644 --- a/inference-engine/ie_bridges/python/sample/hello_reshape_ssd/README.md +++ b/inference-engine/ie_bridges/python/sample/hello_reshape_ssd/README.md @@ -29,15 +29,15 @@ each sample step at [Integration Steps](../../../../../docs/IE_DG/Integrate_with ## Running -Run the application with the -h option to see the usage message: +Run the application with the `-h` option to see the usage message: -```sh -python hello_reshape_ssd.py -h +``` +python /hello_reshape_ssd.py -h ``` Usage message: -```sh +``` usage: hello_reshape_ssd.py [-h] -m MODEL -i INPUT [-l EXTENSION] [-c CONFIG] [-d DEVICE] [--labels LABELS] @@ -76,26 +76,38 @@ To run the sample, you need specify a model and image: > > - The sample accepts models in ONNX format (.onnx) that do not require preprocessing. -You can do inference of an image using a pre-trained model on a GPU using the following command: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name mobilenet-ssd +``` -```sh -python hello_reshape_ssd.py -m /mobilenet-ssd.xml -i /cat.bmp -d GPU +2. If a model is not in the Inference Engine IR or ONNX format, it must be converted. You can do this using the model converter script: + +``` +python /converter.py --name mobilenet-ssd +``` + +3. Perform inference of `car.bmp` using `mobilenet-ssd` model on a `GPU`, for example: + +``` +python /hello_reshape_ssd.py -m /mobilenet-ssd.xml -i /car.bmp -d GPU ``` ## Sample Output The sample application logs each step in a standard output stream and creates an output image, drawing bounding boxes for inference results with an over 50% confidence. -```sh +``` [ INFO ] Creating Inference Engine -[ INFO ] Reading the network: models\mobilenet-ssd.xml +[ INFO ] Reading the network: c:\openvino\deployment_tools\open_model_zoo\tools\downloader\public\mobilenet-ssd\FP32\mobilenet-ssd.xml [ INFO ] Configuring input and output blobs [ INFO ] Reshaping the network to the height and width of the input image [ INFO ] Input shape before reshape: [1, 3, 300, 300] -[ INFO ] Input shape after reshape: [1, 3, 300, 300] +[ INFO ] Input shape after reshape: [1, 3, 637, 749] [ INFO ] Loading the model to the plugin [ INFO ] Starting inference in synchronous mode -[ INFO ] Found: label = 8, confidence = 1.00, coords = (115, 64), (189, 182) +[ INFO ] Found: label = 7, confidence = 0.99, coords = (283, 166), (541, 472) [ INFO ] Image out.bmp was created! [ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool ``` diff --git a/inference-engine/ie_bridges/python/sample/ngraph_function_creation_sample/README.md b/inference-engine/ie_bridges/python/sample/ngraph_function_creation_sample/README.md index 254b9f864ef..097da5ac35f 100644 --- a/inference-engine/ie_bridges/python/sample/ngraph_function_creation_sample/README.md +++ b/inference-engine/ie_bridges/python/sample/ngraph_function_creation_sample/README.md @@ -30,15 +30,15 @@ each sample step at [Integration Steps](../../../../../docs/IE_DG/Integrate_with ## Running -Run the application with the -h option to see the usage message: +Run the application with the `-h` option to see the usage message: -```sh -python ngraph_function_creation_sample.py -h +``` +python /ngraph_function_creation_sample.py -h ``` Usage message: -```sh +``` usage: ngraph_function_creation_sample.py [-h] -m MODEL -i INPUT [INPUT ...] [-d DEVICE] [--labels LABELS] [-nt NUMBER_TOP] @@ -73,25 +73,25 @@ To run the sample, you need specify a model weights and image: > > - The white over black images will be automatically inverted in color for a better predictions. -You can do inference of an image using a pre-trained model on a GPU using the following command: +For example, you can do inference of `3.png` using the pre-trained model on a `GPU`: -```sh -python ngraph_function_creation_sample.py -m /lenet.bin -i /3.png -d GPU +``` +python /ngraph_function_creation_sample.py -m /lenet.bin -i /3.png -d GPU ``` ## Sample Output The sample application logs each step in a standard output stream and outputs top-10 inference results. -```sh +``` [ INFO ] Creating Inference Engine -[ INFO ] Loading the network using ngraph function with weights from /lenet.bin +[ INFO ] Loading the network using ngraph function with weights from c:\openvino\deployment_tools\inference_engine\samples\python\ngraph_function_creation_sample\lenet.bin [ INFO ] Configuring input and output blobs [ INFO ] Loading the model to the plugin -[ WARNING ] /3.png is inverted to white over black -[ WARNING ] /3.png is is resized from (351, 353) to (28, 28) +[ WARNING ] Image c:\images\3.png is inverted to white over black +[ WARNING ] Image c:\images\3.png is resized from (351, 353) to (28, 28) [ INFO ] Starting inference in synchronous mode -[ INFO ] Image path: /3.png +[ INFO ] Image path: c:\images\3.png [ INFO ] Top 10 results: [ INFO ] classid probability [ INFO ] ------------------- diff --git a/inference-engine/ie_bridges/python/sample/object_detection_sample_ssd/README.md b/inference-engine/ie_bridges/python/sample/object_detection_sample_ssd/README.md index 85f8f0d7932..020fe3869f9 100644 --- a/inference-engine/ie_bridges/python/sample/object_detection_sample_ssd/README.md +++ b/inference-engine/ie_bridges/python/sample/object_detection_sample_ssd/README.md @@ -29,15 +29,15 @@ each sample step at [Integration Steps](../../../../../docs/IE_DG/Integrate_with ## Running -Run the application with the -h option to see the usage message: +Run the application with the `-h` option to see the usage message: -```sh -python object_detection_sample_ssd.py -h +``` +python /object_detection_sample_ssd.py -h ``` Usage message: -```sh +``` usage: object_detection_sample_ssd.py [-h] -m MODEL -i INPUT [-l EXTENSION] [-c CONFIG] [-d DEVICE] [--labels LABELS] @@ -78,23 +78,37 @@ To run the sample, you need specify a model and image: > > - The sample accepts models in ONNX format (.onnx) that do not require preprocessing. -You can do inference of an image using a pre-trained model on a GPU using the following command: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name mobilenet-ssd +``` -```sh -python object_detection_sample_ssd.py -m /mobilenet-ssd.xml -i /cat.bmp -d GPU +2. If a model is not in the Inference Engine IR or ONNX format, it must be converted. You can do this using the model converter script: + +``` +python /converter.py --name mobilenet-ssd +``` + +3. Perform inference of `car.bmp` using `mobilenet-ssd` model on a `GPU`, for example: + +``` +python /object_detection_sample_ssd.py -m /mobilenet-ssd.xml -i /car.bmp -d GPU ``` ## Sample Output The sample application logs each step in a standard output stream and creates an output image, drawing bounding boxes for inference results with an over 50% confidence. -```sh +``` [ INFO ] Creating Inference Engine -[ INFO ] Reading the network: models\mobilenet-ssd.xml +[ INFO ] Reading the network: c:\openvino\deployment_tools\open_model_zoo\tools\downloader\public\mobilenet-ssd\FP32\mobilenet-ssd.xml [ INFO ] Configuring input and output blobs [ INFO ] Loading the model to the plugin +[ WARNING ] Image c:\images\car.bmp is resized from (637, 749) to (300, 300) [ INFO ] Starting inference in synchronous mode -[ INFO ] Found: label = 8, confidence = 1.00, coords = (115, 64), (189, 182) +[ INFO ] Found: label = 7, confidence = 1.00, coords = (228, 120), (502, 460) +[ INFO ] Found: label = 7, confidence = 0.95, coords = (637, 233), (743, 608) [ INFO ] Image out.bmp created! [ INFO ] This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool ``` diff --git a/inference-engine/ie_bridges/python/sample/speech_sample/README.md b/inference-engine/ie_bridges/python/sample/speech_sample/README.md index 16a918adaae..0d7289145f1 100644 --- a/inference-engine/ie_bridges/python/sample/speech_sample/README.md +++ b/inference-engine/ie_bridges/python/sample/speech_sample/README.md @@ -68,15 +68,15 @@ In addition to performing inference directly from a GNA model file, this option ## Running -Run the application with the -h option to see the usage message: +Run the application with the `-h` option to see the usage message: -```sh -python speech_sample.py -h +``` +python /speech_sample.py -h ``` Usage message: -```sh +``` usage: speech_sample.py [-h] (-m MODEL | -rg IMPORT_GNA_MODEL) -i INPUT [-o OUTPUT] [-r REFERENCE] [-d DEVICE] [-bs BATCH_SIZE] [-qb QUANTIZATION_BITS] @@ -131,8 +131,8 @@ Options: You can use the following model optimizer command to convert a Kaldi nnet1 or nnet2 neural network to Inference Engine Intermediate Representation format: -```sh -python mo.py --framework kaldi --input_model wsj_dnn5b.nnet --counts wsj_dnn5b.counts --remove_output_softmax --output_dir +``` +python /mo.py --framework kaldi --input_model wsj_dnn5b.nnet --counts wsj_dnn5b.counts --remove_output_softmax --output_dir ``` The following pre-trained models are available: @@ -147,8 +147,8 @@ All of them can be downloaded from [https://storage.openvinotoolkit.org/models_c You can do inference on Intel® Processors with the GNA co-processor (or emulation library): -```sh -python speech_sample.py -d GNA_AUTO -m wsj_dnn5b.xml -i dev93_10.ark -r dev93_scores_10.ark -o result.npz +``` +python /speech_sample.py -m /wsj_dnn5b.xml -i /dev93_10.ark -r /dev93_scores_10.ark -d GNA_AUTO -o result.npz ``` > **NOTES**: @@ -161,7 +161,7 @@ python speech_sample.py -d GNA_AUTO -m wsj_dnn5b.xml -i dev93_10.ark -r dev93_sc The sample application logs each step in a standard output stream. -```sh +``` [ INFO ] Creating Inference Engine [ INFO ] Reading the network: wsj_dnn5b.xml [ INFO ] Configuring input and output blobs diff --git a/inference-engine/ie_bridges/python/sample/style_transfer_sample/README.md b/inference-engine/ie_bridges/python/sample/style_transfer_sample/README.md index d6ca9f8ba49..9689acacba7 100644 --- a/inference-engine/ie_bridges/python/sample/style_transfer_sample/README.md +++ b/inference-engine/ie_bridges/python/sample/style_transfer_sample/README.md @@ -30,15 +30,15 @@ each sample step at [Integration Steps](../../../../../docs/IE_DG/Integrate_with ## Running -Run the application with the -h option to see the usage message: +Run the application with the `-h` option to see the usage message: -```sh -python style_transfer_sample.py -h +``` +python /style_transfer_sample.py -h ``` Usage message: -```sh +``` usage: style_transfer_sample.py [-h] -m MODEL -i INPUT [INPUT ...] [-l EXTENSION] [-c CONFIG] [-d DEVICE] [--original_size] [--mean_val_r MEAN_VAL_R] @@ -90,23 +90,35 @@ To run the sample, you need specify a model and image: > > - The sample accepts models in ONNX format (.onnx) that do not require preprocessing. -You can do inference of an image using a pre-trained model on a GPU using the following command: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name fast-neural-style-mosaic-onnx +``` -```sh -python style_transfer_sample.py -m /fast-neural-style-mosaic-onnx.onnx -i /car.png /cat.jpg -d GPU +2. `fast-neural-style-mosaic-onnx` model does not need to be converted, because it is already in necessary format, so you can skip this step. If you want to use a other model that is not in the Inference Engine IR or ONNX format, you can convert it using the model converter script: + +``` +python /converter.py --name +``` + +3. Perform inference of `car.bmp` and `cat.jpg` using `fast-neural-style-mosaic-onnx` model on a `GPU`, for example: + +``` +python /style_transfer_sample.py -m /fast-neural-style-mosaic-onnx.onnx -i /car.bmp /cat.jpg -d GPU ``` ## Sample Output The sample application logs each step in a standard output stream and creates an output image (`out_0.bmp`) or a sequence of images (`out_0.bmp`, .., `out_.bmp`) that are redrawn in the style of the style transfer model used. -```sh +``` [ INFO ] Creating Inference Engine -[ INFO ] Reading the network: models\fast-neural-style-mosaic-onnx.onnx +[ INFO ] Reading the network: c:\openvino\deployment_tools\open_model_zoo\tools\downloader\public\fast-neural-style-mosaic-onnx\fast-neural-style-mosaic-onnx.onnx [ INFO ] Configuring input and output blobs [ INFO ] Loading the model to the plugin -[ WARNING ] Image images\car.bmp is resized from (259, 787) to (224, 224) -[ WARNING ] Image images\cat.bmp is resized from (300, 300) to (224, 224) +[ WARNING ] Image c:\images\car.bmp is resized from (637, 749) to (224, 224) +[ WARNING ] Image c:\images\cat.jpg is resized from (300, 300) to (224, 224) [ INFO ] Starting inference in synchronous mode [ INFO ] Image out_0.bmp created! [ INFO ] Image out_1.bmp created! diff --git a/inference-engine/ie_bridges/python/wheel/setup.py b/inference-engine/ie_bridges/python/wheel/setup.py index dc177be7d31..5d9ca16238a 100644 --- a/inference-engine/ie_bridges/python/wheel/setup.py +++ b/inference-engine/ie_bridges/python/wheel/setup.py @@ -7,6 +7,7 @@ import sys import errno import subprocess # nosec import typing +from fnmatch import fnmatchcase from pathlib import Path from shutil import copyfile, rmtree from distutils.command.install import install @@ -120,6 +121,16 @@ class CustomBuild(build): def run(self): self.run_command('build_clib') build.run(self) + # Copy extra package_data content filtered by find_packages + dst = Path(self.build_lib) + src = Path(get_package_dir(PY_INSTALL_CFG)) + exclude = ignore_patterns('*ez_setup*', '*__pycache__*', '*.egg-info*') + for path in src.glob('**/*'): + if path.is_dir() or exclude(str(path)): + continue + path_rel = path.relative_to(src) + (dst / path_rel.parent).mkdir(exist_ok=True, parents=True) + copyfile(path, dst / path_rel) class CustomInstall(install): @@ -215,6 +226,13 @@ class CustomClean(clean): clean.run(self) +def ignore_patterns(*patterns): + """ + Filter names by given patterns + """ + return lambda name: any(fnmatchcase(name, pat=pat) for pat in patterns) + + def is_tool(name): """Check if the command-line tool is available""" try: @@ -348,8 +366,7 @@ package_license = config('WHEEL_LICENSE', '') if os.path.exists(package_license): copyfile(package_license, 'LICENSE') - -packages = find_namespace_packages(','.join(get_dir_list(PY_INSTALL_CFG))) +packages = find_namespace_packages(get_package_dir(PY_INSTALL_CFG)) package_data: typing.Dict[str, list] = {} setup( diff --git a/inference-engine/include/cpp/ie_cnn_network.h b/inference-engine/include/cpp/ie_cnn_network.h index 9e21a470d45..1fe5d2173f2 100644 --- a/inference-engine/include/cpp/ie_cnn_network.h +++ b/inference-engine/include/cpp/ie_cnn_network.h @@ -199,6 +199,22 @@ public: */ void serialize(const std::string& xmlPath, const std::string& binPath = {}) const; + /** + * @brief Serialize network to IR and weights streams. + * + * @param xmlBuf output IR stream. + * @param binBuf output weights stream. + */ + void serialize(std::ostream& xmlBuf, std::ostream& binBuf) const; + + /** + * @brief Serialize network to IR stream and weights Blob::Ptr. + * + * @param xmlBuf output IR stream. + * @param binBlob output weights Blob::Ptr. + */ + void serialize(std::ostream& xmlBuf, Blob::Ptr& binBlob) const; + /** * @brief Method maps framework tensor name to OpenVINO name * @param orig_name Framework tensor name diff --git a/inference-engine/include/gpu/gpu_context_api_va.hpp b/inference-engine/include/gpu/gpu_context_api_va.hpp index 93ba0fd7388..0784c729db1 100644 --- a/inference-engine/include/gpu/gpu_context_api_va.hpp +++ b/inference-engine/include/gpu/gpu_context_api_va.hpp @@ -22,17 +22,17 @@ namespace InferenceEngine { namespace gpu { /** -* @brief This class represents an abstraction for GPU plugin remote context -* which is shared with VA display object. -* The plugin object derived from this class can be obtained either with -* GetContext() method of Executable network or using CreateContext() Core call. -* @note User can also obtain OpenCL context handle from this class. -*/ + * @brief This class represents an abstraction for GPU plugin remote context + * which is shared with VA display object. + * The plugin object derived from this class can be obtained either with + * GetContext() method of Executable network or using CreateContext() Core call. + * @note User can also obtain OpenCL context handle from this class. + */ class VAContext : public ClContext { public: /** - * @brief A smart pointer to the VAContext object - */ + * @brief A smart pointer to the VAContext object + */ using Ptr = std::shared_ptr; /** @@ -47,16 +47,16 @@ public: }; /** -* @brief This class represents an abstraction for GPU plugin remote blob -* which is shared with VA output surface. -* The plugin object derived from this class can be obtained with CreateBlob() call. -* @note User can also obtain OpenCL 2D image handle from this class. -*/ + * @brief This class represents an abstraction for GPU plugin remote blob + * which is shared with VA output surface. + * The plugin object derived from this class can be obtained with CreateBlob() call. + * @note User can also obtain OpenCL 2D image handle from this class. + */ class VASurfaceBlob : public ClImage2DBlob { public: /** - * @brief A smart pointer to the VASurfaceBlob object - */ + * @brief A smart pointer to the VASurfaceBlob object + */ using Ptr = std::shared_ptr; /** diff --git a/inference-engine/include/gpu/gpu_ocl_wrapper.hpp b/inference-engine/include/gpu/gpu_ocl_wrapper.hpp index 31f77f93e0c..496f0974ad5 100644 --- a/inference-engine/include/gpu/gpu_ocl_wrapper.hpp +++ b/inference-engine/include/gpu/gpu_ocl_wrapper.hpp @@ -11,8 +11,8 @@ #pragma once /** -* @brief Definitions required by Khronos headers -*/ + * @brief Definitions required by Khronos headers + */ #ifndef CL_HPP_ENABLE_EXCEPTIONS # define CL_HPP_ENABLE_EXCEPTIONS diff --git a/inference-engine/include/gpu/gpu_params.hpp b/inference-engine/include/gpu/gpu_params.hpp index f7ccc86dcb0..eac4cd3f409 100644 --- a/inference-engine/include/gpu/gpu_params.hpp +++ b/inference-engine/include/gpu/gpu_params.hpp @@ -44,63 +44,65 @@ namespace GPUContextParams { #define DECLARE_GPU_PARAM_KEY(name, ...) \ static constexpr auto PARAM_##name = #name /** -* @brief Shared device context type: can be either pure OpenCL (OCL) -* or shared video decoder (VA_SHARED) context -*/ + * @brief Shared device context type: can be either pure OpenCL (OCL) + * or shared video decoder (VA_SHARED) context + */ DECLARE_GPU_PARAM_KEY(CONTEXT_TYPE, std::string); /** -* @brief Pure OpenCL device context -*/ + * @brief Pure OpenCL device context + */ DECLARE_GPU_PARAM_VALUE(OCL); /** -* @brief Shared context (video decoder or D3D) -*/ + * @brief Shared context (video decoder or D3D) + */ DECLARE_GPU_PARAM_VALUE(VA_SHARED); /** -* @brief This key identifies OpenCL context handle -* in a shared context or shared memory blob parameter map -*/ + * @brief This key identifies OpenCL context handle + * in a shared context or shared memory blob parameter map + */ DECLARE_GPU_PARAM_KEY(OCL_CONTEXT, gpu_handle_param); /** -* @brief This key identifies video acceleration device/display handle -* in a shared context or shared memory blob parameter map -*/ + * @brief This key identifies video acceleration device/display handle + * in a shared context or shared memory blob parameter map + */ DECLARE_GPU_PARAM_KEY(VA_DEVICE, gpu_handle_param); /** -* @brief This key identifies type of internal shared memory -* in a shared memory blob parameter map. -*/ + * @brief This key identifies type of internal shared memory + * in a shared memory blob parameter map. + */ DECLARE_GPU_PARAM_KEY(SHARED_MEM_TYPE, std::string); /** -* @brief Shared OpenCL buffer blob -*/ + * @brief Shared OpenCL buffer blob + */ DECLARE_GPU_PARAM_VALUE(OCL_BUFFER); /** -* @brief Shared OpenCL 2D image blob -*/ + * @brief Shared OpenCL 2D image blob + */ DECLARE_GPU_PARAM_VALUE(OCL_IMAGE2D); + /** -* @brief Shared video decoder surface or D3D 2D texture blob -*/ + * @brief Shared video decoder surface or D3D 2D texture blob + */ DECLARE_GPU_PARAM_VALUE(VA_SURFACE); + /** -* @brief Shared D3D buffer blob -*/ + * @brief Shared D3D buffer blob + */ DECLARE_GPU_PARAM_VALUE(DX_BUFFER); /** -* @brief This key identifies OpenCL memory handle -* in a shared memory blob parameter map -*/ + * @brief This key identifies OpenCL memory handle + * in a shared memory blob parameter map + */ DECLARE_GPU_PARAM_KEY(MEM_HANDLE, gpu_handle_param); /** -* @brief This key identifies video decoder surface handle -* in a shared memory blob parameter map -*/ + * @brief This key identifies video decoder surface handle + * in a shared memory blob parameter map + */ #ifdef _WIN32 DECLARE_GPU_PARAM_KEY(DEV_OBJECT_HANDLE, gpu_handle_param); #else @@ -108,9 +110,9 @@ DECLARE_GPU_PARAM_KEY(DEV_OBJECT_HANDLE, uint32_t); #endif /** -* @brief This key identifies video decoder surface plane -* in a shared memory blob parameter map -*/ + * @brief This key identifies video decoder surface plane + * in a shared memory blob parameter map + */ DECLARE_GPU_PARAM_KEY(VA_PLANE, uint32_t); } // namespace GPUContextParams diff --git a/inference-engine/include/ie_blob.h b/inference-engine/include/ie_blob.h index 4e1d2cd873a..2342d4cbcf5 100644 --- a/inference-engine/include/ie_blob.h +++ b/inference-engine/include/ie_blob.h @@ -335,12 +335,9 @@ public: return size() * element_size(); } - /** - * @brief Provides the number of bytes per element. - * Abstract method. - * @return The number of bytes per element. - */ - size_t element_size() const noexcept override = 0; + size_t element_size() const noexcept override { + return tensorDesc.getPrecision().size(); + } /** * @brief Allocates memory to store the data. @@ -569,10 +566,6 @@ public: */ virtual ~TBlob(); - size_t element_size() const noexcept override { - return sizeof(T); - } - /** * @brief Creates an new empty rvalue LockedMemory object. * diff --git a/inference-engine/include/ie_icnn_network.hpp b/inference-engine/include/ie_icnn_network.hpp index 6e42b5ea402..ec640691ecc 100644 --- a/inference-engine/include/ie_icnn_network.hpp +++ b/inference-engine/include/ie_icnn_network.hpp @@ -200,6 +200,32 @@ public: virtual StatusCode serialize(const std::string& xmlPath, const std::string& binPath, ResponseDesc* resp) const noexcept = 0; + /** + * @deprecated Use InferenceEngine::CNNNetwork wrapper instead + * @brief Serialize network to IR and weights files. + * + * @param xmlStream A stream for xml content (.xml file) + * @param binStream A stream for weights content (.bin file) + * @param resp Pointer to the response message that holds a description of an error if any occurred + * @return Status code of the operation + */ + INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::CNNNetwork wrapper instead") + virtual StatusCode serialize(std::ostream& xmlStream, std::ostream& binStream, ResponseDesc* resp) const + noexcept = 0; + + /** + * @deprecated Use InferenceEngine::CNNNetwork wrapper instead + * @brief Serialize network to IR and weights files. + * + * @param xmlStream A stream for xml content (.xml file) + * @param binData A blob for weights content (.bin file) + * @param resp Pointer to the response message that holds a description of an error if any occurred + * @return Status code of the operation + */ + INFERENCE_ENGINE_DEPRECATED("Use InferenceEngine::CNNNetwork wrapper instead") + virtual StatusCode serialize(std::ostream& xmlStream, Blob::Ptr& binData, ResponseDesc* resp) const + noexcept = 0; + /** * @deprecated Use InferenceEngine::CNNNetwork wrapper instead * @brief Methods maps framework tensor name to OpenVINO name diff --git a/inference-engine/include/ie_precision.hpp b/inference-engine/include/ie_precision.hpp index e632d177235..28a7cf36abc 100644 --- a/inference-engine/include/ie_precision.hpp +++ b/inference-engine/include/ie_precision.hpp @@ -109,11 +109,6 @@ public: template bool hasStorageType(const char* typeName = nullptr) const noexcept { try { - if (precisionInfo.value != BIN) { - if (sizeof(T) != size()) { - return false; - } - } #define CASE(x, y) \ case x: \ return std::is_same() @@ -247,14 +242,14 @@ public: } /** - * @brief Returns size of single element of that precision in bits + * @brief Returns size of single element of that precision in bytes * @returns Number of bytes per element */ size_t size() const { if (precisionInfo.bitsSize == 0) { IE_THROW() << " cannot estimate element if precision is " << precisionInfo.name; } - return precisionInfo.bitsSize >> 3; + return (precisionInfo.bitsSize + 7) / 8; } /** @@ -461,7 +456,7 @@ inline Precision::PrecisionInfo Precision::makePrecisionInfo(const char* name) { Precision::PrecisionInfo info; info.name = name; - size_t nBits = precision == BIN ? 1 : 8; + size_t nBits = precision == BIN ? 1 : (precision == U4 || precision == I4) ? 4 : 8; info.bitsSize = nBits * type_size_or_zero::value_type>(); info.isFloat = PrecisionTrait::is_float; info.value = precision; diff --git a/inference-engine/include/ie_remote_context.hpp b/inference-engine/include/ie_remote_context.hpp index 960452b12c1..a6116fe6c0d 100644 --- a/inference-engine/include/ie_remote_context.hpp +++ b/inference-engine/include/ie_remote_context.hpp @@ -46,10 +46,6 @@ public: */ explicit RemoteBlob(const TensorDesc& tensorDesc): MemoryBlob(tensorDesc) {} - size_t element_size() const noexcept override { - return tensorDesc.getPrecision().size(); - } - /** * @brief Returns a map of device-specific parameters required for low-level * operations with underlying object. @@ -194,3 +190,4 @@ inline RemoteBlob::Ptr make_shared_blob(const TensorDesc& desc, RemoteContext::P } } // namespace InferenceEngine + diff --git a/inference-engine/include/vpu/myriad_config.hpp b/inference-engine/include/vpu/myriad_config.hpp index 2b09a0ffc9d..071d2390582 100644 --- a/inference-engine/include/vpu/myriad_config.hpp +++ b/inference-engine/include/vpu/myriad_config.hpp @@ -59,4 +59,9 @@ DECLARE_VPU_CONFIG(MYRIAD_USB); */ DECLARE_VPU_CONFIG(MYRIAD_THROUGHPUT_STREAMS); +/** + * @brief Default key definition for InferenceEngine::MYRIAD_THROUGHPUT_STREAMS option. + */ +DECLARE_VPU_CONFIG(MYRIAD_THROUGHPUT_STREAMS_AUTO); + } // namespace InferenceEngine diff --git a/inference-engine/samples/classification_sample_async/README.md b/inference-engine/samples/classification_sample_async/README.md index 2504daa1316..4f93e6dd51f 100644 --- a/inference-engine/samples/classification_sample_async/README.md +++ b/inference-engine/samples/classification_sample_async/README.md @@ -60,8 +60,8 @@ To run the sample, you need specify a model and image: Running the application with the `-h` option yields the following usage message: -```sh -./classification_sample_async -h +``` +/classification_sample_async -h InferenceEngine: API version ............ Build .................. @@ -85,33 +85,43 @@ Options: Running the application with the empty list of options yields the usage message given above and an error message. -You can do inference of an image using a trained [AlexNet network](https://docs.openvinotoolkit.org/latest/omz_models_model_alexnet.html) on GPU using the following command: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name alexnet +``` -```sh -./classification_sample_async -m /alexnet_fp32.xml -i /cat.bmp -d GPU +2. If a model is not in the Inference Engine IR or ONNX format, it must be converted. You can do this using the model converter script: + +``` +python /converter.py --name alexnet +``` + +3. Perform inference of `car.bmp` using `alexnet` model on a `GPU`, for example: + +``` +/classification_sample_async -m /alexnet.xml -i /car.bmp -d GPU ``` ## Sample Output By default the application outputs top-10 inference results for each infer request. -```sh -classification_sample_async -m alexnet_fp32/alexnet.xml -i car_1.bmp -d GPU +``` [ INFO ] InferenceEngine: - API version ............ - Build .................. - Description ....... API -[ INFO ] Parsing input parameters + IE version ......... 2021.4.0 + Build ........... 2021.4.0-3839-cd81789d294-releases/2021/4 [ INFO ] Parsing input parameters [ INFO ] Files were added: 1 -[ INFO ] car_1.bmp +[ INFO ] C:\images\car.bmp [ INFO ] Loading Inference Engine [ INFO ] Device info: GPU - clDNNPlugin version ......... - Build ........... + clDNNPlugin version ......... 2021.4.0 + Build ........... 2021.4.0-3839-cd81789d294-releases/2021/4 + [ INFO ] Loading network files: - alexnet_fp32/alexnet.xml +[ INFO ] C:\openvino\deployment_tools\open_model_zoo\tools\downloader\public\alexnet\FP32\alexnet.xml [ INFO ] Preparing input blobs [ WARNING ] Image is resized from (749, 637) to (227, 227) [ INFO ] Batch size is 1 @@ -132,20 +142,20 @@ classification_sample_async -m alexnet_fp32/alexnet.xml -i car_1.bmp -d GPU Top 10 results: -Image car_1.bmp +Image C:\images\car.bmp classid probability ------- ----------- -656 0.5491584 -874 0.1101241 -654 0.0559816 -436 0.0488046 -581 0.0330480 -705 0.0307707 -734 0.0185521 -627 0.0162536 -675 0.0145008 -757 0.0125437 +656 0.6645315 +654 0.1121185 +581 0.0698451 +874 0.0334973 +436 0.0259718 +817 0.0173190 +675 0.0109321 +511 0.0109075 +569 0.0083093 +717 0.0063173 [ INFO ] Execution successful diff --git a/inference-engine/samples/hello_classification/README.md b/inference-engine/samples/hello_classification/README.md index ccd81725135..2ee81703812 100644 --- a/inference-engine/samples/hello_classification/README.md +++ b/inference-engine/samples/hello_classification/README.md @@ -47,33 +47,45 @@ To run the sample, you need specify a model and image: > > - The sample accepts models in ONNX format (.onnx) that do not require preprocessing. -You can do inference of an image using a trained AlexNet network on a GPU using the following command: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name alexnet +``` -```sh -./hello_classification /alexnet_fp32.xml /car.png GPU +2. If a model is not in the Inference Engine IR or ONNX format, it must be converted. You can do this using the model converter script: + +``` +python /converter.py --name alexnet +``` + +3. Perform inference of `car.bmp` using `alexnet` model on a `GPU`, for example: + +``` +/hello_classification /alexnet.xml /car.bmp GPU ``` ## Sample Output The application outputs top-10 inference results. -```sh +``` Top 10 results: -Image /opt/intel/openvino/deployment_tools/demo/car.png +Image C:\images\car.bmp classid probability ------- ----------- -479 0.7562194 -511 0.0760387 -436 0.0724114 -817 0.0462140 -656 0.0301230 -661 0.0056171 -581 0.0031623 -468 0.0029917 -717 0.0023081 -627 0.0016193 +656 0.6664789 +654 0.1129405 +581 0.0684867 +874 0.0333845 +436 0.0261321 +817 0.0167310 +675 0.0109796 +511 0.0105919 +569 0.0081782 +717 0.0063356 This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool ``` diff --git a/inference-engine/samples/hello_nv12_input_classification/README.md b/inference-engine/samples/hello_nv12_input_classification/README.md index 06a8d6781e5..a643fcf0d5d 100644 --- a/inference-engine/samples/hello_nv12_input_classification/README.md +++ b/inference-engine/samples/hello_nv12_input_classification/README.md @@ -64,17 +64,29 @@ ffmpeg -i cat.jpg -pix_fmt nv12 cat.yuv > > - The sample accepts models in ONNX format (.onnx) that do not require preprocessing. -You can perform inference on an NV12 image using a trained AlexNet network on CPU with the following command: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name alexnet +``` -```sh -./hello_nv12_input_classification /alexnet_fp32.xml /cat.yuv 300x300 CPU +2. If a model is not in the Inference Engine IR or ONNX format, it must be converted. You can do this using the model converter script: + +``` +python /converter.py --name alexnet +``` + +3. Perform inference of NV12 image using `alexnet` model on a `CPU`, for example: + +``` +/hello_nv12_input_classification /alexnet.xml /cat.yuv 300x300 CPU ``` ## Sample Output The application outputs top-10 inference results. -```sh +``` [ INFO ] Files were added: 1 [ INFO ] ./cat.yuv Batch size is 1 diff --git a/inference-engine/samples/hello_query_device/README.md b/inference-engine/samples/hello_query_device/README.md index 059077c48ad..06a3d087845 100644 --- a/inference-engine/samples/hello_query_device/README.md +++ b/inference-engine/samples/hello_query_device/README.md @@ -27,8 +27,8 @@ To build the sample, please use instructions available at [Build the Sample Appl To see quired information, run the following: -```sh -./hello_query_device -h +``` +/hello_query_device -h Usage : hello_query_device ``` @@ -36,8 +36,7 @@ Usage : hello_query_device The application prints all available devices with their supported metrics and default values for configuration parameters: -```sh -./hello_query_device +``` Available devices: Device: CPU Metrics: diff --git a/inference-engine/samples/hello_reshape_ssd/README.md b/inference-engine/samples/hello_reshape_ssd/README.md index 69727c31e2d..4d382f2e590 100644 --- a/inference-engine/samples/hello_reshape_ssd/README.md +++ b/inference-engine/samples/hello_reshape_ssd/README.md @@ -51,14 +51,26 @@ To run the sample, you need specify a model and image: You can use the following command to do inference on CPU of an image using a trained SSD network: -```sh -hello_reshape_ssd +``` +/hello_reshape_ssd ``` -with one image and [person-detection-retail-0013](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_retail_0013_description_person_detection_retail_0013.html) model +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name person-detection-retail-0013 +``` -```sh -hello_reshape_ssd /person-detection-retail-0013.xml /inputImage.bmp CPU 1 +2. `person-detection-retail-0013` model does not need to be converted, because it is already in necessary format, so you can skip this step. If you want to use a other model that is not in the Inference Engine IR or ONNX format, you can convert it using the model converter script: + +``` +python /converter.py --name +``` + +3. Perform inference of `person_detection.png` using `person-detection-retail-0013` model on a `GPU`, for example: + +``` +/hello_reshape_ssd /person-detection-retail-0013.xml /person_detection.png GPU 1 ``` ## Sample Output @@ -67,13 +79,11 @@ The application renders an image with detected objects enclosed in rectangles. I of the detected objects along with the respective confidence values and the coordinates of the rectangles to the standard output stream. -```sh -hello_reshape_ssd person-detection-retail-0013/FP16/person-detection-retail-0013.xml person_detection.png CPU 1 - +``` Resizing network to the image size = [960x1699] with batch = 1 Resulting input shape = [1,3,960,1699] Resulting output shape = [1,1,200,7] -[0,1] element, prob = 0.721457, bbox = (852.37,187.54)-(983.326,520.672), batch id = 0 +[0,1] element, prob = 0.722292, bbox = (852.382,187.756)-(983.352,520.733), batch id = 0 The resulting image was saved in the file: hello_reshape_ssd_output.jpg This sample is an API example, for any performance measurements please use the dedicated benchmark_app tool diff --git a/inference-engine/samples/ngraph_function_creation_sample/README.md b/inference-engine/samples/ngraph_function_creation_sample/README.md index 72516cc274d..ad10a9d5f82 100644 --- a/inference-engine/samples/ngraph_function_creation_sample/README.md +++ b/inference-engine/samples/ngraph_function_creation_sample/README.md @@ -50,7 +50,7 @@ To run the sample, you need specify a model wights and ubyte image: Running the application with the `-h` option yields the following usage message: -```sh +``` ngraph_function_creation_sample -h [ INFO ] InferenceEngine: API version ............ @@ -75,8 +75,8 @@ Running the application with the empty list of options yields the usage message You can do inference of an image using a pre-trained model on a GPU using the following command: -```sh -./ngraph_function_creation_sample -m /lenet.bin -i -d GPU +``` +/ngraph_function_creation_sample -m /lenet.bin -i -d GPU ``` ## Sample Output diff --git a/inference-engine/samples/object_detection_sample_ssd/README.md b/inference-engine/samples/object_detection_sample_ssd/README.md index e011acd5eea..4c466d42a34 100644 --- a/inference-engine/samples/object_detection_sample_ssd/README.md +++ b/inference-engine/samples/object_detection_sample_ssd/README.md @@ -41,9 +41,9 @@ To run the sample, you need specify a model and image: - you can use [public](@ref omz_models_public_index) or [Intel's](@ref omz_models_intel_index) pre-trained models from the Open Model Zoo. The models can be downloaded using the [Model Downloader](@ref omz_tools_downloader_README). - you can use images from the media files collection available at https://storage.openvinotoolkit.org/data/test_data. -Running the application with the -h option yields the following usage message: +Running the application with the `-h` option yields the following usage message: -```sh +``` ./object_detection_sample_ssd -h InferenceEngine: API version ............ @@ -75,18 +75,30 @@ Running the application with the empty list of options yields the usage message > > - The sample accepts models in ONNX format (\*.onnx) that do not require preprocessing. -For example, to do inference on a CPU with the OpenVINO™ toolkit person detection SSD models, run one of the following commands: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name person-detection-retail-0013 +``` + +2. `person-detection-retail-0013` model does not need to be converted, because it is already in necessary format, so you can skip this step. If you want to use a other model that is not in the Inference Engine IR or ONNX format, you can convert it using the model converter script: + +``` +python /converter.py --name +``` + +3. For example, to do inference on a CPU with the OpenVINO™ toolkit person detection SSD models, run one of the following commands: - with one image and [person-detection-retail-0013](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_retail_0013_description_person_detection_retail_0013.html) model -```sh -./object_detection_sample_ssd -m /person-detection-retail-0013.xml -i /inputImage.bmp -d CPU +``` +/object_detection_sample_ssd -m /person-detection-retail-0013.xml -i /person_detection.png -d CPU ``` - with one image and [person-detection-retail-0002](https://docs.openvinotoolkit.org/latest/omz_models_intel_person_detection_retail_0002_description_person_detection_retail_0002.html) model -```sh -./object_detection_sample_ssd -m /person-detection-retail-0002.xml -i /inputImage.jpg -d GPU +``` +/object_detection_sample_ssd -m /person-detection-retail-0002.xml -i /person_detection.png -d GPU ``` ## Sample Output @@ -95,7 +107,7 @@ The application outputs an image (`out_0.bmp`) with detected objects enclosed in of the detected objects along with the respective confidence values and the coordinates of the rectangles to the standard output stream. -```sh +``` object_detection_sample_ssd -m person-detection-retail-0013\FP16\person-detection-retail-0013.xml -i person_detection.png [ INFO ] InferenceEngine: API version ............ diff --git a/inference-engine/samples/speech_sample/README.md b/inference-engine/samples/speech_sample/README.md index caa5b829d70..392b4e1403e 100644 --- a/inference-engine/samples/speech_sample/README.md +++ b/inference-engine/samples/speech_sample/README.md @@ -87,8 +87,7 @@ To build the sample, please use instructions available at [Build the Sample Appl Running the application with the `-h` option yields the following usage message: -```sh -./speech_sample -h +``` [ INFO ] InferenceEngine: API version ............ Build .................. @@ -132,8 +131,8 @@ Running the application with the empty list of options yields the usage message You can use the following model optimizer command to convert a Kaldi nnet1 or nnet2 neural network to Inference Engine Intermediate Representation format: -```sh -python mo.py --framework kaldi --input_model wsj_dnn5b.nnet --counts wsj_dnn5b.counts --remove_output_softmax --output_dir +``` +python /mo.py --framework kaldi --input_model wsj_dnn5b.nnet --counts wsj_dnn5b.counts --remove_output_softmax --output_dir ``` Assuming that the model optimizer (`mo.py`), Kaldi-trained neural network, `wsj_dnn5b.nnet`, and Kaldi class counts file, `wsj_dnn5b.counts`, are in the working directory this produces @@ -151,8 +150,8 @@ All of them can be downloaded from [https://storage.openvinotoolkit.org/models_c Once the IR is created, you can use the following command to do inference on Intel® Processors with the GNA co-processor (or emulation library): -```sh -./speech_sample -d GNA_AUTO -bs 2 -i dev93_10.ark -m wsj_dnn5b.xml -o scores.ark -r dev93_scores_10.ark +``` +/speech_sample -d GNA_AUTO -bs 2 -i /dev93_10.ark -m /wsj_dnn5b.xml -o scores.ark -r /dev93_scores_10.ark ``` Here, the floating point Kaldi-generated reference neural network scores (`dev93_scores_10.ark`) corresponding to the input feature file (`dev93_10.ark`) are assumed to be available @@ -170,7 +169,7 @@ All of them can be downloaded from [https://storage.openvinotoolkit.org/models_c The acoustic log likelihood sequences for all utterances are stored in the file. Example `scores.ark` or `scores.npz`. If the `-r` option is used, a report on the statistical score error is generated for each utterance such as the following: -```sh +``` ./speech_sample -d GNA_AUTO -bs 2 -i dev93_10.ark -m wsj_dnn5b.xml -o scores.ark -r dev93_scores_10.ark [ INFO ] InferenceEngine: API version ............ diff --git a/inference-engine/samples/style_transfer_sample/README.md b/inference-engine/samples/style_transfer_sample/README.md index 630e7e3d861..dcb178bedda 100644 --- a/inference-engine/samples/style_transfer_sample/README.md +++ b/inference-engine/samples/style_transfer_sample/README.md @@ -40,10 +40,9 @@ To run the sample, you need specify a model and image: - you can use [public](@ref omz_models_public_index) or [Intel's](@ref omz_models_intel_index) pre-trained models from the Open Model Zoo. The models can be downloaded using the [Model Downloader](@ref omz_tools_downloader_README). - you can use images from the media files collection available at https://storage.openvinotoolkit.org/data/test_data. -Running the application with the -h option yields the following usage message: +Running the application with the `-h` option yields the following usage message: -```sh -./style_transfer_sample -h +``` [ INFO ] InferenceEngine: API version ............ Build .................. @@ -65,7 +64,6 @@ Options: -mean_val_b Mean values. Required if the model needs mean values for preprocessing and postprocessing. Available target devices: - ``` Running the application with the empty list of options yields the usage message given above and an error message. @@ -78,37 +76,47 @@ Running the application with the empty list of options yields the usage message > > - The sample accepts models in ONNX format (\*.onnx) that do not require preprocessing. -To perform inference of an image using a trained model of fast-neural-style-mosaic-onnx network on Intel® CPUs, use the following command: +### Example +1. Download a pre-trained model using [Model Downloader](@ref omz_tools_downloader_README): +``` +python /downloader.py --name fast-neural-style-mosaic-onnx +``` -```sh -./style_transfer_sample -i /cat.bmp -m /fast-neural-style-mosaic-onnx.onnx +2. `fast-neural-style-mosaic-onnx` model does not need to be converted, because it is already in necessary format, so you can skip this step. If you want to use a other model that is not in the Inference Engine IR or ONNX format, you can convert it using the model converter script: + +``` +python /converter.py --name +``` + +3. Perform inference of `car.bmp` and `cat.jpg` using `fast-neural-style-mosaic-onnx` model on a `GPU`, for example: + +``` +/style_transfer_sample -m /fast-neural-style-mosaic-onnx.onnx -i /car.bmp /cat.jpg -d GPU ``` ## Sample Output The sample application logs each step in a standard output stream and creates an image (`out1.bmp`) or a sequence of images (`out1.bmp`, ..., `out.bmp`) which are redrawn in style of the style transfer model used for the sample. -```sh -style_transfer_sample -m fast-neural-style-mosaic-onnx.onnx -i car.png car_1.bmp +``` [ INFO ] InferenceEngine: - API version ............ - Build .................. - Description ....... API + IE version ......... 2021.4.0 + Build ........... 2021.4.0-3839-cd81789d294-releases/2021/4 [ INFO ] Parsing input parameters [ INFO ] Files were added: 2 -[ INFO ] car.png -[ INFO ] car_1.bmp -[ INFO +[ INFO ] C:\images\car.bmp +[ INFO ] C:\images\cat.jpg +[ INFO ] Loading Inference Engine [ INFO ] Device info: - CPU - MKLDNNPlugin version ......... - Build ........... + GPU + clDNNPlugin version ......... 2021.4.0 + Build ........... 2021.4.0-3839-cd81789d294-releases/2021/4 -[ INFO ] Loading network files -[ INFO ] fast-neural-style-mosaic-onnx.onnx +[ INFO ] Loading network files: +[ INFO ] C:\openvino\deployment_tools\open_model_zoo\tools\downloader\public\fast-neural-style-mosaic-onnx\fast-neural-style-mosaic-onnx.onnx [ INFO ] Preparing input blobs -[ WARNING ] Image is resized from (787, 259) to (224, 224) [ WARNING ] Image is resized from (749, 637) to (224, 224) +[ WARNING ] Image is resized from (300, 300) to (224, 224) [ INFO ] Batch size is 2 [ INFO ] Preparing output blobs [ INFO ] Loading model to the device diff --git a/inference-engine/src/cldnn_engine/cldnn_engine.cpp b/inference-engine/src/cldnn_engine/cldnn_engine.cpp index 7849101cc2a..72a34dd855a 100644 --- a/inference-engine/src/cldnn_engine/cldnn_engine.cpp +++ b/inference-engine/src/cldnn_engine/cldnn_engine.cpp @@ -192,7 +192,6 @@ InferenceEngine::CNNNetwork clDNNEngine::CloneAndTransformNetwork(const Inferenc manager.register_pass(); manager.register_pass(); manager.register_pass(); - manager.register_pass(); static const precisions_array convert_precision_list { {ngraph::element::i64, ngraph::element::i32}, diff --git a/inference-engine/src/gna_plugin/backend/am_intel_dnn.cpp b/inference-engine/src/gna_plugin/backend/am_intel_dnn.cpp index a3a64c1605b..8b3e0901ba2 100644 --- a/inference-engine/src/gna_plugin/backend/am_intel_dnn.cpp +++ b/inference-engine/src/gna_plugin/backend/am_intel_dnn.cpp @@ -1361,7 +1361,7 @@ uint32_t GNAPluginNS::backend::AMIntelDNN::CountLayers() { } #if GNA_LIB_VER == 2 -void GNAPluginNS::backend::AMIntelDNN::InitGNAStruct(Gna2Model *gnaModel) { +void GNAPluginNS::backend::AMIntelDNN::InitGNAStruct(Gna2Model *gnaModel, const std::string& gnaCompileTarget) { Gna2Operation * gnaOperation; if (gnaModel == nullptr) THROW_GNA_EXCEPTION << "Invalid input parameter"; @@ -1677,7 +1677,11 @@ void GNAPluginNS::backend::AMIntelDNN::InitGNAStruct(intel_nnet_type_t *ptr_nnet const auto fltStride = fltStrideShape->Dimensions[0]; const auto outFromConv = outputFromConv(inVecCnt, nFltSize, fltStride); // FLAT input matrix, pooled outputs per filter - outputTensor.Shape.Dimensions[1] = outputFromPoolingLegacy(outFromConv, poolStride->Dimensions[0]); + if (gnaCompileTarget == InferenceEngine::GNAConfigParams::GNA_TARGET_3_0) { + outputTensor.Shape.Dimensions[1] = outputFromPooling(outFromConv, poolWindow->Dimensions[0], poolStride->Dimensions[0]); + } else { + outputTensor.Shape.Dimensions[1] = outputFromPoolingLegacy(outFromConv, poolStride->Dimensions[0]); + } } else { // kDnnConvolutional2dOp // Override GNA operation output pointer with the one from pooling component outputTensor.Data = comp.ptr_outputs; @@ -1743,7 +1747,8 @@ void GNAPluginNS::backend::AMIntelDNN::InitGNAStruct(intel_nnet_type_t *ptr_nnet || (component[i - 1].operation == kDnnConvolutional1dOp) || (component[i - 1].operation == kDnnConvolutional2dOp) || ((component[i - 1].operation == kDnnMaxPoolOp) && - (component[i - 2].operation == kDnnConvolutional1dOp))) { + (component[i - 2].operation == kDnnConvolutional1dOp + || component[i - 2].operation == kDnnConvolutional2dOp))) { if (gnaOperation->Operands[PwlOpIdx] == nullptr) { HelperGna2OperationSetOperand(gnaOperation, gnaUserAllocator, gnaUserFree, PwlOpIdx, createGna2TensorPwl(1, nullptr)); } diff --git a/inference-engine/src/gna_plugin/backend/am_intel_dnn.hpp b/inference-engine/src/gna_plugin/backend/am_intel_dnn.hpp index 7dcab94a685..19ca045647f 100644 --- a/inference-engine/src/gna_plugin/backend/am_intel_dnn.hpp +++ b/inference-engine/src/gna_plugin/backend/am_intel_dnn.hpp @@ -15,6 +15,7 @@ #if GNA_LIB_VER == 2 #include +#include #endif namespace GNAPluginNS { @@ -293,7 +294,7 @@ public: #if GNA_LIB_VER == 2 - void InitGNAStruct(Gna2Model *gnaModel); + void InitGNAStruct(Gna2Model *gnaModel, const std::string& gnaCompileTarget = InferenceEngine::GNAConfigParams::GNA_TARGET_2_0); void DestroyGNAStruct(Gna2Model *gnaModel); #else diff --git a/inference-engine/src/gna_plugin/frontend/precision_ex.hpp b/inference-engine/src/gna_plugin/frontend/precision_ex.hpp index c29ec5e48a0..a5f86262deb 100644 --- a/inference-engine/src/gna_plugin/frontend/precision_ex.hpp +++ b/inference-engine/src/gna_plugin/frontend/precision_ex.hpp @@ -65,17 +65,6 @@ class TPrecision : public Precision { explicit TPrecision(const Precision::ePrecision value) : Precision(value) {} }; -template TPrecision createTPrecision() { - TPrecision cnt(InferenceEngine::Precision::fromType()); - return cnt; -} - -template -TPrecision::value_type> createTPrecision() { - TPrecision::value_type> cnt(T); - return cnt; -} - // special case for Mixed, or undefined precisions template <> diff --git a/inference-engine/src/gna_plugin/gna_plugin.cpp b/inference-engine/src/gna_plugin/gna_plugin.cpp index fdd3edd3181..c40b97209e1 100644 --- a/inference-engine/src/gna_plugin/gna_plugin.cpp +++ b/inference-engine/src/gna_plugin/gna_plugin.cpp @@ -680,12 +680,6 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) { manager.register_pass(); manager.register_pass(); manager.register_pass(); - manager.register_pass(); - manager.register_pass(); - manager.register_pass(); - manager.register_pass(); - manager.register_pass(); - manager.register_pass(); // TODO enable this transformation for networks with convolutions if (!ngraph::op::util::has_op_with_type(graph)) { manager.register_pass(); @@ -992,7 +986,7 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) { if (!gnaFlags->sw_fp32 && !graphCompiler.dnnComponents.components.empty()) { // number of layer gets calculated inside that InitGNAStruct function #if GNA_LIB_VER == 2 - dnn->InitGNAStruct(&std::get<0>(gnaModels.front())->obj); + dnn->InitGNAStruct(&std::get<0>(gnaModels.front())->obj, config.gnaCompileTarget); #else dnn->InitGNAStruct(&std::get<0>(nnets.front())->obj); #endif @@ -1003,7 +997,7 @@ void GNAPlugin::LoadNetwork(CNNNetwork & _network) { #if GNA_LIB_VER == 2 gnaModels.push_back(std::make_tuple(make_shared>())); // this can be improved by just copy all structures, but we are too lazy - dnn->InitGNAStruct(&std::get<0>(gnaModels.back())->obj); + dnn->InitGNAStruct(&std::get<0>(gnaModels.back())->obj, config.gnaCompileTarget); #else nnets.emplace_back(make_shared>(), -1, InferenceEngine::BlobMap()); dnn->InitGNAStruct(&std::get<0>(nnets.back())->obj); diff --git a/inference-engine/src/gna_plugin/gna_plugin_config.cpp b/inference-engine/src/gna_plugin/gna_plugin_config.cpp index 766e7d2d52c..e18847e851c 100644 --- a/inference-engine/src/gna_plugin/gna_plugin_config.cpp +++ b/inference-engine/src/gna_plugin/gna_plugin_config.cpp @@ -131,7 +131,13 @@ void Config::UpdateFromMap(const std::map& config) { if (supportedTargets.count(value) == 0) { THROW_GNA_EXCEPTION << "Unsupported GNA config value (key, value): (" << key << ", " << value << ")"; } - (key == GNA_CONFIG_KEY(EXEC_TARGET) ? gnaExecTarget : gnaCompileTarget) = value; + if (key == GNA_CONFIG_KEY(EXEC_TARGET)) { + gnaExecTarget = value; + if (gnaCompileTarget == "") + gnaCompileTarget = value; + } else { + gnaCompileTarget = value; + } } else if (key == GNA_CONFIG_KEY(COMPACT_MODE)) { if (value == PluginConfigParams::YES) { gnaFlags.compact_mode = true; diff --git a/inference-engine/src/gna_plugin/transformations/convert_padded2valid_conv.cpp b/inference-engine/src/gna_plugin/transformations/convert_padded2valid_conv.cpp index b07add2183d..1701993f387 100644 --- a/inference-engine/src/gna_plugin/transformations/convert_padded2valid_conv.cpp +++ b/inference-engine/src/gna_plugin/transformations/convert_padded2valid_conv.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -18,12 +19,6 @@ using namespace GNAPluginNS; NGRAPH_RTTI_DEFINITION(ConvertPadded2ValidConv, "ConvertPadded2ValidConv", 0); -NGRAPH_RTTI_DEFINITION(ConvertPaddedWithBias2ValidConv, "ConvertPaddedWithBias2ValidConv", 0); -NGRAPH_RTTI_DEFINITION(ConvertPaddedWithBiasAF2ValidConv, "ConvertPaddedWithBiasAF2ValidConv", 0); -NGRAPH_RTTI_DEFINITION(ConvertPaddedWithBiasMaxPool2ValidConv, "ConvertPaddedWithBiasMaxPool2ValidConv", 0); -NGRAPH_RTTI_DEFINITION(ConvertPaddedWithBiasMaxPoolAF2ValidConv, "ConvertPaddedWithBiasMaxPoolAF2ValidConv", 0); -NGRAPH_RTTI_DEFINITION(ConvertPaddedTransposedWithBias2ValidConv, "ConvertPaddedTransposedWithBias2ValidConv", 0); -NGRAPH_RTTI_DEFINITION(ConvertPaddedTransposedWithBiasAF2ValidConv, "ConvertPaddedTransposedWithBiasAF2ValidConv", 0); struct ConvData { size_t input_height; @@ -92,26 +87,16 @@ static bool VerifyBias(std::shared_ptr bias, const size_t& if (!add_const) add_const = std::dynamic_pointer_cast(bias->input_value(1).get_node_shared_ptr()); - // The add may be a normal add not conv bias, then we just go further + // The add may be a normal add not convolution bias, then we just go further return (add_const && shape_size(add_const->get_shape()) == filter_count); } -static bool VerifyMaxPool(std::shared_ptr max_pool) { - auto pool_strides = max_pool->get_strides(); - auto pool_kernel = max_pool->get_kernel(); - - // Check if MaxPool vertical stride == pool size - // Check if padding is VALID - return (max_pool->get_auto_pad() == ngraph::op::PadType::VALID && - pool_kernel.size() == 2 && pool_strides.size() == 2); -} - static std::shared_ptr FlatCrop(ngraph::Output input, size_t offset, size_t size) { return std::make_shared( input, // data - ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{ 2 }, { (size_t)0, offset }), // begin sice index - ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{ 2 }, { (size_t)0, offset + size }), // end slice index - ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{ 2 }, { (size_t)1, (size_t)1 }), // strides + ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{2}, {(size_t)0, offset}), // begin sice index + ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{2}, {(size_t)0, offset + size}), // end slice index + ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{2}, {(size_t)1, (size_t)1}), // strides std::vector{1, 0}, // begin mask std::vector{1, 0}); // end mask } @@ -142,11 +127,11 @@ static std::shared_ptr CreatePaddedNet(std::shared_ptr(leading_transpose->input_value(0), - ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{ 2 }, - ngraph::Shape{ 1ull, shape_size(leading_transpose->input_value(0).get_shape()) }), false); + ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{2}, + ngraph::Shape{1ull, shape_size(leading_transpose->input_value(0).get_shape())}), false); // Constant with zero padding - auto const_holding_padding = std::make_shared(conv_data.element_type, ngraph::Shape{ 1, biggest_padding }, 0); + auto const_holding_padding = std::make_shared(conv_data.element_type, ngraph::Shape{1, biggest_padding}, 0); copy_runtime_info(conv, const_holding_padding); std::shared_ptr original_row = flat_input; @@ -213,21 +198,21 @@ static void GeneratePadding(std::shared_ptr leading_t auto padded_input_plane = CreatePaddedNet(leading_transpose, conv, conv_data); auto padded_input_plane_reshaped = std::make_shared(padded_input_plane, - ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { static_cast(1), + ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {static_cast(1), conv_data.pads_begin_height + conv_data.input_height + conv_data.pads_end_height, conv_data.pads_begin_width + conv_data.input_width + conv_data.pads_end_width, - conv_data.input_channel_count }), false); + conv_data.input_channel_count}), false); // NHWC => NCHW auto transposed2chw = std::make_shared(padded_input_plane_reshaped, - ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{ 4 }, { 0ull, 3ull, 1ull, 2ull })->output(0)); + ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {0ull, 3ull, 1ull, 2ull})->output(0)); auto conv_copy = std::make_shared( transposed2chw->output(0), conv->input_value(1), conv->get_strides(), - ngraph::CoordinateDiff{ 0, 0 }, - ngraph::CoordinateDiff{ 0, 0 }, + ngraph::CoordinateDiff{0, 0}, + ngraph::CoordinateDiff{0, 0}, conv->get_dilations(), ngraph::op::PadType::EXPLICIT); @@ -237,9 +222,7 @@ static void GeneratePadding(std::shared_ptr leading_t static bool Convert(std::shared_ptr leading_transpose, std::shared_ptr conv, std::shared_ptr trailing_transpose, - std::shared_ptr bias, - std::shared_ptr af, - std::shared_ptr max_pool) { + std::shared_ptr bias) { ConvData conv_data; @@ -248,18 +231,15 @@ static bool Convert(std::shared_ptr leading_transpose, // We are looking for Transpose(NHWC->NCHW) => Conv => Transpose(NCHW->NHWC) // or similar cases, so required network must be in NHWC order like in TF - if (!TransposeOrderMatches(std::dynamic_pointer_cast(leading_transpose), { 0, 3, 1, 2 })) + if (!TransposeOrderMatches(std::dynamic_pointer_cast(leading_transpose), {0, 3, 1, 2})) return false; - if (!TransposeOrderMatches(std::dynamic_pointer_cast(trailing_transpose), { 0, 2, 3, 1 })) + if (!TransposeOrderMatches(std::dynamic_pointer_cast(trailing_transpose), {0, 2, 3, 1})) return false; if (bias && !VerifyBias(std::dynamic_pointer_cast(bias), conv_data.filter_count)) return false; - if (max_pool && !VerifyMaxPool(std::dynamic_pointer_cast(max_pool))) - return false; - GeneratePadding(std::dynamic_pointer_cast(leading_transpose), std::dynamic_pointer_cast(conv), conv_data); @@ -276,184 +256,46 @@ ConvertPadded2ValidConv::ConvertPadded2ValidConv() { MATCHER_SCOPE(ConvertPadded2ValidConv); auto const_input = ngraph::pattern::wrap_type(); - auto leading_transpose = ngraph::pattern::wrap_type({ ngraph::pattern::any_input(), const_input }, + auto leading_transpose = ngraph::pattern::wrap_type({ngraph::pattern::any_input(), const_input}, consumers_and_rank(1, 4)); auto conv = ngraph::pattern::wrap_type( - { leading_transpose, ngraph::pattern::wrap_type(ngraph::pattern::rank_equals(4)) }, + {leading_transpose, ngraph::pattern::wrap_type(ngraph::pattern::rank_equals(4))}, ngraph::pattern::consumers_count(1)); - auto trailing_transpose = ngraph::pattern::wrap_type({ conv, const_input }, - consumers_and_rank(1, 4)); - - ngraph::matcher_pass_callback callback = [=](ngraph::pattern::Matcher& m) { - const auto& pattern_map = m.get_pattern_value_map(); - return Convert(pattern_map.at(leading_transpose).get_node_shared_ptr(), pattern_map.at(conv).get_node_shared_ptr(), - pattern_map.at(trailing_transpose).get_node_shared_ptr(), nullptr, nullptr, nullptr); - }; - - auto m = std::make_shared(trailing_transpose, matcher_name); - this->register_matcher(m, callback); -} - -ConvertPaddedWithBias2ValidConv::ConvertPaddedWithBias2ValidConv() { - MATCHER_SCOPE(ConvertPaddedWithBias2ValidConv); - - auto const_input = ngraph::pattern::wrap_type(); - auto leading_transpose = ngraph::pattern::wrap_type({ ngraph::pattern::any_input(), const_input }, - consumers_and_rank(1, 4)); - auto conv = ngraph::pattern::wrap_type( - { leading_transpose, ngraph::pattern::wrap_type(ngraph::pattern::rank_equals(4)) }, + auto bias = ngraph::pattern::wrap_type({conv, const_input}, ngraph::pattern::consumers_count(1)); - auto bias = ngraph::pattern::wrap_type({ conv, const_input }, + auto fq = ngraph::pattern::wrap_type({bias, const_input, const_input, const_input, const_input}, ngraph::pattern::consumers_count(1)); - auto trailing_transpose = ngraph::pattern::wrap_type({ bias, const_input }, - consumers_and_rank(1, 4)); - - ngraph::matcher_pass_callback callback = [=](ngraph::pattern::Matcher& m) { - const auto& pattern_map = m.get_pattern_value_map(); - return Convert(pattern_map.at(leading_transpose).get_node_shared_ptr(), pattern_map.at(conv).get_node_shared_ptr(), - pattern_map.at(trailing_transpose).get_node_shared_ptr(), pattern_map.at(bias).get_node_shared_ptr(), nullptr, nullptr); - }; - - auto m = std::make_shared(trailing_transpose, matcher_name); - this->register_matcher(m, callback); -} - -ConvertPaddedWithBiasAF2ValidConv::ConvertPaddedWithBiasAF2ValidConv() { - MATCHER_SCOPE(ConvertPaddedWithBiasAF2ValidConv); - - auto const_input = ngraph::pattern::wrap_type(); - auto leading_transpose = ngraph::pattern::wrap_type({ ngraph::pattern::any_input(), const_input }, - consumers_and_rank(1, 4)); - auto conv = ngraph::pattern::wrap_type( - { leading_transpose, ngraph::pattern::wrap_type(ngraph::pattern::rank_equals(4)) }, + auto max_pool1 = ngraph::pattern::wrap_type({bias}, ngraph::pattern::consumers_count(1)); - auto bias = ngraph::pattern::wrap_type({ conv, const_input }, + auto max_pool2 = ngraph::pattern::wrap_type({fq}, ngraph::pattern::consumers_count(1)); - auto af = ngraph::pattern::wrap_type({ bias }, - ngraph::pattern::consumers_count(1)); - auto trailing_transpose = ngraph::pattern::wrap_type({ af, const_input }, - consumers_and_rank(1, 4)); - - ngraph::matcher_pass_callback callback = [=](ngraph::pattern::Matcher& m) { - const auto& pattern_map = m.get_pattern_value_map(); - return Convert(pattern_map.at(leading_transpose).get_node_shared_ptr(), pattern_map.at(conv).get_node_shared_ptr(), - pattern_map.at(trailing_transpose).get_node_shared_ptr(), pattern_map.at(bias).get_node_shared_ptr(), - pattern_map.at(af).get_node_shared_ptr(), nullptr); - }; - - auto m = std::make_shared(trailing_transpose, matcher_name); - this->register_matcher(m, callback); -} - -ConvertPaddedWithBiasMaxPool2ValidConv::ConvertPaddedWithBiasMaxPool2ValidConv() { - MATCHER_SCOPE(ConvertPaddedWithBiasMaxPool2ValidConv); - - auto const_input = ngraph::pattern::wrap_type(); - auto leading_transpose = ngraph::pattern::wrap_type({ ngraph::pattern::any_input(), const_input }, - consumers_and_rank(1, 4)); - auto conv = ngraph::pattern::wrap_type( - { leading_transpose, ngraph::pattern::wrap_type(ngraph::pattern::rank_equals(4)) }, - ngraph::pattern::consumers_count(1)); - auto bias = ngraph::pattern::wrap_type({ conv, const_input }, - ngraph::pattern::consumers_count(1)); - auto max_pool = ngraph::pattern::wrap_type({ bias }, - ngraph::pattern::consumers_count(1)); - auto trailing_transpose = ngraph::pattern::wrap_type({ max_pool, const_input }, - consumers_and_rank(1, 4)); - - ngraph::matcher_pass_callback callback = [=](ngraph::pattern::Matcher& m) { - const auto& pattern_map = m.get_pattern_value_map(); - return Convert(pattern_map.at(leading_transpose).get_node_shared_ptr(), pattern_map.at(conv).get_node_shared_ptr(), - pattern_map.at(trailing_transpose).get_node_shared_ptr(), pattern_map.at(bias).get_node_shared_ptr(), - nullptr, pattern_map.at(max_pool).get_node_shared_ptr()); - }; - - auto m = std::make_shared(trailing_transpose, matcher_name); - this->register_matcher(m, callback); -} - -ConvertPaddedWithBiasMaxPoolAF2ValidConv::ConvertPaddedWithBiasMaxPoolAF2ValidConv() { - MATCHER_SCOPE(ConvertPaddedWithBiasMaxPoolAF2ValidConv); - - auto const_input = ngraph::pattern::wrap_type(); - auto leading_transpose = ngraph::pattern::wrap_type({ ngraph::pattern::any_input(), const_input }, - consumers_and_rank(1, 4)); - auto conv = ngraph::pattern::wrap_type( - { leading_transpose, ngraph::pattern::wrap_type(ngraph::pattern::rank_equals(4)) }, - ngraph::pattern::consumers_count(1)); - auto bias = ngraph::pattern::wrap_type({ conv, const_input }, - ngraph::pattern::consumers_count(1)); - auto max_pool = ngraph::pattern::wrap_type({ bias }, - ngraph::pattern::consumers_count(1)); - auto af = ngraph::pattern::wrap_type({bias}, ngraph::pattern::consumers_count(1)); + auto af2 = ngraph::pattern::wrap_type({ max_pool }, - ngraph::pattern::consumers_count(1)); - auto trailing_transpose = ngraph::pattern::wrap_type({ af, const_input }, + ngraph::opset7::Sign, ngraph::opset7::Clamp>({fq}, ngraph::pattern::consumers_count(1)); + auto af3 = ngraph::pattern::wrap_type({max_pool1}, ngraph::pattern::consumers_count(1)); + auto af4 = ngraph::pattern::wrap_type({max_pool2}, ngraph::pattern::consumers_count(1)); + auto transpose_input = std::make_shared(ngraph::OutputVector{conv, bias, max_pool1, max_pool2, fq, af1, af2, af3, af4}); + auto trailing_transpose = ngraph::pattern::wrap_type({transpose_input, const_input}, consumers_and_rank(1, 4)); ngraph::matcher_pass_callback callback = [=](ngraph::pattern::Matcher& m) { const auto& pattern_map = m.get_pattern_value_map(); + auto conv_output = conv->output(0).get_node_shared_ptr(); + IE_ASSERT(conv_output != nullptr); + + auto bias_node = std::dynamic_pointer_cast(conv_output); + return Convert(pattern_map.at(leading_transpose).get_node_shared_ptr(), pattern_map.at(conv).get_node_shared_ptr(), - pattern_map.at(trailing_transpose).get_node_shared_ptr(), pattern_map.at(bias).get_node_shared_ptr(), - pattern_map.at(af).get_node_shared_ptr(), pattern_map.at(max_pool).get_node_shared_ptr()); + pattern_map.at(trailing_transpose).get_node_shared_ptr(), bias_node); }; auto m = std::make_shared(trailing_transpose, matcher_name); this->register_matcher(m, callback); } - -ConvertPaddedTransposedWithBias2ValidConv::ConvertPaddedTransposedWithBias2ValidConv() { - MATCHER_SCOPE(ConvertPaddedTransposedWithBias2ValidConv); - - auto const_input = ngraph::pattern::wrap_type(); - auto leading_transpose = ngraph::pattern::wrap_type({ ngraph::pattern::any_input(), const_input }, - consumers_and_rank(1, 4)); - auto conv = ngraph::pattern::wrap_type( - { leading_transpose, ngraph::pattern::wrap_type(ngraph::pattern::rank_equals(4)) }, - ngraph::pattern::consumers_count(1)); - auto trailing_transpose = ngraph::pattern::wrap_type({ conv, const_input }, - consumers_and_rank(1, 4)); - auto bias = ngraph::pattern::wrap_type({ trailing_transpose, const_input }, - ngraph::pattern::consumers_count(1)); - - ngraph::matcher_pass_callback callback = [=](ngraph::pattern::Matcher& m) { - const auto& pattern_map = m.get_pattern_value_map(); - return Convert(pattern_map.at(leading_transpose).get_node_shared_ptr(), pattern_map.at(conv).get_node_shared_ptr(), - pattern_map.at(trailing_transpose).get_node_shared_ptr(), pattern_map.at(bias).get_node_shared_ptr(), nullptr, nullptr); - }; - - auto m = std::make_shared(bias, matcher_name); - this->register_matcher(m, callback); -} - -ConvertPaddedTransposedWithBiasAF2ValidConv::ConvertPaddedTransposedWithBiasAF2ValidConv() { - MATCHER_SCOPE(ConvertPaddedTransposedWithBiasAF2ValidConv); - - auto const_input = ngraph::pattern::wrap_type(); - auto leading_transpose = ngraph::pattern::wrap_type({ ngraph::pattern::any_input(), const_input }, - consumers_and_rank(1, 4)); - auto conv = ngraph::pattern::wrap_type( - { leading_transpose, ngraph::pattern::wrap_type(ngraph::pattern::rank_equals(4)) }, - ngraph::pattern::consumers_count(1)); - auto trailing_transpose = ngraph::pattern::wrap_type({ conv, const_input }, - consumers_and_rank(1, 4)); - auto bias = ngraph::pattern::wrap_type({ trailing_transpose, const_input }, - ngraph::pattern::consumers_count(1)); - auto af = ngraph::pattern::wrap_type({ bias }, - ngraph::pattern::consumers_count(1)); - - ngraph::matcher_pass_callback callback = [=](ngraph::pattern::Matcher& m) { - const auto& pattern_map = m.get_pattern_value_map(); - return Convert(pattern_map.at(leading_transpose).get_node_shared_ptr(), pattern_map.at(conv).get_node_shared_ptr(), - pattern_map.at(trailing_transpose).get_node_shared_ptr(), pattern_map.at(bias).get_node_shared_ptr(), - pattern_map.at(af).get_node_shared_ptr(), nullptr); - }; - - auto m = std::make_shared(af, matcher_name); - this->register_matcher(m, callback); -} diff --git a/inference-engine/src/gna_plugin/transformations/convert_padded2valid_conv.hpp b/inference-engine/src/gna_plugin/transformations/convert_padded2valid_conv.hpp index aefdccfeb9c..9d8a0f10477 100644 --- a/inference-engine/src/gna_plugin/transformations/convert_padded2valid_conv.hpp +++ b/inference-engine/src/gna_plugin/transformations/convert_padded2valid_conv.hpp @@ -8,159 +8,30 @@ namespace GNAPluginNS { - /** - * @brief Convert a padded convolution, wrapped with transposes, - * to a valid convolution with padding added before the leading transpose: - * - * Padding - * | - * Transpose (NHWC -> NCHW) Transpose (NHWC -> NCHW) - * | | - * Convolution with padding Convolution with padding - * | | - * Transpose (NCHW -> NHWC) Transpose (NCHW -> NHWC) - * - */ +/** + * @brief Convert a padded convolution with bias, max pooling and activation function + * wrapped with transposes, to a valid convolution with padding added before the leading transpose, + * POT precessed models are supported (fake quantized layers omitted below for clarity): + * + * Padding + * | + * Transpose (NHWC -> NCHW) Transpose (NHWC -> NCHW) + * | | + * Convolution with padding Convolution with padding + * | | + * Broadcast Bias (optional) Broadcast Bias (optional) + * | | + * Max Pooling (optional) Max Pooling (optional) + * | | + * Activation Function (optional) Activation Function (optional) + * | | + * Transpose (NCHW -> NHWC) Transpose (NCHW -> NHWC) + * + */ class ConvertPadded2ValidConv : public ngraph::pass::MatcherPass { public: NGRAPH_RTTI_DECLARATION; ConvertPadded2ValidConv(); }; -/** - * @brief Convert a padded convolution with bias, wrapped with transposes, - * to a valid convolution with padding added before the leading transpose: - * - * Padding - * | - * Transpose (NHWC -> NCHW) Transpose (NHWC -> NCHW) - * | | - * Convolution with padding Convolution with padding - * | | - * Broadcast Bias Broadcast Bias - * | | - * Transpose (NCHW -> NHWC) Transpose (NCHW -> NHWC) - * - */ -class ConvertPaddedWithBias2ValidConv : public ngraph::pass::MatcherPass { -public: - NGRAPH_RTTI_DECLARATION; - ConvertPaddedWithBias2ValidConv(); -}; - -/** - * @brief Convert a padded convolution with bias and an activation function, - * wrapped with transposes, to a valid convolution with padding added before the leading transpose: - * - * Padding - * | - * Transpose (NHWC -> NCHW) Transpose (NHWC -> NCHW) - * | | - * Convolution with padding Convolution with padding - * | | - * Broadcast Bias Broadcast Bias - * | | - * Activation Function Activation Function - * | | - * Transpose (NCHW -> NHWC) Transpose (NCHW -> NHWC) - * - */ -class ConvertPaddedWithBiasAF2ValidConv : public ngraph::pass::MatcherPass { -public: - NGRAPH_RTTI_DECLARATION; - ConvertPaddedWithBiasAF2ValidConv(); -}; - -/** - * @brief Convert a padded convolution with bias and max pooling, - * wrapped with transposes, to a valid convolution with padding added before the leading transpose: - * - * Padding - * | - * Transpose (NHWC -> NCHW) Transpose (NHWC -> NCHW) - * | | - * Convolution with padding Convolution with padding - * | | - * Broadcast Bias Broadcast Bias - * | | - * Max Pooling Max Pooling - * | | - * Transpose (NCHW -> NHWC) Transpose (NCHW -> NHWC) - * - */ -class ConvertPaddedWithBiasMaxPool2ValidConv : public ngraph::pass::MatcherPass { -public: - NGRAPH_RTTI_DECLARATION; - ConvertPaddedWithBiasMaxPool2ValidConv(); -}; - -/** - * @brief Convert a padded convolution with bias, max pooling and activation function - * wrapped with transposes, to a valid convolution with padding added before the leading transpose: - * - * Padding - * | - * Transpose (NHWC -> NCHW) Transpose (NHWC -> NCHW) - * | | - * Convolution with padding Convolution with padding - * | | - * Broadcast Bias Broadcast Bias - * | | - * Max Pooling Max Pooling - * | | - * Activation Function Activation Function - * | | - * Transpose (NCHW -> NHWC) Transpose (NCHW -> NHWC) - * - */ -class ConvertPaddedWithBiasMaxPoolAF2ValidConv : public ngraph::pass::MatcherPass { -public: - NGRAPH_RTTI_DECLARATION; - ConvertPaddedWithBiasMaxPoolAF2ValidConv(); -}; - -/** - * @brief Convert a padded convolution wrapped with transposes, with bias after trailing transpose, - * to a valid convolution with padding added before the leading transpose: - * - * Padding - * | - * Transpose (NHWC -> NCHW) Transpose (NHWC -> NCHW) - * | | - * Convolution with padding Convolution with padding - * | | - * Transpose (NCHW -> NHWC) Transpose (NCHW -> NHWC) - * | | - * Broadcast Bias Broadcast Bias - * - */ -class ConvertPaddedTransposedWithBias2ValidConv : public ngraph::pass::MatcherPass { -public: - NGRAPH_RTTI_DECLARATION; - ConvertPaddedTransposedWithBias2ValidConv(); -}; - -/** - * @brief Convert a padded convolution wrapped with transposes, with bias - * and activation function after trailing transpose, to a valid convolution with padding added before the leading transpose: - * - * Padding - * | - * Transpose (NHWC -> NCHW) Transpose (NHWC -> NCHW) - * | | - * Convolution with padding Convolution with padding - * | | - * Transpose (NCHW -> NHWC) Transpose (NCHW -> NHWC) - * | | - * Broadcast Bias Broadcast Bias - * | | - * Activation Function Activation Function - * - */ -class ConvertPaddedTransposedWithBiasAF2ValidConv : public ngraph::pass::MatcherPass { -public: - NGRAPH_RTTI_DECLARATION; - ConvertPaddedTransposedWithBiasAF2ValidConv(); -}; - } // namespace GNAPluginNS diff --git a/inference-engine/src/gna_plugin/transformations/insert_transpose_after_convolution_or_pooling.cpp b/inference-engine/src/gna_plugin/transformations/insert_transpose_after_convolution_or_pooling.cpp index 4954529762d..8d71a6ad46e 100644 --- a/inference-engine/src/gna_plugin/transformations/insert_transpose_after_convolution_or_pooling.cpp +++ b/inference-engine/src/gna_plugin/transformations/insert_transpose_after_convolution_or_pooling.cpp @@ -9,7 +9,7 @@ #include #include - +#include #include "gna_plugin_log.hpp" using namespace GNAPluginNS; @@ -94,11 +94,13 @@ bool InsertTransposeAfterConvOrPool::run_on_function(std::shared_ptr(node, reshapeConstBefore, false); reshapeBefore->set_friendly_name(node->get_friendly_name() + "/reshape_out"); + ngraph::copy_runtime_info(node, reshapeBefore); auto transpose_order = transposeInShape.size() == 3 ? ngraph::Shape{0, 2, 1} : ngraph::Shape{0, 3, 1, 2}; auto transpose = std::make_shared(reshapeBefore, ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{transpose_order.size()}, transpose_order)); transpose->set_friendly_name(node->get_friendly_name() + "/transpose_out"); + ngraph::copy_runtime_info(node, transpose); for (auto input : consumers) { input.replace_source_output(transpose); diff --git a/inference-engine/src/gna_plugin/transformations/swap_input_matmul_gna.cpp b/inference-engine/src/gna_plugin/transformations/swap_input_matmul_gna.cpp index d177b83ba40..fdfcfc254d4 100644 --- a/inference-engine/src/gna_plugin/transformations/swap_input_matmul_gna.cpp +++ b/inference-engine/src/gna_plugin/transformations/swap_input_matmul_gna.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -22,9 +23,15 @@ NGRAPH_RTTI_DEFINITION(SwapInputMatMul, "SwapInputMatMul", 0); SwapInputMatMul::SwapInputMatMul() { MATCHER_SCOPE(SwapInputMatMul); - auto matmul = ngraph::pattern::wrap_type({ngraph::pattern::any_input( - ngraph::pattern::has_static_shape()), ngraph::pattern::any_input(ngraph::pattern::has_static_shape())}, - ngraph::pattern::has_static_shape()); + auto constant = ngraph::pattern::wrap_type({}, ngraph::pattern::rank_equals(2)); + auto fake_quantize = ngraph::pattern::wrap_type({constant, + ngraph::pattern::wrap_type(), + ngraph::pattern::wrap_type(), + ngraph::pattern::wrap_type(), + ngraph::pattern::wrap_type()}); + auto matmul_input = std::make_shared(ngraph::OutputVector{constant, fake_quantize}); + auto matmul = ngraph::pattern::wrap_type({matmul_input, ngraph::pattern::any_input()}, + ngraph::pattern::has_static_shape()); ngraph::matcher_pass_callback callback = [this](ngraph::pattern::Matcher& m) { auto matmul = std::dynamic_pointer_cast(m.get_match_root()); if (!matmul) { @@ -51,22 +58,6 @@ SwapInputMatMul::SwapInputMatMul() { ngraph::NodeVector new_ops; - // Skip FakeQuantize layers - std::shared_ptr input_a_skip_fq = input_a.get_node_shared_ptr(); - if (std::dynamic_pointer_cast(input_a_skip_fq)) { - input_a_skip_fq = input_a_skip_fq->input_value(0).get_node_shared_ptr(); - } - - std::shared_ptr input_b_skip_fq = input_b.get_node_shared_ptr(); - if (std::dynamic_pointer_cast(input_b_skip_fq)) { - input_b_skip_fq = input_b_skip_fq->input_value(0).get_node_shared_ptr(); - } - - if (!std::dynamic_pointer_cast(input_a_skip_fq) || - std::dynamic_pointer_cast(input_b_skip_fq)) { - return false; - } - if (shape_input_a[0] < 8 || ((shape_input_a[0] % 8 != 0 || shape_input_a[1] % 8 != 0))) { return false; } diff --git a/inference-engine/src/inference_engine/cnn_network_ngraph_impl.cpp b/inference-engine/src/inference_engine/cnn_network_ngraph_impl.cpp index 1252c1b856a..1f05ca0098c 100644 --- a/inference-engine/src/inference_engine/cnn_network_ngraph_impl.cpp +++ b/inference-engine/src/inference_engine/cnn_network_ngraph_impl.cpp @@ -8,6 +8,10 @@ #include #include +#include +#include + + #include #include #include @@ -476,6 +480,64 @@ StatusCode CNNNetworkNGraphImpl::serialize(const std::string& xmlPath, return OK; } +StatusCode CNNNetworkNGraphImpl::serialize(std::ostream& xmlBuf, + std::ostream& binBuf, + ResponseDesc* resp) const noexcept { + try { + std::map custom_opsets; + for (const auto& extension : _ie_extensions) { + auto opset = extension->getOpSets(); + custom_opsets.insert(begin(opset), end(opset)); + } + ngraph::pass::Manager manager; + manager.register_pass( + xmlBuf, binBuf, ngraph::pass::Serialize::Version::IR_V10, + custom_opsets); + manager.run_passes(_ngraph_function); + } catch (const Exception& e) { + return DescriptionBuffer(GENERAL_ERROR, resp) << e.what(); + } catch (const std::exception& e) { + return DescriptionBuffer(UNEXPECTED, resp) << e.what(); + } catch (...) { + return DescriptionBuffer(UNEXPECTED, resp); + } + return OK; +} + +StatusCode CNNNetworkNGraphImpl::serialize(std::ostream& xmlBuf, + Blob::Ptr& binBlob, + ResponseDesc* resp) const noexcept { + try { + std::map custom_opsets; + for (const auto& extension : _ie_extensions) { + auto opset = extension->getOpSets(); + custom_opsets.insert(begin(opset), end(opset)); + } + + std::stringstream binBuf; + ngraph::pass::Manager manager; + manager.register_pass( + xmlBuf, binBuf, ngraph::pass::Serialize::Version::IR_V10, + custom_opsets); + manager.run_passes(_ngraph_function); + + std::streambuf* pbuf = binBuf.rdbuf(); + unsigned long bufSize = binBuf.tellp(); + + TensorDesc tensorDesc(Precision::U8, { bufSize }, Layout::C); + binBlob = make_shared_blob(tensorDesc); + binBlob->allocate(); + pbuf->sgetn(binBlob->buffer(), bufSize); + } catch (const Exception& e) { + return DescriptionBuffer(GENERAL_ERROR, resp) << e.what(); + } catch (const std::exception& e) { + return DescriptionBuffer(UNEXPECTED, resp) << e.what(); + } catch (...) { + return DescriptionBuffer(UNEXPECTED, resp); + } + return OK; +} + StatusCode CNNNetworkNGraphImpl::getOVNameForTensor(std::string& ov_name, const std::string& orig_name, ResponseDesc* resp) const noexcept { if (_tensorNames.find(orig_name) == _tensorNames.end()) return DescriptionBuffer(NOT_FOUND, resp) << "Framework tensor with name \"" << orig_name << "\" was not mapped to OpenVINO data!"; diff --git a/inference-engine/src/inference_engine/cnn_network_ngraph_impl.hpp b/inference-engine/src/inference_engine/cnn_network_ngraph_impl.hpp index db0d1d9ab49..6fe00b8ad81 100644 --- a/inference-engine/src/inference_engine/cnn_network_ngraph_impl.hpp +++ b/inference-engine/src/inference_engine/cnn_network_ngraph_impl.hpp @@ -79,6 +79,12 @@ public: StatusCode serialize(const std::string& xmlPath, const std::string& binPath, ResponseDesc* resp) const noexcept override; + StatusCode serialize(std::ostream& xmlBuf, std::ostream& binBuf, ResponseDesc* resp) const + noexcept override; + + StatusCode serialize(std::ostream& xmlBuf, Blob::Ptr& binBlob, ResponseDesc* resp) const + noexcept override; + StatusCode getOVNameForTensor(std::string& ov_name, const std::string& orig_name, ResponseDesc* resp) const noexcept override; // used by convertFunctionToICNNNetwork from legacy library diff --git a/inference-engine/src/inference_engine/cpp/ie_cnn_network.cpp b/inference-engine/src/inference_engine/cpp/ie_cnn_network.cpp index 52ae8998038..e2506d6cdca 100644 --- a/inference-engine/src/inference_engine/cpp/ie_cnn_network.cpp +++ b/inference-engine/src/inference_engine/cpp/ie_cnn_network.cpp @@ -124,6 +124,14 @@ void CNNNetwork::serialize(const std::string& xmlPath, const std::string& binPat CALL_STATUS_FNC(serialize, xmlPath, binPath); } +void CNNNetwork::serialize(std::ostream& xmlBuf, std::ostream& binBuf) const { + CALL_STATUS_FNC(serialize, xmlBuf, binBuf); +} + +void CNNNetwork::serialize(std::ostream& xmlBuf, Blob::Ptr& binBlob) const { + CALL_STATUS_FNC(serialize, xmlBuf, binBlob); +} + std::string CNNNetwork::getOVNameForTensor(const std::string& orig_name) const { std::string ov_name; CALL_STATUS_FNC(getOVNameForTensor, ov_name, orig_name); diff --git a/inference-engine/src/legacy_api/include/legacy/cnn_network_impl.hpp b/inference-engine/src/legacy_api/include/legacy/cnn_network_impl.hpp index 8151832d027..4849f4d0193 100644 --- a/inference-engine/src/legacy_api/include/legacy/cnn_network_impl.hpp +++ b/inference-engine/src/legacy_api/include/legacy/cnn_network_impl.hpp @@ -122,6 +122,12 @@ public: StatusCode serialize(const std::string& xmlPath, const std::string& binPath, ResponseDesc* resp) const noexcept override; + StatusCode serialize(std::ostream& xmlBuf, std::ostream& binBuf, ResponseDesc* resp) const + noexcept override; + + StatusCode serialize(std::ostream& xmlBuf, Blob::Ptr& binBlob, ResponseDesc* resp) const + noexcept override; + protected: std::map _data; std::map _layers; diff --git a/inference-engine/src/legacy_api/src/cnn_network_impl.cpp b/inference-engine/src/legacy_api/src/cnn_network_impl.cpp index c332d2e07ae..a7309caca69 100644 --- a/inference-engine/src/legacy_api/src/cnn_network_impl.cpp +++ b/inference-engine/src/legacy_api/src/cnn_network_impl.cpp @@ -408,6 +408,17 @@ StatusCode CNNNetworkImpl::serialize(const std::string& xmlPath, const std::stri return DescriptionBuffer(NOT_IMPLEMENTED, resp) << "The CNNNetworkImpl::serialize is not implemented"; } + +StatusCode CNNNetworkImpl::serialize(std::ostream& xmlBuf, std::ostream& binBuf, ResponseDesc* resp) const + noexcept { + return DescriptionBuffer(NOT_IMPLEMENTED, resp) << "The CNNNetworkImpl::serialize is not implemented"; +} + +StatusCode CNNNetworkImpl::serialize(std::ostream& xmlBuf, Blob::Ptr& binBlob, ResponseDesc* resp) const + noexcept { + return DescriptionBuffer(NOT_IMPLEMENTED, resp) << "The CNNNetworkImpl::serialize is not implemented"; +} + StatusCode CNNNetworkImpl::setBatchSize(size_t size, ResponseDesc* responseDesc) noexcept { try { auto originalBatchSize = getBatchSize(); diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp index efc99bddb84..9d10ad036da 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph.cpp @@ -977,17 +977,16 @@ void MKLDNNGraph::getOutputBlobs(InferenceEngine::BlobMap &resp) { } } -void MKLDNNGraph::DropNode(const MKLDNNNodePtr &node) { - auto removeEdge = [](MKLDNNGraph &graph, MKLDNNEdgePtr& edge) { - auto& edges = graph.GetEdges(); - for (auto it = edges.begin(); it != edges.end(); it++) { - if ((*it) == edge) { - edges.erase(it); - return; - } +void MKLDNNGraph::RemoveEdge(MKLDNNEdgePtr& edge) { + for (auto it = graphEdges.begin(); it != graphEdges.end(); it++) { + if ((*it) == edge) { + graphEdges.erase(it); + return; } - }; + } +} +void MKLDNNGraph::DropNode(const MKLDNNNodePtr &node) { auto children = node->childEdges; auto parents = node->parentEdges; @@ -1009,14 +1008,14 @@ void MKLDNNGraph::DropNode(const MKLDNNNodePtr &node) { if (remEdge) { inNum = remEdge->getInputNum(); remEdge->drop(); - removeEdge(*this, remEdge); + RemoveEdge(remEdge); } remEdge = children[j].lock(); int outNum = 0; if (remEdge) { outNum = remEdge->getOutputNum(); remEdge->drop(); - removeEdge(*this, remEdge); + RemoveEdge(remEdge); } MKLDNNEdgePtr newEdge(new MKLDNNEdge(parent, child, inNum, outNum)); graphEdges.push_back(newEdge); @@ -1026,16 +1025,6 @@ void MKLDNNGraph::DropNode(const MKLDNNNodePtr &node) { } void MKLDNNGraph::DropDWConvNode(const MKLDNNNodePtr &node) { - auto removeEdge = [](MKLDNNGraph &graph, MKLDNNEdgePtr& edge) { - auto& edges = graph.GetEdges(); - for (auto it = edges.begin(); it != edges.end(); it++) { - if ((*it) == edge) { - edges.erase(it); - return; - } - } - }; - auto children = node->childEdges; auto parents = node->parentEdges; @@ -1062,14 +1051,14 @@ void MKLDNNGraph::DropDWConvNode(const MKLDNNNodePtr &node) { if (remEdge) { inNum = remEdge->getInputNum(); remEdge->drop(); - removeEdge(*this, remEdge); + RemoveEdge(remEdge); } remEdge = children[j].lock(); int outNum = 0; if (remEdge) { outNum = remEdge->getOutputNum(); remEdge->drop(); - removeEdge(*this, remEdge); + RemoveEdge(remEdge); } MKLDNNEdgePtr newEdge(new MKLDNNEdge(parent, child, inNum, outNum)); graphEdges.push_back(newEdge); @@ -1088,7 +1077,7 @@ void MKLDNNGraph::DropDWConvNode(const MKLDNNNodePtr &node) { if (remEdge) { inNum = remEdge->getInputNum(); remEdge->drop(); - removeEdge(*this, remEdge); + RemoveEdge(remEdge); } int outNum = parentConv->parentEdges.size(); diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph.h b/inference-engine/src/mkldnn_plugin/mkldnn_graph.h index 1b54f71e88c..213fb3b0d54 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph.h +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph.h @@ -101,6 +101,7 @@ public: void RemoveDroppedNodes(); void RemoveDroppedEdges(); + void RemoveEdge(MKLDNNEdgePtr& edge); void DropNode(const MKLDNNNodePtr& node); void DropDWConvNode(const MKLDNNNodePtr& node); diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp index bcd6e2affb2..9811b683ad1 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.cpp @@ -220,14 +220,14 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndBias(MKLDNNGraph &graph) { if (remEdge) { inNum = remEdge->getInputNum(); remEdge->drop(); - removeEdge(graph, remEdge); + graph.RemoveEdge(remEdge); } remEdge = childs[j].lock(); int outNum = 0; if (remEdge) { outNum = remEdge->getOutputNum(); remEdge->drop(); - removeEdge(graph, remEdge); + graph.RemoveEdge(remEdge); } MKLDNNEdgePtr newEdge(new MKLDNNEdge(parent, child, inNum, outNum)); auto &graphEdges = graph.GetEdges(); @@ -240,7 +240,7 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndBias(MKLDNNGraph &graph) { if (remEdge) { inNum = remEdge->getInputNum(); remEdge->drop(); - removeEdge(graph, remEdge); + graph.RemoveEdge(remEdge); } auto parentEltwise = parentNode; @@ -289,7 +289,7 @@ void MKLDNNGraphOptimizer::FuseDeconvolutionAndSimpleOperation(MKLDNNGraph &grap if (p_edge->getParent()->getType() == Deconvolution) continue; - removeEdge(graph, p_edge); + graph.RemoveEdge(p_edge); } graph.DropNode(childNode); @@ -368,14 +368,14 @@ void MKLDNNGraphOptimizer::FuseMultiplyAndAdd(MKLDNNGraph &graph) { if (remEdge) { inNum = remEdge->getInputNum(); remEdge->drop(); - removeEdge(graph, remEdge); + graph.RemoveEdge(remEdge); } remEdge = childs[j].lock(); int outNum = 0; if (remEdge) { outNum = remEdge->getOutputNum(); remEdge->drop(); - removeEdge(graph, remEdge); + graph.RemoveEdge(remEdge); } MKLDNNEdgePtr newEdge(new MKLDNNEdge(parent, child, inNum, outNum)); auto &graphEdges = graph.GetEdges(); @@ -388,7 +388,7 @@ void MKLDNNGraphOptimizer::FuseMultiplyAndAdd(MKLDNNGraph &graph) { if (remEdge) { inNum = remEdge->getInputNum(); remEdge->drop(); - removeEdge(graph, remEdge); + graph.RemoveEdge(remEdge); } auto parentEltwise = parentNode; @@ -568,7 +568,7 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndZeroPoints(MKLDNNGraph &graph) { auto weightsEltwise = conv->getParentEdgesAtPort(1)[0]->getParent(); if (initializeInputZeroPoints(conv, dataEltwise, weightsEltwise)) { auto p_edge = dataEltwise->getParentEdgesAtPort(1)[0]; - removeEdge(graph, p_edge); + graph.RemoveEdge(p_edge); graph.DropNode(dataEltwise); } @@ -620,7 +620,7 @@ void MKLDNNGraphOptimizer::FuseFullyConnectedAndSimpleOperation(MKLDNNGraph &gra if (p_edge->getParent()->getType() == FullyConnected) continue; - removeEdge(graph, p_edge); + graph.RemoveEdge(p_edge); } } @@ -800,7 +800,7 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndSimpleOperationThroughMaxPool(MKLDN if (p_edge->getParent() == childNode) continue; - removeEdge(graph, p_edge); + graph.RemoveEdge(p_edge); } graph.DropNode(fuseCandidate); } @@ -843,7 +843,7 @@ void MKLDNNGraphOptimizer::FuseConvolutionAndSimpleOperation(MKLDNNGraph &graph) if (p_edge->getParent()->getType() == parentNodeType) continue; - removeEdge(graph, p_edge); + graph.RemoveEdge(p_edge); } } @@ -882,7 +882,7 @@ void MKLDNNGraphOptimizer::FusePoolingAndFakeQuantize(MKLDNNGraph &graph) { if (p_edge->getParent()->getType() == Pooling) continue; - removeEdge(graph, p_edge); + graph.RemoveEdge(p_edge); } graph.DropNode(child); @@ -1159,7 +1159,7 @@ void MKLDNNGraphOptimizer::FuseMVNAndSimpleOperation(MKLDNNGraph &graph) { if (p_edge->getParent()->getType() == MVN) continue; - removeEdge(graph, p_edge); + graph.RemoveEdge(p_edge); } } @@ -1211,7 +1211,7 @@ void MKLDNNGraphOptimizer::FuseInterpolateAndSimpleOperation(MKLDNNGraph &graph) if (p_edge->getParent()->getType() == Interpolate) continue; - removeEdge(graph, p_edge); + graph.RemoveEdge(p_edge); } } @@ -1249,7 +1249,7 @@ void MKLDNNGraphOptimizer::FuseNormalizeL2AndSimpleOperation(MKLDNNGraph &graph) if (p_edge->getParent()->getType() == NormalizeL2) continue; - removeEdge(graph, p_edge); + graph.RemoveEdge(p_edge); } } @@ -1310,7 +1310,7 @@ void MKLDNNGraphOptimizer::FuseEltwiseAndSimple(MKLDNNGraph &graph) { if (p_edge->getParent()->getType() == Eltwise) continue; - removeEdge(graph, p_edge); + graph.RemoveEdge(p_edge); } graph.DropNode(childNode); @@ -1338,14 +1338,14 @@ void MKLDNNGraphOptimizer::FuseEltwiseAndSimple(MKLDNNGraph &graph) { if (remEdge) { inNum = remEdge->getInputNum(); remEdge->drop(); - removeEdge(graph, remEdge); + graph.RemoveEdge(remEdge); } remEdge = children[j].lock(); int outNum = 0; if (remEdge) { outNum = remEdge->getOutputNum(); remEdge->drop(); - removeEdge(graph, remEdge); + graph.RemoveEdge(remEdge); } MKLDNNEdgePtr newEdge(new MKLDNNEdge(parent, child, inNum, outNum)); auto &graphEdges = graph.GetEdges(); @@ -1365,7 +1365,7 @@ void MKLDNNGraphOptimizer::FuseEltwiseAndSimple(MKLDNNGraph &graph) { outNum = initialParentInNum + remEdge->getOutputNum() - 1; } remEdge->drop(); - removeEdge(graph, remEdge); + graph.RemoveEdge(remEdge); } MKLDNNEdgePtr newEdge(new MKLDNNEdge(parent, parentNode, inNum, outNum)); @@ -1436,16 +1436,6 @@ void MKLDNNGraphOptimizer::DropDoubleReorders(MKLDNNGraph &graph) { } } -void MKLDNNGraphOptimizer::removeEdge(MKLDNNGraph &graph, MKLDNNEdgePtr& edge) { - auto& edges = graph.GetEdges(); - for (auto it = edges.begin(); it != edges.end(); it++) { - if ((*it) == edge) { - edges.erase(it); - return; - } - } -} - void MKLDNNGraphOptimizer::FuseBroadcastAndEltwise(MKLDNNGraph &graph) { std::vector& graphNodes = graph.GetNodes(); @@ -1654,7 +1644,7 @@ void MKLDNNGraphOptimizer::FusePerformedAsScaleShiftAndFakeQuantize(MKLDNNGraph if (!p_edge->getParent()->isConstant()) continue; - removeEdge(graph, p_edge); + graph.RemoveEdge(p_edge); } graph.DropNode(parent); diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.h b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.h index 66a57c05a4a..cd263547750 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.h +++ b/inference-engine/src/mkldnn_plugin/mkldnn_graph_optimizer.h @@ -39,8 +39,6 @@ private: void FusePerformedAsScaleShiftAndFakeQuantize(MKLDNNGraph &graph); void FuseClampAndFakeQuantize(MKLDNNGraph &graph); void MergeTransposeAndReorder(MKLDNNGraph &graph); - - void removeEdge(MKLDNNGraph &graph, MKLDNNEdgePtr& edge); }; } // namespace MKLDNNPlugin diff --git a/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp b/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp index 3f53db150ce..733d785d594 100644 --- a/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp +++ b/inference-engine/src/mkldnn_plugin/mkldnn_plugin.cpp @@ -56,6 +56,7 @@ #include #include #include +#include #include #include #include diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_detection_output_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_detection_output_node.cpp index 4b8c695a987..0a2f4fc8140 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_detection_output_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_detection_output_node.cpp @@ -14,9 +14,15 @@ using namespace MKLDNNPlugin; using namespace InferenceEngine; template -static bool SortScorePairDescend(const std::pair& pair1, - const std::pair& pair2) { - return pair1.first > pair2.first; +bool SortScorePairDescend(const std::pair& pair1, + const std::pair& pair2) { + return (pair1.first > pair2.first) || (pair1.first == pair2.first && pair1.second < pair2.second); +} + +template <> +bool SortScorePairDescend>(const std::pair>& pair1, + const std::pair>& pair2) { + return (pair1.first > pair2.first) || (pair1.first == pair2.first && pair1.second.second < pair2.second.second); } bool MKLDNNDetectionOutputNode::isSupportedOperation(const std::shared_ptr& op, std::string& errorMessage) noexcept { diff --git a/inference-engine/src/offline_transformations/src/moc_transformations.cpp b/inference-engine/src/offline_transformations/src/moc_transformations.cpp index 50ae6bcaa7e..0b7d66f3743 100644 --- a/inference-engine/src/offline_transformations/src/moc_transformations.cpp +++ b/inference-engine/src/offline_transformations/src/moc_transformations.cpp @@ -17,6 +17,7 @@ #include #include #include +#include NGRAPH_RTTI_DEFINITION(ngraph::pass::MOCTransformations, "MOCTransformations", 0); @@ -35,6 +36,7 @@ bool ngraph::pass::MOCTransformations::run_on_function(std::shared_ptr(); manager.register_pass(); manager.register_pass(); + manager.register_pass(); auto common_fusions = manager.register_pass(); common_fusions->add_matcher(); diff --git a/inference-engine/src/plugin_api/ie_ngraph_utils.hpp b/inference-engine/src/plugin_api/ie_ngraph_utils.hpp index 40904bb0721..48a9a026dac 100644 --- a/inference-engine/src/plugin_api/ie_ngraph_utils.hpp +++ b/inference-engine/src/plugin_api/ie_ngraph_utils.hpp @@ -134,6 +134,8 @@ inline Precision convertPrecision(const ::ngraph::element::Type& precision) { return Precision(Precision::BIN); case ::ngraph::element::Type_t::boolean: return Precision(Precision::BOOL); + case ::ngraph::element::Type_t::dynamic: + return Precision(Precision::UNSPECIFIED); default: IE_THROW() << "Incorrect precision " << precision.get_type_name() << "!"; return{}; } diff --git a/inference-engine/src/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.cpp b/inference-engine/src/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.cpp index 390d41ce24a..cba0b9b5da0 100644 --- a/inference-engine/src/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.cpp +++ b/inference-engine/src/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.cpp @@ -29,19 +29,6 @@ namespace InferenceEngine { namespace gapi { namespace kernels { namespace neon { -void calcRowArea_8U(uchar dst[], const uchar *src[], const Size& inSz, - const Size& outSz, Q0_16 yalpha, const MapperUnit8U &ymap, - int xmaxdf, const short xindex[], const Q0_16 xalpha[], - Q8_8 vbuf[]) { - calcRowArea_impl(dst, src, inSz, outSz, yalpha, ymap, xmaxdf, xindex, xalpha, vbuf); -} - -void calcRowArea_32F(float dst[], const float *src[], const Size& inSz, - const Size& outSz, float yalpha, const MapperUnit32F& ymap, - int xmaxdf, const int xindex[], const float xalpha[], - float vbuf[]) { - calcRowArea_impl(dst, src, inSz, outSz, yalpha, ymap, xmaxdf, xindex, xalpha, vbuf); -} template CV_ALWAYS_INLINE void channels2planes_store(std::array, chanNum>& dst, @@ -649,6 +636,16 @@ template void mergeRowImpl(neon_tag, const std::array(neon_tag, uint8_t dst[], const uint8_t* src[], const Size& inSz, + const Size& outSz, Q0_16 yalpha, const MapperUnit8U &ymap, + int xmaxdf, const short xindex[], const Q0_16 xalpha[], + Q8_8 vbuf[]); + +template void calcRowAreaImpl(neon_tag, float dst[], const float *src[], const Size& inSz, + const Size& outSz, float yalpha, const MapperUnit32F& ymap, + int xmaxdf, const int xindex[], const float xalpha[], + float vbuf[]); } // namespace kernels } // namespace gapi } // namespace InferenceEngine diff --git a/inference-engine/src/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.hpp b/inference-engine/src/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.hpp index dba6fe63f1d..5d4173bae4a 100644 --- a/inference-engine/src/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.hpp +++ b/inference-engine/src/preprocessing/arm_neon/ie_preprocess_gapi_kernels_neon.hpp @@ -32,41 +32,19 @@ void calcRowArea_32F(float dst[], const float *src[], const Size &inSz, const Si template void chanToPlaneRowImpl(isa_tag_t, const T* in, const int chan, const int chs, T* out, const int length); -extern template void chanToPlaneRowImpl(neon_tag, const uint8_t* in, const int chan, const int chs, uint8_t* out, const int length); -extern template void chanToPlaneRowImpl(neon_tag, const float* in, const int chan, const int chs, float * out, const int length); - template void nv12ToRgbRowImpl(isa_tag_t, const uint8_t** y_rows, const uint8_t* uv_row, uint8_t** out_rows, const int buf_width); -extern template void nv12ToRgbRowImpl(neon_tag, const uint8_t** y_rows, const uint8_t* uv_row, uint8_t** out_rows, const int buf_width); - template void i420ToRgbRowImpl(isa_tag_t, const uint8_t** y_rows, const uint8_t* u_row, const uint8_t* v_row, uint8_t** out_rows, const int buf_width); -extern template void i420ToRgbRowImpl(neon_tag, const uint8_t** y_rows, const uint8_t* u_row, - const uint8_t* v_row, uint8_t** out_rows, const int buf_width); - template void splitRowImpl(isa_tag_t, const T* in, std::array& outs, const int length); -extern template void splitRowImpl(neon_tag, const uint8_t* in, std::array& outs, const int length); -extern template void splitRowImpl(neon_tag, const float* in, std::array& outs, const int length); -extern template void splitRowImpl(neon_tag, const uint8_t* in, std::array& outs, const int length); -extern template void splitRowImpl(neon_tag, const float* in, std::array& outs, const int length); -extern template void splitRowImpl(neon_tag, const uint8_t* in, std::array& outs, const int length); -extern template void splitRowImpl(neon_tag, const float* in, std::array& outs, const int length); - template void mergeRowImpl(isa_tag_t, const std::array& ins, T* out, const int length); -extern template void mergeRowImpl(neon_tag, const std::array& ins, uint8_t* out, const int length); -extern template void mergeRowImpl(neon_tag, const std::array& ins, float* out, const int length); -extern template void mergeRowImpl(neon_tag, const std::array& ins, uint8_t* out, const int length); -extern template void mergeRowImpl(neon_tag, const std::array& ins, float* out, const int length); -extern template void mergeRowImpl(neon_tag, const std::array& ins, uint8_t* out, const int length); -extern template void mergeRowImpl(neon_tag, const std::array& ins, float* out, const int length); - template bool calcRowLinear8UC1Impl(isa_tag_t, uint8_t* dst[], const uint8_t* src0[], const uint8_t* src1[], const short alpha[], const short clone[], const short mapsx[], @@ -79,18 +57,17 @@ void calcRowLinear32FC1Impl(isa_tag_t, float* dst[], const float* src0[], const const float beta[], const Size& inSz, const Size& outSz, const int lpi, const int l); -extern template void calcRowLinear32FC1Impl(neon_tag, float* dst[], const float* src0[], - const float* src1[], const float alpha[], - const int mapsx[], const float beta[], - const Size& inSz, const Size& outSz, - const int lpi, const int l); - template bool calcRowLinear8UC3C4Impl(isa_tag_t, std::array, chs>& dst, const uint8_t* src0[], const uint8_t* src1[], const short alpha[], const short clone[], const short mapsx[], const short beta[], uint8_t tmp[], const Size& inSz, const Size& outSz, const int lpi, const int l); + +template +void calcRowAreaImpl(isa_tag_t, T dst[], const T* src[], const Size& inSz, + const Size& outSz, A yalpha, const MapperUnit& ymap, + int xmaxdf, const I xindex[], const A xalpha[], W vbuf[]); } // namespace kernels } // namespace gapi } // namespace InferenceEngine diff --git a/inference-engine/src/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.cpp b/inference-engine/src/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.cpp index c5588b0cf39..fcc13cce4ea 100644 --- a/inference-engine/src/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.cpp +++ b/inference-engine/src/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.cpp @@ -47,20 +47,6 @@ namespace kernels { namespace avx { -void calcRowArea_8U(uchar dst[], const uchar *src[], const Size& inSz, - const Size& outSz, Q0_16 yalpha, const MapperUnit8U &ymap, - int xmaxdf, const short xindex[], const Q0_16 xalpha[], - Q8_8 vbuf[]) { - calcRowArea_impl(dst, src, inSz, outSz, yalpha, ymap, xmaxdf, xindex, xalpha, vbuf); -} - -void calcRowArea_32F(float dst[], const float *src[], const Size& inSz, - const Size& outSz, float yalpha, const MapperUnit32F& ymap, - int xmaxdf, const int xindex[], const float xalpha[], - float vbuf[]) { - calcRowArea_impl(dst, src, inSz, outSz, yalpha, ymap, xmaxdf, xindex, xalpha, vbuf); -} - CV_ALWAYS_INLINE void main_computation_horizontalPass_lpi4(const v_uint8& val_0, const v_uint8& val_1, const v_uint8& val_2, @@ -528,6 +514,16 @@ template void calcRowLinear32FC1Impl(avx2_tag, float* dst[], const float* src0[] const float alpha[], const int mapsx[], const float beta[], const Size& inSz, const Size& outSz, const int lpi, const int l); + +template void calcRowAreaImpl(avx2_tag, uint8_t dst[], const uint8_t* src[], const Size& inSz, + const Size& outSz, Q0_16 yalpha, const MapperUnit8U &ymap, + int xmaxdf, const short xindex[], const Q0_16 xalpha[], + Q8_8 vbuf[]); + +template void calcRowAreaImpl(avx2_tag, float dst[], const float *src[], const Size& inSz, + const Size& outSz, float yalpha, const MapperUnit32F& ymap, + int xmaxdf, const int xindex[], const float xalpha[], + float vbuf[]); } // namespace kernels } // namespace gapi } // namespace InferenceEngine diff --git a/inference-engine/src/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.hpp b/inference-engine/src/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.hpp index 73562c3920e..3457134303c 100644 --- a/inference-engine/src/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.hpp +++ b/inference-engine/src/preprocessing/cpu_x86_avx2/ie_preprocess_gapi_kernels_avx2.hpp @@ -44,44 +44,20 @@ void calcRowArea_CVKL_U8_SSE42(const uchar * src[], template void chanToPlaneRowImpl(isa_tag_t, const T* in, const int chan, const int chs, T* out, const int length); -extern template void chanToPlaneRowImpl(avx2_tag, const uint8_t* in, const int chan, const int chs, uint8_t* out, const int length); -extern template void chanToPlaneRowImpl(avx2_tag, const float* in, const int chan, const int chs, float * out, const int length); - template void nv12ToRgbRowImpl(isa_tag_t, const uint8_t** y_rows, const uint8_t* uv_row, uint8_t** out_rows, const int buf_width); -extern template void nv12ToRgbRowImpl(avx2_tag, const uint8_t** y_rows, - const uint8_t* uv_row, uint8_t** out_rows, - const int buf_width); - template void i420ToRgbRowImpl(isa_tag_t, const uint8_t** y_rows, const uint8_t* u_row, const uint8_t* v_row, uint8_t** out_rows, const int buf_width); -extern template void i420ToRgbRowImpl(avx2_tag, const uint8_t** y_rows, const uint8_t* u_row, - const uint8_t* v_row, uint8_t** out_rows, const int buf_width); - template void splitRowImpl(isa_tag_t, const T* in, std::array& outs, const int length); -extern template void splitRowImpl(avx2_tag, const uint8_t* in, std::array& outs, const int length); -extern template void splitRowImpl(avx2_tag, const float* in, std::array& outs, const int length); -extern template void splitRowImpl(avx2_tag, const uint8_t* in, std::array& outs, const int length); -extern template void splitRowImpl(avx2_tag, const float* in, std::array& outs, const int length); -extern template void splitRowImpl(avx2_tag, const uint8_t* in, std::array& outs, const int length); -extern template void splitRowImpl(avx2_tag, const float* in, std::array& outs, const int length); - template void mergeRowImpl(isa_tag_t, const std::array& ins, T* out, const int length); -extern template void mergeRowImpl(avx2_tag, const std::array& ins, uint8_t* out, const int length); -extern template void mergeRowImpl(avx2_tag, const std::array& ins, float* out, const int length); -extern template void mergeRowImpl(avx2_tag, const std::array& ins, uint8_t* out, const int length); -extern template void mergeRowImpl(avx2_tag, const std::array& ins, float* out, const int length); -extern template void mergeRowImpl(avx2_tag, const std::array& ins, uint8_t* out, const int length); -extern template void mergeRowImpl(avx2_tag, const std::array& ins, float* out, const int length); - template bool calcRowLinear8UC1Impl(isa_tag_t, uint8_t* dst[], const uint8_t* src0[], const uint8_t* src1[], const short alpha[], const short clone[], const short mapsx[], @@ -94,17 +70,17 @@ void calcRowLinear32FC1Impl(isa_tag_t, float* dst[], const float* src0[], const const float beta[], const Size& inSz, const Size& outSz, const int lpi, const int l); -extern template void calcRowLinear32FC1Impl(avx2_tag, float* dst[], const float* src0[], const float* src1[], - const float alpha[], const int mapsx[], - const float beta[], const Size& inSz, const Size& outSz, - const int lpi, const int l); - template bool calcRowLinear8UC3C4Impl(isa_tag_t, std::array, chs>& dst, const uint8_t* src0[], const uint8_t* src1[], const short alpha[], const short clone[], const short mapsx[], const short beta[], uint8_t tmp[], const Size& inSz, const Size& outSz, const int lpi, const int l); + +template +void calcRowAreaImpl(isa_tag_t, T dst[], const T* src[], const Size& inSz, + const Size& outSz, A yalpha, const MapperUnit& ymap, + int xmaxdf, const I xindex[], const A xalpha[], W vbuf[]); } // namespace kernels } // namespace gapi } // namespace InferenceEngine diff --git a/inference-engine/src/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.cpp b/inference-engine/src/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.cpp index 6d7520193ce..1266e389dca 100644 --- a/inference-engine/src/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.cpp +++ b/inference-engine/src/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.cpp @@ -41,20 +41,6 @@ namespace kernels { namespace avx512 { -void calcRowArea_8U(uchar dst[], const uchar *src[], const Size& inSz, - const Size& outSz, Q0_16 yalpha, const MapperUnit8U &ymap, - int xmaxdf, const short xindex[], const Q0_16 xalpha[], - Q8_8 vbuf[]) { - calcRowArea_impl(dst, src, inSz, outSz, yalpha, ymap, xmaxdf, xindex, xalpha, vbuf); -} - -void calcRowArea_32F(float dst[], const float *src[], const Size& inSz, - const Size& outSz, float yalpha, const MapperUnit32F& ymap, - int xmaxdf, const int xindex[], const float xalpha[], - float vbuf[]) { - calcRowArea_impl(dst, src, inSz, outSz, yalpha, ymap, xmaxdf, xindex, xalpha, vbuf); -} - CV_ALWAYS_INLINE void verticalPass_lpi4_8U(const uint8_t* src0[], const uint8_t* src1[], uint8_t tmp[], const short beta[], const v_uint8& shuf_mask, const int width) { @@ -555,6 +541,16 @@ template void calcRowLinear32FC1Impl(avx512_tag, float* dst[], const float* src0 const int mapsx[], const float beta[], const Size& inSz, const Size& outSz, const int lpi, const int l); + +template void calcRowAreaImpl(avx512_tag, uint8_t dst[], const uint8_t* src[], const Size& inSz, + const Size& outSz, Q0_16 yalpha, const MapperUnit8U &ymap, + int xmaxdf, const short xindex[], const Q0_16 xalpha[], + Q8_8 vbuf[]); + +template void calcRowAreaImpl(avx512_tag, float dst[], const float *src[], const Size& inSz, + const Size& outSz, float yalpha, const MapperUnit32F& ymap, + int xmaxdf, const int xindex[], const float xalpha[], + float vbuf[]); } // namespace kernels } // namespace gapi } // namespace InferenceEngine diff --git a/inference-engine/src/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.hpp b/inference-engine/src/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.hpp index bbd43dcbd63..e95acb6004c 100644 --- a/inference-engine/src/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.hpp +++ b/inference-engine/src/preprocessing/cpu_x86_avx512/ie_preprocess_gapi_kernels_avx512.hpp @@ -44,41 +44,19 @@ void calcRowArea_CVKL_U8(const uchar * src[], template void chanToPlaneRowImpl(isa_tag_t, const T* in, const int chan, const int chs, T* out, const int length); -extern template void chanToPlaneRowImpl(avx512_tag, const uint8_t* in, const int chan, const int chs, uint8_t* out, const int length); -extern template void chanToPlaneRowImpl(avx512_tag, const float* in, const int chan, const int chs, float* out, const int length); - template void nv12ToRgbRowImpl(isa_tag_t, const uint8_t** y_rows, const uint8_t* uv_row, uint8_t** out_rows, const int buf_width); -extern template void nv12ToRgbRowImpl(avx512_tag, const uint8_t** y_rows, const uint8_t* uv_row, uint8_t** out_rows, const int buf_width); - template void i420ToRgbRowImpl(isa_tag_t, const uint8_t** y_rows, const uint8_t* u_row, const uint8_t* v_row, uint8_t** out_rows, const int buf_width); -extern template void i420ToRgbRowImpl(avx512_tag, const uint8_t** y_rows, const uint8_t* u_row, - const uint8_t* v_row, uint8_t** out_rows, const int buf_width); - template void splitRowImpl(isa_tag_t, const T* in, std::array& outs, const int length); -extern template void splitRowImpl(avx512_tag, const uint8_t* in, std::array& outs, const int length); -extern template void splitRowImpl(avx512_tag, const float* in, std::array& outs, const int length); -extern template void splitRowImpl(avx512_tag, const uint8_t* in, std::array& outs, const int length); -extern template void splitRowImpl(avx512_tag, const float* in, std::array& outs, const int length); -extern template void splitRowImpl(avx512_tag, const uint8_t* in, std::array& outs, const int length); -extern template void splitRowImpl(avx512_tag, const float* in, std::array& outs, const int length); - template void mergeRowImpl(isa_tag_t, const std::array& ins, T* out, const int length); -extern template void mergeRowImpl(avx512_tag, const std::array& ins, uint8_t* out, const int length); -extern template void mergeRowImpl(avx512_tag, const std::array& ins, float* out, const int length); -extern template void mergeRowImpl(avx512_tag, const std::array& ins, uint8_t* out, const int length); -extern template void mergeRowImpl(avx512_tag, const std::array& ins, float* out, const int length); -extern template void mergeRowImpl(avx512_tag, const std::array& ins, uint8_t* out, const int length); -extern template void mergeRowImpl(avx512_tag, const std::array& ins, float* out, const int length); - template bool calcRowLinear8UC1Impl(isa_tag_t, uint8_t* dst[], const uint8_t* src0[], const uint8_t* src1[], const short alpha[], const short clone[], const short mapsx[], @@ -91,17 +69,17 @@ void calcRowLinear32FC1Impl(isa_tag_t, float* dst[], const float* src0[], const const float beta[], const Size& inSz, const Size& outSz, const int lpi, const int l); -extern template void calcRowLinear32FC1Impl(avx512_tag, float* dst[], const float* src0[], const float* src1[], - const float alpha[], const int mapsx[], - const float beta[], const Size& inSz, const Size& outSz, - const int lpi, const int l); - template bool calcRowLinear8UC3C4Impl(isa_tag_t, std::array, chs>& dst, const uint8_t* src0[], const uint8_t* src1[], const short alpha[], const short clone[], const short mapsx[], const short beta[], uint8_t tmp[], const Size& inSz, const Size& outSz, const int lpi, const int l); + +template +void calcRowAreaImpl(isa_tag_t, T dst[], const T* src[], const Size& inSz, + const Size& outSz, A yalpha, const MapperUnit& ymap, + int xmaxdf, const I xindex[], const A xalpha[], W vbuf[]); } // namespace kernels } // namespace gapi } // namespace InferenceEngine diff --git a/inference-engine/src/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.cpp b/inference-engine/src/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.cpp index 5ddf951db8a..646d334a111 100644 --- a/inference-engine/src/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.cpp +++ b/inference-engine/src/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.cpp @@ -949,20 +949,6 @@ bool calcRowLinear8UC3C4Impl(sse42_tag, return calcRowLinear_8UC_Impl_(sse42_tag{}, dst, src0, src1, alpha, clone, mapsx, beta, tmp, inSz, outSz, lpi); } -//------------------------------------------------------------------------------ - -void calcRowArea_8U(uchar dst[], const uchar *src[], const Size& inSz, const Size& outSz, - Q0_16 yalpha, const MapperUnit8U &ymap, int xmaxdf, const short xindex[], const Q0_16 xalpha[], - Q8_8 vbuf[]) { - calcRowArea_impl(dst, src, inSz, outSz, yalpha, ymap, xmaxdf, xindex, xalpha, vbuf); -} - -void calcRowArea_32F(float dst[], const float *src[], const Size& inSz, const Size& outSz, - float yalpha, const MapperUnit32F& ymap, int xmaxdf, const int xindex[], const float xalpha[], - float vbuf[]) { - calcRowArea_impl(dst, src, inSz, outSz, yalpha, ymap, xmaxdf, xindex, xalpha, vbuf); -} - //------------------------------------------------------------------------------ #if USE_CVKL @@ -1296,6 +1282,16 @@ template void calcRowLinear32FC1Impl(sse42_tag, float* dst[], const float* src0[ const float alpha[], const int mapsx[], const float beta[], const Size& inSz, const Size& outSz, const int lpi, const int l); + +template void calcRowAreaImpl(sse42_tag, uint8_t dst[], const uint8_t* src[], const Size& inSz, + const Size& outSz, Q0_16 yalpha, const MapperUnit8U &ymap, + int xmaxdf, const short xindex[], const Q0_16 xalpha[], + Q8_8 vbuf[]); + +template void calcRowAreaImpl(sse42_tag, float dst[], const float *src[], const Size& inSz, + const Size& outSz, float yalpha, const MapperUnit32F& ymap, + int xmaxdf, const int xindex[], const float xalpha[], + float vbuf[]); } // namespace kernels } // namespace gapi } // namespace InferenceEngine diff --git a/inference-engine/src/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.hpp b/inference-engine/src/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.hpp index c71ebc93e78..f7aa5b40189 100644 --- a/inference-engine/src/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.hpp +++ b/inference-engine/src/preprocessing/cpu_x86_sse42/ie_preprocess_gapi_kernels_sse42.hpp @@ -75,6 +75,11 @@ bool calcRowLinear8UC3C4Impl(isa_tag_t, std::array, chs> const short alpha[], const short clone[], const short mapsx[], const short beta[], uint8_t tmp[], const Size& inSz, const Size& outSz, const int lpi, const int l); + +template +void calcRowAreaImpl(isa_tag_t, T dst[], const T* src[], const Size& inSz, + const Size& outSz, A yalpha, const MapperUnit& ymap, + int xmaxdf, const I xindex[], const A xalpha[], W vbuf[]); } // namespace kernels } // namespace gapi } // namespace InferenceEngine diff --git a/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels.cpp b/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels.cpp index c465c49f4a7..7aa5bcb1b85 100644 --- a/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels.cpp +++ b/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels.cpp @@ -584,9 +584,9 @@ struct typed_resizeLinearU8C1 { const short beta[], uint8_t tmp[], const Size& inSz, const Size& outSz, const int lpi, const int length) { if (!calcRowLinear8UC1Impl(isa_tag_t{}, dst, src0, - src1, alpha, clone, - mapsx, beta, tmp, - inSz, outSz, lpi, length)) + src1, alpha, clone, + mapsx, beta, tmp, + inSz, outSz, lpi, length)) calcRowLinear8UC1Impl(scalar_tag{}, dst, src0, src1, alpha, clone, mapsx, beta, tmp, inSz, outSz, lpi, length); }; @@ -738,6 +738,539 @@ struct typed_resizeLinearU8C3C4 { }; } // namespace +template +struct AreaDownMapper { + typedef A alpha_type; + typedef I index_type; + typedef W work_type; + + typedef MapperUnit Unit; + + inline Unit map(int outCoord) { + double inCoord0 = outCoord * ratio; + double inCoord1 = (outCoord + 1) * ratio; + + double index0 = std::floor(inCoord0 + 0.001); + double index1 = std::ceil(inCoord1 - 0.001); + + double alpha0 = (index0 + 1 - inCoord0) * inv_ratio; + double alpha1 = - (index1 - 1 - inCoord1) * inv_ratio; + + GAPI_Assert((0 <= outCoord) && (outCoord <= outSz-1)); + GAPI_Assert((0 <= index0) && (index0 < index1) && (index1 <= inSz)); + + Unit unit; + + unit.index0 = checked_cast(index0); + unit.index1 = checked_cast(index1); + + unit.alpha0 = convert_cast(alpha0); + unit.alpha1 = convert_cast(alpha1); + + return unit; + } + + int inSz, outSz; + double ratio, inv_ratio; + + alpha_type alpha; // == inv_ratio, rounded + + AreaDownMapper(int _inSz, int _outSz) { + inSz = _inSz; + outSz = _outSz; + + inv_ratio = invRatio(inSz, outSz); + ratio = 1.0 / inv_ratio; + + alpha = convert_cast(inv_ratio); + } +}; + +namespace areaDownscale32f { +struct Mapper: public AreaDownMapper { + Mapper(int _inSz, int _outSz):AreaDownMapper(_inSz, _outSz) {} +}; +} + +namespace areaDownscale8u { +struct Mapper: public AreaDownMapper { + Mapper(int _inSz, int _outSz):AreaDownMapper(_inSz, _outSz) {} +}; +} + +namespace areaUpscale { +struct Mapper { + typedef short alpha_type; + typedef short index_type; + constexpr static const int unity = ONE; + + typedef MapperUnit Unit; + + static inline Unit map(double ratio, int start, int max, int outCoord) { + const int s = cvFloor(outCoord*ratio); + float res = static_cast((outCoord + 1) - (s + 1)/ratio); + res = res <= 0 ? 0.f : res - cvFloor(res); + + Unit u; + + u.index0 = std::max(s - start, 0); + u.index1 = ((res == 0.0) || (s + 1 >= max)) ? s - start : s - start + 1; + + u.alpha0 = saturate_cast(ONE * (1.0f - res)); + u.alpha1 = saturate_cast(ONE * res); + + return u; + } +}; +} // namespace areaUpscale + +namespace areaUpscale32f { +struct Mapper { + typedef float alpha_type; + typedef int index_type; + constexpr static const float unity = 1; + + typedef MapperUnit Unit; + + static inline Unit map(double ratio, int start, int max, int outCoord) { + int s = cvFloor(outCoord*ratio); + float f = static_cast((outCoord+1) - (s+1)/ratio); + f = f <= 0 ? 0.f : f - cvFloor(f); + + Unit u; + + u.index0 = std::max(s - start, 0); + u.index1 = ((f == 0.0) || s + 1 >= max) ? s - start : s - start + 1; + + u.alpha0 = 1.0f - f; + u.alpha1 = f; + + return u; + } +}; +} // namespace areaUpscale32f + +template +static void initScratchArea(const cv::GMatDesc& in, const Size& outSz, + cv::gapi::fluid::Buffer &scratch) { + using Unit = typename Mapper::Unit; + using alpha_type = typename Mapper::alpha_type; + using index_type = typename Mapper::index_type; + + // compute the chunk of input pixels for each output pixel, + // along with the coefficients for taking the weigthed sum + + Size inSz = in.size; + Mapper mapper(inSz.width, outSz.width); + + std::vector xmaps(outSz.width); + int maxdif = 0; + + for (int w = 0; w < outSz.width; w++) { + Unit map = mapper.map(w); + xmaps[w] = map; + + maxdif = std::max(maxdif, map.index1 - map.index0); + } + + // This assertion is critical for our trick with chunk sizes: + // we would expand a chunk it is smaller than maximal size + GAPI_Assert(inSz.width >= maxdif); + + // pack the input chunks positions and coefficients into scratch-buffer, + // along with the maximal size of chunk (note that chunk size may vary) + + size_t scratch_bytes = sizeof(int) + + outSz.width * sizeof(index_type) + + outSz.width * sizeof(alpha_type) * maxdif + + inSz.width * sizeof(alpha_type); + Size scratch_size{static_cast(scratch_bytes), 1}; + + cv::GMatDesc desc(CV_8UC1, 1, scratch_size); + + cv::gapi::fluid::Buffer buffer(desc); + scratch = std::move(buffer); + + auto *maxdf = scratch.OutLine(); + auto *index = reinterpret_cast(maxdf + 1); + auto *alpha = reinterpret_cast(index + outSz.width); + + for (int w = 0; w < outSz.width; w++) { + // adjust input indices so that: + // - data chunk is exactly maxdif pixels + // - data chunk fits inside input width + int index0 = xmaps[w].index0; + int index1 = xmaps[w].index1; + int i0 = index0; + int i1 = index1; + i1 = std::min(i0 + maxdif, in.size.width); + i0 = i1 - maxdif; + GAPI_DbgAssert(i0 >= 0); + + // fulfill coefficients for the data chunk, + // extending with zeros if any extra pixels + alpha_type *alphaw = &alpha[w * maxdif]; + for (int i = 0; i < maxdif; i++) { + if (i + i0 == index0) { + alphaw[i] = xmaps[w].alpha0; + + } else if (i + i0 == index1 - 1) { + alphaw[i] = xmaps[w].alpha1; + + } else if (i + i0 > index0 && i + i0 < index1 - 1) { + alphaw[i] = mapper.alpha; + + } else { + alphaw[i] = 0; + } + } + + // start input chunk with adjusted position + index[w] = i0; + } + + *maxdf = maxdif; +} + +#if USE_CVKL +static int getResizeAreaTabSize(int dst_go, int ssize, int dsize, float scale) { + static const float threshold = 1e-3f; + int max_count = 0; + + for (int col = dst_go; col < dst_go + dsize; col++) { + int count = 0; + + float fsx1 = col * scale; + float fsx2 = fsx1 + scale; + + int sx1 = static_cast(ceil(fsx1)); + int sx2 = static_cast(floor(fsx2)); + + sx2 = std::min(sx2, ssize - 1); + sx1 = std::min(sx1, sx2); + + if ((sx1 - fsx1) > threshold) { + count++; + } + + for (int sx = sx1; sx < sx2; sx++) { + count++; + } + + if ((fsx2 - sx2) > threshold) { + count++; + } + max_count = std::max(max_count, count); + } + + return max_count; +} + +// taken from: ie_preprocess_data.cpp +static void computeResizeAreaTab(int src_go, int dst_go, int ssize, int dsize, float scale, + uint16_t* si, uint16_t* alpha, int max_count) { + static const float threshold = 1e-3f; + int k = 0; + + for (int col = dst_go; col < dst_go + dsize; col++) { + int count = 0; + + float fsx1 = col * scale; + float fsx2 = fsx1 + scale; + float cellWidth = (std::min)(scale, ssize - fsx1); + + int sx1 = static_cast(ceil(fsx1)); + int sx2 = static_cast(floor(fsx2)); + + sx2 = (std::min)(sx2, ssize - 1); + sx1 = (std::min)(sx1, sx2); + + si[col - dst_go] = (uint16_t)(sx1 - src_go); + + if (sx1 - fsx1 > threshold) { + si[col - dst_go] = (uint16_t)(sx1 - src_go - 1); + alpha[k++] = (uint16_t)((1 << 16) * ((sx1 - fsx1) / cellWidth)); + count++; + } + + for (int sx = sx1; sx < sx2; sx++) { + alpha[k++] = (uint16_t)((1 << 16) * (1.0f / cellWidth)); + count++; + } + + if (fsx2 - sx2 > threshold) { + alpha[k++] = (uint16_t)((1 << 16) * ((std::min)((std::min)(fsx2 - sx2, 1.f), cellWidth) / cellWidth)); + count++; + } + + if (count != max_count) { + alpha[k++] = 0; + } + } +} + +// teken from: ie_preprocess_data.cpp +static void generate_alpha_and_id_arrays(int x_max_count, int dcols, const uint16_t* xalpha, uint16_t* xsi, + uint16_t** alpha, uint16_t** sxid) { + if (x_max_count <= 4) { + for (int col = 0; col < dcols; col++) { + for (int x = 0; x < x_max_count; x++) { + alpha[x][col] = xalpha[col*x_max_count + x]; + } + } + } + if (x_max_count <= 4) { + for (int col = 0; col <= dcols - 8; col += 8) { + for (int chunk_num_h = 0; chunk_num_h < x_max_count; chunk_num_h++) { + for (int i = 0; i < 128 / 16; i++) { + int id_diff = xsi[col + i] - xsi[col]; + + for (int chunk_num_v = 0; chunk_num_v < x_max_count; chunk_num_v++) { + uint16_t* sxidp = sxid[chunk_num_v] + col * x_max_count + chunk_num_h * 8; + + int id0 = (id_diff + chunk_num_v) * 2 + 0; + int id1 = (id_diff + chunk_num_v) * 2 + 1; + + (reinterpret_cast(sxidp + i))[0] = static_cast(id0 >= (chunk_num_h * 16) && id0 < (chunk_num_h + 1) * 16 ? id0 : -1); + (reinterpret_cast(sxidp + i))[1] = static_cast(id1 >= (chunk_num_h * 16) && id1 < (chunk_num_h + 1) * 16 ? id1 : -1); + } + } + } + } + } +} + +// taken from: ie_preprocess_data.cpp +// (and simplified for specifically downscale area 8u) +static size_t resize_get_buffer_size(const Size& inSz, const Size& outSz) { + int dst_full_width = outSz.width; + int dst_full_height = outSz.height; + int src_full_width = inSz.width; + int src_full_height = inSz.height; + + auto resize_area_u8_downscale_sse_buffer_size = [&]() { + const int dwidth = outSz.width; + const int dheight = outSz.height; + const int swidth = inSz.width; + + const int dst_go_x = 0; + const int dst_go_y = 0; + + int x_max_count = getResizeAreaTabSize(dst_go_x, src_full_width, dwidth, static_cast(src_full_width) / dst_full_width) + 1; + int y_max_count = getResizeAreaTabSize(dst_go_y, src_full_height, dheight, static_cast(src_full_height) / dst_full_height) + 1; + + size_t si_buf_size = sizeof(uint16_t) * dwidth + sizeof(uint16_t) * dheight; + size_t alpha_buf_size = + sizeof(uint16_t) * (dwidth * x_max_count + 8 * 16) + sizeof(uint16_t) * dheight * y_max_count; + size_t vert_sum_buf_size = sizeof(uint16_t) * (swidth * 2); + size_t alpha_array_buf_size = sizeof(uint16_t) * 4 * dwidth; + size_t sxid_array_buf_size = sizeof(uint16_t) * 4 * 4 * dwidth; + + size_t buffer_size = si_buf_size + + alpha_buf_size + + vert_sum_buf_size + + alpha_array_buf_size + + sxid_array_buf_size; + + return buffer_size; + }; + + return resize_area_u8_downscale_sse_buffer_size(); +} + +// buffer-fulfill is taken from: ie_preprocess_data_sse42.cpp +static void initScratchArea_CVKL_U8(const cv::GMatDesc & in, + const Size & outSz, + cv::gapi::fluid::Buffer & scratch) { + const Size& inSz = in.size; + + // estimate buffer size + size_t scratch_bytes = resize_get_buffer_size(inSz, outSz); + + // allocate buffer + + Size scratch_size{static_cast(scratch_bytes), 1}; + + cv::GMatDesc desc; + desc.chan = 1; + desc.depth = CV_8UC1; + desc.size = scratch_size; + + cv::gapi::fluid::Buffer buffer(desc); + scratch = std::move(buffer); + + // fulfil buffer + { + // this code is taken from: ie_preprocess_data_sse42.cpp + // (and simplified for 1-channel cv::Mat instead of blob) + + auto dwidth = outSz.width; + auto dheight = outSz.height; + auto swidth = inSz.width; + auto sheight = inSz.height; + + const int src_go_x = 0; + const int src_go_y = 0; + const int dst_go_x = 0; + const int dst_go_y = 0; + + auto src_full_width = swidth; + auto src_full_height = sheight; + auto dst_full_width = dwidth; + auto dst_full_height = dheight; + + float scale_x = static_cast(src_full_width) / dst_full_width; + float scale_y = static_cast(src_full_height) / dst_full_height; + + int x_max_count = getResizeAreaTabSize(dst_go_x, src_full_width, dwidth, scale_x); + int y_max_count = getResizeAreaTabSize(dst_go_y, src_full_height, dheight, scale_y); + + auto* maxdif = scratch.OutLine(); + auto* xsi = reinterpret_cast(maxdif + 2); + auto* ysi = xsi + dwidth; + auto* xalpha = ysi + dheight; + auto* yalpha = xalpha + dwidth*x_max_count + 8*16; + + maxdif[0] = x_max_count; + maxdif[1] = y_max_count; + + computeResizeAreaTab(src_go_x, dst_go_x, src_full_width, dwidth, scale_x, xsi, xalpha, x_max_count); + computeResizeAreaTab(src_go_y, dst_go_y, src_full_height, dheight, scale_y, ysi, yalpha, y_max_count); + + int vest_sum_size = 2*swidth; + uint16_t* vert_sum = yalpha + dheight*y_max_count; + uint16_t* alpha0 = vert_sum + vest_sum_size; + uint16_t* alpha1 = alpha0 + dwidth; + uint16_t* alpha2 = alpha1 + dwidth; + uint16_t* alpha3 = alpha2 + dwidth; + uint16_t* sxid0 = alpha3 + dwidth; + uint16_t* sxid1 = sxid0 + 4*dwidth; + uint16_t* sxid2 = sxid1 + 4*dwidth; + uint16_t* sxid3 = sxid2 + 4*dwidth; + + uint16_t* alpha[] = {alpha0, alpha1, alpha2, alpha3}; + uint16_t* sxid[] = {sxid0, sxid1, sxid2, sxid3}; + generate_alpha_and_id_arrays(x_max_count, dwidth, xalpha, xsi, alpha, sxid); + } +} + +static void calcAreaRow_CVKL_U8(const cv::gapi::fluid::View & in, + cv::gapi::fluid::Buffer & out, + cv::gapi::fluid::Buffer & scratch) { + Size inSz = in.meta().size; + Size outSz = out.meta().size; + + // this method is valid only for down-scale + GAPI_DbgAssert(inSz.width >= outSz.width); + GAPI_DbgAssert(inSz.height >= outSz.height); + + int dwidth = outSz.width; + int dheight = outSz.height; + + auto* maxdif = scratch.OutLine(); + int x_max_count = maxdif[0]; + int y_max_count = maxdif[1]; + + auto* xsi = reinterpret_cast(maxdif + 2); + auto* ysi = xsi + dwidth; + auto* xalpha = ysi + dheight; + auto* yalpha = xalpha + dwidth*x_max_count + 8*16; + auto* vert_sum = yalpha + dheight*y_max_count; + + int iny = in.y(); + int y = out.y(); + + int lpi = out.lpi(); + GAPI_DbgAssert(y + lpi <= outSz.height); + + for (int l = 0; l < lpi; l++) { + int yin0 = ysi[y + l]; + int yin1 = yin0 + y_max_count; + + GAPI_Assert(yin1 - yin0 <= 32); + const uint8_t *src[32] = {}; + + for (int yin = yin0; yin < yin1 && yin < inSz.height; yin++) { + if (yalpha[(y+l)*y_max_count + yin - yin0] == 0) { + src[yin - yin0] = in.InLine(yin - iny - 1); + } else { + src[yin - yin0] = in.InLine(yin - iny); + } + } + + uint8_t *dst = out.OutLine(l); + + calcRowArea_CVKL_U8_SSE42(src, dst, inSz, outSz, y + l, xsi, ysi, + xalpha, yalpha, x_max_count, y_max_count, vert_sum); + } +} + +#endif // USE_CVKL + +namespace { + +using resizeArea_suptypes = typelist; + +template +inline void calcRowAreaImpl(scalar_tag, + T dst[], const T* src[], const Size& inSz, + const Size& outSz, A yalpha, + const MapperUnit& ymap, int xmaxdf, + const I xindex[], const A xalpha[], + W vbuf[]) { + // vertical pass + int y_1st = ymap.index0; + int ylast = ymap.index1 - 1; + if (y_1st < ylast) { + for (int w = 0; w < inSz.width; w++) { + vbuf[w] = mulas(ymap.alpha0, src[0][w]) // Q8_8 = Q0_16 * U8 + + mulas(ymap.alpha1, src[ylast - y_1st][w]); + } + + for (int i = 1; i < ylast - y_1st; i++) { + for (int w = 0; w < inSz.width; w++) { + vbuf[w] += mulas(yalpha, src[i][w]); + } + } + } else { + for (int w = 0; w < inSz.width; w++) { + vbuf[w] = convert_cast(src[0][w]); // Q8_8 = U8 + } + } + + // horizontal pass + for (int x = 0; x < outSz.width; x++) { + W sum = 0; + + auto index = xindex[x]; + const auto *alpha = &xalpha[x * xmaxdf]; + + for (int i = 0; i < xmaxdf; i++) { + sum += mulaw(alpha[i], vbuf[index + i]); // Q8_8 = Q0_16 * Q8_8 + } + + dst[x] = convert_cast(sum); // U8 = Q8_8 + } +} + +template +struct typed_resizeArea { + using p_f = void (*)(T dst[], const T* src[], const Size& inSz, const Size& outSz, + A yalpha, const MapperUnit& ymap, int xmaxdf, + const I xindex[], const A xalpha[], W vbuf[]); + +template +inline p_f operator()(type_to_type) { + return [](T dst[], const T* src[], const Size& inSz, const Size& outSz, + A yalpha, const MapperUnit& ymap, int xmaxdf, + const I xindex[], const A xalpha[], W vbuf[]) { + calcRowAreaImpl(isa_tag_t{}, dst, src, inSz, outSz, yalpha, + ymap, xmaxdf, xindex, xalpha, vbuf); + }; +} +}; +} // namespace + template struct choose_impl { GAPI_FLUID_KERNEL(FChanToPlane, ChanToPlane, false) { @@ -797,7 +1330,9 @@ GAPI_FLUID_KERNEL(FI420toRGB, I420toRGB, false) { int buf_width = out.length(); GAPI_DbgAssert(in_u.length() == in_v.length()); - const auto rowFunc = type_dispatch(out.meta().depth, cv_type_id{}, typed_i420_to_rgb_row{}, nullptr); + const auto rowFunc = type_dispatch(out.meta().depth, cv_type_id{}, + typed_i420_to_rgb_row{}, + nullptr); GAPI_DbgAssert(rowFunc); @@ -818,7 +1353,8 @@ GAPI_FLUID_KERNEL(FSplit2, Split2, false) { GAPI_DbgAssert(in.meta().depth == out2.meta().depth); GAPI_DbgAssert(is_cv_type_in_list(in.meta().depth)); - const auto rowFunc = type_dispatch(in.meta().depth, cv_type_id{}, typed_split_row{}, nullptr); + const auto rowFunc = type_dispatch(in.meta().depth, cv_type_id{}, + typed_split_row{}, nullptr); for (int i = 0, lpi = out1.lpi(); i < lpi; i++) { std::array outs = { out1.OutLineB(i), out2.OutLineB(i) }; rowFunc(in.InLineB(i), outs, in.length()); @@ -843,10 +1379,11 @@ GAPI_FLUID_KERNEL(FSplit3, Split3, false) { GAPI_DbgAssert(is_cv_type_in_list(in.meta().depth)); - const auto rowFunc = type_dispatch(in.meta().depth, cv_type_id{}, typed_split_row{}, nullptr); + const auto rowFunc = type_dispatch(in.meta().depth, cv_type_id{}, + typed_split_row{}, nullptr); for (int i = 0, lpi = out1.lpi(); i < lpi; i++) { std::array outs = { out1.OutLineB(i), out2.OutLineB(i), - out3.OutLineB(i) }; + out3.OutLineB(i) }; rowFunc(in.InLineB(i), outs, in.length()); } } @@ -871,10 +1408,11 @@ GAPI_FLUID_KERNEL(FSplit4, Split4, false) { GAPI_DbgAssert(in.meta().depth == out4.meta().depth); GAPI_DbgAssert(is_cv_type_in_list(in.meta().depth)); - const auto rowFunc = type_dispatch(in.meta().depth, cv_type_id{}, typed_split_row{}, nullptr); + const auto rowFunc = type_dispatch(in.meta().depth, cv_type_id{}, + typed_split_row{}, nullptr); for (int i = 0, lpi = out1.lpi(); i < lpi; i++) { std::array outs = { out1.OutLineB(i), out2.OutLineB(i), - out3.OutLineB(i), out4.OutLineB(i) }; + out3.OutLineB(i), out4.OutLineB(i) }; rowFunc(in.InLineB(i), outs, in.length()); } } @@ -888,7 +1426,8 @@ GAPI_FLUID_KERNEL(FMerge2, Merge2, false) { cv::gapi::fluid::Buffer & out) { GAPI_DbgAssert(is_cv_type_in_list(out.meta().depth)); - const auto rowFunc = type_dispatch(out.meta().depth, cv_type_id{}, typed_merge_row{}, nullptr); + const auto rowFunc = type_dispatch(out.meta().depth, cv_type_id{}, + typed_merge_row{}, nullptr); for (int l = 0; l < out.lpi(); l++) { rowFunc({ a.InLineB(l), b.InLineB(l) }, out.OutLineB(l), a.length()); } @@ -904,7 +1443,8 @@ GAPI_FLUID_KERNEL(FMerge3, Merge3, false) { cv::gapi::fluid::Buffer & out) { GAPI_DbgAssert(is_cv_type_in_list(out.meta().depth)); - const auto rowFunc = type_dispatch(out.meta().depth, cv_type_id{}, typed_merge_row{}, nullptr); + const auto rowFunc = type_dispatch(out.meta().depth, cv_type_id{}, + typed_merge_row{}, nullptr); for (int l = 0; l < out.lpi(); l++) { rowFunc({ a.InLineB(l), b.InLineB(l), c.InLineB(l) }, out.OutLineB(l), a.length()); } @@ -921,7 +1461,8 @@ GAPI_FLUID_KERNEL(FMerge4, Merge4, false) { cv::gapi::fluid::Buffer & out) { GAPI_DbgAssert(is_cv_type_in_list(out.meta().depth)); - const auto rowFunc = type_dispatch(out.meta().depth, cv_type_id{}, typed_merge_row{}, nullptr); + const auto rowFunc = type_dispatch(out.meta().depth, cv_type_id{}, + typed_merge_row{}, nullptr); for (int l = 0; l < out.lpi(); l++) { rowFunc({ a.InLineB(l), b.InLineB(l), c.InLineB(l), d.InLineB(l) }, out.OutLineB(l), a.length()); } @@ -1043,10 +1584,53 @@ GAPI_FLUID_KERNEL(FScalePlane32f, ScalePlane32f, true) { } }; +GAPI_FLUID_KERNEL(FUpscalePlaneArea8u, UpscalePlaneArea8u, true) { + static const int Window = 1; + static const int LPI = 4; + static const auto Kind = cv::GFluidKernel::Kind::Resize; + + static void initScratch(const cv::GMatDesc & in, + Size outSz, int /*interp*/, + cv::gapi::fluid::Buffer & scratch) { + initScratchLinear(in, outSz, scratch, LPI); + } + + static void resetScratch(cv::gapi::fluid::Buffer& /*scratch*/) { + } + + static void run(const cv::gapi::fluid::View & in, Size /*sz*/, int /*interp*/, + cv::gapi::fluid::Buffer & out, cv::gapi::fluid::Buffer & scratch) { + calcRowLinear, + resizeLinearU8C1_suptypes>(in, out, scratch); + } +}; + +GAPI_FLUID_KERNEL(FUpscalePlaneArea32f, UpscalePlaneArea32f, true) { + static const int Window = 1; + static const int LPI = 4; + static const auto Kind = cv::GFluidKernel::Kind::Resize; + + static void initScratch(const cv::GMatDesc & in, + Size outSz, int /*interp*/, + cv::gapi::fluid::Buffer & scratch) { + initScratchLinear(in, outSz, scratch, 0); + } + + static void resetScratch(cv::gapi::fluid::Buffer& /*scratch*/) { + } + + static void run(const cv::gapi::fluid::View & in, Size /*sz*/, int /*interp*/, + cv::gapi::fluid::Buffer & out, cv::gapi::fluid::Buffer & scratch) { + calcRowLinear, + resizeLinearF32C1_suptypes>(in, out, scratch); + } +}; + template static inline void calcRowLinearC(const cv::gapi::fluid::View& in, - std::array, chs>& out, - cv::gapi::fluid::Buffer& scratch) { + std::array, chs>& out, + cv::gapi::fluid::Buffer& scratch) { GAPI_DbgAssert(is_cv_type_in_list(in.meta().depth)); auto inSz = in.meta().size; @@ -1143,6 +1727,133 @@ GAPI_FLUID_KERNEL(FScalePlanes4, ScalePlanes4, true) { calcRowLinearC(in, out, scratch); } }; + +#if defined __GNUC__ +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wstrict-aliasing" +#endif + +template +static inline void calcAreaRow(const cv::gapi::fluid::View& in, cv::gapi::fluid::Buffer& out, + cv::gapi::fluid::Buffer& scratch) { + using Unit = typename Mapper::Unit; + using alpha_type = typename Mapper::alpha_type; + using index_type = typename Mapper::index_type; + using work_type = typename Mapper::work_type; + + Size inSz = in.meta().size; + Size outSz = out.meta().size; + + // this method is valid only for down-scale + GAPI_DbgAssert(inSz.width >= outSz.width); + GAPI_DbgAssert(inSz.height >= outSz.height); + + Mapper ymapper(inSz.height, outSz.height); + + auto *xmaxdf = scratch.OutLine(); + auto maxdif = xmaxdf[0]; + + auto *xindex = reinterpret_cast(xmaxdf + 1); + auto *xalpha = reinterpret_cast(xindex + outSz.width); + auto *vbuf_c = reinterpret_cast(xalpha + outSz.width * maxdif); + + auto *vbuf = const_cast(vbuf_c); + + int iny = in.y(); + int y = out.y(); + + int lpi = out.lpi(); + GAPI_DbgAssert(y + lpi <= outSz.height); + + const auto rowFunc = type_dispatch(in.meta().depth, + cv_type_id{}, + typed_resizeArea{}, + nullptr); + GAPI_DbgAssert(rowFunc); + constexpr int max_num = 32; + for (int l = 0; l < lpi; l++) { + Unit ymap = ymapper.map(y + l); + + GAPI_Assert(ymap.index1 - ymap.index0 <= max_num); + GAPI_Assert(ymap.index1 - ymap.index0 > 0); + const T *src[max_num] = {}; + + for (int yin = ymap.index0; yin < ymap.index1; yin++) { + src[yin - ymap.index0] = in.InLine(yin - iny); + } + + auto dst = out.OutLine(l); + + rowFunc(dst, src, inSz, outSz, ymapper.alpha, ymap, xmaxdf[0], xindex, xalpha, vbuf); + } +} + +#if defined __GNUC__ +# pragma GCC diagnostic pop +#endif + +GAPI_FLUID_KERNEL(FScalePlaneArea32f, ScalePlaneArea32f, true) { + static const int Window = 1; + static const int LPI = 4; + static const auto Kind = cv::GFluidKernel::Kind::Resize; + + static void initScratch(const cv::GMatDesc& in, + Size outSz, int /*interp*/, + cv::gapi::fluid::Buffer& scratch) { + initScratchArea(in, outSz, scratch); + } + + static void resetScratch(cv::gapi::fluid::Buffer& /*scratch*/) { + } + + static void run(const cv::gapi::fluid::View& in, Size /*sz*/, int /*interp*/, + cv::gapi::fluid::Buffer& out, cv::gapi::fluid::Buffer& scratch) { + calcAreaRow(in, out, scratch); + } +}; + +GAPI_FLUID_KERNEL(FScalePlaneArea8u, ScalePlaneArea8u, true) { + static const int Window = 1; + static const int LPI = 4; + static const auto Kind = cv::GFluidKernel::Kind::Resize; + + static void initScratch(const cv::GMatDesc& in, + Size outSz, int /*interp*/, + cv::gapi::fluid::Buffer& scratch) { +#if USE_CVKL + if (with_cpu_x86_sse42()) { + const Size& inSz = in.size; + if (inSz.width > outSz.width && inSz.height > outSz.height) { + // CVKL code we use supports only downscale + initScratchArea_CVKL_U8(in, outSz, scratch); + return; + } + } +#endif + + initScratchArea(in, outSz, scratch); + } + + static void resetScratch(cv::gapi::fluid::Buffer& /*scratch*/) { + } + + static void run(const cv::gapi::fluid::View& in, Size /*sz*/, int /*interp*/, + cv::gapi::fluid::Buffer& out, cv::gapi::fluid::Buffer& scratch) { +#if USE_CVKL + if (with_cpu_x86_sse42()) { + auto inSz = in.meta().size; + auto outSz = out.meta().size; + if (inSz.width > outSz.width && inSz.height > outSz.height) { + // CVKL's code supports only downscale + calcAreaRow_CVKL_U8(in, out, scratch); + return; + } + } +#endif + + calcAreaRow(in, out, scratch); + } +}; }; namespace { @@ -1178,6 +1889,10 @@ struct Split_ResizeISA { pckg.include::FScalePlane32f>(); pckg.include::FScalePlanes>(); pckg.include::FScalePlanes4>(); + pckg.include::FScalePlaneArea8u>(); + pckg.include::FScalePlaneArea32f>(); + pckg.include::FUpscalePlaneArea8u>(); + pckg.include::FUpscalePlaneArea32f>(); //at the moment type_dispatch requires something to be returned by the lambda return true; } @@ -1236,863 +1951,14 @@ GAPI_COMPOUND_KERNEL(FScalePlane, ScalePlane) { } }; -template -static void calcRowLinear(const cv::gapi::fluid::View & in, - cv::gapi::fluid::Buffer& out, - cv::gapi::fluid::Buffer& scratch) { - using alpha_type = typename Mapper::alpha_type; - - auto inSz = in.meta().size; - auto outSz = out.meta().size; - - auto inY = in.y(); - int length = out.length(); - int outY = out.y(); - int lpi = out.lpi(); - GAPI_DbgAssert(outY + lpi <= outSz.height); - - GAPI_DbgAssert(lpi <= 4); - - linearScratchDesc scr(inSz.width, inSz.height, outSz.width, outSz.height, scratch.OutLineB()); - - const auto *alpha = scr.alpha; - const auto *mapsx = scr.mapsx; - const auto *beta0 = scr.beta; - const auto *mapsy = scr.mapsy; - - const auto *beta = beta0 + outY; - const T *src0[4]; - const T *src1[4]; - T *dst[4]; - - for (int l = 0; l < lpi; l++) { - auto index0 = mapsy[outY + l] - inY; - auto index1 = mapsy[outSz.height + outY + l] - inY; - src0[l] = in.InLine(index0); - src1[l] = in.InLine(index1); - dst[l] = out.OutLine(l); - } - - for (int l = 0; l < lpi; l++) { - constexpr static const auto unity = Mapper::unity; - - auto beta0 = beta[l]; - auto beta1 = saturate_cast(unity - beta[l]); - - for (int x = 0; x < length; x++) { - auto alpha0 = alpha[x]; - auto alpha1 = saturate_cast(unity - alpha[x]); - auto sx0 = mapsx[x]; - auto sx1 = sx0 + 1; - T tmp0 = calc(beta0, src0[l][sx0], beta1, src1[l][sx0]); - T tmp1 = calc(beta0, src0[l][sx1], beta1, src1[l][sx1]); - dst[l][x] = calc(alpha0, tmp0, alpha1, tmp1); - } - } -} - //------------------------------------------------------------------------------ -namespace areaUpscale { -struct Mapper { - typedef short alpha_type; - typedef short index_type; - constexpr static const int unity = ONE; - - typedef MapperUnit Unit; - - static inline Unit map(double ratio, int start, int max, int outCoord) { - int s = cvFloor(outCoord*ratio); - float f = static_cast((outCoord+1) - (s+1)/ratio); - f = f <= 0 ? 0.f : f - cvFloor(f); - - Unit u; - - u.index0 = std::max(s - start, 0); - u.index1 = ((f == 0.0) || s + 1 >= max) ? s - start : s - start + 1; - - u.alpha0 = saturate_cast(ONE * (1.0f - f)); - u.alpha1 = saturate_cast(ONE * f); - - return u; - } -}; -} // namespace areaUpscale - -namespace areaUpscale32f { -struct Mapper { - typedef float alpha_type; - typedef int index_type; - constexpr static const float unity = 1; - - typedef MapperUnit Unit; - - static inline Unit map(double ratio, int start, int max, int outCoord) { - int s = cvFloor(outCoord*ratio); - float f = static_cast((outCoord+1) - (s+1)/ratio); - f = f <= 0 ? 0.f : f - cvFloor(f); - - Unit u; - - u.index0 = std::max(s - start, 0); - u.index1 = ((f == 0.0) || s + 1 >= max) ? s - start : s - start + 1; - - u.alpha0 = 1.0f - f; - u.alpha1 = f; - - return u; - } -}; -} // namespace areaUpscale32f - -//------------------------------------------------------------------------------ - -template -struct AreaDownMapper { - typedef A alpha_type; - typedef I index_type; - typedef W work_type; - - typedef MapperUnit Unit; - - inline Unit map(int outCoord) { - double inCoord0 = outCoord * ratio; - double inCoord1 = (outCoord + 1) * ratio; - - double index0 = std::floor(inCoord0 + 0.001); - double index1 = std::ceil(inCoord1 - 0.001); - - double alpha0 = (index0 + 1 - inCoord0) * inv_ratio; - double alpha1 = - (index1 - 1 - inCoord1) * inv_ratio; - - GAPI_Assert(0 <= outCoord && outCoord <= outSz-1); - GAPI_Assert(0 <= index0 && index0 < index1 && index1 <= inSz); - - Unit unit; - - unit.index0 = checked_cast(index0); - unit.index1 = checked_cast(index1); - - unit.alpha0 = convert_cast(alpha0); - unit.alpha1 = convert_cast(alpha1); - - return unit; - } - - int inSz, outSz; - double ratio, inv_ratio; - - alpha_type alpha; // == inv_ratio, rounded - - void init(int _inSz, int _outSz) { - inSz = _inSz; - outSz = _outSz; - - inv_ratio = invRatio(inSz, outSz); - ratio = 1.0 / inv_ratio; - - alpha = convert_cast(inv_ratio); - } -}; - -namespace areaDownscale32f { -struct Mapper: public AreaDownMapper { - Mapper(int _inSz, int _outSz) { - init(_inSz, _outSz); - } -}; -} - -namespace areaDownscale8u { -struct Mapper: public AreaDownMapper { - Mapper(int _inSz, int _outSz) { - init(_inSz, _outSz); - } -}; -} - -template -static void initScratchArea(const cv::GMatDesc& in, const Size& outSz, - cv::gapi::fluid::Buffer &scratch) { - using Unit = typename Mapper::Unit; - using alpha_type = typename Mapper::alpha_type; - using index_type = typename Mapper::index_type; - - // compute the chunk of input pixels for each output pixel, - // along with the coefficients for taking the weigthed sum - - Size inSz = in.size; - Mapper mapper(inSz.width, outSz.width); - - std::vector xmaps(outSz.width); - int maxdif = 0; - - for (int w = 0; w < outSz.width; w++) { - Unit map = mapper.map(w); - xmaps[w] = map; - - int dif = map.index1 - map.index0; - if (dif > maxdif) - maxdif = dif; - } - - // This assertion is critical for our trick with chunk sizes: - // we would expand a chunk it is is smaller than maximal size - GAPI_Assert(inSz.width >= maxdif); - - // pack the input chunks positions and coefficients into scratch-buffer, - // along with the maximal size of chunk (note that chunk size may vary) - - size_t scratch_bytes = sizeof(int) - + outSz.width * sizeof(index_type) - + outSz.width * sizeof(alpha_type) * maxdif - + inSz.width * sizeof(alpha_type); - Size scratch_size{static_cast(scratch_bytes), 1}; - - cv::GMatDesc desc; - desc.chan = 1; - desc.depth = CV_8UC1; - desc.size = scratch_size; - - cv::gapi::fluid::Buffer buffer(desc); - scratch = std::move(buffer); - - auto *maxdf = scratch.OutLine(); - auto *index = reinterpret_cast(maxdf + 1); - auto *alpha = reinterpret_cast(index + outSz.width); -// auto *vbuf = reinterpret_cast(alpha + outSz.width * maxdif); - - for (int w = 0; w < outSz.width; w++) { - // adjust input indices so that: - // - data chunk is exactly maxdif pixels - // - data chunk fits inside input width - int index0 = xmaps[w].index0; - int index1 = xmaps[w].index1; - int i0 = index0, i1 = index1; - i1 = (std::min)(i0 + maxdif, in.size.width); - i0 = i1 - maxdif; - GAPI_DbgAssert(i0 >= 0); - - // fulfill coefficients for the data chunk, - // extending with zeros if any extra pixels - alpha_type *alphaw = &alpha[w * maxdif]; - for (int i = 0; i < maxdif; i++) { - if (i + i0 == index0) { - alphaw[i] = xmaps[w].alpha0; - - } else if (i + i0 == index1 - 1) { - alphaw[i] = xmaps[w].alpha1; - - } else if (i + i0 > index0 && i + i0 < index1 - 1) { - alphaw[i] = mapper.alpha; - - } else { - alphaw[i] = 0; - } - } - - // start input chunk with adjusted position - index[w] = i0; - } - - *maxdf = maxdif; -} - -#if defined __GNUC__ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wstrict-aliasing" -#endif - -template -static void calcAreaRow(const cv::gapi::fluid::View& in, cv::gapi::fluid::Buffer& out, - cv::gapi::fluid::Buffer& scratch) { - using Unit = typename Mapper::Unit; - using alpha_type = typename Mapper::alpha_type; - using index_type = typename Mapper::index_type; - using work_type = typename Mapper::work_type; - - Size inSz = in.meta().size; - Size outSz = out.meta().size; - - // this method is valid only for down-scale - GAPI_DbgAssert(inSz.width >= outSz.width); - GAPI_DbgAssert(inSz.height >= outSz.height); - -// Mapper xmapper(inSz.width, outSz.width); - Mapper ymapper(inSz.height, outSz.height); - - auto *xmaxdf = scratch.OutLine(); - auto maxdif = xmaxdf[0]; - - auto *xindex = reinterpret_cast(xmaxdf + 1); - auto *xalpha = reinterpret_cast(xindex + outSz.width); - auto *vbuf_c = reinterpret_cast(xalpha + outSz.width * maxdif); - - auto *vbuf = const_cast(vbuf_c); - - int iny = in.y(); - int y = out.y(); - - int lpi = out.lpi(); - GAPI_DbgAssert(y + lpi <= outSz.height); - - for (int l = 0; l < lpi; l++) { - Unit ymap = ymapper.map(y + l); - - GAPI_Assert(ymap.index1 - ymap.index0 <= 32); - GAPI_Assert(ymap.index1 - ymap.index0 > 0); - const T *src[32] = {}; - - for (int yin = ymap.index0; yin < ymap.index1; yin++) { - src[yin - ymap.index0] = in.InLine(yin - iny); - } - - auto dst = out.OutLine(l); - - #ifdef HAVE_AVX512 - if (with_cpu_x86_avx512f()) { - if (std::is_same::value) { - avx512::calcRowArea_8U(reinterpret_cast(dst), - reinterpret_cast(src), - inSz, outSz, - static_cast(ymapper.alpha), - reinterpret_cast(ymap), - xmaxdf[0], - reinterpret_cast(xindex), - reinterpret_cast(xalpha), - reinterpret_cast(vbuf)); - continue; // next l = 0, ..., lpi-1 - } - - if (std::is_same::value) { - avx512::calcRowArea_32F(reinterpret_cast(dst), - reinterpret_cast(src), - inSz, outSz, - static_cast(ymapper.alpha), - reinterpret_cast(ymap), - xmaxdf[0], - reinterpret_cast(xindex), - reinterpret_cast(xalpha), - reinterpret_cast(vbuf)); - continue; - } - } - #endif // HAVE_AVX512 - - #ifdef HAVE_AVX2 - if (with_cpu_x86_avx2()) { - if (std::is_same::value) { - avx::calcRowArea_8U(reinterpret_cast(dst), - reinterpret_cast(src), - inSz, outSz, - static_cast(ymapper.alpha), - reinterpret_cast(ymap), - xmaxdf[0], - reinterpret_cast(xindex), - reinterpret_cast(xalpha), - reinterpret_cast(vbuf)); - continue; // next l = 0, ..., lpi-1 - } - - if (std::is_same::value) { - avx::calcRowArea_32F(reinterpret_cast(dst), - reinterpret_cast(src), - inSz, outSz, - static_cast(ymapper.alpha), - reinterpret_cast(ymap), - xmaxdf[0], - reinterpret_cast(xindex), - reinterpret_cast(xalpha), - reinterpret_cast(vbuf)); - continue; - } - } - #endif // HAVE_AVX2 - - #ifdef HAVE_SSE - if (with_cpu_x86_sse42()) { - if (std::is_same::value) { - calcRowArea_8U(reinterpret_cast(dst), - reinterpret_cast(src), - inSz, outSz, - static_cast(ymapper.alpha), - reinterpret_cast(ymap), - xmaxdf[0], - reinterpret_cast(xindex), - reinterpret_cast(xalpha), - reinterpret_cast(vbuf)); - continue; // next l = 0, ..., lpi-1 - } - - if (std::is_same::value) { - calcRowArea_32F(reinterpret_cast(dst), - reinterpret_cast(src), - inSz, outSz, - static_cast(ymapper.alpha), - reinterpret_cast(ymap), - xmaxdf[0], - reinterpret_cast(xindex), - reinterpret_cast(xalpha), - reinterpret_cast(vbuf)); - continue; - } - } - #endif // HAVE_SSE - - // vertical pass - int y_1st = ymap.index0; - int ylast = ymap.index1 - 1; - if (y_1st < ylast) { - for (int w = 0; w < inSz.width; w++) { - vbuf[w] = mulas(ymap.alpha0, src[0][w]) // Q8_8 = Q0_16 * U8 - + mulas(ymap.alpha1, src[ylast - y_1st][w]); - } - - for (int i = 1; i < ylast - y_1st; i++) { - for (int w = 0; w < inSz.width; w++) { - vbuf[w] += mulas(ymapper.alpha, src[i][w]); - } - } - } else { - for (int w = 0; w < inSz.width; w++) { - vbuf[w] = convert_cast(src[0][w]); // Q8_8 = U8 - } - } - - // horizontal pass - for (int x = 0; x < outSz.width; x++) { - work_type sum = 0; - - auto index = xindex[x]; - const auto *alpha = &xalpha[x * maxdif]; - - for (int i = 0; i < maxdif; i++) { - sum += mulaw(alpha[i], vbuf[index + i]); // Q8_8 = Q0_16 * Q8_8 - } - - dst[x] = convert_cast(sum); // U8 = Q8_8 - } - } -} - -#if defined __GNUC__ -# pragma GCC diagnostic pop -#endif - -//---------------------------------------------------------------------- - -#if USE_CVKL - -// taken from: ie_preprocess_data.cpp -static int getResizeAreaTabSize(int dst_go, int ssize, int dsize, float scale) { - static const float threshold = 1e-3f; - int max_count = 0; - - for (int col = dst_go; col < dst_go + dsize; col++) { - int count = 0; - - float fsx1 = col * scale; - float fsx2 = fsx1 + scale; - - int sx1 = static_cast(ceil(fsx1)); - int sx2 = static_cast(floor(fsx2)); - - sx2 = (std::min)(sx2, ssize - 1); - sx1 = (std::min)(sx1, sx2); - - if (sx1 - fsx1 > threshold) { - count++; - } - - for (int sx = sx1; sx < sx2; sx++) { - count++; - } - - if (fsx2 - sx2 > threshold) { - count++; - } - max_count = (std::max)(max_count, count); - } - - return max_count; -} - -// taken from: ie_preprocess_data.cpp -static void computeResizeAreaTab(int src_go, int dst_go, int ssize, int dsize, float scale, - uint16_t* si, uint16_t* alpha, int max_count) { - static const float threshold = 1e-3f; - int k = 0; - - for (int col = dst_go; col < dst_go + dsize; col++) { - int count = 0; - - float fsx1 = col * scale; - float fsx2 = fsx1 + scale; - float cellWidth = (std::min)(scale, ssize - fsx1); - - int sx1 = static_cast(ceil(fsx1)); - int sx2 = static_cast(floor(fsx2)); - - sx2 = (std::min)(sx2, ssize - 1); - sx1 = (std::min)(sx1, sx2); - - si[col - dst_go] = (uint16_t)(sx1 - src_go); - - if (sx1 - fsx1 > threshold) { - si[col - dst_go] = (uint16_t)(sx1 - src_go - 1); - alpha[k++] = (uint16_t)((1 << 16) * ((sx1 - fsx1) / cellWidth)); - count++; - } - - for (int sx = sx1; sx < sx2; sx++) { - alpha[k++] = (uint16_t)((1 << 16) * (1.0f / cellWidth)); - count++; - } - - if (fsx2 - sx2 > threshold) { - alpha[k++] = (uint16_t)((1 << 16) * ((std::min)((std::min)(fsx2 - sx2, 1.f), cellWidth) / cellWidth)); - count++; - } - - if (count != max_count) { - alpha[k++] = 0; - } - } -} - -// teken from: ie_preprocess_data.cpp -static void generate_alpha_and_id_arrays(int x_max_count, int dcols, const uint16_t* xalpha, uint16_t* xsi, - uint16_t** alpha, uint16_t** sxid) { - if (x_max_count <= 4) { - for (int col = 0; col < dcols; col++) { - for (int x = 0; x < x_max_count; x++) { - alpha[x][col] = xalpha[col*x_max_count + x]; - } - } - } - if (x_max_count <= 4) { - for (int col = 0; col <= dcols - 8; col += 8) { - for (int chunk_num_h = 0; chunk_num_h < x_max_count; chunk_num_h++) { - for (int i = 0; i < 128 / 16; i++) { - int id_diff = xsi[col + i] - xsi[col]; - - for (int chunk_num_v = 0; chunk_num_v < x_max_count; chunk_num_v++) { - uint16_t* sxidp = sxid[chunk_num_v] + col * x_max_count + chunk_num_h * 8; - - int id0 = (id_diff + chunk_num_v) * 2 + 0; - int id1 = (id_diff + chunk_num_v) * 2 + 1; - - (reinterpret_cast(sxidp + i))[0] = static_cast(id0 >= (chunk_num_h * 16) && id0 < (chunk_num_h + 1) * 16 ? id0 : -1); - (reinterpret_cast(sxidp + i))[1] = static_cast(id1 >= (chunk_num_h * 16) && id1 < (chunk_num_h + 1) * 16 ? id1 : -1); - } - } - } - } - } -} - -// taken from: ie_preprocess_data.cpp -// (and simplified for specifically downscale area 8u) -static size_t resize_get_buffer_size(const Size& inSz, const Size& outSz) { - int dst_full_width = outSz.width; - int dst_full_height = outSz.height; - int src_full_width = inSz.width; - int src_full_height = inSz.height; - - auto resize_area_u8_downscale_sse_buffer_size = [&]() { - const int dwidth = outSz.width; - const int dheight = outSz.height; - const int swidth = inSz.width; - - const int dst_go_x = 0; - const int dst_go_y = 0; - - int x_max_count = getResizeAreaTabSize(dst_go_x, src_full_width, dwidth, static_cast(src_full_width) / dst_full_width) + 1; - int y_max_count = getResizeAreaTabSize(dst_go_y, src_full_height, dheight, static_cast(src_full_height) / dst_full_height) + 1; - - size_t si_buf_size = sizeof(uint16_t) * dwidth + sizeof(uint16_t) * dheight; - size_t alpha_buf_size = - sizeof(uint16_t) * (dwidth * x_max_count + 8 * 16) + sizeof(uint16_t) * dheight * y_max_count; - size_t vert_sum_buf_size = sizeof(uint16_t) * (swidth * 2); - size_t alpha_array_buf_size = sizeof(uint16_t) * 4 * dwidth; - size_t sxid_array_buf_size = sizeof(uint16_t) * 4 * 4 * dwidth; - - size_t buffer_size = si_buf_size + - alpha_buf_size + - vert_sum_buf_size + - alpha_array_buf_size + - sxid_array_buf_size; - - return buffer_size; - }; - - return resize_area_u8_downscale_sse_buffer_size(); -} - -// buffer-fulfill is taken from: ie_preprocess_data_sse42.cpp -static void initScratchArea_CVKL_U8(const cv::GMatDesc & in, - const Size & outSz, - cv::gapi::fluid::Buffer & scratch) { - const Size& inSz = in.size; - - // estimate buffer size - size_t scratch_bytes = resize_get_buffer_size(inSz, outSz); - - // allocate buffer - - Size scratch_size{static_cast(scratch_bytes), 1}; - - cv::GMatDesc desc; - desc.chan = 1; - desc.depth = CV_8UC1; - desc.size = scratch_size; - - cv::gapi::fluid::Buffer buffer(desc); - scratch = std::move(buffer); - - // fulfil buffer - { - // this code is taken from: ie_preprocess_data_sse42.cpp - // (and simplified for 1-channel cv::Mat instead of blob) - - auto dwidth = outSz.width; - auto dheight = outSz.height; - auto swidth = inSz.width; - auto sheight = inSz.height; - - const int src_go_x = 0; - const int src_go_y = 0; - const int dst_go_x = 0; - const int dst_go_y = 0; - - auto src_full_width = swidth; - auto src_full_height = sheight; - auto dst_full_width = dwidth; - auto dst_full_height = dheight; - - float scale_x = static_cast(src_full_width) / dst_full_width; - float scale_y = static_cast(src_full_height) / dst_full_height; - - int x_max_count = getResizeAreaTabSize(dst_go_x, src_full_width, dwidth, scale_x); - int y_max_count = getResizeAreaTabSize(dst_go_y, src_full_height, dheight, scale_y); - - auto* maxdif = scratch.OutLine(); - auto* xsi = reinterpret_cast(maxdif + 2); - auto* ysi = xsi + dwidth; - auto* xalpha = ysi + dheight; - auto* yalpha = xalpha + dwidth*x_max_count + 8*16; - // auto* vert_sum = yalpha + dheight*y_max_count; - - maxdif[0] = x_max_count; - maxdif[1] = y_max_count; - - computeResizeAreaTab(src_go_x, dst_go_x, src_full_width, dwidth, scale_x, xsi, xalpha, x_max_count); - computeResizeAreaTab(src_go_y, dst_go_y, src_full_height, dheight, scale_y, ysi, yalpha, y_max_count); - - int vest_sum_size = 2*swidth; - uint16_t* vert_sum = yalpha + dheight*y_max_count; - uint16_t* alpha0 = vert_sum + vest_sum_size; - uint16_t* alpha1 = alpha0 + dwidth; - uint16_t* alpha2 = alpha1 + dwidth; - uint16_t* alpha3 = alpha2 + dwidth; - uint16_t* sxid0 = alpha3 + dwidth; - uint16_t* sxid1 = sxid0 + 4*dwidth; - uint16_t* sxid2 = sxid1 + 4*dwidth; - uint16_t* sxid3 = sxid2 + 4*dwidth; - - uint16_t* alpha[] = {alpha0, alpha1, alpha2, alpha3}; - uint16_t* sxid[] = {sxid0, sxid1, sxid2, sxid3}; - generate_alpha_and_id_arrays(x_max_count, dwidth, xalpha, xsi, alpha, sxid); - } -} - -static void calcAreaRow_CVKL_U8(const cv::gapi::fluid::View & in, - cv::gapi::fluid::Buffer & out, - cv::gapi::fluid::Buffer & scratch) { - Size inSz = in.meta().size; - Size outSz = out.meta().size; - - // this method is valid only for down-scale - GAPI_DbgAssert(inSz.width >= outSz.width); - GAPI_DbgAssert(inSz.height >= outSz.height); - - int dwidth = outSz.width; - int dheight = outSz.height; - - auto* maxdif = scratch.OutLine(); - int x_max_count = maxdif[0]; - int y_max_count = maxdif[1]; - - auto* xsi = reinterpret_cast(maxdif + 2); - auto* ysi = xsi + dwidth; - auto* xalpha = ysi + dheight; - auto* yalpha = xalpha + dwidth*x_max_count + 8*16; - auto* vert_sum = yalpha + dheight*y_max_count; - - int iny = in.y(); - int y = out.y(); - - int lpi = out.lpi(); - GAPI_DbgAssert(y + lpi <= outSz.height); - - for (int l = 0; l < lpi; l++) { - int yin0 = ysi[y + l]; - int yin1 = yin0 + y_max_count; - - GAPI_Assert(yin1 - yin0 <= 32); - const uint8_t *src[32] = {}; - - for (int yin = yin0; yin < yin1 && yin < inSz.height; yin++) { - if (yalpha[(y+l)*y_max_count + yin - yin0] == 0) { - src[yin - yin0] = in.InLine(yin - iny - 1); - } else { - src[yin - yin0] = in.InLine(yin - iny); - } - } - - uint8_t *dst = out.OutLine(l); - - calcRowArea_CVKL_U8_SSE42(src, dst, inSz, outSz, y + l, xsi, ysi, - xalpha, yalpha, x_max_count, y_max_count, vert_sum); - } -} - -#endif // CVKL -//---------------------------------------------------------------------- - -GAPI_FLUID_KERNEL(FScalePlane8u, ScalePlane8u, true) { - static const int Window = 1; - static const int LPI = 4; - static const auto Kind = cv::GFluidKernel::Kind::Resize; - - static void initScratch(const cv::GMatDesc& in, - Size outSz, int /*interp*/, - cv::gapi::fluid::Buffer &scratch) { - initScratchLinear(in, outSz, scratch, LPI); - } - - static void resetScratch(cv::gapi::fluid::Buffer& /*scratch*/) { - } - - static void run(const cv::gapi::fluid::View& in, Size /*sz*/, int /*interp*/, - cv::gapi::fluid::Buffer& out, cv::gapi::fluid::Buffer &scratch) { - calcRowLinear(in, out, scratch); - } -}; - -GAPI_FLUID_KERNEL(FUpscalePlaneArea8u, UpscalePlaneArea8u, true) { - static const int Window = 1; - static const int LPI = 4; - static const auto Kind = cv::GFluidKernel::Kind::Resize; - - static void initScratch(const cv::GMatDesc& in, - Size outSz, int /*interp*/, - cv::gapi::fluid::Buffer &scratch) { - initScratchLinear(in, outSz, scratch, LPI); - } - - static void resetScratch(cv::gapi::fluid::Buffer& /*scratch*/) { - } - - static void run(const cv::gapi::fluid::View& in, Size /*sz*/, int /*interp*/, - cv::gapi::fluid::Buffer& out, cv::gapi::fluid::Buffer &scratch) { - calcRowLinear(in, out, scratch); - } -}; - -GAPI_FLUID_KERNEL(FUpscalePlaneArea32f, UpscalePlaneArea32f, true) { - static const int Window = 1; - static const int LPI = 4; - static const auto Kind = cv::GFluidKernel::Kind::Resize; - - static void initScratch(const cv::GMatDesc& in, - Size outSz, int /*interp*/, - cv::gapi::fluid::Buffer &scratch) { - initScratchLinear(in, outSz, scratch, 0); - } - - static void resetScratch(cv::gapi::fluid::Buffer& /*scratch*/) { - } - - static void run(const cv::gapi::fluid::View& in, Size /*sz*/, int /*interp*/, - cv::gapi::fluid::Buffer& out, cv::gapi::fluid::Buffer &scratch) { - calcRowLinear(in, out, scratch); - } -}; -//---------------------------------------------------------------------- - -GAPI_FLUID_KERNEL(FScalePlaneArea32f, ScalePlaneArea32f, true) { - static const int Window = 1; - static const int LPI = 4; - static const auto Kind = cv::GFluidKernel::Kind::Resize; - - static void initScratch(const cv::GMatDesc& in, - Size outSz, int /*interp*/, - cv::gapi::fluid::Buffer &scratch) { - initScratchArea(in, outSz, scratch); - } - - static void resetScratch(cv::gapi::fluid::Buffer& /*scratch*/) { - } - - static void run(const cv::gapi::fluid::View& in, Size /*sz*/, int /*interp*/, - cv::gapi::fluid::Buffer& out, cv::gapi::fluid::Buffer &scratch) { - calcAreaRow(in, out, scratch); - } -}; - -GAPI_FLUID_KERNEL(FScalePlaneArea8u, ScalePlaneArea8u, true) { - static const int Window = 1; - static const int LPI = 4; - static const auto Kind = cv::GFluidKernel::Kind::Resize; - - static void initScratch(const cv::GMatDesc& in, - Size outSz, int /*interp*/, - cv::gapi::fluid::Buffer &scratch) { - #if USE_CVKL - #ifdef HAVE_SSE - if (with_cpu_x86_sse42()) { - const Size& inSz = in.size; - if (inSz.width > outSz.width && inSz.height > outSz.height) { - // CVKL code we use supports only downscale - initScratchArea_CVKL_U8(in, outSz, scratch); - return; - } - } - #endif // HAVE_SSE - #endif - - initScratchArea(in, outSz, scratch); - } - - static void resetScratch(cv::gapi::fluid::Buffer& /*scratch*/) { - } - - static void run(const cv::gapi::fluid::View& in, Size /*sz*/, int /*interp*/, - cv::gapi::fluid::Buffer& out, cv::gapi::fluid::Buffer &scratch) { - #if USE_CVKL - #ifdef HAVE_SSE - if (with_cpu_x86_sse42()) { - auto inSz = in.meta().size; - auto outSz = out.meta().size; - if (inSz.width > outSz.width && inSz.height > outSz.height) { - // CVKL's code supports only downscale - calcAreaRow_CVKL_U8(in, out, scratch); - return; - } - } - #endif // HAVE_SSE - #endif - - calcAreaRow(in, out, scratch); - } -}; namespace { template void convert_precision(const uint8_t* src, uint8_t* dst, const int width) { const auto *in = reinterpret_cast(src); - auto *out = reinterpret_cast(dst); + auto *out = reinterpret_cast(dst); for (int i = 0; i < width; i++) { out[i] = saturate_cast(in[i]); @@ -2203,10 +2069,6 @@ cv::gapi::GKernelPackage preprocKernels() { FKernelsChooseISA(), cv::gapi::kernels < FScalePlane - , FUpscalePlaneArea8u - , FUpscalePlaneArea32f - , FScalePlaneArea8u - , FScalePlaneArea32f , FConvertDepth , FSubC , FDivC diff --git a/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels_simd_impl.hpp b/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels_simd_impl.hpp index 8ff918747f3..19b00e41f31 100644 --- a/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels_simd_impl.hpp +++ b/inference-engine/src/preprocessing/ie_preprocess_gapi_kernels_simd_impl.hpp @@ -514,12 +514,11 @@ CV_ALWAYS_INLINE void downx(T dst[], int outWidth, int xmaxdf, const I xindex[], #undef HSUM } -template -CV_ALWAYS_INLINE void calcRowArea_impl(T dst[], const T *src[], const Size& inSz, - const Size& outSz, A yalpha, - const MapperUnit& ymap, int xmaxdf, - const I xindex[], const A xalpha[], - W vbuf[]) { +template +CV_ALWAYS_INLINE void calcRowAreaImpl(isa_tag_t, T dst[], const T *src[], + const Size& inSz, const Size& outSz, A yalpha, + const MapperUnit& ymap, int xmaxdf, + const I xindex[], const A xalpha[], W vbuf[]) { bool xRatioEq1 = inSz.width == outSz.width; bool yRatioEq1 = inSz.height == outSz.height; diff --git a/inference-engine/src/readers/ir_reader/ie_ir_parser.cpp b/inference-engine/src/readers/ir_reader/ie_ir_parser.cpp index 892c2e6bae4..cc00ec77114 100644 --- a/inference-engine/src/readers/ir_reader/ie_ir_parser.cpp +++ b/inference-engine/src/readers/ir_reader/ie_ir_parser.cpp @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -838,6 +839,7 @@ std::shared_ptr XmlDeserializer::createNode( } ngraphNode->set_arguments(inputs); XmlDeserializer visitor(node, weights, opsets, variables); + if (ngraphNode->visit_attributes(visitor)) { ngraphNode->constructor_validate_and_infer_types(); } @@ -900,6 +902,7 @@ V10Parser::V10Parser(const std::vector& exts) : _exts(exts) { opsets["opset5"] = ngraph::get_opset5(); opsets["opset6"] = ngraph::get_opset6(); opsets["opset7"] = ngraph::get_opset7(); + opsets["opset8"] = ngraph::get_opset8(); // Load custom opsets for (const auto& ext : exts) { diff --git a/inference-engine/src/transformations/include/ngraph_ops/framework_node.hpp b/inference-engine/src/transformations/include/ngraph_ops/framework_node.hpp index 1a5729d8ecd..8abda399c9c 100644 --- a/inference-engine/src/transformations/include/ngraph_ops/framework_node.hpp +++ b/inference-engine/src/transformations/include/ngraph_ops/framework_node.hpp @@ -55,7 +55,7 @@ class TRANSFORMATIONS_API FrameworkNode : public Op { public: NGRAPH_RTTI_DECLARATION; - explicit FrameworkNode(const OutputVector& inputs); + explicit FrameworkNode(const OutputVector& inputs, size_t output_size = 1); void validate_and_infer_types() override; diff --git a/inference-engine/src/transformations/include/transformations/common_optimizations/simplify_shape_of_sub_graph.hpp b/inference-engine/src/transformations/include/transformations/common_optimizations/simplify_shape_of_sub_graph.hpp index 85d8aa662da..752054baa49 100644 --- a/inference-engine/src/transformations/include/transformations/common_optimizations/simplify_shape_of_sub_graph.hpp +++ b/inference-engine/src/transformations/include/transformations/common_optimizations/simplify_shape_of_sub_graph.hpp @@ -20,6 +20,7 @@ namespace pass { class TRANSFORMATIONS_API SimplifyShapeOfSubGraph; class TRANSFORMATIONS_API SharedShapeOf; class TRANSFORMATIONS_API GroupedGatherElimination; +class TRANSFORMATIONS_API GatherNopElimination; } // namespace pass } // namespace ngraph @@ -58,3 +59,13 @@ public: NGRAPH_RTTI_DECLARATION; bool run_on_function(std::shared_ptr f) override; }; + +/** + * @ingroup ie_transformation_common_api + * @brief GatherNopElimination transformation optimizes out useless Gather operations + */ +class ngraph::pass::GatherNopElimination: public ngraph::pass::MatcherPass { +public: + NGRAPH_RTTI_DECLARATION; + GatherNopElimination(); +}; diff --git a/inference-engine/src/transformations/src/ngraph_ops/framework_node.cpp b/inference-engine/src/transformations/src/ngraph_ops/framework_node.cpp index b25143c20f5..94d0008c110 100644 --- a/inference-engine/src/transformations/src/ngraph_ops/framework_node.cpp +++ b/inference-engine/src/transformations/src/ngraph_ops/framework_node.cpp @@ -10,8 +10,9 @@ using namespace ngraph; NGRAPH_RTTI_DEFINITION(op::FrameworkNode, "FrameworkNode", 0); -op::FrameworkNode::FrameworkNode(const OutputVector& inputs) +op::FrameworkNode::FrameworkNode(const OutputVector& inputs, size_t output_size) : Op(inputs) { + set_output_size(output_size); constructor_validate_and_infer_types(); } diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp index 956904c9a34..415ecb11610 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/common_optimizations.cpp @@ -72,6 +72,7 @@ #include "transformations/op_conversions/mvn6_decomposition.hpp" #include "transformations/op_conversions/simplify_ctc_greedy_decoder_seq_len.hpp" #include "transformations/op_conversions/gather_normalize_negative_indices.hpp" +#include "transformations/op_conversions/convert_deformable_conv_v8_to_v1.hpp" #include #include @@ -180,6 +181,7 @@ bool ngraph::pass::CommonOptimizations::run_on_function(std::shared_ptr(); manager.register_pass(); manager.register_pass(); + manager.register_pass(); auto fq_fusions = manager.register_pass(); fq_fusions->add_matcher(); diff --git a/inference-engine/src/transformations/src/transformations/common_optimizations/simplify_shape_of_sub_graph.cpp b/inference-engine/src/transformations/src/transformations/common_optimizations/simplify_shape_of_sub_graph.cpp index 4aeae1d8f14..ec4614241b9 100644 --- a/inference-engine/src/transformations/src/transformations/common_optimizations/simplify_shape_of_sub_graph.cpp +++ b/inference-engine/src/transformations/src/transformations/common_optimizations/simplify_shape_of_sub_graph.cpp @@ -14,6 +14,7 @@ #include #include #include +#include NGRAPH_RTTI_DEFINITION(ngraph::pass::SharedShapeOf, "SharedShapeOf", 0); @@ -49,7 +50,7 @@ ngraph::pass::GroupedGatherElimination::GroupedGatherElimination() { MATCHER_SCOPE(GroupedGatherElimination); auto concat_label = ngraph::pattern::wrap_type(pattern::rank_equals(1)); - ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { + ngraph::matcher_pass_callback callback = [=](pattern::Matcher& m) { auto concat = m.get_match_root(); OutputVector inputs = concat->input_values(); NodeVector new_ops; @@ -62,19 +63,27 @@ ngraph::pass::GroupedGatherElimination::GroupedGatherElimination() { ++i; continue; } // curr and next are the same type of gather which takes data from the same source + bool is_opset1 = is_type(curr); auto joint_indices = ngraph::op::util::make_try_fold(OutputVector{curr->input_value(1), next->input_value(1)}, 0); - auto new_gather = curr->clone_with_new_inputs( - {curr->input_value(0), joint_indices, ngraph::opset1::Constant::create(element::i64, {}, {0})}); + std::shared_ptr new_gather; + if (is_opset1) + new_gather = register_new_node( + curr->input_value(0), joint_indices->output(0), ngraph::opset1::Constant::create(element::i64, {}, {0})->output(0)); + else + new_gather = register_new_node( + curr->input_value(0), joint_indices->output(0), ngraph::opset1::Constant::create(element::i64, {}, {0})->output(0)); new_ops.push_back(joint_indices); new_ops.push_back(new_gather); inputs.erase(inputs.begin() + i); inputs[i] = new_gather->output(0); } + ngraph::copy_runtime_info(concat, new_ops); + if (inputs.size() == 1) // we can optimize out concat + return replace_output_update_name(concat->output(0), inputs[0]); if (original_inputs_size > inputs.size()) { auto new_concat = std::make_shared(inputs, 0); - new_ops.push_back(new_concat); new_concat->set_friendly_name(concat->get_friendly_name()); - ngraph::copy_runtime_info(concat, new_ops); + ngraph::copy_runtime_info(concat, new_concat); ngraph::replace_node(concat, new_concat); return true; } @@ -85,17 +94,43 @@ ngraph::pass::GroupedGatherElimination::GroupedGatherElimination() { this->register_matcher(m, callback); } +NGRAPH_RTTI_DEFINITION(ngraph::pass::GatherNopElimination, "GatherNopElimination", 0); + +ngraph::pass::GatherNopElimination::GatherNopElimination() { + MATCHER_SCOPE(GatherNopElimination); + const auto gather_label = ngraph::pattern::wrap_type( + {ngraph::pattern::any_input(pattern::has_static_shape()), + ngraph::pattern::wrap_type(), + ngraph::pattern::wrap_type()}); + + ngraph::matcher_pass_callback callback = [](pattern::Matcher& m) { + auto gather = m.get_match_root(); + const auto& number_of_indices = shape_size(gather->get_input_shape(1)); + if (gather->get_input_shape(0) != gather->get_output_shape(0) || shape_size(gather->get_input_shape(2)) != 1 || number_of_indices > 10) + return false; + std::vector expected_vector(number_of_indices); + std::iota(expected_vector.begin(), expected_vector.end(), 0); + if (const auto& indices = get_constant_from_source(gather->input_value(1))) { + const auto& indices_values = indices->cast_vector(); + if (indices_values != expected_vector) + return false; + } + return replace_output_update_name(gather->output(0), gather->input_value(0)); + }; + auto m = std::make_shared(gather_label, matcher_name); + this->register_matcher(m, callback); +} + NGRAPH_RTTI_DEFINITION(ngraph::pass::SimplifyShapeOfSubGraph, "SimplifyShapeOfSubGraph", 0); bool ngraph::pass::SimplifyShapeOfSubGraph::run_on_function(std::shared_ptr f) { RUN_ON_FUNCTION_SCOPE(GroupedGatherElimination); ngraph::pass::Manager manager; - manager.set_per_pass_validation(false); manager.register_pass(); manager.register_pass(); manager.register_pass(); - manager.register_pass(); + manager.register_pass(); manager.run_passes(f); return false; } diff --git a/inference-engine/src/transformations/src/transformations/serialize.cpp b/inference-engine/src/transformations/src/transformations/serialize.cpp index 73b72313e5f..93f9c24e4b8 100644 --- a/inference-engine/src/transformations/src/transformations/serialize.cpp +++ b/inference-engine/src/transformations/src/transformations/serialize.cpp @@ -465,10 +465,10 @@ const std::vector create_edge_mapping( std::string get_opset_name( const ngraph::Node* n, const std::map& custom_opsets) { - auto opsets = std::array, 7>{ + auto opsets = std::array, 8>{ ngraph::get_opset1(), ngraph::get_opset2(), ngraph::get_opset3(), ngraph::get_opset4(), ngraph::get_opset5(), ngraph::get_opset6(), - ngraph::get_opset7()}; + ngraph::get_opset7(), ngraph::get_opset8()}; auto special_opset = get_special_opset_for_op(n->get_type_info()); if (!special_opset.empty()) { @@ -495,6 +495,7 @@ std::string get_opset_name( std::string get_precision_name(const ngraph::element::Type & elem_type) { switch (elem_type) { case ::ngraph::element::Type_t::undefined: + case ::ngraph::element::Type_t::dynamic: return "UNSPECIFIED"; case ::ngraph::element::Type_t::f16: return "FP16"; diff --git a/inference-engine/src/vpu/common/CMakeLists.txt b/inference-engine/src/vpu/common/CMakeLists.txt index 71c727b631a..26d31047c24 100644 --- a/inference-engine/src/vpu/common/CMakeLists.txt +++ b/inference-engine/src/vpu/common/CMakeLists.txt @@ -53,7 +53,7 @@ function(add_common_target TARGET_NAME STATIC_IE) openvino_developer_export_targets(COMPONENT inference_engine_vpu TARGETS ${TARGET_NAME}) target_link_libraries(${TARGET_NAME} PUBLIC ngraph inference_engine_transformations - PRIVATE openvino::itt) + PRIVATE mvnc openvino::itt) if(NOT STATIC_IE) target_link_libraries(${TARGET_NAME} PUBLIC inference_engine_legacy) diff --git a/inference-engine/src/vpu/common/include/vpu/configuration.hpp b/inference-engine/src/vpu/common/include/vpu/configuration.hpp deleted file mode 100644 index 4ed6f77b91f..00000000000 --- a/inference-engine/src/vpu/common/include/vpu/configuration.hpp +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (C) 2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include -#include -#include - -#include "caseless.hpp" - -#include "vpu/utils/optional.hpp" - -namespace vpu { - -struct CompilationConfig { - int numSHAVEs = -1; - int numCMXSlices = -1; - int numExecutors = -1; - int tilingCMXLimitKB = -1; - - bool hwOptimization = true; - bool hwExtraSplit = false; - - std::string irWithVpuScalesDir; - - std::string customLayers; - - bool detectBatch = true; - - Optional injectSwOps; - Optional packDataInCmx; - bool mergeHwPoolToConv = true; - bool hwDilation = false; - bool forceDeprecatedCnnConversion = false; - bool enableEarlyEltwiseReLUFusion = true; - - std::map> ioStrides; - - // - // Debug options - // - - InferenceEngine::details::caseless_set hwWhiteList; - InferenceEngine::details::caseless_set hwBlackList; - - bool hwDisabled(const std::string& layerName) const { - if (!hwWhiteList.empty()) { - return hwWhiteList.count(layerName) == 0; - } - - if (!hwBlackList.empty()) { - return hwBlackList.count(layerName) != 0; - } - - return false; - } - - InferenceEngine::details::caseless_set noneLayers; - - bool skipAllLayers() const { - if (noneLayers.size() == 1) { - const auto& val = *noneLayers.begin(); - return val == "*"; - } - return false; - } - - bool skipLayerType(const std::string& layerType) const { - return noneLayers.count(layerType) != 0; - } - bool ignoreUnknownLayers = false; - - std::string dumpInternalGraphFileName; - std::string dumpInternalGraphDirectory; - bool dumpAllPasses; - - bool disableReorder = false; // TODO: rename to enableReorder and switch logic. - bool disableConvertStages = false; - bool enablePermuteMerging = true; - bool enableReplWithSCRelu = false; - bool enableReplaceWithReduceMean = true; - bool enableTensorIteratorUnrolling = false; - bool forcePureTensorIterator = false; - bool enableMemoryTypesAnnotation = false; - bool enableWeightsAnalysis = true; - bool checkPreprocessingInsideModel = true; - bool enableCustomReshapeParam = false; - - // - // Deprecated options - // - - float inputScale = 1.0f; - float inputBias = 0.0f; -}; - -} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/check_preprocessing_inside_model.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/check_preprocessing_inside_model.hpp new file mode 100644 index 00000000000..aac0a1c0312 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/check_preprocessing_inside_model.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct CheckPreprocessingInsideModelOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/config_file.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/config_file.hpp new file mode 100644 index 00000000000..97da06b7bac --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/config_file.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct ConfigFileOption : public AsParameterEnabler { + using value_type = std::string; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/custom_layers.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/custom_layers.hpp new file mode 100644 index 00000000000..63803c6ffea --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/custom_layers.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct CustomLayersOption : public AsParameterEnabler { + using value_type = std::string; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/detect_network_batch.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/detect_network_batch.hpp new file mode 100644 index 00000000000..2834497fe3f --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/detect_network_batch.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct DetectNetworkBatchOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/device_connect_timeout.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/device_connect_timeout.hpp new file mode 100644 index 00000000000..98e6a243551 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/device_connect_timeout.hpp @@ -0,0 +1,35 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct DeviceConnectTimeoutOption : public AsParsedParameterEnabler { + using value_type = std::chrono::seconds; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/device_id.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/device_id.hpp new file mode 100644 index 00000000000..2703f7e80b8 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/device_id.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct DeviceIDOption : public AsParameterEnabler { + using value_type = std::string; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/disable_convert_stages.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/disable_convert_stages.hpp new file mode 100644 index 00000000000..04b9130b760 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/disable_convert_stages.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct DisableConvertStagesOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/disable_reorder.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/disable_reorder.hpp new file mode 100644 index 00000000000..8a719071053 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/disable_reorder.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct DisableReorderOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/dump_all_passes.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/dump_all_passes.hpp new file mode 100644 index 00000000000..3d351a958a0 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/dump_all_passes.hpp @@ -0,0 +1,35 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct DumpAllPassesOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/dump_all_passes_directory.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/dump_all_passes_directory.hpp new file mode 100644 index 00000000000..4f5664f81b7 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/dump_all_passes_directory.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct DumpAllPassesDirectoryOption : public AsParameterEnabler { + using value_type = std::string; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/dump_internal_graph_file_name.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/dump_internal_graph_file_name.hpp new file mode 100644 index 00000000000..67917916ee5 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/dump_internal_graph_file_name.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct DumpInternalGraphFileNameOption : public AsParameterEnabler { + using value_type = std::string; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_async_dma.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_async_dma.hpp new file mode 100644 index 00000000000..8562c64ee3f --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_async_dma.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct EnableAsyncDMAOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_custom_reshape_param.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_custom_reshape_param.hpp new file mode 100644 index 00000000000..c18df218a87 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_custom_reshape_param.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct EnableCustomReshapeParamOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_early_eltwise_relu_fusion.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_early_eltwise_relu_fusion.hpp new file mode 100644 index 00000000000..f968fdeb657 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_early_eltwise_relu_fusion.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct EnableEarlyEltwiseReluFusionOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_force_reset.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_force_reset.hpp new file mode 100644 index 00000000000..9f158705d1f --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_force_reset.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct EnableForceResetOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_memory_types_annotation.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_memory_types_annotation.hpp new file mode 100644 index 00000000000..e451a3b65c1 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_memory_types_annotation.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct EnableMemoryTypesAnnotationOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_permute_merging.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_permute_merging.hpp new file mode 100644 index 00000000000..48f0974ca44 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_permute_merging.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct EnablePermuteMergingOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_receiving_tensor_time.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_receiving_tensor_time.hpp new file mode 100644 index 00000000000..a14266c2f4e --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_receiving_tensor_time.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct EnableReceivingTensorTimeOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_repl_with_screlu.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_repl_with_screlu.hpp new file mode 100644 index 00000000000..1a1a263d42d --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_repl_with_screlu.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct EnableReplWithSCReluOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_tensor_iterator_unrolling.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_tensor_iterator_unrolling.hpp new file mode 100644 index 00000000000..11c12e0eb76 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_tensor_iterator_unrolling.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct EnableTensorIteratorUnrollingOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_weights_analysis.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_weights_analysis.hpp new file mode 100644 index 00000000000..5db2c470aa0 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/enable_weights_analysis.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct EnableWeightsAnalysisOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/exclusive_async_requests.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/exclusive_async_requests.hpp new file mode 100644 index 00000000000..db1b748218e --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/exclusive_async_requests.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct ExclusiveAsyncRequestsOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/force_pure_tensor_iterator.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/force_pure_tensor_iterator.hpp new file mode 100644 index 00000000000..025fb6e0741 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/force_pure_tensor_iterator.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct ForcePureTensorIteratorOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_acceleration.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_acceleration.hpp new file mode 100644 index 00000000000..bb1d76bcd61 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_acceleration.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct HwAccelerationOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_black_list.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_black_list.hpp new file mode 100644 index 00000000000..a4925e0c5ef --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_black_list.hpp @@ -0,0 +1,36 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +#include "caseless.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct HwBlackListOption : public AsParameterEnabler { + using value_type = InferenceEngine::details::caseless_set; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_dilation.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_dilation.hpp new file mode 100644 index 00000000000..44bf2446ce9 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_dilation.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct HwDilationOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_extra_split.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_extra_split.hpp new file mode 100644 index 00000000000..269b98e707f --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_extra_split.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct HwExtraSplitOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_inject_stages.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_inject_stages.hpp new file mode 100644 index 00000000000..04e3cd0b338 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_inject_stages.hpp @@ -0,0 +1,35 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" +#include "vpu/utils/optional.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct HwInjectStagesOption : public AsParameterEnabler { + using value_type = Optional; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_pool_conv_merge.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_pool_conv_merge.hpp new file mode 100644 index 00000000000..85e0d1bc35b --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/hw_pool_conv_merge.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct HwPoolConvMergeOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/ignore_unknown_layers.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/ignore_unknown_layers.hpp new file mode 100644 index 00000000000..18b111462f1 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/ignore_unknown_layers.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct IgnoreUnknownLayersOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/ir_with_scales_directory.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/ir_with_scales_directory.hpp new file mode 100644 index 00000000000..e4ed56fd0d5 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/ir_with_scales_directory.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct IRWithScalesDirectoryOption : public AsParameterEnabler { + using value_type = std::string; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/memory_type.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/memory_type.hpp new file mode 100644 index 00000000000..5121735ed01 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/memory_type.hpp @@ -0,0 +1,36 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +enum class MovidiusDdrType; + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct MemoryTypeOption : public AsParameterEnabler { + using value_type = MovidiusDdrType; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/none_layers.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/none_layers.hpp new file mode 100644 index 00000000000..e8cfa0dbc1e --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/none_layers.hpp @@ -0,0 +1,36 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +#include "caseless.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct NoneLayersOption : public AsParameterEnabler { + using value_type = InferenceEngine::details::caseless_set; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/number_of_cmx_slices.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/number_of_cmx_slices.hpp new file mode 100644 index 00000000000..07e6e14a648 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/number_of_cmx_slices.hpp @@ -0,0 +1,35 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" +#include "vpu/utils/optional.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct NumberOfCMXSlicesOption : public AsParameterEnabler { + using value_type = Optional; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/number_of_shaves.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/number_of_shaves.hpp new file mode 100644 index 00000000000..be7d568f6eb --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/number_of_shaves.hpp @@ -0,0 +1,35 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" +#include "vpu/utils/optional.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct NumberOfSHAVEsOption : public AsParameterEnabler { + using value_type = Optional; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/pack_data_in_cmx.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/pack_data_in_cmx.hpp new file mode 100644 index 00000000000..6b33f4a5e00 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/pack_data_in_cmx.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct PackDataInCMXOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/perf_count.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/perf_count.hpp new file mode 100644 index 00000000000..5241e1e3551 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/perf_count.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct PerfCountOption : public AsParsedParameterEnabler { + using value_type = bool; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/perf_report_mode.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/perf_report_mode.hpp new file mode 100644 index 00000000000..cf25de20bf7 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/perf_report_mode.hpp @@ -0,0 +1,35 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct PerfReportModeOption : public AsParameterEnabler { + using value_type = PerfReport; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/platform.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/platform.hpp new file mode 100644 index 00000000000..bcf527ac37b --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/platform.hpp @@ -0,0 +1,36 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +#include + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct PlatformOption : public AsParameterEnabler { + using value_type = ncDevicePlatform_t; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/power_config.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/power_config.hpp new file mode 100644 index 00000000000..2a506548142 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/power_config.hpp @@ -0,0 +1,36 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +enum class PowerConfig; + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct PowerConfigOption : public AsParameterEnabler { + using value_type = PowerConfig; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/protocol.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/protocol.hpp new file mode 100644 index 00000000000..cd5a7b86e57 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/protocol.hpp @@ -0,0 +1,36 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +#include + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct ProtocolOption : public AsParameterEnabler { + using value_type = ncDeviceProtocol_t; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/tensor_strides.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/tensor_strides.hpp new file mode 100644 index 00000000000..d79786161d6 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/tensor_strides.hpp @@ -0,0 +1,34 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct TensorStridesOption : public AsParsedParameterEnabler { + using value_type = std::map>; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/throughput_streams.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/throughput_streams.hpp new file mode 100644 index 00000000000..52363935ca4 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/throughput_streams.hpp @@ -0,0 +1,35 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" +#include "vpu/utils/optional.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct ThroughputStreamsOption : public AsParameterEnabler { + using value_type = Optional; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/tiling_cmx_limit_kb.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/tiling_cmx_limit_kb.hpp new file mode 100644 index 00000000000..4104a03183f --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/tiling_cmx_limit_kb.hpp @@ -0,0 +1,35 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" +#include "vpu/utils/optional.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct TilingCMXLimitKBOption : public AsParameterEnabler { + using value_type = Optional; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/options/watchdog_interval.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/options/watchdog_interval.hpp new file mode 100644 index 00000000000..3bd7e336880 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/configuration/options/watchdog_interval.hpp @@ -0,0 +1,35 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include +#include + +#include "vpu/configuration/as_parameter_enabler.hpp" + +namespace vpu { + +namespace details { + +enum class Access; +enum class Category; + +} // namespace details + +class PluginConfiguration; + +struct WatchdogIntervalOption : public AsParsedParameterEnabler { + using value_type = std::chrono::milliseconds; + + static std::string key(); + static void validate(const std::string&); + static void validate(const PluginConfiguration&); + static std::string defaultValue(); + static value_type parse(const std::string&); + static details::Access access(); + static details::Category category(); +}; + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/configuration/plugin_configuration.hpp b/inference-engine/src/vpu/common/include/vpu/configuration/plugin_configuration.hpp index ced07f36477..5d4786f321c 100644 --- a/inference-engine/src/vpu/common/include/vpu/configuration/plugin_configuration.hpp +++ b/inference-engine/src/vpu/common/include/vpu/configuration/plugin_configuration.hpp @@ -9,7 +9,6 @@ #include #include #include -#include #include "ie_parameter.hpp" @@ -78,9 +77,7 @@ private: } // namespace details -// TODO: remove virtual inheritance once all options are migrated -// it's needed to pass updated compilation config to graph transformer -class PluginConfiguration : public virtual ParsedConfig { +class PluginConfiguration { public: PluginConfiguration(); diff --git a/inference-engine/src/vpu/common/include/vpu/parsed_config.hpp b/inference-engine/src/vpu/common/include/vpu/parsed_config.hpp deleted file mode 100644 index aa1793806e9..00000000000 --- a/inference-engine/src/vpu/common/include/vpu/parsed_config.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include - -namespace vpu { - -class ParsedConfig : public ParsedConfigBase { -public: - ParsedConfig() = default; - ParsedConfig(const ParsedConfig&) = default; - ParsedConfig& operator=(const ParsedConfig&) = default; - ParsedConfig(ParsedConfig&&) = delete; - ParsedConfig& operator=(ParsedConfig&&) = delete; - - const std::string& compilerLogFilePath() const { - return _compilerLogFilePath; - } - - const CompilationConfig& compileConfig() const { - return _compileConfig; - } - - CompilationConfig& compileConfig() { - return _compileConfig; - } - - bool printReceiveTensorTime() const { - return _printReceiveTensorTime; - } - - bool perfCount() const { - return _perfCount; - } - - PerfReport perfReport() const { - return _perfReport; - } - -protected: - const std::unordered_set& getCompileOptions() const override; - const std::unordered_set& getRunTimeOptions() const override; - const std::unordered_set& getDeprecatedOptions() const override; - void parse(const std::map& config) override; - -private: - std::string _compilerLogFilePath; - CompilationConfig _compileConfig; - bool _printReceiveTensorTime = false; - bool _perfCount = false; - PerfReport _perfReport = PerfReport::PerLayer; -}; - -} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/parsed_config_base.hpp b/inference-engine/src/vpu/common/include/vpu/parsed_config_base.hpp deleted file mode 100644 index fc57ea8ed24..00000000000 --- a/inference-engine/src/vpu/common/include/vpu/parsed_config_base.hpp +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -namespace vpu { - -VPU_DECLARE_ENUM(ConfigMode, - Any, - RunTime, -) - -class ParsedConfigBase { -public: - bool exclusiveAsyncRequests() const { - return _exclusiveAsyncRequests; - } - -public: - ParsedConfigBase(); - virtual ~ParsedConfigBase(); - -protected: - void update(const std::map& config, ConfigMode mode = ConfigMode::Any); - - virtual const std::unordered_set& getCompileOptions() const; - virtual const std::unordered_set& getRunTimeOptions() const; - virtual const std::unordered_set& getDeprecatedOptions() const; - virtual void parse(const std::map& config); - -protected: - static std::unordered_set merge( - const std::unordered_set& set1, - const std::unordered_set& set2); - - static void setOption( - std::string& dst, - const std::map& config, - const std::string& key); - - template - static void setOption( - T& dst, - const SupportedMap& supported, - const std::map& config, - const std::string& key) { - const auto value = config.find(key); - if (value != config.end()) { - const auto parsedValue = supported.find(value->second); - if (parsedValue == supported.end()) { - IE_THROW() - << "Unsupported value " << "\"" << value->second << "\"" - << " for key " << key; - } - - dst = parsedValue->second; - } - } - - template - static void setOption( - T& dst, - const std::map& config, - const std::string& key, - const PreprocessFunc& preprocess) { - const auto value = config.find(key); - if (value != config.end()) { - try { - dst = preprocess(value->second); - } catch(const std::exception& e) { - IE_THROW() - << "Invalid value " << "\"" << value->second << "\"" - << " for key " << key - << " : " << e.what(); - } - } - } - - static std::chrono::seconds parseSeconds(const std::string& src) { - try { - return std::chrono::seconds(std::stoi(src)); - } catch (const std::exception& e) { - IE_THROW() - << "Can not convert string:" - << src << " to seconds. " - << "Message : " << e.what(); - } - } - - static int parseInt(const std::string& src) { - const auto val = std::stoi(src); - - return val; - } - - static float parseFloat(const std::string& src) { - return std::stof(src); - } - - static float parseFloatReverse(const std::string& src) { - const auto val = std::stof(src); - if (val == 0.0f) { - throw std::invalid_argument("Zero value"); - } - return 1.0f / val; - } - -protected: - static const std::unordered_map switches; - - Logger::Ptr _log; - -private: - bool _exclusiveAsyncRequests = false; -}; - -} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/private_plugin_config.hpp b/inference-engine/src/vpu/common/include/vpu/private_plugin_config.hpp index 7a209f036d3..78f1964e080 100644 --- a/inference-engine/src/vpu/common/include/vpu/private_plugin_config.hpp +++ b/inference-engine/src/vpu/common/include/vpu/private_plugin_config.hpp @@ -29,7 +29,6 @@ DECLARE_VPU_CONFIG(MYRIAD_HW_POOL_CONV_MERGE); DECLARE_VPU_CONFIG(MYRIAD_PACK_DATA_IN_CMX); DECLARE_VPU_CONFIG(MYRIAD_HW_DILATION); DECLARE_VPU_CONFIG(MYRIAD_HW_EXTRA_SPLIT); -DECLARE_VPU_CONFIG(MYRIAD_FORCE_DEPRECATED_CNN_CONVERSION); DECLARE_VPU_CONFIG(MYRIAD_PERF_REPORT_MODE); DECLARE_VPU_CONFIG(MYRIAD_PER_LAYER); @@ -60,20 +59,37 @@ DECLARE_VPU_CONFIG(MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL); */ DECLARE_VPU_CONFIG(MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM); +/** + * @brief Default key definition for InferenceEngine::MYRIAD_NUMBER_OF_SHAVES option. + */ +DECLARE_VPU_CONFIG(MYRIAD_NUMBER_OF_SHAVES_AUTO); + +/** + * @brief Default key definition for InferenceEngine::MYRIAD_NUMBER_OF_CMX_SLICES option. + */ +DECLARE_VPU_CONFIG(MYRIAD_NUMBER_OF_CMX_SLICES_AUTO); + +/** + * @brief Default key definition for InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB option. + */ +DECLARE_VPU_CONFIG(MYRIAD_TILING_CMX_LIMIT_KB_AUTO); + +/** + * @brief Default key definition for InferenceEngine::MYRIAD_HW_INJECT_STAGES option. + */ +DECLARE_VPU_CONFIG(MYRIAD_HW_INJECT_STAGES_AUTO); + // // Debug options // -DECLARE_VPU_CONFIG(MYRIAD_HW_WHITE_LIST); DECLARE_VPU_CONFIG(MYRIAD_HW_BLACK_LIST); DECLARE_VPU_CONFIG(MYRIAD_NONE_LAYERS); DECLARE_VPU_CONFIG(MYRIAD_IGNORE_UNKNOWN_LAYERS); -DECLARE_VPU_CONFIG(MYRIAD_COMPILER_LOG_FILE_PATH); - DECLARE_VPU_CONFIG(MYRIAD_DUMP_INTERNAL_GRAPH_FILE_NAME); -DECLARE_VPU_CONFIG(MYRIAD_DUMP_INTERNAL_GRAPH_DIRECTORY); +DECLARE_VPU_CONFIG(MYRIAD_DUMP_ALL_PASSES_DIRECTORY); DECLARE_VPU_CONFIG(MYRIAD_DUMP_ALL_PASSES); /** @@ -95,8 +111,6 @@ DECLARE_VPU_CONFIG(MYRIAD_ENABLE_PERMUTE_MERGING); DECLARE_VPU_CONFIG(MYRIAD_ENABLE_REPL_WITH_SCRELU); -DECLARE_VPU_CONFIG(MYRIAD_ENABLE_REPLACE_WITH_REDUCE_MEAN); - /** * @brief Used to enable Tensor Iterator unrolling to get a reference for Tensor Iterator per-layer tests. * Default is "NO". @@ -123,8 +137,6 @@ DECLARE_VPU_CONFIG(MYRIAD_POWER_STAGE_NCES); DECLARE_VPU_CONFIG(MYRIAD_WATCHDOG); -DECLARE_VPU_CONFIG(MYRIAD_PLUGIN_LOG_FILE_PATH); - DECLARE_VPU_CONFIG(MYRIAD_DEVICE_CONNECT_TIMEOUT); DECLARE_VPU_CONFIG(MYRIAD_ENABLE_ASYNC_DMA); diff --git a/inference-engine/src/vpu/common/include/vpu/utils/ddr_type.hpp b/inference-engine/src/vpu/common/include/vpu/utils/ddr_type.hpp new file mode 100644 index 00000000000..30af123dee6 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/utils/ddr_type.hpp @@ -0,0 +1,19 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "vpu/utils/enums.hpp" + +namespace vpu { + +VPU_DECLARE_ENUM(MovidiusDdrType, + AUTO = 0, + MICRON_2GB = 1, + SAMSUNG_2GB = 2, + HYNIX_2GB = 3, + MICRON_1GB = 4, +) + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/utils/hw_disabled.hpp b/inference-engine/src/vpu/common/include/vpu/utils/hw_disabled.hpp new file mode 100644 index 00000000000..759a6fcfdea --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/utils/hw_disabled.hpp @@ -0,0 +1,22 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/configuration/options/hw_black_list.hpp" + +namespace vpu { + +inline bool HwDisabled(const PluginConfiguration& configuration, const std::string& layerName) { + auto hwBlackList = configuration.get(); + + if (!hwBlackList.empty()) { + return hwBlackList.count(layerName) != 0; + } + + return false; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/utils/power_config.hpp b/inference-engine/src/vpu/common/include/vpu/utils/power_config.hpp new file mode 100644 index 00000000000..1f63e5e5907 --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/utils/power_config.hpp @@ -0,0 +1,20 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "vpu/utils/enums.hpp" + +namespace vpu { + +// Must be synchronized with firmware side. +VPU_DECLARE_ENUM(PowerConfig, + FULL = 0, + INFER = 1, + STAGE = 2, + STAGE_SHAVES = 3, + STAGE_NCES = 4, +) + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/include/vpu/utils/skip_layers.hpp b/inference-engine/src/vpu/common/include/vpu/utils/skip_layers.hpp new file mode 100644 index 00000000000..d31bf10546a --- /dev/null +++ b/inference-engine/src/vpu/common/include/vpu/utils/skip_layers.hpp @@ -0,0 +1,26 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/configuration/options/none_layers.hpp" + +namespace vpu { + +inline bool skipAllLayers(const PluginConfiguration& configuration) { + auto noneLayers = configuration.get(); + + if (noneLayers.size() == 1) { + const auto& val = *noneLayers.begin(); + return val == "*"; + } + return false; +} + +inline bool skipLayerType(const PluginConfiguration& configuration, const std::string& layerType) { + return configuration.get().count(layerType) != 0; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/check_preprocessing_inside_model.cpp b/inference-engine/src/vpu/common/src/configuration/options/check_preprocessing_inside_model.cpp new file mode 100644 index 00000000000..2d620f16a56 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/check_preprocessing_inside_model.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/check_preprocessing_inside_model.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void CheckPreprocessingInsideModelOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void CheckPreprocessingInsideModelOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string CheckPreprocessingInsideModelOption::key() { + return InferenceEngine::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL; +} + +details::Access CheckPreprocessingInsideModelOption::access() { + return details::Access::Private; +} + +details::Category CheckPreprocessingInsideModelOption::category() { + return details::Category::CompileTime; +} + +std::string CheckPreprocessingInsideModelOption::defaultValue() { + return InferenceEngine::PluginConfigParams::YES; +} + +CheckPreprocessingInsideModelOption::value_type CheckPreprocessingInsideModelOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/config_file.cpp b/inference-engine/src/vpu/common/src/configuration/options/config_file.cpp new file mode 100644 index 00000000000..aac555fa61a --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/config_file.cpp @@ -0,0 +1,39 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/configuration/options/config_file.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +#include "ie_plugin_config.hpp" + +namespace vpu { + +void ConfigFileOption::validate(const std::string& value) {} + +void ConfigFileOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string ConfigFileOption::key() { + return CONFIG_KEY(CONFIG_FILE); +} + +details::Access ConfigFileOption::access() { + return details::Access::Public; +} + +details::Category ConfigFileOption::category() { + return details::Category::CompileTime; +} + +std::string ConfigFileOption::defaultValue() { + return std::string(); +} + +ConfigFileOption::value_type ConfigFileOption::parse(const std::string& value) { + return value; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/custom_layers.cpp b/inference-engine/src/vpu/common/src/configuration/options/custom_layers.cpp new file mode 100644 index 00000000000..e23a0332dbe --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/custom_layers.cpp @@ -0,0 +1,38 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/configuration/options/custom_layers.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/vpu_config.hpp" + +namespace vpu { + +void CustomLayersOption::validate(const std::string& value) {} + +void CustomLayersOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string CustomLayersOption::key() { + return InferenceEngine::MYRIAD_CUSTOM_LAYERS; +} + +details::Access CustomLayersOption::access() { + return details::Access::Public; +} + +details::Category CustomLayersOption::category() { + return details::Category::CompileTime; +} + +std::string CustomLayersOption::defaultValue() { + return std::string(); +} + +CustomLayersOption::value_type CustomLayersOption::parse(const std::string& value) { + return value; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/detect_network_batch.cpp b/inference-engine/src/vpu/common/src/configuration/options/detect_network_batch.cpp new file mode 100644 index 00000000000..214bfc119ed --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/detect_network_batch.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/detect_network_batch.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void DetectNetworkBatchOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void DetectNetworkBatchOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string DetectNetworkBatchOption::key() { + return InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH; +} + +details::Access DetectNetworkBatchOption::access() { + return details::Access::Private; +} + +details::Category DetectNetworkBatchOption::category() { + return details::Category::CompileTime; +} + +std::string DetectNetworkBatchOption::defaultValue() { + return InferenceEngine::PluginConfigParams::YES; +} + +DetectNetworkBatchOption::value_type DetectNetworkBatchOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/device_connect_timeout.cpp b/inference-engine/src/vpu/common/src/configuration/options/device_connect_timeout.cpp new file mode 100644 index 00000000000..a8ba73f2576 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/device_connect_timeout.cpp @@ -0,0 +1,58 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/configuration/options/device_connect_timeout.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/utils/error.hpp" + +namespace vpu { + +void DeviceConnectTimeoutOption::validate(const std::string& value) { + int intValue; + try { + intValue = std::stoi(value); + } catch (const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value); + } + + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(intValue >= 0, + R"(unexpected {} option value "{}", only not negative numbers are supported)", key(), value); + return; +} + +void DeviceConnectTimeoutOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string DeviceConnectTimeoutOption::key() { + return InferenceEngine::MYRIAD_DEVICE_CONNECT_TIMEOUT; +} + +details::Access DeviceConnectTimeoutOption::access() { + return details::Access::Private; +} + +details::Category DeviceConnectTimeoutOption::category() { + return details::Category::RunTime; +} + +std::string DeviceConnectTimeoutOption::defaultValue() { + return std::to_string(15); +} + +DeviceConnectTimeoutOption::value_type DeviceConnectTimeoutOption::parse(const std::string& value) { + int intValue; + try { + intValue = std::stoi(value); + } catch (const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value); + } + + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(intValue >= 0, + R"(unexpected {} option value "{}", only not negative numbers are supported)", key(), value); + return DeviceConnectTimeoutOption::value_type(intValue); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/device_id.cpp b/inference-engine/src/vpu/common/src/configuration/options/device_id.cpp new file mode 100644 index 00000000000..d56f86244f2 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/device_id.cpp @@ -0,0 +1,38 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/configuration/options/device_id.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "ie_plugin_config.hpp" + +namespace vpu { + +void DeviceIDOption::validate(const std::string& value) {} + +void DeviceIDOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string DeviceIDOption::key() { + return CONFIG_KEY(DEVICE_ID); +} + +details::Access DeviceIDOption::access() { + return details::Access::Public; +} + +details::Category DeviceIDOption::category() { + return details::Category::RunTime; +} + +std::string DeviceIDOption::defaultValue() { + return std::string(); +} + +DeviceIDOption::value_type DeviceIDOption::parse(const std::string& value) { + return value; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/disable_convert_stages.cpp b/inference-engine/src/vpu/common/src/configuration/options/disable_convert_stages.cpp new file mode 100644 index 00000000000..6b1002da809 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/disable_convert_stages.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/disable_convert_stages.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void DisableConvertStagesOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void DisableConvertStagesOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string DisableConvertStagesOption::key() { + return InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES; +} + +details::Access DisableConvertStagesOption::access() { + return details::Access::Private; +} + +details::Category DisableConvertStagesOption::category() { + return details::Category::CompileTime; +} + +std::string DisableConvertStagesOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +DisableConvertStagesOption::value_type DisableConvertStagesOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/disable_reorder.cpp b/inference-engine/src/vpu/common/src/configuration/options/disable_reorder.cpp new file mode 100644 index 00000000000..f9863f2740a --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/disable_reorder.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/disable_reorder.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void DisableReorderOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void DisableReorderOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string DisableReorderOption::key() { + return InferenceEngine::MYRIAD_DISABLE_REORDER; +} + +details::Access DisableReorderOption::access() { + return details::Access::Private; +} + +details::Category DisableReorderOption::category() { + return details::Category::CompileTime; +} + +std::string DisableReorderOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +DisableReorderOption::value_type DisableReorderOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/dump_all_passes.cpp b/inference-engine/src/vpu/common/src/configuration/options/dump_all_passes.cpp new file mode 100644 index 00000000000..10294df5467 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/dump_all_passes.cpp @@ -0,0 +1,48 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/dump_all_passes.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/private_plugin_config.hpp" + +#include + +namespace vpu { + +void DumpAllPassesOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, + R"(unexpected {} option value "{}", only {} are supported)", key(), value, getKeys(converters)); +} + +void DumpAllPassesOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string DumpAllPassesOption::key() { + return InferenceEngine::MYRIAD_DUMP_ALL_PASSES; +} + +details::Access DumpAllPassesOption::access() { + return details::Access::Private; +} + +details::Category DumpAllPassesOption::category() { + return details::Category::CompileTime; +} + +std::string DumpAllPassesOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +DumpAllPassesOption::value_type DumpAllPassesOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, + R"(unexpected {} option value "{}", only {} are supported)", key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/dump_all_passes_directory.cpp b/inference-engine/src/vpu/common/src/configuration/options/dump_all_passes_directory.cpp new file mode 100644 index 00000000000..428a3d1d12a --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/dump_all_passes_directory.cpp @@ -0,0 +1,38 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/configuration/options/dump_all_passes_directory.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void DumpAllPassesDirectoryOption::validate(const std::string& value) {} + +void DumpAllPassesDirectoryOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string DumpAllPassesDirectoryOption::key() { + return InferenceEngine::MYRIAD_DUMP_ALL_PASSES_DIRECTORY; +} + +details::Access DumpAllPassesDirectoryOption::access() { + return details::Access::Private; +} + +details::Category DumpAllPassesDirectoryOption::category() { + return details::Category::CompileTime; +} + +std::string DumpAllPassesDirectoryOption::defaultValue() { + return std::string(); +} + +DumpAllPassesDirectoryOption::value_type DumpAllPassesDirectoryOption::parse(const std::string& value) { + return value; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/dump_internal_graph_file_name.cpp b/inference-engine/src/vpu/common/src/configuration/options/dump_internal_graph_file_name.cpp new file mode 100644 index 00000000000..99961c727a7 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/dump_internal_graph_file_name.cpp @@ -0,0 +1,38 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/configuration/options/dump_internal_graph_file_name.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void DumpInternalGraphFileNameOption::validate(const std::string& value) {} + +void DumpInternalGraphFileNameOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string DumpInternalGraphFileNameOption::key() { + return InferenceEngine::MYRIAD_DUMP_INTERNAL_GRAPH_FILE_NAME; +} + +details::Access DumpInternalGraphFileNameOption::access() { + return details::Access::Private; +} + +details::Category DumpInternalGraphFileNameOption::category() { + return details::Category::CompileTime; +} + +std::string DumpInternalGraphFileNameOption::defaultValue() { + return std::string(); +} + +DumpInternalGraphFileNameOption::value_type DumpInternalGraphFileNameOption::parse(const std::string& value) { + return value; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/enable_async_dma.cpp b/inference-engine/src/vpu/common/src/configuration/options/enable_async_dma.cpp new file mode 100644 index 00000000000..d5cda8d01f1 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/enable_async_dma.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/enable_async_dma.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void EnableAsyncDMAOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void EnableAsyncDMAOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string EnableAsyncDMAOption::key() { + return InferenceEngine::MYRIAD_ENABLE_ASYNC_DMA; +} + +details::Access EnableAsyncDMAOption::access() { + return details::Access::Private; +} + +details::Category EnableAsyncDMAOption::category() { + return details::Category::CompileTime; +} + +std::string EnableAsyncDMAOption::defaultValue() { + return InferenceEngine::PluginConfigParams::YES; +} + +EnableAsyncDMAOption::value_type EnableAsyncDMAOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/enable_custom_reshape_param.cpp b/inference-engine/src/vpu/common/src/configuration/options/enable_custom_reshape_param.cpp new file mode 100644 index 00000000000..07fbbe42140 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/enable_custom_reshape_param.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/enable_custom_reshape_param.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void EnableCustomReshapeParamOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void EnableCustomReshapeParamOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string EnableCustomReshapeParamOption::key() { + return InferenceEngine::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM; +} + +details::Access EnableCustomReshapeParamOption::access() { + return details::Access::Private; +} + +details::Category EnableCustomReshapeParamOption::category() { + return details::Category::CompileTime; +} + +std::string EnableCustomReshapeParamOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +EnableCustomReshapeParamOption::value_type EnableCustomReshapeParamOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/enable_early_eltwise_relu_fusion.cpp b/inference-engine/src/vpu/common/src/configuration/options/enable_early_eltwise_relu_fusion.cpp new file mode 100644 index 00000000000..ed095104e92 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/enable_early_eltwise_relu_fusion.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/enable_early_eltwise_relu_fusion.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void EnableEarlyEltwiseReluFusionOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void EnableEarlyEltwiseReluFusionOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string EnableEarlyEltwiseReluFusionOption::key() { + return InferenceEngine::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION; +} + +details::Access EnableEarlyEltwiseReluFusionOption::access() { + return details::Access::Private; +} + +details::Category EnableEarlyEltwiseReluFusionOption::category() { + return details::Category::CompileTime; +} + +std::string EnableEarlyEltwiseReluFusionOption::defaultValue() { + return InferenceEngine::PluginConfigParams::YES; +} + +EnableEarlyEltwiseReluFusionOption::value_type EnableEarlyEltwiseReluFusionOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/enable_force_reset.cpp b/inference-engine/src/vpu/common/src/configuration/options/enable_force_reset.cpp new file mode 100644 index 00000000000..a52b7ada5b6 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/enable_force_reset.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/enable_force_reset.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/myriad_config.hpp" + +namespace vpu { + +void EnableForceResetOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void EnableForceResetOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string EnableForceResetOption::key() { + return InferenceEngine::MYRIAD_ENABLE_FORCE_RESET; +} + +details::Access EnableForceResetOption::access() { + return details::Access::Public; +} + +details::Category EnableForceResetOption::category() { + return details::Category::RunTime; +} + +std::string EnableForceResetOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +EnableForceResetOption::value_type EnableForceResetOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/enable_memory_types_annotation.cpp b/inference-engine/src/vpu/common/src/configuration/options/enable_memory_types_annotation.cpp new file mode 100644 index 00000000000..8ccbb49ac89 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/enable_memory_types_annotation.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/enable_memory_types_annotation.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void EnableMemoryTypesAnnotationOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void EnableMemoryTypesAnnotationOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string EnableMemoryTypesAnnotationOption::key() { + return InferenceEngine::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION; +} + +details::Access EnableMemoryTypesAnnotationOption::access() { + return details::Access::Private; +} + +details::Category EnableMemoryTypesAnnotationOption::category() { + return details::Category::CompileTime; +} + +std::string EnableMemoryTypesAnnotationOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +EnableMemoryTypesAnnotationOption::value_type EnableMemoryTypesAnnotationOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/enable_permute_merging.cpp b/inference-engine/src/vpu/common/src/configuration/options/enable_permute_merging.cpp new file mode 100644 index 00000000000..3cd3179c478 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/enable_permute_merging.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/enable_permute_merging.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void EnablePermuteMergingOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void EnablePermuteMergingOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string EnablePermuteMergingOption::key() { + return InferenceEngine::MYRIAD_ENABLE_PERMUTE_MERGING; +} + +details::Access EnablePermuteMergingOption::access() { + return details::Access::Private; +} + +details::Category EnablePermuteMergingOption::category() { + return details::Category::CompileTime; +} + +std::string EnablePermuteMergingOption::defaultValue() { + return InferenceEngine::PluginConfigParams::YES; +} + +EnablePermuteMergingOption::value_type EnablePermuteMergingOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/enable_receiving_tensor_time.cpp b/inference-engine/src/vpu/common/src/configuration/options/enable_receiving_tensor_time.cpp new file mode 100644 index 00000000000..a1aeb1fdfc1 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/enable_receiving_tensor_time.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/enable_receiving_tensor_time.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/vpu_config.hpp" + +namespace vpu { + +void EnableReceivingTensorTimeOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void EnableReceivingTensorTimeOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string EnableReceivingTensorTimeOption::key() { + return InferenceEngine::MYRIAD_ENABLE_RECEIVING_TENSOR_TIME; +} + +details::Access EnableReceivingTensorTimeOption::access() { + return details::Access::Public; +} + +details::Category EnableReceivingTensorTimeOption::category() { + return details::Category::RunTime; +} + +std::string EnableReceivingTensorTimeOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +EnableReceivingTensorTimeOption::value_type EnableReceivingTensorTimeOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/enable_repl_with_screlu.cpp b/inference-engine/src/vpu/common/src/configuration/options/enable_repl_with_screlu.cpp new file mode 100644 index 00000000000..8cc2668dc30 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/enable_repl_with_screlu.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/enable_repl_with_screlu.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void EnableReplWithSCReluOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void EnableReplWithSCReluOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string EnableReplWithSCReluOption::key() { + return InferenceEngine::MYRIAD_ENABLE_REPL_WITH_SCRELU; +} + +details::Access EnableReplWithSCReluOption::access() { + return details::Access::Private; +} + +details::Category EnableReplWithSCReluOption::category() { + return details::Category::CompileTime; +} + +std::string EnableReplWithSCReluOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +EnableReplWithSCReluOption::value_type EnableReplWithSCReluOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/enable_tensor_iterator_unrolling.cpp b/inference-engine/src/vpu/common/src/configuration/options/enable_tensor_iterator_unrolling.cpp new file mode 100644 index 00000000000..1fde36a9100 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/enable_tensor_iterator_unrolling.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/enable_tensor_iterator_unrolling.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void EnableTensorIteratorUnrollingOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void EnableTensorIteratorUnrollingOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string EnableTensorIteratorUnrollingOption::key() { + return InferenceEngine::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING; +} + +details::Access EnableTensorIteratorUnrollingOption::access() { + return details::Access::Private; +} + +details::Category EnableTensorIteratorUnrollingOption::category() { + return details::Category::CompileTime; +} + +std::string EnableTensorIteratorUnrollingOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +EnableTensorIteratorUnrollingOption::value_type EnableTensorIteratorUnrollingOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/enable_weights_analysis.cpp b/inference-engine/src/vpu/common/src/configuration/options/enable_weights_analysis.cpp new file mode 100644 index 00000000000..7b6f5153092 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/enable_weights_analysis.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/enable_weights_analysis.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void EnableWeightsAnalysisOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void EnableWeightsAnalysisOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string EnableWeightsAnalysisOption::key() { + return InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS; +} + +details::Access EnableWeightsAnalysisOption::access() { + return details::Access::Private; +} + +details::Category EnableWeightsAnalysisOption::category() { + return details::Category::CompileTime; +} + +std::string EnableWeightsAnalysisOption::defaultValue() { + return InferenceEngine::PluginConfigParams::YES; +} + +EnableWeightsAnalysisOption::value_type EnableWeightsAnalysisOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/exclusive_async_requests.cpp b/inference-engine/src/vpu/common/src/configuration/options/exclusive_async_requests.cpp new file mode 100644 index 00000000000..bd516582541 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/exclusive_async_requests.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/exclusive_async_requests.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "ie_plugin_config.hpp" + +namespace vpu { + +void ExclusiveAsyncRequestsOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void ExclusiveAsyncRequestsOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string ExclusiveAsyncRequestsOption::key() { + return InferenceEngine::PluginConfigParams::KEY_EXCLUSIVE_ASYNC_REQUESTS; +} + +details::Access ExclusiveAsyncRequestsOption::access() { + return details::Access::Public; +} + +details::Category ExclusiveAsyncRequestsOption::category() { + return details::Category::RunTime; +} + +std::string ExclusiveAsyncRequestsOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +ExclusiveAsyncRequestsOption::value_type ExclusiveAsyncRequestsOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/force_pure_tensor_iterator.cpp b/inference-engine/src/vpu/common/src/configuration/options/force_pure_tensor_iterator.cpp new file mode 100644 index 00000000000..9248304177d --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/force_pure_tensor_iterator.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/force_pure_tensor_iterator.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void ForcePureTensorIteratorOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void ForcePureTensorIteratorOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string ForcePureTensorIteratorOption::key() { + return InferenceEngine::MYRIAD_FORCE_PURE_TENSOR_ITERATOR; +} + +details::Access ForcePureTensorIteratorOption::access() { + return details::Access::Private; +} + +details::Category ForcePureTensorIteratorOption::category() { + return details::Category::CompileTime; +} + +std::string ForcePureTensorIteratorOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +ForcePureTensorIteratorOption::value_type ForcePureTensorIteratorOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/hw_acceleration.cpp b/inference-engine/src/vpu/common/src/configuration/options/hw_acceleration.cpp new file mode 100644 index 00000000000..c8833a0bce9 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/hw_acceleration.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/hw_acceleration.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/vpu_config.hpp" + +namespace vpu { + +void HwAccelerationOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void HwAccelerationOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string HwAccelerationOption::key() { + return InferenceEngine::MYRIAD_ENABLE_HW_ACCELERATION; +} + +details::Access HwAccelerationOption::access() { + return details::Access::Public; +} + +details::Category HwAccelerationOption::category() { + return details::Category::CompileTime; +} + +std::string HwAccelerationOption::defaultValue() { + return InferenceEngine::PluginConfigParams::YES; +} + +HwAccelerationOption::value_type HwAccelerationOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/hw_black_list.cpp b/inference-engine/src/vpu/common/src/configuration/options/hw_black_list.cpp new file mode 100644 index 00000000000..8bcbc60f87c --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/hw_black_list.cpp @@ -0,0 +1,53 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/configuration/options/hw_black_list.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/utils/error.hpp" + +#include + +namespace vpu { + +void HwBlackListOption::validate(const std::string& value) { + try { + splitStringList(value, ','); + } catch(const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}")", key(), value); + } +} + +void HwBlackListOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string HwBlackListOption::key() { + return InferenceEngine::MYRIAD_HW_BLACK_LIST; +} + +details::Access HwBlackListOption::access() { + return details::Access::Private; +} + +details::Category HwBlackListOption::category() { + return details::Category::CompileTime; +} + +std::string HwBlackListOption::defaultValue() { + return std::string(); +} + +HwBlackListOption::value_type HwBlackListOption::parse(const std::string& value) { + HwBlackListOption::value_type stringList; + try { + stringList = splitStringList(value, ','); + } catch(const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}")", key(), value); + } + return stringList; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/hw_dilation.cpp b/inference-engine/src/vpu/common/src/configuration/options/hw_dilation.cpp new file mode 100644 index 00000000000..eb9b52654fe --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/hw_dilation.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/hw_dilation.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void HwDilationOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void HwDilationOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string HwDilationOption::key() { + return InferenceEngine::MYRIAD_HW_DILATION; +} + +details::Access HwDilationOption::access() { + return details::Access::Private; +} + +details::Category HwDilationOption::category() { + return details::Category::CompileTime; +} + +std::string HwDilationOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +HwDilationOption::value_type HwDilationOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/hw_extra_split.cpp b/inference-engine/src/vpu/common/src/configuration/options/hw_extra_split.cpp new file mode 100644 index 00000000000..659374a2ac2 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/hw_extra_split.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/hw_extra_split.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void HwExtraSplitOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void HwExtraSplitOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string HwExtraSplitOption::key() { + return InferenceEngine::MYRIAD_HW_EXTRA_SPLIT; +} + +details::Access HwExtraSplitOption::access() { + return details::Access::Private; +} + +details::Category HwExtraSplitOption::category() { + return details::Category::CompileTime; +} + +std::string HwExtraSplitOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +HwExtraSplitOption::value_type HwExtraSplitOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/hw_inject_stages.cpp b/inference-engine/src/vpu/common/src/configuration/options/hw_inject_stages.cpp new file mode 100644 index 00000000000..32126bcd9f0 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/hw_inject_stages.cpp @@ -0,0 +1,50 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/hw_inject_stages.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void HwInjectStagesOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(value == defaultValue() || converters.count(value) != 0, + R"(unexpected {} option value "{}", only {} are supported)", key(), value, getKeys(converters)); +} + +void HwInjectStagesOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string HwInjectStagesOption::key() { + return InferenceEngine::MYRIAD_HW_INJECT_STAGES; +} + +details::Access HwInjectStagesOption::access() { + return details::Access::Private; +} + +details::Category HwInjectStagesOption::category() { + return details::Category::CompileTime; +} + +std::string HwInjectStagesOption::defaultValue() { + return InferenceEngine::MYRIAD_HW_INJECT_STAGES_AUTO; +} + +HwInjectStagesOption::value_type HwInjectStagesOption::parse(const std::string& value) { + if (value == defaultValue()) { + return HwInjectStagesOption::value_type(); + } + + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, + R"(unexpected {} option value "{}", only {} are supported)", key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/hw_pool_conv_merge.cpp b/inference-engine/src/vpu/common/src/configuration/options/hw_pool_conv_merge.cpp new file mode 100644 index 00000000000..763fe0b5089 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/hw_pool_conv_merge.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/hw_pool_conv_merge.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void HwPoolConvMergeOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void HwPoolConvMergeOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string HwPoolConvMergeOption::key() { + return InferenceEngine::MYRIAD_HW_POOL_CONV_MERGE; +} + +details::Access HwPoolConvMergeOption::access() { + return details::Access::Private; +} + +details::Category HwPoolConvMergeOption::category() { + return details::Category::CompileTime; +} + +std::string HwPoolConvMergeOption::defaultValue() { + return InferenceEngine::PluginConfigParams::YES; +} + +HwPoolConvMergeOption::value_type HwPoolConvMergeOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/ignore_unknown_layers.cpp b/inference-engine/src/vpu/common/src/configuration/options/ignore_unknown_layers.cpp new file mode 100644 index 00000000000..4043a7b6686 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/ignore_unknown_layers.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/ignore_unknown_layers.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void IgnoreUnknownLayersOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void IgnoreUnknownLayersOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string IgnoreUnknownLayersOption::key() { + return InferenceEngine::MYRIAD_IGNORE_UNKNOWN_LAYERS; +} + +details::Access IgnoreUnknownLayersOption::access() { + return details::Access::Private; +} + +details::Category IgnoreUnknownLayersOption::category() { + return details::Category::CompileTime; +} + +std::string IgnoreUnknownLayersOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +IgnoreUnknownLayersOption::value_type IgnoreUnknownLayersOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/ir_with_scales_directory.cpp b/inference-engine/src/vpu/common/src/configuration/options/ir_with_scales_directory.cpp new file mode 100644 index 00000000000..42037bdc9f0 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/ir_with_scales_directory.cpp @@ -0,0 +1,38 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/configuration/options/ir_with_scales_directory.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void IRWithScalesDirectoryOption::validate(const std::string& value) {} + +void IRWithScalesDirectoryOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string IRWithScalesDirectoryOption::key() { + return InferenceEngine::MYRIAD_IR_WITH_SCALES_DIRECTORY; +} + +details::Access IRWithScalesDirectoryOption::access() { + return details::Access::Private; +} + +details::Category IRWithScalesDirectoryOption::category() { + return details::Category::CompileTime; +} + +std::string IRWithScalesDirectoryOption::defaultValue() { + return std::string(); +} + +IRWithScalesDirectoryOption::value_type IRWithScalesDirectoryOption::parse(const std::string& value) { + return value; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/memory_type.cpp b/inference-engine/src/vpu/common/src/configuration/options/memory_type.cpp new file mode 100644 index 00000000000..6c4f7845511 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/memory_type.cpp @@ -0,0 +1,74 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/configuration/options/memory_type.hpp" +#include "vpu/utils/ddr_type.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +#include +#include + +#include + +namespace vpu { + +namespace { + +const std::unordered_map& string2type() { +IE_SUPPRESS_DEPRECATED_START + static const std::unordered_map converters = { + {InferenceEngine::MYRIAD_DDR_AUTO, MovidiusDdrType::AUTO }, + {InferenceEngine::MYRIAD_DDR_MICRON_2GB, MovidiusDdrType::MICRON_2GB }, + {InferenceEngine::MYRIAD_DDR_SAMSUNG_2GB, MovidiusDdrType::SAMSUNG_2GB }, + {InferenceEngine::MYRIAD_DDR_HYNIX_2GB, MovidiusDdrType::HYNIX_2GB }, + {InferenceEngine::MYRIAD_DDR_MICRON_1GB, MovidiusDdrType::MICRON_1GB }, + + // Deprecated + {VPU_MYRIAD_CONFIG_VALUE(DDR_AUTO), MovidiusDdrType::AUTO }, + {VPU_MYRIAD_CONFIG_VALUE(MICRON_2GB), MovidiusDdrType::MICRON_2GB }, + {VPU_MYRIAD_CONFIG_VALUE(SAMSUNG_2GB), MovidiusDdrType::SAMSUNG_2GB }, + {VPU_MYRIAD_CONFIG_VALUE(HYNIX_2GB), MovidiusDdrType::HYNIX_2GB }, + {VPU_MYRIAD_CONFIG_VALUE(MICRON_1GB), MovidiusDdrType::MICRON_1GB } + }; +IE_SUPPRESS_DEPRECATED_END + return converters; +} + +} // namespace + +void MemoryTypeOption::validate(const std::string& value) { + const auto& converters = string2type(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void MemoryTypeOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string MemoryTypeOption::key() { + return InferenceEngine::MYRIAD_DDR_TYPE; +} + +details::Access MemoryTypeOption::access() { + return details::Access::Public; +} + +details::Category MemoryTypeOption::category() { + return details::Category::RunTime; +} + +std::string MemoryTypeOption::defaultValue() { + return InferenceEngine::MYRIAD_DDR_AUTO; +} + +MemoryTypeOption::value_type MemoryTypeOption::parse(const std::string& value) { + const auto& converters = string2type(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/none_layers.cpp b/inference-engine/src/vpu/common/src/configuration/options/none_layers.cpp new file mode 100644 index 00000000000..480ae6b7cc0 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/none_layers.cpp @@ -0,0 +1,53 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/configuration/options/none_layers.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/utils/error.hpp" + +#include + +namespace vpu { + +void NoneLayersOption::validate(const std::string& value) { + try { + splitStringList(value, ','); + } catch(const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}")", key(), value); + } +} + +void NoneLayersOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string NoneLayersOption::key() { + return InferenceEngine::MYRIAD_NONE_LAYERS; +} + +details::Access NoneLayersOption::access() { + return details::Access::Private; +} + +details::Category NoneLayersOption::category() { + return details::Category::CompileTime; +} + +std::string NoneLayersOption::defaultValue() { + return std::string(); +} + +NoneLayersOption::value_type NoneLayersOption::parse(const std::string& value) { + NoneLayersOption::value_type splitList; + try { + splitList = splitStringList(value, ','); + } catch(const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}")", key(), value); + } + return splitList; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/number_of_cmx_slices.cpp b/inference-engine/src/vpu/common/src/configuration/options/number_of_cmx_slices.cpp new file mode 100644 index 00000000000..5f575a98f6e --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/number_of_cmx_slices.cpp @@ -0,0 +1,78 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/number_of_cmx_slices.hpp" +#include "vpu/configuration/options/number_of_shaves.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/utils/error.hpp" + +namespace vpu { + +void NumberOfCMXSlicesOption::validate(const std::string& value) { + if (value == defaultValue()) { + return; + } + + int intValue; + try { + intValue = std::stoi(value); + } catch (const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value); + } + + VPU_THROW_UNLESS(intValue >= 0, + R"(unexpected {} option value "{}", only not negative numbers are supported)", key(), value); +} + +void NumberOfCMXSlicesOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); + VPU_THROW_UNLESS((configuration[key()] == defaultValue() && + configuration[NumberOfSHAVEsOption::key()] == NumberOfSHAVEsOption::defaultValue()) || + (configuration[key()] != defaultValue() && + configuration[NumberOfSHAVEsOption::key()] != NumberOfSHAVEsOption::defaultValue()), + R"(should set both options for resource management: {} and {})", NumberOfSHAVEsOption::key(), key()); + if (configuration[key()] != defaultValue()) { + VPU_THROW_UNLESS(configuration.get().get() <= parse(configuration[key()]).get(), + R"(Value of option {} must be not greater than value of option {}, but {} > {} are provided)", + NumberOfSHAVEsOption::key(), key(), + configuration.get().get(), parse(configuration[key()]).get()); + } +} + +std::string NumberOfCMXSlicesOption::key() { + return InferenceEngine::MYRIAD_NUMBER_OF_CMX_SLICES; +} + +details::Access NumberOfCMXSlicesOption::access() { + return details::Access::Private; +} + +details::Category NumberOfCMXSlicesOption::category() { + return details::Category::CompileTime; +} + +std::string NumberOfCMXSlicesOption::defaultValue() { + return InferenceEngine::MYRIAD_NUMBER_OF_CMX_SLICES_AUTO; +} + +NumberOfCMXSlicesOption::value_type NumberOfCMXSlicesOption::parse(const std::string& value) { + if (value == defaultValue()) { + return NumberOfCMXSlicesOption::value_type(); + } + + int intValue; + try { + intValue = std::stoi(value); + } catch (const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value); + } + + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(intValue >= 0, + R"(unexpected {} option value "{}", only not negative numbers are supported)", key(), value); + return intValue; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/number_of_shaves.cpp b/inference-engine/src/vpu/common/src/configuration/options/number_of_shaves.cpp new file mode 100644 index 00000000000..65fc2488e88 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/number_of_shaves.cpp @@ -0,0 +1,78 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/number_of_shaves.hpp" +#include "vpu/configuration/options/number_of_cmx_slices.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/utils/error.hpp" + +namespace vpu { + +void NumberOfSHAVEsOption::validate(const std::string& value) { + if (value == defaultValue()) { + return; + } + + int intValue; + try { + intValue = std::stoi(value); + } catch (const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value); + } + + VPU_THROW_UNLESS(intValue >= 0, + R"(unexpected {} option value "{}", only not negative numbers are supported)", key(), value); +} + +void NumberOfSHAVEsOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); + VPU_THROW_UNLESS((configuration[key()] == defaultValue() && + configuration[NumberOfCMXSlicesOption::key()] == NumberOfCMXSlicesOption::defaultValue()) || + (configuration[key()] != defaultValue() && + configuration[NumberOfCMXSlicesOption::key()] != NumberOfCMXSlicesOption::defaultValue()), + R"(should set both options for resource management: {} and {})", key(), NumberOfCMXSlicesOption::key()); + if (configuration[key()] != defaultValue()) { + VPU_THROW_UNLESS(parse(configuration[key()]).get() <= configuration.get().get(), + R"(Value of option {} must be not greater than value of option {}, but {} > {} are provided)", + key(), NumberOfCMXSlicesOption::key(), + parse(configuration[key()]).get(), configuration.get().get()); + } +} + +std::string NumberOfSHAVEsOption::key() { + return InferenceEngine::MYRIAD_NUMBER_OF_SHAVES; +} + +details::Access NumberOfSHAVEsOption::access() { + return details::Access::Private; +} + +details::Category NumberOfSHAVEsOption::category() { + return details::Category::CompileTime; +} + +std::string NumberOfSHAVEsOption::defaultValue() { + return InferenceEngine::MYRIAD_NUMBER_OF_SHAVES_AUTO; +} + +NumberOfSHAVEsOption::value_type NumberOfSHAVEsOption::parse(const std::string& value) { + if (value == defaultValue()) { + return NumberOfSHAVEsOption::value_type(); + } + + int intValue; + try { + intValue = std::stoi(value); + } catch (const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value); + } + + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(intValue >= 0, + R"(unexpected {} option value "{}", only not negative numbers are supported)", key(), value); + return intValue; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/pack_data_in_cmx.cpp b/inference-engine/src/vpu/common/src/configuration/options/pack_data_in_cmx.cpp new file mode 100644 index 00000000000..a195e2d5819 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/pack_data_in_cmx.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/pack_data_in_cmx.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +namespace vpu { + +void PackDataInCMXOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void PackDataInCMXOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string PackDataInCMXOption::key() { + return InferenceEngine::MYRIAD_PACK_DATA_IN_CMX; +} + +details::Access PackDataInCMXOption::access() { + return details::Access::Private; +} + +details::Category PackDataInCMXOption::category() { + return details::Category::CompileTime; +} + +std::string PackDataInCMXOption::defaultValue() { + return InferenceEngine::PluginConfigParams::YES; +} + +PackDataInCMXOption::value_type PackDataInCMXOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/perf_count.cpp b/inference-engine/src/vpu/common/src/configuration/options/perf_count.cpp new file mode 100644 index 00000000000..ad651bfdede --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/perf_count.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/perf_count.hpp" +#include "vpu/configuration/switch_converters.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "ie_plugin_config.hpp" + +namespace vpu { + +void PerfCountOption::validate(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void PerfCountOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string PerfCountOption::key() { + return CONFIG_KEY(PERF_COUNT); +} + +details::Access PerfCountOption::access() { + return details::Access::Public; +} + +details::Category PerfCountOption::category() { + return details::Category::RunTime; +} + +std::string PerfCountOption::defaultValue() { + return InferenceEngine::PluginConfigParams::NO; +} + +PerfCountOption::value_type PerfCountOption::parse(const std::string& value) { + const auto& converters = string2switch(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/perf_report_mode.cpp b/inference-engine/src/vpu/common/src/configuration/options/perf_report_mode.cpp new file mode 100644 index 00000000000..37e19006206 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/perf_report_mode.cpp @@ -0,0 +1,59 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/perf_report_mode.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +#include + +namespace vpu { + +namespace { + +const std::unordered_map& string2mode() { + static const std::unordered_map converters = { + {InferenceEngine::MYRIAD_PER_LAYER, PerfReport::PerLayer}, + {InferenceEngine::MYRIAD_PER_STAGE, PerfReport::PerStage} + }; + return converters; +} + +} // namespace + +void PerfReportModeOption::validate(const std::string& value) { + const auto& converters = string2mode(); + VPU_THROW_UNLESS(converters.count(value) != 0, + R"(unexpected {} option value "{}", only {} are supported)", key(), value, getKeys(converters)); +} + +void PerfReportModeOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string PerfReportModeOption::key() { + return InferenceEngine::MYRIAD_PERF_REPORT_MODE; +} + +details::Access PerfReportModeOption::access() { + return details::Access::Private; +} + +details::Category PerfReportModeOption::category() { + return details::Category::RunTime; +} + +std::string PerfReportModeOption::defaultValue() { + return InferenceEngine::MYRIAD_PER_LAYER; +} + +PerfReportModeOption::value_type PerfReportModeOption::parse(const std::string& value) { + const auto& converters = string2mode(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, + R"(unexpected {} option value "{}", only {} are supported)", key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/platform.cpp b/inference-engine/src/vpu/common/src/configuration/options/platform.cpp new file mode 100644 index 00000000000..210414dd1e8 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/platform.cpp @@ -0,0 +1,66 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/configuration/options/platform.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +#include +#include + +#include + +namespace vpu { + +namespace { + +const std::unordered_map& string2platform() { +IE_SUPPRESS_DEPRECATED_START + static const std::unordered_map converters = { + {VPU_MYRIAD_CONFIG_VALUE(2450), ncDevicePlatform_t::NC_MYRIAD_2}, + {VPU_MYRIAD_CONFIG_VALUE(2480), ncDevicePlatform_t::NC_MYRIAD_X}, + {std::string(), ncDevicePlatform_t::NC_ANY_PLATFORM}, + }; +IE_SUPPRESS_DEPRECATED_END + return converters; +} + +} // namespace + +void PlatformOption::validate(const std::string& value) { + const auto& converters = string2platform(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void PlatformOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string PlatformOption::key() { +IE_SUPPRESS_DEPRECATED_START + return VPU_MYRIAD_CONFIG_KEY(PLATFORM); +IE_SUPPRESS_DEPRECATED_END +} + +details::Access PlatformOption::access() { + return details::Access::Public; +} + +details::Category PlatformOption::category() { + return details::Category::RunTime; +} + +std::string PlatformOption::defaultValue() { + return std::string(); +} + +PlatformOption::value_type PlatformOption::parse(const std::string& value) { + const auto& converters = string2platform(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/power_config.cpp b/inference-engine/src/vpu/common/src/configuration/options/power_config.cpp new file mode 100644 index 00000000000..a2c97640884 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/power_config.cpp @@ -0,0 +1,65 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/configuration/options/power_config.hpp" +#include "vpu/utils/power_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +#include "ie_plugin_config.hpp" + +#include + +namespace vpu { + +namespace { + +const std::unordered_map& string2power() { + static const std::unordered_map converters = { + {InferenceEngine::MYRIAD_POWER_FULL, PowerConfig::FULL}, + {InferenceEngine::MYRIAD_POWER_INFER, PowerConfig::INFER}, + {InferenceEngine::MYRIAD_POWER_STAGE, PowerConfig::STAGE}, + {InferenceEngine::MYRIAD_POWER_STAGE_SHAVES, PowerConfig::STAGE_SHAVES}, + {InferenceEngine::MYRIAD_POWER_STAGE_NCES, PowerConfig::STAGE_NCES}, + }; + return converters; +} + +} // namespace + +void PowerConfigOption::validate(const std::string& value) { + const auto& converters = string2power(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void PowerConfigOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string PowerConfigOption::key() { + return InferenceEngine::MYRIAD_POWER_MANAGEMENT; +} + +details::Access PowerConfigOption::access() { + return details::Access::Private; +} + +details::Category PowerConfigOption::category() { + return details::Category::RunTime; +} + +std::string PowerConfigOption::defaultValue() { + return InferenceEngine::MYRIAD_POWER_FULL; +} + +PowerConfigOption::value_type PowerConfigOption::parse(const std::string& value) { + const auto& converters = string2power(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/protocol.cpp b/inference-engine/src/vpu/common/src/configuration/options/protocol.cpp new file mode 100644 index 00000000000..db5b784fe77 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/protocol.cpp @@ -0,0 +1,68 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/configuration/options/protocol.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +#include +#include + +#include + +namespace vpu { + +namespace { + +const std::unordered_map& string2protocol() { +IE_SUPPRESS_DEPRECATED_START + static const std::unordered_map converters = { + {InferenceEngine::MYRIAD_USB, ncDeviceProtocol_t::NC_USB}, + {InferenceEngine::MYRIAD_PCIE, ncDeviceProtocol_t::NC_PCIE}, + {std::string(), ncDeviceProtocol_t::NC_ANY_PROTOCOL}, + + // Deprecated + {VPU_MYRIAD_CONFIG_VALUE(USB), ncDeviceProtocol_t::NC_USB}, + {VPU_MYRIAD_CONFIG_VALUE(PCIE), ncDeviceProtocol_t::NC_PCIE} + }; +IE_SUPPRESS_DEPRECATED_END + return converters; +} + +} // namespace + +void ProtocolOption::validate(const std::string& value) { + const auto& converters = string2protocol(); + VPU_THROW_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); +} + +void ProtocolOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string ProtocolOption::key() { + return InferenceEngine::MYRIAD_PROTOCOL; +} + +details::Access ProtocolOption::access() { + return details::Access::Public; +} + +details::Category ProtocolOption::category() { + return details::Category::RunTime; +} + +std::string ProtocolOption::defaultValue() { + return std::string(); +} + +ProtocolOption::value_type ProtocolOption::parse(const std::string& value) { + const auto& converters = string2protocol(); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, R"(unexpected {} option value "{}", only {} are supported)", + key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/tensor_strides.cpp b/inference-engine/src/vpu/common/src/configuration/options/tensor_strides.cpp new file mode 100644 index 00000000000..a8f0c929b87 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/tensor_strides.cpp @@ -0,0 +1,84 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/configuration/options/tensor_strides.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/plugin_configuration.hpp" + +#include + +namespace vpu { + +void TensorStridesOption::validate(const std::string& value) { + if (value == defaultValue()) { + return; + } + + auto configStrides = value; + configStrides.pop_back(); + + const auto inputs = InferenceEngine::details::split(configStrides, "],"); + + for (const auto& input : inputs) { + const auto pair = InferenceEngine::details::split(input, "["); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(pair.size() == 2, + R"(unexpected {} option value "{}", value {} does not match the pattern: tensor_name[strides])", + key(), value, input); + } +} + +void TensorStridesOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string TensorStridesOption::key() { + return InferenceEngine::MYRIAD_TENSOR_STRIDES; +} + +details::Access TensorStridesOption::access() { + return details::Access::Private; +} + +details::Category TensorStridesOption::category() { + return details::Category::CompileTime; +} + +std::string TensorStridesOption::defaultValue() { + return std::string(); +} + +TensorStridesOption::value_type TensorStridesOption::parse(const std::string& value) { + if (value == defaultValue()) { + return TensorStridesOption::value_type(); + } + + auto configStrides = value; + configStrides.pop_back(); + + const auto inputs = InferenceEngine::details::split(configStrides, "],"); + + std::map> stridesMap; + + for (const auto& input : inputs) { + std::vector strides; + + const auto pair = InferenceEngine::details::split(input, "["); + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(pair.size() == 2, + R"(unexpected {} option value "{}", value {} does not match the pattern: tensor_name[strides])", + key(), value, input); + + const auto strideValues = InferenceEngine::details::split(pair.at(1), ","); + + for (const auto& stride : strideValues) { + strides.insert(strides.begin(), std::stoi(stride)); + } + + stridesMap.insert({pair.at(0), strides}); + } + + return stridesMap; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/throughput_streams.cpp b/inference-engine/src/vpu/common/src/configuration/options/throughput_streams.cpp new file mode 100644 index 00000000000..9482a5a93e5 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/throughput_streams.cpp @@ -0,0 +1,66 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/throughput_streams.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/utils/error.hpp" +#include + +namespace vpu { + +void ThroughputStreamsOption::validate(const std::string& value) { + if (value == defaultValue()) { + return; + } + + int intValue; + try { + intValue = std::stoi(value); + } catch (const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value); + } + + VPU_THROW_UNLESS(intValue >= 0, + R"(unexpected {} option value "{}", only not negative numbers are supported)", key(), value); +} + +void ThroughputStreamsOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string ThroughputStreamsOption::key() { + return InferenceEngine::MYRIAD_THROUGHPUT_STREAMS; +} + +details::Access ThroughputStreamsOption::access() { + return details::Access::Public; +} + +details::Category ThroughputStreamsOption::category() { + return details::Category::CompileTime; +} + +std::string ThroughputStreamsOption::defaultValue() { + return InferenceEngine::MYRIAD_THROUGHPUT_STREAMS_AUTO; +} + +ThroughputStreamsOption::value_type ThroughputStreamsOption::parse(const std::string& value) { + if (value == defaultValue()) { + return ThroughputStreamsOption::value_type(); + } + + int intValue; + try { + intValue = std::stoi(value); + } catch (const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value); + } + + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(intValue >= 0, + R"(unexpected {} option value "{}", only not negative numbers are supported)", key(), value); + return intValue; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/tiling_cmx_limit_kb.cpp b/inference-engine/src/vpu/common/src/configuration/options/tiling_cmx_limit_kb.cpp new file mode 100644 index 00000000000..3982b5eb3fd --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/tiling_cmx_limit_kb.cpp @@ -0,0 +1,66 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/tiling_cmx_limit_kb.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/utils/error.hpp" + +namespace vpu { + +void TilingCMXLimitKBOption::validate(const std::string& value) { + if (value == defaultValue()) { + return; + } + + int intValue; + try { + intValue = std::stoi(value); + } catch (const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value); + } + + VPU_THROW_UNLESS(intValue >= 0, + R"(unexpected {} option value "{}", only not negative numbers are supported)", key(), value); +} + +void TilingCMXLimitKBOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string TilingCMXLimitKBOption::key() { + return InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB; +} + +details::Access TilingCMXLimitKBOption::access() { + return details::Access::Private; +} + +details::Category TilingCMXLimitKBOption::category() { + return details::Category::CompileTime; +} + +std::string TilingCMXLimitKBOption::defaultValue() { + return InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB_AUTO; +} + +TilingCMXLimitKBOption::value_type TilingCMXLimitKBOption::parse(const std::string& value) { + if (value == defaultValue()) { + return TilingCMXLimitKBOption::value_type(); + } + + int intValue; + try { + intValue = std::stoi(value); + } catch (const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value); + } + + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(intValue >= 0, + R"(unexpected {} option value "{}", only not negative numbers are supported)", key(), value); + return intValue; +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/options/watchdog_interval.cpp b/inference-engine/src/vpu/common/src/configuration/options/watchdog_interval.cpp new file mode 100644 index 00000000000..89891913917 --- /dev/null +++ b/inference-engine/src/vpu/common/src/configuration/options/watchdog_interval.cpp @@ -0,0 +1,92 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "vpu/private_plugin_config.hpp" +#include "vpu/utils/containers.hpp" +#include "vpu/configuration/options/watchdog_interval.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/utils/error.hpp" + +#include + +namespace vpu { + +namespace { + +const std::unordered_map& string2interval() { + static const std::unordered_map converters = { + {CONFIG_VALUE(NO), std::chrono::milliseconds(0)}, + {CONFIG_VALUE(YES), std::chrono::milliseconds(1000)} + }; + return converters; +} + +} // namespace + +void WatchdogIntervalOption::validate(const std::string& value) { + const auto& converters = string2interval(); + +#ifndef NDEBUG + if (converters.count(value) == 0) { + int intValue; + try { + intValue = std::stoi(value); + } catch (const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value); + } + + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(intValue >= 0, + R"(unexpected {} option value "{}", only {} and not negative numbers are supported)", key(), value, getKeys(converters)); + return; + } +#endif + + VPU_THROW_UNLESS(converters.count(value) != 0, + R"(unexpected {} option value "{}", only {} are supported)", key(), value, getKeys(converters)); +} + +void WatchdogIntervalOption::validate(const PluginConfiguration& configuration) { + validate(configuration[key()]); +} + +std::string WatchdogIntervalOption::key() { + return InferenceEngine::MYRIAD_WATCHDOG; +} + +details::Access WatchdogIntervalOption::access() { + return details::Access::Private; +} + +details::Category WatchdogIntervalOption::category() { + return details::Category::RunTime; +} + +std::string WatchdogIntervalOption::defaultValue() { + return InferenceEngine::PluginConfigParams::YES; +} + +WatchdogIntervalOption::value_type WatchdogIntervalOption::parse(const std::string& value) { + const auto& converters = string2interval(); + +#ifndef NDEBUG + if (converters.count(value) == 0) { + int intValue; + try { + intValue = std::stoi(value); + } catch (const std::exception& e) { + VPU_THROW_FORMAT(R"(unexpected {} option value "{}", must be a number)", key(), value); + } + + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(intValue >= 0, + R"(unexpected {} option value "{}", only {} and not negative numbers are supported)", key(), value, getKeys(converters)); + return WatchdogIntervalOption::value_type(intValue); + } +#endif + + VPU_THROW_UNSUPPORTED_OPTION_UNLESS(converters.count(value) != 0, + R"(unexpected {} option value "{}", only {} are supported)", key(), value, getKeys(converters)); + return converters.at(value); +} + +} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/configuration/plugin_configuration.cpp b/inference-engine/src/vpu/common/src/configuration/plugin_configuration.cpp index 6e051606c67..66c73ace92a 100644 --- a/inference-engine/src/vpu/common/src/configuration/plugin_configuration.cpp +++ b/inference-engine/src/vpu/common/src/configuration/plugin_configuration.cpp @@ -95,7 +95,9 @@ InferenceEngine::Parameter PluginConfiguration::asParameter(const std::string& k void PluginConfiguration::validate(const std::string& key) const { VPU_THROW_UNSUPPORTED_OPTION_UNLESS(supports(key), "Encountered an unsupported key {}, supported keys are {}", key, getPublicKeys()); if (concepts.at(key).isDeprecated()) { - logger->warning("Encountered deprecated option {} usage, consider replacing it with {} option", key, concepts.at(key).key()); + if (concepts.at(key).key() != key) { + logger->warning("Encountered deprecated option {} usage, consider replacing it with {} option", key, concepts.at(key).key()); + } } } diff --git a/inference-engine/src/vpu/common/src/parsed_config.cpp b/inference-engine/src/vpu/common/src/parsed_config.cpp deleted file mode 100644 index b0a2ec46c93..00000000000 --- a/inference-engine/src/vpu/common/src/parsed_config.cpp +++ /dev/null @@ -1,267 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -namespace vpu { - -const std::unordered_set& ParsedConfig::getCompileOptions() const { -IE_SUPPRESS_DEPRECATED_START - static const std::unordered_set options = merge(ParsedConfigBase::getCompileOptions(), { - // - // Public options - // - - CONFIG_KEY(CONFIG_FILE), - - ie::MYRIAD_ENABLE_HW_ACCELERATION, - ie::MYRIAD_CUSTOM_LAYERS, - ie::MYRIAD_THROUGHPUT_STREAMS, - - // - // Public deprecated - // - - VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION), - VPU_CONFIG_KEY(CUSTOM_LAYERS), - - // - // Private options - // - - ie::MYRIAD_HW_EXTRA_SPLIT, - - ie::MYRIAD_NUMBER_OF_SHAVES, - ie::MYRIAD_NUMBER_OF_CMX_SLICES, - ie::MYRIAD_TILING_CMX_LIMIT_KB, - - ie::MYRIAD_TENSOR_STRIDES, - - ie::MYRIAD_IR_WITH_SCALES_DIRECTORY, - ie::MYRIAD_DETECT_NETWORK_BATCH, - ie::MYRIAD_COPY_OPTIMIZATION, - ie::MYRIAD_HW_INJECT_STAGES, - ie::MYRIAD_HW_POOL_CONV_MERGE, - ie::MYRIAD_PACK_DATA_IN_CMX, - ie::MYRIAD_HW_DILATION, - ie::MYRIAD_FORCE_DEPRECATED_CNN_CONVERSION, - ie::MYRIAD_DISABLE_REORDER, - ie::MYRIAD_ENABLE_PERMUTE_MERGING, - ie::MYRIAD_ENABLE_REPL_WITH_SCRELU, - ie::MYRIAD_ENABLE_REPLACE_WITH_REDUCE_MEAN, - ie::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING, - ie::MYRIAD_FORCE_PURE_TENSOR_ITERATOR, - ie::MYRIAD_DISABLE_CONVERT_STAGES, - ie::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, - ie::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL, - ie::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION, - ie::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM, - - // - // Debug options - // - - ie::MYRIAD_HW_WHITE_LIST, - ie::MYRIAD_HW_BLACK_LIST, - - ie::MYRIAD_NONE_LAYERS, - ie::MYRIAD_IGNORE_UNKNOWN_LAYERS, - - ie::MYRIAD_COMPILER_LOG_FILE_PATH, - - ie::MYRIAD_DUMP_INTERNAL_GRAPH_FILE_NAME, - ie::MYRIAD_DUMP_INTERNAL_GRAPH_DIRECTORY, - ie::MYRIAD_DUMP_ALL_PASSES, - - // - // Private deprecated options - // - - VPU_CONFIG_KEY(DETECT_NETWORK_BATCH), - }); -IE_SUPPRESS_DEPRECATED_END - - return options; -} - -const std::unordered_set& ParsedConfig::getRunTimeOptions() const { -IE_SUPPRESS_DEPRECATED_START - static const std::unordered_set options = merge(ParsedConfigBase::getRunTimeOptions(), { - CONFIG_KEY(PERF_COUNT), - VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME), - ie::MYRIAD_ENABLE_RECEIVING_TENSOR_TIME, - ie::MYRIAD_PERF_REPORT_MODE, - }); -IE_SUPPRESS_DEPRECATED_END - - return options; -} - -const std::unordered_set& ParsedConfig::getDeprecatedOptions() const { -IE_SUPPRESS_DEPRECATED_START - static const std::unordered_set options = merge(ParsedConfigBase::getDeprecatedOptions(), { - VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION), - VPU_CONFIG_KEY(CUSTOM_LAYERS), - VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME), - }); -IE_SUPPRESS_DEPRECATED_END - - return options; -} - -void ParsedConfig::parse(const std::map& config) { - static const std::unordered_map perfReports { - { ie::MYRIAD_PER_LAYER, PerfReport::PerLayer }, - { ie::MYRIAD_PER_STAGE, PerfReport::PerStage }, - }; - - static const auto parseStrides = [](const std::string& src) { - auto configStrides = src; - configStrides.pop_back(); - - const auto inputs = ie::details::split(configStrides, "],"); - - std::map> stridesMap; - - for (const auto& input : inputs) { - std::vector strides; - - const auto pair = ie::details::split(input, "["); - IE_ASSERT(pair.size() == 2) - << "Invalid config value \"" << input << "\" " - << "for VPU_TENSOR_STRIDES, does not match the pattern: tensor_name[strides]"; - - const auto strideValues = ie::details::split(pair.at(1), ","); - - for (const auto& stride : strideValues) { - strides.insert(strides.begin(), std::stoi(stride)); - } - - stridesMap.insert({pair.at(0), strides}); - } - - return stridesMap; - }; - - const auto parseStringSet = [](const std::string& value) { - return splitStringList>(value, ','); - }; - - ParsedConfigBase::parse(config); - - setOption(_compilerLogFilePath, config, ie::MYRIAD_COMPILER_LOG_FILE_PATH); - setOption(_compileConfig.dumpInternalGraphFileName, config, ie::MYRIAD_DUMP_INTERNAL_GRAPH_FILE_NAME); - setOption(_compileConfig.dumpInternalGraphDirectory, config, ie::MYRIAD_DUMP_INTERNAL_GRAPH_DIRECTORY); - setOption(_compileConfig.dumpAllPasses, switches, config, ie::MYRIAD_DUMP_ALL_PASSES); - - setOption(_compileConfig.detectBatch, switches, config, ie::MYRIAD_DETECT_NETWORK_BATCH); - setOption(_compileConfig.packDataInCmx, switches, config, ie::MYRIAD_PACK_DATA_IN_CMX); - setOption(_compileConfig.ignoreUnknownLayers, switches, config, ie::MYRIAD_IGNORE_UNKNOWN_LAYERS); - setOption(_compileConfig.hwOptimization, switches, config, ie::MYRIAD_ENABLE_HW_ACCELERATION); - setOption(_compileConfig.hwExtraSplit, switches, config, ie::MYRIAD_HW_EXTRA_SPLIT); - setOption(_compileConfig.injectSwOps, switches, config, ie::MYRIAD_HW_INJECT_STAGES); - setOption(_compileConfig.mergeHwPoolToConv, switches, config, ie::MYRIAD_HW_POOL_CONV_MERGE); - setOption(_compileConfig.hwDilation, switches, config, ie::MYRIAD_HW_DILATION); - setOption(_compileConfig.forceDeprecatedCnnConversion, switches, config, ie::MYRIAD_FORCE_DEPRECATED_CNN_CONVERSION); - setOption(_compileConfig.disableReorder, switches, config, ie::MYRIAD_DISABLE_REORDER); - setOption(_compileConfig.enablePermuteMerging, switches, config, ie::MYRIAD_ENABLE_PERMUTE_MERGING); - setOption(_compileConfig.enableReplWithSCRelu, switches, config, ie::MYRIAD_ENABLE_REPL_WITH_SCRELU); - setOption(_compileConfig.enableReplaceWithReduceMean, switches, config, ie::MYRIAD_ENABLE_REPLACE_WITH_REDUCE_MEAN); - setOption(_compileConfig.enableTensorIteratorUnrolling, switches, config, ie::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING); - setOption(_compileConfig.forcePureTensorIterator, switches, config, ie::MYRIAD_FORCE_PURE_TENSOR_ITERATOR); - setOption(_compileConfig.disableConvertStages, switches, config, ie::MYRIAD_DISABLE_CONVERT_STAGES); - setOption(_compileConfig.enableWeightsAnalysis, switches, config, ie::MYRIAD_ENABLE_WEIGHTS_ANALYSIS); - setOption(_compileConfig.checkPreprocessingInsideModel, switches, config, ie::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL); - setOption(_compileConfig.enableEarlyEltwiseReLUFusion, switches, config, ie::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION); - setOption(_compileConfig.enableCustomReshapeParam, switches, config, ie::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM); - - setOption(_compileConfig.irWithVpuScalesDir, config, ie::MYRIAD_IR_WITH_SCALES_DIRECTORY); - setOption(_compileConfig.noneLayers, config, ie::MYRIAD_NONE_LAYERS, parseStringSet); - setOption(_compileConfig.hwWhiteList, config, ie::MYRIAD_HW_WHITE_LIST, parseStringSet); - setOption(_compileConfig.hwBlackList, config, ie::MYRIAD_HW_BLACK_LIST, parseStringSet); - - // Priority is set to VPU configuration file over plug-in config. - setOption(_compileConfig.customLayers, config, ie::MYRIAD_CUSTOM_LAYERS); - if (_compileConfig.customLayers.empty()) { - setOption(_compileConfig.customLayers, config, CONFIG_KEY(CONFIG_FILE)); - } - - auto isPositive = [](int value) { - return value >= 0; - }; - - auto isDefaultValue = [](int value) { - return value == -1; - }; - - auto preprocessCompileOption = [&](const std::string& src) { - int value = parseInt(src); - - if (isPositive(value) || isDefaultValue(value)) { - return value; - } - - throw std::invalid_argument("Value must be positive or default(-1)."); - }; - - setOption(_compileConfig.numSHAVEs, config, ie::MYRIAD_NUMBER_OF_SHAVES, preprocessCompileOption); - setOption(_compileConfig.numCMXSlices, config, ie::MYRIAD_NUMBER_OF_CMX_SLICES, preprocessCompileOption); - setOption(_compileConfig.numExecutors, config, ie::MYRIAD_THROUGHPUT_STREAMS, preprocessCompileOption); - setOption(_compileConfig.tilingCMXLimitKB, config, ie::MYRIAD_TILING_CMX_LIMIT_KB, preprocessCompileOption); - - if ((_compileConfig.numSHAVEs < 0 && _compileConfig.numCMXSlices >= 0) || - (_compileConfig.numSHAVEs >= 0 && _compileConfig.numCMXSlices < 0)) { - IE_THROW() << "You should set both option for resource management: VPU_NUMBER_OF_CMX_SLICES and VPU_NUMBER_OF_SHAVES"; - } - - setOption(_compileConfig.ioStrides, config, ie::MYRIAD_TENSOR_STRIDES, parseStrides); - - setOption(_printReceiveTensorTime, switches, config, ie::MYRIAD_ENABLE_RECEIVING_TENSOR_TIME); - setOption(_perfCount, switches, config, CONFIG_KEY(PERF_COUNT)); - setOption(_perfReport, perfReports, config, ie::MYRIAD_PERF_REPORT_MODE); - setOption(_compileConfig.enableMemoryTypesAnnotation, switches, config, ie::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION); - -IE_SUPPRESS_DEPRECATED_START - setOption(_compileConfig.hwOptimization, switches, config, VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION)); - setOption(_compileConfig.customLayers, config, VPU_CONFIG_KEY(CUSTOM_LAYERS)); - setOption(_printReceiveTensorTime, switches, config, VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME)); - setOption(_compileConfig.detectBatch, switches, config, VPU_CONFIG_KEY(DETECT_NETWORK_BATCH)); -IE_SUPPRESS_DEPRECATED_END - -#ifndef NDEBUG - if (const auto envVar = std::getenv("IE_VPU_COMPILER_LOG_FILE_PATH")) { - _compilerLogFilePath = envVar; - } - if (const auto envVar = std::getenv("IE_VPU_DUMP_INTERNAL_GRAPH_FILE_NAME")) { - _compileConfig.dumpInternalGraphFileName = envVar; - } - if (const auto envVar = std::getenv("IE_VPU_DUMP_INTERNAL_GRAPH_DIRECTORY")) { - _compileConfig.dumpInternalGraphDirectory = envVar; - } - if (const auto envVar = std::getenv("IE_VPU_DUMP_ALL_PASSES")) { - _compileConfig.dumpAllPasses = std::stoi(envVar) != 0; - } - if (const auto envVar = std::getenv("IE_VPU_NUMBER_OF_SHAVES_AND_CMX_SLICES")) { - _compileConfig.numSHAVEs = _compileConfig.numCMXSlices = preprocessCompileOption(envVar); - } - if (const auto envVar = std::getenv("IE_VPU_TILING_CMX_LIMIT_KB")) { - _compileConfig.tilingCMXLimitKB = preprocessCompileOption(envVar); - } -#endif -} - -} // namespace vpu diff --git a/inference-engine/src/vpu/common/src/parsed_config_base.cpp b/inference-engine/src/vpu/common/src/parsed_config_base.cpp deleted file mode 100644 index c9e8a36f4a7..00000000000 --- a/inference-engine/src/vpu/common/src/parsed_config_base.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include - -namespace vpu { - -const std::unordered_map ParsedConfigBase::switches = { - { CONFIG_VALUE(YES), true }, - { CONFIG_VALUE(NO), false } -}; - -ParsedConfigBase::ParsedConfigBase() { - _log = std::make_shared("Config", LogLevel::Warning, consoleOutput()); -} - -ParsedConfigBase::~ParsedConfigBase() = default; - -void ParsedConfigBase::update( - const std::map& config, - ConfigMode mode) { - const auto& compileOptions = getCompileOptions(); - const auto& runTimeOptions = getRunTimeOptions(); - const auto& deprecatedOptions = getDeprecatedOptions(); - - for (const auto& entry : config) { - const bool isCompileOption = compileOptions.count(entry.first) != 0; - const bool isRunTimeOption = runTimeOptions.count(entry.first) != 0; - const bool isDeprecatedOption = deprecatedOptions.count(entry.first) != 0; - - if (!isCompileOption && !isRunTimeOption) { - IE_THROW(NotFound) << entry.first - << " key is not supported for VPU"; - } - - if (mode == ConfigMode::RunTime) { - if (!isRunTimeOption) { - _log->warning("%s option is used in %s mode", entry.first, mode); - } - } - - if (isDeprecatedOption) { - _log->warning("Deprecated option was used : %s", entry.first); - } - } - - parse(config); -} - -const std::unordered_set& ParsedConfigBase::getCompileOptions() const { - static const std::unordered_set options; - return options; -} - -const std::unordered_set& ParsedConfigBase::getRunTimeOptions() const { -IE_SUPPRESS_DEPRECATED_START - static const std::unordered_set options = { - CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS), - }; -IE_SUPPRESS_DEPRECATED_END - - return options; -} - -const std::unordered_set& ParsedConfigBase::getDeprecatedOptions() const { - static const std::unordered_set options; - return options; -} - -void ParsedConfigBase::parse(const std::map& config) { - setOption(_exclusiveAsyncRequests, switches, config, CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS)); -} - -std::unordered_set ParsedConfigBase::merge( - const std::unordered_set& set1, - const std::unordered_set& set2) { - auto out = set1; - out.insert(set2.begin(), set2.end()); - return out; -} - -void ParsedConfigBase::setOption(std::string& dst, const std::map& config, const std::string& key) { - const auto value = config.find(key); - if (value != config.end()) { - dst = value->second; - } -} - -} // namespace vpu diff --git a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt index e223914d7c0..dd7de66f5c3 100644 --- a/inference-engine/src/vpu/graph_transformer/CMakeLists.txt +++ b/inference-engine/src/vpu/graph_transformer/CMakeLists.txt @@ -57,7 +57,6 @@ function(add_graph_transformer_target TARGET_NAME STATIC_IE) inference_engine_plugin_api PRIVATE openvino::itt - mvnc # TODO: remove once all options are migrated ) if(WIN32) diff --git a/inference-engine/src/vpu/graph_transformer/src/backend/backend.cpp b/inference-engine/src/vpu/graph_transformer/src/backend/backend.cpp index 27a9d40794e..be2388dd97b 100644 --- a/inference-engine/src/vpu/graph_transformer/src/backend/backend.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/backend/backend.cpp @@ -10,6 +10,10 @@ #include #include +#include +#include +#include + #include #include #include @@ -85,12 +89,12 @@ void BackEnd::dumpModel( std::string fileName; - if (!env.config.compileConfig().dumpInternalGraphFileName.empty()) { - fileName = fileNameNoExt(env.config.compileConfig().dumpInternalGraphFileName); - } else if (!env.config.compileConfig().dumpInternalGraphDirectory.empty()) { + if (!env.config.get().empty()) { + fileName = fileNameNoExt(env.config.get()); + } else if (!env.config.get().empty()) { fileName = formatString( "%s/vpu_graph_%f%f%i_%s", - env.config.compileConfig().dumpInternalGraphDirectory, + env.config.get(), std::setw(2), std::setfill('0'), model->attrs().get("index"), replaceBadCharacters(model->name())); @@ -99,7 +103,7 @@ void BackEnd::dumpModel( } if (!postfix.empty()) { - if (!env.config.compileConfig().dumpAllPasses) { + if (!env.config.get()) { return; } diff --git a/inference-engine/src/vpu/graph_transformer/src/backend/dump_to_dot.cpp b/inference-engine/src/vpu/graph_transformer/src/backend/dump_to_dot.cpp index 3d5103338f9..3efa808ca2a 100644 --- a/inference-engine/src/vpu/graph_transformer/src/backend/dump_to_dot.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/backend/dump_to_dot.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include #include diff --git a/inference-engine/src/vpu/graph_transformer/src/backend/get_meta_data.cpp b/inference-engine/src/vpu/graph_transformer/src/backend/get_meta_data.cpp index b853ac932b7..aec2e8488d6 100644 --- a/inference-engine/src/vpu/graph_transformer/src/backend/get_meta_data.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/backend/get_meta_data.cpp @@ -30,7 +30,6 @@ #include #include -#include #include #include #include diff --git a/inference-engine/src/vpu/graph_transformer/src/backend/serialize.cpp b/inference-engine/src/vpu/graph_transformer/src/backend/serialize.cpp index 10c296bd33d..6d45a968b9f 100644 --- a/inference-engine/src/vpu/graph_transformer/src/backend/serialize.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/backend/serialize.cpp @@ -4,7 +4,6 @@ #include -#include #include #include #include diff --git a/inference-engine/src/vpu/graph_transformer/src/frontend/detect_network_batch.cpp b/inference-engine/src/vpu/graph_transformer/src/frontend/detect_network_batch.cpp index 48de8bb9f87..c706fb595d0 100644 --- a/inference-engine/src/vpu/graph_transformer/src/frontend/detect_network_batch.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/frontend/detect_network_batch.cpp @@ -18,6 +18,7 @@ #include #include +#include namespace vpu { @@ -29,7 +30,7 @@ void FrontEnd::detectNetworkBatch( using PrecisionsMap = std::map; const auto& env = CompileEnv::get(); - if (!env.config.compileConfig().detectBatch) { + if (!env.config.get()) { // skip batch extraction step and go as is return; } diff --git a/inference-engine/src/vpu/graph_transformer/src/frontend/frontend.cpp b/inference-engine/src/vpu/graph_transformer/src/frontend/frontend.cpp index 533ad61f991..c53a729651c 100644 --- a/inference-engine/src/vpu/graph_transformer/src/frontend/frontend.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/frontend/frontend.cpp @@ -51,6 +51,12 @@ #include #include #include +#include +#include +#include +#include +#include + namespace vpu { FrontEnd::FrontEnd(StageBuilder::Ptr stageBuilder, const std::shared_ptr core) : _stageBuilder(std::move(stageBuilder)), @@ -436,7 +442,7 @@ void FrontEnd::processTrivialCases(const Model& model) { void FrontEnd::defaultOnUnsupportedLayerCallback(const Model& model, const ie::CNNLayerPtr& layer, const DataVector& inputs, const DataVector& outputs, const std::string& extraMessage) { const auto& env = CompileEnv::get(); - VPU_THROW_UNSUPPORTED_LAYER_UNLESS(env.config.compileConfig().ignoreUnknownLayers, "Failed to compile layer \"%v\": %v", layer->name, extraMessage); + VPU_THROW_UNSUPPORTED_LAYER_UNLESS(env.config.get(), "Failed to compile layer \"%v\": %v", layer->name, extraMessage); _stageBuilder->addNoneStage(model, layer->name, layer, inputs, outputs); } @@ -466,15 +472,17 @@ ModelPtr FrontEnd::runCommonPasses(ie::CNNNetwork network, // Parse custom layers // - if (!env.config.compileConfig().customLayers.empty()) { - env.log->trace("Parse custom layers : %s", env.config.compileConfig().customLayers); + auto customLayers = env.config.get().empty() + ? env.config.get() : env.config.get(); + if (!customLayers.empty()) { + env.log->trace("Parse custom layers : %s", customLayers); VPU_LOGGER_SECTION(env.log); if (env.platform != ncDevicePlatform_t::NC_MYRIAD_X) { VPU_THROW_FORMAT("Custom layers are not supported for %v platforms", env.platform); } - _customLayers = CustomLayer::loadFromFile(env.config.compileConfig().customLayers); + _customLayers = CustomLayer::loadFromFile(customLayers); } // @@ -494,10 +502,6 @@ ModelPtr FrontEnd::runCommonPasses(ie::CNNNetwork network, env.log->trace("Update IE Network"); VPU_LOGGER_SECTION(env.log); - if (network.getFunction() && env.config.compileConfig().forceDeprecatedCnnConversion) { - network = convertNetwork(network); - } - detectNetworkBatch(network, model); if (network.getFunction()) { @@ -545,7 +549,7 @@ ModelPtr FrontEnd::runCommonPasses(ie::CNNNetwork network, processTrivialCases(model); - if (!CompileEnv::get().config.compileConfig().disableConvertStages) { + if (!CompileEnv::get().config.get()) { addDataTypeConvertStages(model); } @@ -567,7 +571,7 @@ ModelPtr FrontEnd::runCommonPasses(ie::CNNNetwork network, getInputAndOutputData(model, layer, inputs, outputs); - if (env.config.compileConfig().skipAllLayers() || env.config.compileConfig().skipLayerType(layer->type)) { + if (skipAllLayers(env.config) || skipLayerType(env.config, layer->type)) { _stageBuilder->addNoneStage(model, layer->name, layer, inputs, outputs); supportedLayer(layer); continue; diff --git a/inference-engine/src/vpu/graph_transformer/src/frontend/in_out_convert.cpp b/inference-engine/src/vpu/graph_transformer/src/frontend/in_out_convert.cpp index 159bd3430a4..53cafb98d56 100644 --- a/inference-engine/src/vpu/graph_transformer/src/frontend/in_out_convert.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/frontend/in_out_convert.cpp @@ -22,8 +22,6 @@ void FrontEnd::addDataTypeConvertStages(const Model& model) { env.log->trace("Add Data type conversion stages"); VPU_LOGGER_SECTION(env.log); - const bool hasScaleBias = env.config.compileConfig().inputScale != 1.0f || env.config.compileConfig().inputBias != 0.0f; - for (const auto& input : model->datas()) { if (input->usage() != DataUsage::Input) { continue; @@ -33,37 +31,6 @@ void FrontEnd::addDataTypeConvertStages(const Model& model) { VPU_LOGGER_SECTION(env.log); switch (input->desc().type()) { - case DataType::FP16: { - if (hasScaleBias) { - env.log->trace("Apply deprecated scale/bias parameters"); - - std::ostringstream postfix; - if (env.config.compileConfig().inputScale != 1.0f) { - postfix << "@SCALE=" << InferenceEngine::CNNLayer::ie_serialize_float(env.config.compileConfig().inputScale); - } - if (env.config.compileConfig().inputBias != 0.0f) { - postfix << "@BIAS=" << InferenceEngine::CNNLayer::ie_serialize_float(env.config.compileConfig().inputBias); - } - - const auto scaledInput = model->duplicateData( - input, - postfix.str()); - - bindData(scaledInput, input->origData()); - - _stageBuilder->addPowerStage( - model, - scaledInput->name(), - nullptr, - env.config.compileConfig().inputScale, - 1.0f, - env.config.compileConfig().inputBias, - input, - scaledInput); - } - break; - } - case DataType::U8: case DataType::FP32: { env.log->trace("Convert to FP16"); @@ -89,8 +56,8 @@ void FrontEnd::addDataTypeConvertStages(const Model& model) { inputFP16->name(), input, inputFP16, - env.config.compileConfig().inputScale, - env.config.compileConfig().inputBias); + 1.0f, + 0.0f); break; } diff --git a/inference-engine/src/vpu/graph_transformer/src/frontend/parse_data.cpp b/inference-engine/src/vpu/graph_transformer/src/frontend/parse_data.cpp index 392c0b86df8..3d50071eaaf 100644 --- a/inference-engine/src/vpu/graph_transformer/src/frontend/parse_data.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/frontend/parse_data.cpp @@ -8,6 +8,8 @@ #include #include +#include + #include #include #include @@ -25,8 +27,9 @@ void FrontEnd::parseInputAndOutputData(const Model& model) { VPU_LOGGER_SECTION(env.log); const auto parseIOStrides = [&env](const std::string& name, const Data& data) { - const auto& match = env.config.compileConfig().ioStrides.find(name); - if (match == env.config.compileConfig().ioStrides.end()) { + const auto tensorStrides = env.config.get(); + const auto& match = tensorStrides.find(name); + if (match == tensorStrides.end()) { return; } diff --git a/inference-engine/src/vpu/graph_transformer/src/frontend/unroll_loops.cpp b/inference-engine/src/vpu/graph_transformer/src/frontend/unroll_loops.cpp index 34ca4835a92..219c92a5772 100644 --- a/inference-engine/src/vpu/graph_transformer/src/frontend/unroll_loops.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/frontend/unroll_loops.cpp @@ -11,6 +11,10 @@ #include +#include +#include +#include + namespace vpu { void FrontEnd::unrollLoops(ie::CNNNetwork& network) { @@ -21,7 +25,7 @@ void FrontEnd::unrollLoops(ie::CNNNetwork& network) { env.log->trace("Unroll TensorIterator loops"); VPU_LOGGER_SECTION(env.log); - if (!env.config.compileConfig().irWithVpuScalesDir.empty()) { + if (!env.config.get().empty()) { // TODO: Scale dumps does not work with IR, which contain Tensor Iterator layers, because we cannot serialize them. #-23429 for (auto iterator = ie::details::CNNNetworkIterator(network); iterator != ie::details::CNNNetworkIterator(); ++iterator) { const auto& layer = *iterator; @@ -30,11 +34,11 @@ void FrontEnd::unrollLoops(ie::CNNNetwork& network) { } } - if (env.config.compileConfig().forcePureTensorIterator) { + if (env.config.get()) { return; } - if (env.config.compileConfig().enableTensorIteratorUnrolling) { + if (env.config.get()) { ie::NetPass::UnrollTI(network); } else { // Try to convert network to a RNN sequence due to performance reasons diff --git a/inference-engine/src/vpu/graph_transformer/src/graph_transformer.cpp b/inference-engine/src/vpu/graph_transformer/src/graph_transformer.cpp index 118a9a0a65e..463e0fdcada 100644 --- a/inference-engine/src/vpu/graph_transformer/src/graph_transformer.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/graph_transformer.cpp @@ -32,7 +32,7 @@ #include #include -#include +#include #include #include #include @@ -42,8 +42,16 @@ #include #include #include +#include #include +#include +#include +#include +#include +#include +#include + namespace vpu { // @@ -81,39 +89,36 @@ void CompileEnv::init(ncDevicePlatform_t platform, const PluginConfiguration& co #endif if (platform == ncDevicePlatform_t::NC_MYRIAD_2) { - g_compileEnv->config.compileConfig().hwOptimization = false; + g_compileEnv->config.set(ie::MYRIAD_ENABLE_HW_ACCELERATION, ie::PluginConfigParams::NO); } - VPU_THROW_UNLESS(g_compileEnv->config.compileConfig().numSHAVEs <= g_compileEnv->config.compileConfig().numCMXSlices, - R"(Value of configuration option ("{}") must be not greater than value of configuration option ("{}"), but {} > {} are provided)", - ie::MYRIAD_NUMBER_OF_SHAVES, ie::MYRIAD_NUMBER_OF_CMX_SLICES, config.compileConfig().numSHAVEs, config.compileConfig().numCMXSlices); - - const auto numExecutors = config.compileConfig().numExecutors != -1 ? config.compileConfig().numExecutors : DefaultAllocation::numStreams(platform, config); + const auto numExecutors = config.get().hasValue() + ? config.get().get() : DefaultAllocation::numStreams(platform, config); VPU_THROW_UNLESS(numExecutors >= 1 && numExecutors <= DeviceResources::numStreams(), R"(Value of configuration option ("{}") must be in the range [{}, {}], actual is "{}")", - ie::MYRIAD_THROUGHPUT_STREAMS, 1, DeviceResources::numStreams(), numExecutors); + ThroughputStreamsOption::key(), 1, DeviceResources::numStreams(), numExecutors); - const auto numSlices = config.compileConfig().numCMXSlices != -1 - ? config.compileConfig().numCMXSlices + const auto numSlices = config.get().hasValue() + ? config.get().get() : DefaultAllocation::numSlices(platform, numExecutors); VPU_THROW_UNLESS(numSlices >= 1 && numSlices <= DeviceResources::numSlices(platform), R"(Value of configuration option ("{}") must be in the range [{}, {}], actual is "{}")", - ie::MYRIAD_NUMBER_OF_CMX_SLICES, 1, DeviceResources::numSlices(platform), numSlices); + NumberOfCMXSlicesOption::key(), 1, DeviceResources::numSlices(platform), numSlices); int defaultCmxLimit = DefaultAllocation::tilingCMXLimit(numSlices); - const auto tilingCMXLimit = config.compileConfig().tilingCMXLimitKB != -1 - ? std::min(config.compileConfig().tilingCMXLimitKB * 1024, defaultCmxLimit) + const auto tilingCMXLimit = config.get().hasValue() + ? std::min(config.get().get() * 1024, defaultCmxLimit) : defaultCmxLimit; VPU_THROW_UNLESS(tilingCMXLimit >= 0, R"(Value of configuration option ("{}") must be greater than {}, actual is "{}")", - ie::MYRIAD_TILING_CMX_LIMIT_KB, 0, tilingCMXLimit); + TilingCMXLimitKBOption::key(), 0, tilingCMXLimit); - const auto numShaves = config.compileConfig().numSHAVEs != -1 - ? config.compileConfig().numSHAVEs + const auto numShaves = config.get().hasValue() + ? config.get().get() : DefaultAllocation::numShaves(platform, numExecutors, numSlices); VPU_THROW_UNLESS(numShaves >= 1 && numShaves <= DeviceResources::numShaves(platform), R"(Value of configuration option ("{}") must be in the range [{}, {}], actual is "{}")", - ie::MYRIAD_NUMBER_OF_SHAVES, 1, DeviceResources::numShaves(platform), numShaves); + NumberOfSHAVEsOption::key(), 1, DeviceResources::numShaves(platform), numShaves); const auto numAllocatedShaves = numShaves * numExecutors; VPU_THROW_UNLESS(numAllocatedShaves >= 1 && numAllocatedShaves <= DeviceResources::numShaves(platform), @@ -172,9 +177,9 @@ CompiledGraph::Ptr compileImpl(const ie::CNNNetwork& network, const std::shared_ middleEnd->run(model); - if (!env.config.compileConfig().irWithVpuScalesDir.empty()) { - network.serialize(env.config.compileConfig().irWithVpuScalesDir + "/" + network.getName() + "_scales.xml", - env.config.compileConfig().irWithVpuScalesDir + "/" + network.getName() + "_scales.bin"); + if (!env.config.get().empty()) { + network.serialize(env.config.get() + "/" + network.getName() + "_scales.xml", + env.config.get() + "/" + network.getName() + "_scales.bin"); } return backEnd->build(model, frontEnd->origLayers()); @@ -275,7 +280,7 @@ int DeviceResources::numStreams() { } int DefaultAllocation::numStreams(const ncDevicePlatform_t& platform, const PluginConfiguration& configuration) { - return platform == ncDevicePlatform_t::NC_MYRIAD_X && configuration.compileConfig().hwOptimization ? 2 : 1; + return platform == ncDevicePlatform_t::NC_MYRIAD_X && configuration.get() ? 2 : 1; } int DefaultAllocation::numSlices(const ncDevicePlatform_t& platform, int numStreams) { diff --git a/inference-engine/src/vpu/graph_transformer/src/middleend/pass_manager.cpp b/inference-engine/src/vpu/graph_transformer/src/middleend/pass_manager.cpp index f5e5d6ff2df..d2c7d8f930b 100644 --- a/inference-engine/src/vpu/graph_transformer/src/middleend/pass_manager.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/middleend/pass_manager.cpp @@ -11,6 +11,17 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace vpu { @@ -94,7 +105,7 @@ PassSet::Ptr PassManager::buildMiddleEnd() { ADD_PASS(convertShapeNotation); ADD_DUMP_PASS("convertShapeNotation"); - if (!env.config.compileConfig().disableReorder && !env.config.compileConfig().hwOptimization) { + if (!env.config.get() && !env.config.get()) { ADD_PASS(reorderInputsToChannelMinor); ADD_DUMP_PASS("reorderInputsToChannelMinor"); } @@ -126,7 +137,7 @@ PassSet::Ptr PassManager::buildMiddleEnd() { // To overcome fp16 limitations // - if (env.config.compileConfig().hwOptimization && env.config.compileConfig().enableWeightsAnalysis) { + if (env.config.get() && env.config.get()) { ADD_PASS(analyzeWeightableLayers); ADD_DUMP_PASS("analyzeWeightableLayers"); } @@ -151,7 +162,7 @@ PassSet::Ptr PassManager::buildMiddleEnd() { // Model HW-specific optimizations // - if (env.config.compileConfig().hwOptimization) { + if (env.config.get()) { ADD_PASS(replaceFCbyConv); ADD_DUMP_PASS("replaceFCbyConv"); @@ -162,7 +173,7 @@ PassSet::Ptr PassManager::buildMiddleEnd() { ADD_PASS(replaceDeconvByConv); ADD_DUMP_PASS("replaceDeconvByConv"); - if (env.config.compileConfig().hwDilation) { + if (env.config.get()) { ADD_PASS(reshapeDilationConv); ADD_DUMP_PASS("reshapeDilationConv"); } @@ -174,7 +185,7 @@ PassSet::Ptr PassManager::buildMiddleEnd() { // Pass should be located before "adjustDataBatch" because "adjustDataBatch" specifies "origConvOutput" attribute // for convolution in order to provide that information to "hwConvTiling" pass. // Otherwise, "hwConvTiling" will see incorrect values in "origConvOutput" attribute. - if (env.config.compileConfig().enableCustomReshapeParam) { + if (env.config.get()) { ADD_PASS(reshapeBeforeConvTiling); ADD_DUMP_PASS("reshapeBeforeConvTiling"); } @@ -198,7 +209,7 @@ PassSet::Ptr PassManager::buildMiddleEnd() { ADD_PASS(hwPadding); ADD_DUMP_PASS("hwPadding"); - if (env.config.compileConfig().hwOptimization) { + if (env.config.get()) { ADD_PASS(splitLargeKernelConv); ADD_DUMP_PASS("splitLargeKernelConv"); } @@ -210,7 +221,7 @@ PassSet::Ptr PassManager::buildMiddleEnd() { ADD_PASS(adjustDataBatch); ADD_DUMP_PASS("adjustDataBatch"); - if (env.config.compileConfig().enableReplWithSCRelu) { + if (env.config.get()) { ADD_PASS(replaceWithSCReLU); ADD_DUMP_PASS("replaceWithSCReLU"); } @@ -219,13 +230,13 @@ PassSet::Ptr PassManager::buildMiddleEnd() { // HW stages tiling // - if (env.config.compileConfig().hwOptimization) { + if (env.config.get()) { ADD_PASS(hwConvTiling); ADD_PASS(hwPoolTiling); ADD_PASS(hwFullyConnectedTiling); ADD_DUMP_PASS("hwTiling"); - if (env.config.compileConfig().hwExtraSplit) { + if (env.config.get()) { ADD_PASS(hwExtraSplit); ADD_DUMP_PASS("hwExtraSplit"); } @@ -243,10 +254,9 @@ PassSet::Ptr PassManager::buildMiddleEnd() { // // this stage should be executed after "hwPoolTiling" // and before "swPoolAdaptation" - if (env.config.compileConfig().enableReplaceWithReduceMean) { - ADD_PASS(replaceWithReduceMean); - ADD_DUMP_PASS("replaceWithReduceMean"); - } + ADD_PASS(replaceWithReduceMean); + ADD_DUMP_PASS("replaceWithReduceMean"); + ADD_PASS(swPoolAdaptation); ADD_PASS(swFullyConnectedAdaptation); @@ -262,7 +272,7 @@ PassSet::Ptr PassManager::buildMiddleEnd() { ADD_PASS(mergeReLUAndBias); ADD_DUMP_PASS("mergeReLUAndBias"); - if (env.config.compileConfig().enableEarlyEltwiseReLUFusion) { + if (env.config.get()) { ADD_PASS(mergeEltwiseAndReLUDynamic); ADD_DUMP_PASS("mergeEltwiseAndReLUDynamic"); } @@ -280,7 +290,7 @@ PassSet::Ptr PassManager::buildMiddleEnd() { // TODO: mergePermute support for reorder stage too. // TODO: pass that will swap Permute and per-element operations. - if (env.config.compileConfig().enablePermuteMerging) { + if (env.config.get()) { ADD_PASS(mergePermuteStages); ADD_DUMP_PASS("mergePermuteStages"); } @@ -335,7 +345,7 @@ PassSet::Ptr PassManager::buildMiddleEnd() { // // HW/SW injection - if (env.config.compileConfig().hwOptimization && env.config.compileConfig().injectSwOps.getOrDefault(true)) { + if (env.config.get() && env.config.get().getOrDefault(true)) { ADD_PASS(injectSw); ADD_DUMP_PASS("injectSw"); } @@ -351,7 +361,7 @@ PassSet::Ptr PassManager::buildMiddleEnd() { // HW stages finalization // - if (env.config.compileConfig().hwOptimization) { + if (env.config.get()) { ADD_PASS(finalizeHwOps); ADD_DUMP_PASS("hwFinalization"); } @@ -362,7 +372,7 @@ PassSet::Ptr PassManager::buildMiddleEnd() { ADD_PASS(markFastStages); ADD_DUMP_PASS("markFastStages"); - if (env.config.compileConfig().enableMemoryTypesAnnotation) { + if (env.config.get()) { ADD_PASS(annotateMemoryTypes); ADD_DUMP_PASS("annotateMemoryTypes"); } diff --git a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/adjust_data_location.cpp b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/adjust_data_location.cpp index 4990b8153ca..dea11142f66 100644 --- a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/adjust_data_location.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/adjust_data_location.cpp @@ -14,6 +14,9 @@ #include #include +#include +#include + namespace vpu { namespace { @@ -48,7 +51,7 @@ void PassImpl::run(const Model& model) { allocNonIntermediateData(model); adjustModelForMemReqs(model); copyHwMisalignedInput(model); - if (env.config.compileConfig().packDataInCmx.getOrDefault(true)) { + if (env.config.get()) { packDataInCmx(model); } } @@ -147,7 +150,7 @@ void PassImpl::collectMemReqs(const Model& model) { } void PassImpl::resetStageOrder(const Model& model) { - if (!CompileEnv::get().config.compileConfig().hwOptimization) + if (!CompileEnv::get().config.get()) return; static const std::string s_expectCMXOutput {"expectCMXOutput"}; diff --git a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/inject_sw.cpp b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/inject_sw.cpp index 4fb8c5c0123..6f739e04080 100644 --- a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/inject_sw.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/inject_sw.cpp @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -68,7 +69,7 @@ void PassImpl::run(const Model& model) { // Collect HW and SW candidates // - if (!env.config.compileConfig().injectSwOps.hasValue() && + if (!env.config.get().hasValue() && model->numStages() > nMaxStagesForInjectSw) { env.log->warning( "Pass [injectSw] SKIPPED : number of stages (%d) is larger than threshold %d", diff --git a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/merge_eltwise_and_relu.cpp b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/merge_eltwise_and_relu.cpp index 548557b594b..6f338edf443 100644 --- a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/merge_eltwise_and_relu.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/merge_eltwise_and_relu.cpp @@ -9,6 +9,8 @@ #include +#include + #include namespace vpu { @@ -30,7 +32,7 @@ private: }; void PassImpl::run(const Model& model) { - const bool enableEarlyEltwiseReLUFusion = CompileEnv::get().config.compileConfig().enableEarlyEltwiseReLUFusion; + const bool enableEarlyEltwiseReLUFusion = CompileEnv::get().config.get(); if (enableEarlyEltwiseReLUFusion) { if (m_mode == MergeMode::DYNAMIC_NETWORK) { VPU_PROFILE(mergeEltwiseAndReLUDynamic); diff --git a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/merge_hw_stages.cpp b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/merge_hw_stages.cpp index 5b83fd0e49b..3fcb1b18c17 100644 --- a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/merge_hw_stages.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/merge_hw_stages.cpp @@ -11,6 +11,7 @@ #include #include #include +#include namespace vpu { @@ -170,7 +171,7 @@ void PassImpl::run(const Model& model) { // Try to merge next Pooling layer // - if (env.config.compileConfig().mergeHwPoolToConv) { + if (env.config.get()) { if (stage->type() == StageType::StubConv) { if (auto nextPoolStage = getNextPoolStage(stage, output)) { output = nextPoolStage->output(0); diff --git a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/replace_deconv_by_conv.cpp b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/replace_deconv_by_conv.cpp index 4ca08a4f65f..07a7dc5325e 100644 --- a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/replace_deconv_by_conv.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/replace_deconv_by_conv.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -148,7 +149,7 @@ void PassImpl::run(const Model& model) { auto output = stage->output(0); const auto& env = CompileEnv::get(); - if (env.config.compileConfig().hwDisabled(stage->origLayer()->name)) { + if (HwDisabled(env.config, stage->origLayer()->name)) { continue; } diff --git a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/weights_analysis.cpp b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/weights_analysis.cpp index 24efadc7857..f29432aeaff 100644 --- a/inference-engine/src/vpu/graph_transformer/src/middleend/passes/weights_analysis.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/middleend/passes/weights_analysis.cpp @@ -9,6 +9,9 @@ #include #include +#include +#include + #include #include @@ -88,7 +91,7 @@ bool isScalable(const Stage& stage) { bool checkGrowingOutput(const Model& model) { const auto& env = CompileEnv::get(); - if (!env.config.compileConfig().checkPreprocessingInsideModel) { + if (!env.config.get()) { return false; } @@ -258,7 +261,7 @@ void PassImpl::run(const Model& model) { scale = static_cast(1ULL << static_cast(shift)); } - if (!env.config.compileConfig().irWithVpuScalesDir.empty()) { + if (!env.config.get().empty()) { stage->origLayer()->params["vpu_scale"] = toString(scale); } } diff --git a/inference-engine/src/vpu/graph_transformer/src/stages/convolution.cpp b/inference-engine/src/vpu/graph_transformer/src/stages/convolution.cpp index 695bd43f3c9..e168872ad5b 100644 --- a/inference-engine/src/vpu/graph_transformer/src/stages/convolution.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/stages/convolution.cpp @@ -16,6 +16,9 @@ #include #include #include +#include +#include +#include namespace vpu { @@ -163,9 +166,9 @@ void parseConv2D(const Model & model, kernelStrideY, dilationX, dilationY, - env.config.compileConfig().hwOptimization, - env.config.compileConfig().hwDilation, - env.config.compileConfig().hwDisabled(layer->name)); + env.config.get(), + env.config.get(), + HwDisabled(env.config, layer->name)); // // Create const datas @@ -476,9 +479,9 @@ void parseConvND(const Model & model, strides[1], dilations[0], dilations[1], - env.config.compileConfig().hwOptimization, - env.config.compileConfig().hwDilation, - env.config.compileConfig().hwDisabled(layer->name)); + env.config.get(), + env.config.get(), + HwDisabled(env.config, layer->name)); int try_hw = tryHW ? 1 : 0; diff --git a/inference-engine/src/vpu/graph_transformer/src/stages/fc.cpp b/inference-engine/src/vpu/graph_transformer/src/stages/fc.cpp index 96da14dc941..1bb448b5b05 100644 --- a/inference-engine/src/vpu/graph_transformer/src/stages/fc.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/stages/fc.cpp @@ -11,6 +11,9 @@ #include #include +#include +#include + namespace vpu { void FrontEnd::parseFullyConnected(const Model& model, const ie::CNNLayerPtr& _layer, const DataVector& inputs, const DataVector& outputs) const { @@ -37,13 +40,13 @@ void FrontEnd::parseFullyConnected(const Model& model, const ie::CNNLayerPtr& _l // Check if HW is applicable // - auto tryHW = env.config.compileConfig().hwOptimization; + auto tryHW = env.config.get(); if (output->desc().dim(Dim::W, 1) != 1 || output->desc().dim(Dim::H, 1) != 1) { tryHW = false; } - if (env.config.compileConfig().hwDisabled(layer->name)) { + if (HwDisabled(env.config, layer->name)) { tryHW = false; } diff --git a/inference-engine/src/vpu/graph_transformer/src/stages/mtcnn.cpp b/inference-engine/src/vpu/graph_transformer/src/stages/mtcnn.cpp index 6d44c510307..9859ddb9818 100644 --- a/inference-engine/src/vpu/graph_transformer/src/stages/mtcnn.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/stages/mtcnn.cpp @@ -9,6 +9,8 @@ #include #include +#include + #include #include #include @@ -162,7 +164,7 @@ void FrontEnd::parseMTCNN(const Model& model, const ie::CNNLayerPtr& layer, cons IE_ASSERT(inputs.size() == 1); IE_ASSERT(outputs.size() == 1); - if (!env.config.compileConfig().hwOptimization) { + if (!env.config.get()) { VPU_THROW_EXCEPTION << "MTCNN layer supports Myriad X with NCE only"; } diff --git a/inference-engine/src/vpu/graph_transformer/src/stages/permute.cpp b/inference-engine/src/vpu/graph_transformer/src/stages/permute.cpp index 071c2fb0328..861aece1a16 100644 --- a/inference-engine/src/vpu/graph_transformer/src/stages/permute.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/stages/permute.cpp @@ -11,6 +11,8 @@ #include #include +#include + namespace vpu { namespace { @@ -124,7 +126,7 @@ Stage StageBuilder::addReorderStage( const Data& output) { const auto* env = CompileEnv::getOrNull(); VPU_THROW_UNLESS( - env == nullptr || !env->config.compileConfig().disableReorder, + env == nullptr || !env->config.get(), "Tried to add Reorder Stage %v, while DISABLE_REORDER option was set", name); diff --git a/inference-engine/src/vpu/graph_transformer/src/stages/pooling.cpp b/inference-engine/src/vpu/graph_transformer/src/stages/pooling.cpp index 2823d0c9165..32a8f7dbd5d 100644 --- a/inference-engine/src/vpu/graph_transformer/src/stages/pooling.cpp +++ b/inference-engine/src/vpu/graph_transformer/src/stages/pooling.cpp @@ -17,6 +17,9 @@ #include #include +#include +#include + namespace vpu { static @@ -221,8 +224,8 @@ void parsePool2D(const Model & model, // const auto& env = CompileEnv::get(); - bool hwOptimization = env.config.compileConfig().hwOptimization; - bool hwDisabled = env.config.compileConfig().hwDisabled(layer->name); + bool hwOptimization = env.config.get(); + bool hwDisabled = HwDisabled(env.config, layer->name); int inputWidth = input->desc().dim(Dim::W); int inputHeight = input->desc().dim(Dim::H); @@ -480,8 +483,8 @@ void parsePoolND(const Model & model, // const auto& env = CompileEnv::get(); - bool hwOptimization = env.config.compileConfig().hwOptimization; - bool hwDisabled = env.config.compileConfig().hwDisabled(layer->name); + bool hwOptimization = env.config.get(); + bool hwDisabled = HwDisabled(env.config, layer->name); bool tryHW = canTryHW(poolLayer->_type, input_shape[0], diff --git a/inference-engine/src/vpu/myriad_plugin/configuration/myriad_configuration.cpp b/inference-engine/src/vpu/myriad_plugin/configuration/myriad_configuration.cpp deleted file mode 100644 index 41a53f0619e..00000000000 --- a/inference-engine/src/vpu/myriad_plugin/configuration/myriad_configuration.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2020 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "configuration/myriad_configuration.hpp" - -namespace vpu { - -MyriadConfiguration::MyriadConfiguration() {} - -void MyriadConfiguration::from(const std::map& configuration) { - std::map migratedOptions, notMigratedOptions; - for (const auto& entry : configuration) { - auto& destination = PluginConfiguration::supports(entry.first) ? migratedOptions : notMigratedOptions; - destination.emplace(entry); - } - PluginConfiguration::from(migratedOptions); - update(notMigratedOptions); -} - -void MyriadConfiguration::fromAtRuntime(const std::map& configuration) { - std::map migratedOptions, notMigratedOptions; - for (const auto& entry : configuration) { - auto& destination = PluginConfiguration::supports(entry.first) ? migratedOptions : notMigratedOptions; - destination.emplace(entry); - } - PluginConfiguration::fromAtRuntime(migratedOptions); - update(notMigratedOptions, ConfigMode::RunTime); -} - -} // namespace vpu diff --git a/inference-engine/src/vpu/myriad_plugin/configuration/myriad_configuration.hpp b/inference-engine/src/vpu/myriad_plugin/configuration/myriad_configuration.hpp deleted file mode 100644 index 080d262c703..00000000000 --- a/inference-engine/src/vpu/myriad_plugin/configuration/myriad_configuration.hpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2020 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include "vpu/configuration/plugin_configuration.hpp" -#include "myriad_config.h" - -namespace vpu { - -class MyriadConfiguration final : public PluginConfiguration, public MyriadPlugin::MyriadConfig { -public: - MyriadConfiguration(); - - // TODO: remove once all options are migrated - void from(const std::map& configuration); - void fromAtRuntime(const std::map& configuration); -}; - -} // namespace vpu diff --git a/inference-engine/src/vpu/myriad_plugin/myriad_config.cpp b/inference-engine/src/vpu/myriad_plugin/myriad_config.cpp deleted file mode 100644 index e37aa804809..00000000000 --- a/inference-engine/src/vpu/myriad_plugin/myriad_config.cpp +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "myriad_config.h" - -#include -#include -#include -#include - -#include -#include - -namespace vpu { -namespace MyriadPlugin { - -const std::unordered_set& MyriadConfig::getCompileOptions() const { -IE_SUPPRESS_DEPRECATED_START - static const std::unordered_set options = merge(ParsedConfig::getCompileOptions(), { - VPU_MYRIAD_CONFIG_KEY(PLATFORM), - }); -IE_SUPPRESS_DEPRECATED_END - - return options; -} - -const std::unordered_set& MyriadConfig::getRunTimeOptions() const { -IE_SUPPRESS_DEPRECATED_START - static const std::unordered_set options = merge(ParsedConfig::getRunTimeOptions(), { - CONFIG_KEY(DEVICE_ID), - - ie::MYRIAD_ENABLE_FORCE_RESET, - - ie::MYRIAD_PROTOCOL, - ie::MYRIAD_WATCHDOG, - ie::MYRIAD_THROUGHPUT_STREAMS, - ie::MYRIAD_POWER_MANAGEMENT, - - ie::MYRIAD_PLUGIN_LOG_FILE_PATH, - ie::MYRIAD_DEVICE_CONNECT_TIMEOUT, - - ie::MYRIAD_DDR_TYPE, - - // Deprecated - VPU_MYRIAD_CONFIG_KEY(FORCE_RESET), - VPU_MYRIAD_CONFIG_KEY(PLATFORM), - VPU_MYRIAD_CONFIG_KEY(PROTOCOL), - VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), - }); -IE_SUPPRESS_DEPRECATED_END - - return options; -} - -const std::unordered_set& MyriadConfig::getDeprecatedOptions() const { -IE_SUPPRESS_DEPRECATED_START - static const std::unordered_set options = merge(ParsedConfig::getDeprecatedOptions(), { - VPU_MYRIAD_CONFIG_KEY(FORCE_RESET), - VPU_MYRIAD_CONFIG_KEY(PLATFORM), - VPU_MYRIAD_CONFIG_KEY(PROTOCOL), - VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), - }); -IE_SUPPRESS_DEPRECATED_END - - return options; -} - -void MyriadConfig::parse(const std::map& config) { -IE_SUPPRESS_DEPRECATED_START - static const std::unordered_map platformsDeprecated = { - { VPU_MYRIAD_CONFIG_VALUE(2450), NC_MYRIAD_2 }, - { VPU_MYRIAD_CONFIG_VALUE(2480), NC_MYRIAD_X }, - { std::string(), NC_ANY_PLATFORM } - }; - - static const std::unordered_map protocolsDeprecated = { - { VPU_MYRIAD_CONFIG_VALUE(USB), NC_USB}, - { VPU_MYRIAD_CONFIG_VALUE(PCIE), NC_PCIE}, - { std::string(), NC_ANY_PROTOCOL} - }; - - static const std::unordered_map memoryTypesDeprecated = { - { VPU_MYRIAD_CONFIG_VALUE(DDR_AUTO), MovidiusDdrType::AUTO }, - { VPU_MYRIAD_CONFIG_VALUE(MICRON_2GB), MovidiusDdrType::MICRON_2GB }, - { VPU_MYRIAD_CONFIG_VALUE(SAMSUNG_2GB), MovidiusDdrType::SAMSUNG_2GB }, - { VPU_MYRIAD_CONFIG_VALUE(HYNIX_2GB), MovidiusDdrType::HYNIX_2GB }, - { VPU_MYRIAD_CONFIG_VALUE(MICRON_1GB), MovidiusDdrType::MICRON_1GB } - }; -IE_SUPPRESS_DEPRECATED_END - - static const std::unordered_map protocols = { - { ie::MYRIAD_USB, NC_USB}, - { ie::MYRIAD_PCIE, NC_PCIE}, - { std::string(), NC_ANY_PROTOCOL} - }; - - static const std::unordered_map watchdogIntervals = { - { CONFIG_VALUE(YES), std::chrono::milliseconds(1000) }, - { CONFIG_VALUE(NO), std::chrono::milliseconds(0) } - }; - - static const std::unordered_map powerConfigs = { - { ie::MYRIAD_POWER_FULL, PowerConfig::FULL }, - { ie::MYRIAD_POWER_INFER, PowerConfig::INFER }, - { ie::MYRIAD_POWER_STAGE, PowerConfig::STAGE }, - { ie::MYRIAD_POWER_STAGE_SHAVES, PowerConfig::STAGE_SHAVES }, - { ie::MYRIAD_POWER_STAGE_NCES, PowerConfig::STAGE_NCES }, - }; - - static const std::unordered_map memoryTypes = { - { ie::MYRIAD_DDR_AUTO, MovidiusDdrType::AUTO }, - { ie::MYRIAD_DDR_MICRON_2GB, MovidiusDdrType::MICRON_2GB }, - { ie::MYRIAD_DDR_SAMSUNG_2GB, MovidiusDdrType::SAMSUNG_2GB }, - { ie::MYRIAD_DDR_HYNIX_2GB, MovidiusDdrType::HYNIX_2GB }, - { ie::MYRIAD_DDR_MICRON_1GB, MovidiusDdrType::MICRON_1GB } - }; - - ParsedConfig::parse(config); - - setOption(_pluginLogFilePath, config, ie::MYRIAD_PLUGIN_LOG_FILE_PATH); - setOption(_deviceName, config, CONFIG_KEY(DEVICE_ID)); - setOption(_forceReset, switches, config, ie::MYRIAD_ENABLE_FORCE_RESET); - setOption(_protocol, protocols, config, ie::MYRIAD_PROTOCOL); - setOption(_watchdogInterval, watchdogIntervals, config, ie::MYRIAD_WATCHDOG); - setOption(_deviceConnectTimeout, config, ie::MYRIAD_DEVICE_CONNECT_TIMEOUT, parseSeconds); - setOption(_powerConfig, powerConfigs, config, ie::MYRIAD_POWER_MANAGEMENT); - setOption(_memoryType, memoryTypes, config, ie::MYRIAD_DDR_TYPE); - setOption(_enableAsyncDma, switches, config, ie::MYRIAD_ENABLE_ASYNC_DMA); - -IE_SUPPRESS_DEPRECATED_START - setOption(_forceReset, switches, config, VPU_MYRIAD_CONFIG_KEY(FORCE_RESET)); - setOption(_platform, platformsDeprecated, config, VPU_MYRIAD_CONFIG_KEY(PLATFORM)); - setOption(_protocol, protocolsDeprecated, config, VPU_MYRIAD_CONFIG_KEY(PROTOCOL)); - setOption(_memoryType, memoryTypesDeprecated, config, VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE)); -IE_SUPPRESS_DEPRECATED_END - -#ifndef NDEBUG - if (const auto envVar = std::getenv("IE_VPU_MYRIAD_PLUGIN_LOG_FILE_PATH")) { - _pluginLogFilePath = envVar; - } - if (const auto envVar = std::getenv("IE_VPU_MYRIAD_FORCE_RESET")) { - _forceReset = std::stoi(envVar); - } - if (const auto envVar = std::getenv("IE_VPU_MYRIAD_WATCHDOG_INTERVAL")) { - _watchdogInterval = std::chrono::milliseconds(std::stoi(envVar)); - } -#endif -} - -} // namespace MyriadPlugin -} // namespace vpu diff --git a/inference-engine/src/vpu/myriad_plugin/myriad_config.h b/inference-engine/src/vpu/myriad_plugin/myriad_config.h deleted file mode 100644 index 5745516e179..00000000000 --- a/inference-engine/src/vpu/myriad_plugin/myriad_config.h +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#pragma once - -#include -#include -#include -#include - -#include - -#include - -namespace vpu { -namespace MyriadPlugin { - -// Must be synchronized with firmware side. -VPU_DECLARE_ENUM(PowerConfig, - FULL = 0, - INFER = 1, - STAGE = 2, - STAGE_SHAVES = 3, - STAGE_NCES = 4, -) - -// Must be synchronized with firmware side. -VPU_DECLARE_ENUM(MovidiusDdrType, - AUTO = 0, - MICRON_2GB = 1, - SAMSUNG_2GB = 2, - HYNIX_2GB = 3, - MICRON_1GB = 4, -) - -class MyriadConfig : public virtual ParsedConfig { -public: - const std::string& pluginLogFilePath() const { - return _pluginLogFilePath; - } - - bool forceReset() const { - return _forceReset; - } - - bool asyncDma() const { - return _enableAsyncDma; - } - - PowerConfig powerConfig() const { - return _powerConfig; - } - - ncDevicePlatform_t platform() const { - return _platform; - } - - ncDeviceProtocol_t protocol() const { - return _protocol; - } - - const std::chrono::milliseconds& watchdogInterval() const { - return _watchdogInterval; - } - - const std::chrono::seconds& deviceConnectTimeout() const { - return _deviceConnectTimeout; - } - - const std::string& deviceName() const { - return _deviceName; - } - - MovidiusDdrType memoryType() const { - return _memoryType; - } - -protected: - const std::unordered_set& getCompileOptions() const override; - const std::unordered_set& getRunTimeOptions() const override; - const std::unordered_set& getDeprecatedOptions() const override; - void parse(const std::map& config) override; - -private: - std::string _pluginLogFilePath; - bool _forceReset = false; - bool _enableAsyncDma = true; - PowerConfig _powerConfig = PowerConfig::FULL; - ncDevicePlatform_t _platform = NC_ANY_PLATFORM; - ncDeviceProtocol_t _protocol = NC_ANY_PROTOCOL; - std::chrono::milliseconds _watchdogInterval = std::chrono::milliseconds(1000); - std::chrono::seconds _deviceConnectTimeout = std::chrono::seconds(15); - std::string _deviceName; - MovidiusDdrType _memoryType = MovidiusDdrType::AUTO; -}; - -} // namespace MyriadPlugin -} // namespace vpu diff --git a/inference-engine/src/vpu/myriad_plugin/myriad_executable_network.cpp b/inference-engine/src/vpu/myriad_plugin/myriad_executable_network.cpp index 3ddcc2fcc45..679fb25d1cd 100644 --- a/inference-engine/src/vpu/myriad_plugin/myriad_executable_network.cpp +++ b/inference-engine/src/vpu/myriad_plugin/myriad_executable_network.cpp @@ -16,6 +16,8 @@ #include #include #include +#include +#include using namespace InferenceEngine; @@ -26,7 +28,7 @@ namespace MyriadPlugin { ExecutableNetwork::ExecutableNetwork( std::shared_ptr mvnc, - const MyriadConfiguration& config, + const PluginConfiguration& config, const std::shared_ptr core) : _config(config), _core(core) { @@ -37,9 +39,9 @@ ExecutableNetwork::ExecutableNetwork( _log = std::make_shared( "MyriadPlugin", logLevel, - defaultOutput(_config.pluginLogFilePath())); + consoleOutput()); - _executor = std::make_shared(_config.forceReset(), std::move(mvnc), logLevel, _log); + _executor = std::make_shared(false, std::move(mvnc), logLevel, _log); _supportedMetrics = { METRIC_KEY(NETWORK_NAME), @@ -53,14 +55,15 @@ ExecutableNetwork::ExecutableNetwork( void ExecutableNetwork::openDevice(std::vector& devicePool) { _device = _executor->openDevice(devicePool, _config); const auto& revision = _device->revision(); - _actualNumExecutors = _config.compileConfig().numExecutors != -1 ? _config.compileConfig().numExecutors : DefaultAllocation::numStreams(revision, _config); + _actualNumExecutors = _config.get().hasValue() + ? _config.get().get() : DefaultAllocation::numStreams(revision, _config); } ExecutableNetwork::ExecutableNetwork( const ie::CNNNetwork& network, std::shared_ptr mvnc, std::vector& devicePool, - const MyriadConfiguration& config, + const PluginConfiguration& config, const std::shared_ptr core) : ExecutableNetwork(std::move(mvnc), config, core) { VPU_PROFILE(ExecutableNetwork); @@ -68,7 +71,7 @@ ExecutableNetwork::ExecutableNetwork( const auto compilerLog = std::make_shared( "GraphCompiler", _config.get(), - defaultOutput(_config.compilerLogFilePath())); + consoleOutput()); auto compiledGraph = compileNetwork( network, @@ -85,7 +88,7 @@ ExecutableNetwork::ExecutableNetwork( _outputInfo = std::move(compiledGraph->outputInfo); const auto& networkName = network.getName(); - if (_config.exclusiveAsyncRequests()) { + if (_config.get()) { ExecutorManager *executorManager = ExecutorManager::getInstance(); _taskExecutor = executorManager->getExecutor("MYRIAD"); } @@ -112,7 +115,7 @@ ExecutableNetwork::ExecutableNetwork( _executor->allocateGraph(_device, _graphDesc, _graphBlob, compiledGraph->blobHeader, compiledGraph->numActiveStages, networkName, _actualNumExecutors); } -void ExecutableNetwork::Import(std::istream& strm, std::vector &devicePool, const MyriadConfiguration& configuration) { +void ExecutableNetwork::Import(std::istream& strm, std::vector &devicePool, const PluginConfiguration& configuration) { auto currentPos = strm.tellg(); strm.seekg(0, strm.end); auto blobSize = strm.tellg() - currentPos; @@ -140,7 +143,7 @@ void ExecutableNetwork::Import(std::istream& strm, std::vector &devic meta.status = InferenceEngineProfileInfo::LayerStatus::EXECUTED; } - if (_config.exclusiveAsyncRequests()) { + if (_config.get()) { ExecutorManager *executorManager = ExecutorManager::getInstance(); _taskExecutor = executorManager->getExecutor("MYRIAD"); } @@ -155,7 +158,7 @@ void ExecutableNetwork::Import(std::istream& strm, std::vector &devic ExecutableNetwork::ExecutableNetwork(std::istream& strm, std::shared_ptr mvnc, std::vector &devicePool, - const MyriadConfiguration& config, + const PluginConfiguration& config, const std::shared_ptr core) : ExecutableNetwork(std::move(mvnc), config, core) { VPU_PROFILE(ExecutableNetwork); @@ -166,7 +169,7 @@ ExecutableNetwork::ExecutableNetwork( const std::string& blobFilename, std::shared_ptr mvnc, std::vector& devicePool, - const MyriadConfiguration& config, + const PluginConfiguration& config, const std::shared_ptr core) : ExecutableNetwork(std::move(mvnc), config, core) { VPU_PROFILE(ExecutableNetwork); diff --git a/inference-engine/src/vpu/myriad_plugin/myriad_executable_network.h b/inference-engine/src/vpu/myriad_plugin/myriad_executable_network.h index 94ed3e76b11..c64a9f6aaf0 100644 --- a/inference-engine/src/vpu/myriad_plugin/myriad_executable_network.h +++ b/inference-engine/src/vpu/myriad_plugin/myriad_executable_network.h @@ -18,12 +18,10 @@ #include #include -#include #include "myriad_executor.h" #include "myriad_infer_request.h" #include "myriad_async_infer_request.h" -#include "myriad_config.h" namespace vpu { namespace MyriadPlugin { @@ -33,14 +31,13 @@ public: typedef std::shared_ptr Ptr; ExecutableNetwork(const InferenceEngine::CNNNetwork& network, std::shared_ptr mvnc, std::vector &devicePool, - const MyriadConfiguration& configuration, const std::shared_ptr core); + const PluginConfiguration& configuration, const std::shared_ptr core); - ExecutableNetwork(std::istream& strm, std::shared_ptr mvnc, std::vector &devicePool, const MyriadConfiguration& configuration, + ExecutableNetwork(std::istream& strm, std::shared_ptr mvnc, std::vector &devicePool, const PluginConfiguration& configuration, const std::shared_ptr core); ExecutableNetwork(const std::string &blobFilename, std::shared_ptr mvnc, std::vector &devicePool, - const MyriadConfiguration& configuration, const std::shared_ptr core); - + const PluginConfiguration& configuration, const std::shared_ptr core); virtual ~ExecutableNetwork() { try { @@ -101,7 +98,7 @@ public: ie::CNNNetwork GetExecGraphInfo() override; - void Import(std::istream& strm, std::vector &devicePool, const MyriadConfiguration& configuration); + void Import(std::istream& strm, std::vector &devicePool, const PluginConfiguration& configuration); private: Logger::Ptr _log; @@ -110,7 +107,7 @@ private: GraphDesc _graphDesc; DevicePtr _device; GraphMetaInfo _graphMetaData; - MyriadConfiguration _config; + PluginConfiguration _config; bool _isNetworkConstant = false; const std::shared_ptr _core = nullptr; int _actualNumExecutors = 0; @@ -124,7 +121,7 @@ private: std::queue _taskExecutorGetResultIds; ExecutableNetwork(std::shared_ptr mvnc, - const MyriadConfiguration& config, + const PluginConfiguration& config, const std::shared_ptr core); ie::ITaskExecutor::Ptr getNextTaskExecutor() { diff --git a/inference-engine/src/vpu/myriad_plugin/myriad_executor.cpp b/inference-engine/src/vpu/myriad_plugin/myriad_executor.cpp index 49cf63c4e63..f0f3628049c 100644 --- a/inference-engine/src/vpu/myriad_plugin/myriad_executor.cpp +++ b/inference-engine/src/vpu/myriad_plugin/myriad_executor.cpp @@ -19,8 +19,15 @@ #include #include +#include +#include +#include +#include +#include +#include +#include + #include "myriad_executor.h" -#include "myriad_config.h" #ifndef _WIN32 # include @@ -73,7 +80,7 @@ MyriadExecutor::MyriadExecutor(bool forceReset, std::shared_ptr mvnc, /* * @brief Boot available device */ -ncStatus_t MyriadExecutor::bootNextDevice(std::vector &devicePool, const MyriadConfiguration& config) { +ncStatus_t MyriadExecutor::bootNextDevice(std::vector &devicePool, const PluginConfiguration& config) { VPU_PROFILE(bootNextDevice); // #-17972, #-16790 #if defined(NO_BOOT) @@ -83,11 +90,11 @@ ncStatus_t MyriadExecutor::bootNextDevice(std::vector &devicePool, co } #endif - const ncDevicePlatform_t& configPlatform = config.platform(); - const ncDeviceProtocol_t& configProtocol = config.protocol(); - const std::string& configDevName = config.deviceName(); - PowerConfig powerConfig = config.powerConfig(); - int enableAsyncDma = config.asyncDma(); + const ncDevicePlatform_t& configPlatform = ncDevicePlatform_t::NC_ANY_PLATFORM; + const ncDeviceProtocol_t& configProtocol = config.get(); + const std::string& configDevName = config.get(); + PowerConfig powerConfig = config.get(); + int enableAsyncDma = config.get(); int lastDeviceIdx = devicePool.empty() ? -1 : devicePool.back()->_deviceIdx; ncStatus_t statusOpen = NC_ERROR; @@ -131,15 +138,15 @@ ncStatus_t MyriadExecutor::bootNextDevice(std::vector &devicePool, co configDevName.copy(in_deviceDesc.name, NC_MAX_NAME_SIZE - 1); } - statusOpen = ncSetDeviceConnectTimeout(static_cast(config.deviceConnectTimeout().count())); + statusOpen = ncSetDeviceConnectTimeout(static_cast(config.get().count())); if (statusOpen) { return statusOpen; } ncDeviceOpenParams_t deviceOpenParams = {}; deviceOpenParams.watchdogHndl = _mvnc->watchdogHndl(); - deviceOpenParams.watchdogInterval = static_cast(config.watchdogInterval().count()); - deviceOpenParams.memoryType = checked_cast(config.memoryType()); + deviceOpenParams.watchdogInterval = static_cast(config.get().count()); + deviceOpenParams.memoryType = static_cast(config.get()); deviceOpenParams.customFirmwareDirectory = dirName.c_str(); // Open new device with specific path to FW folder @@ -220,7 +227,7 @@ ncStatus_t MyriadExecutor::bootNextDevice(std::vector &devicePool, co } DevicePtr MyriadExecutor::openDevice(std::vector& devicePool, - const MyriadConfiguration& config) { + const PluginConfiguration& config) { VPU_PROFILE(openDevice); std::lock_guard lock(device_mutex); @@ -236,7 +243,7 @@ DevicePtr MyriadExecutor::openDevice(std::vector& devicePool, return device; } - if (!config.deviceName().empty()) { + if (!config.get().empty()) { auto firstBootedBySpecificName = std::find_if(devicePool.begin(), devicePool.end(), [&](const DevicePtr& device) { return device->isBooted() && device->isSuitableForConfig(config); @@ -248,7 +255,7 @@ DevicePtr MyriadExecutor::openDevice(std::vector& devicePool, device->_graphNum++; return device; } else { - IE_THROW() << "Maximum number of networks reached for device: " << config.deviceName(); + IE_THROW() << "Maximum number of networks reached for device: " << config.get(); } } } @@ -268,12 +275,7 @@ DevicePtr MyriadExecutor::openDevice(std::vector& devicePool, }); // Return mock device. If try infer with it, exception will be thrown - if (availableDevices.empty() && config.platform() != NC_ANY_PLATFORM) { - DeviceDesc device; - device._platform = config.platform(); - device._protocol = config.protocol(); - return std::make_shared(device); - } else if (availableDevices.empty()) { + if (availableDevices.empty()) { IE_THROW() << "Can not init Myriad device: " << ncStatusToStr(nullptr, booted); } diff --git a/inference-engine/src/vpu/myriad_plugin/myriad_executor.h b/inference-engine/src/vpu/myriad_plugin/myriad_executor.h index d9883d8501e..997f7525d32 100644 --- a/inference-engine/src/vpu/myriad_plugin/myriad_executor.h +++ b/inference-engine/src/vpu/myriad_plugin/myriad_executor.h @@ -13,12 +13,13 @@ #include #include "myriad_mvnc_wrapper.h" -#include "configuration/myriad_configuration.hpp" +#include "vpu/configuration/plugin_configuration.hpp" +#include "vpu/configuration/options/protocol.hpp" +#include "vpu/configuration/options/device_id.hpp" +#include "vpu/utils/error.hpp" #include -#include - namespace vpu { namespace MyriadPlugin { @@ -53,15 +54,14 @@ struct DeviceDesc { return _graphNum < _maxGraphNum; } - bool isSuitableForConfig(const MyriadConfig& config) const { + bool isSuitableForConfig(const PluginConfiguration& config) const { bool isSuitableByName = true; - if (!config.deviceName().empty()) { - isSuitableByName = config.deviceName() == _name; + if (!config.get().empty()) { + isSuitableByName = config.get() == _name; } return isSuitableByName && - ((config.platform() == NC_ANY_PLATFORM) || (_platform == config.platform())) && - ((config.protocol() == NC_ANY_PROTOCOL) || (_protocol == config.protocol())); + ((config.get() == NC_ANY_PROTOCOL) || (_protocol == config.get())); } ncDevicePlatform_t revision() const { @@ -87,7 +87,7 @@ public: * @brief Get myriad device * @return Already booted and empty device or new booted device */ - DevicePtr openDevice(std::vector &devicePool, const MyriadConfiguration& config); + DevicePtr openDevice(std::vector &devicePool, const PluginConfiguration& config); static void closeDevices(std::vector &devicePool, std::shared_ptr mvnc); @@ -135,7 +135,7 @@ private: * @param configPlatform Boot the selected platform * @param configProtocol Boot device with selected protocol */ - ncStatus_t bootNextDevice(std::vector &devicePool, const MyriadConfiguration& config); + ncStatus_t bootNextDevice(std::vector &devicePool, const PluginConfiguration& config); }; typedef std::shared_ptr MyriadExecutorPtr; diff --git a/inference-engine/src/vpu/myriad_plugin/myriad_infer_request.cpp b/inference-engine/src/vpu/myriad_plugin/myriad_infer_request.cpp index a3662543a0f..27ecca826fa 100644 --- a/inference-engine/src/vpu/myriad_plugin/myriad_infer_request.cpp +++ b/inference-engine/src/vpu/myriad_plugin/myriad_infer_request.cpp @@ -15,6 +15,9 @@ #include #include #include +#include "vpu/configuration/options/enable_receiving_tensor_time.hpp" +#include "vpu/configuration/options/perf_report_mode.hpp" +#include "vpu/configuration/options/tensor_strides.hpp" #include "myriad_executable_network.h" #include "myriad_infer_request.h" @@ -31,7 +34,7 @@ MyriadInferRequest::MyriadInferRequest(GraphDesc &graphDesc, DataInfo& compilerInputsInfo, DataInfo& compilerOutputsInfo, const std::vector &blobMetaData, - const MyriadConfig& myriadConfig, + const PluginConfiguration& myriadConfig, const Logger::Ptr &log, const MyriadExecutorPtr &executor, std::map constDatas, @@ -42,7 +45,7 @@ MyriadInferRequest::MyriadInferRequest(GraphDesc &graphDesc, _graphDesc(graphDesc), _constDatas(constDatas), _isNetworkConstant(isNetworkConstant) { VPU_PROFILE(MyriadInferRequest); - const auto& ioStrides = _config.compileConfig().ioStrides; + const auto& ioStrides = _config.get(); // allocate inputs for (auto &networkInput : _networkInputs) { IE_ASSERT(ioStrides.find(networkInput.first) == ioStrides.end()) @@ -309,5 +312,5 @@ std::map MyriadInferRe return vpu::parsePerformanceReport( _stagesMetaData, perfInfo.data(), static_cast(perfInfo.size()), - _config.perfReport(), _config.printReceiveTensorTime()); + _config.get(), _config.get()); } diff --git a/inference-engine/src/vpu/myriad_plugin/myriad_infer_request.h b/inference-engine/src/vpu/myriad_plugin/myriad_infer_request.h index 194ce5fc990..ccfe1ddc6eb 100644 --- a/inference-engine/src/vpu/myriad_plugin/myriad_infer_request.h +++ b/inference-engine/src/vpu/myriad_plugin/myriad_infer_request.h @@ -17,7 +17,6 @@ #include #include "myriad_executor.h" -#include "myriad_config.h" namespace vpu { namespace MyriadPlugin { @@ -26,7 +25,7 @@ class MyriadInferRequest : public InferenceEngine::IInferRequestInternal { MyriadExecutorPtr _executor; Logger::Ptr _log; std::vector _stagesMetaData; - MyriadConfig _config; + PluginConfiguration _config; const DataInfo _inputInfo; const DataInfo _outputInfo; @@ -46,7 +45,7 @@ public: DataInfo& compilerInputsInfo, DataInfo& compilerOutputsInfo, const std::vector &blobMetaData, - const MyriadConfig &myriadConfig, + const PluginConfiguration &myriadConfig, const Logger::Ptr &log, const MyriadExecutorPtr &executor, std::map constDatas, diff --git a/inference-engine/src/vpu/myriad_plugin/myriad_metrics.cpp b/inference-engine/src/vpu/myriad_plugin/myriad_metrics.cpp index e91ef8333fe..83e16dbaff0 100644 --- a/inference-engine/src/vpu/myriad_plugin/myriad_metrics.cpp +++ b/inference-engine/src/vpu/myriad_plugin/myriad_metrics.cpp @@ -3,6 +3,7 @@ // #include "myriad_metrics.h" +#include "vpu/private_plugin_config.hpp" #include @@ -33,23 +34,15 @@ MyriadMetrics::MyriadMetrics() { IE_SUPPRESS_DEPRECATED_START // TODO: remove once all options are migrated _supportedConfigKeys = { - MYRIAD_ENABLE_HW_ACCELERATION, - MYRIAD_ENABLE_RECEIVING_TENSOR_TIME, MYRIAD_CUSTOM_LAYERS, MYRIAD_ENABLE_FORCE_RESET, - MYRIAD_THROUGHPUT_STREAMS, // deprecated - KEY_VPU_HW_STAGES_OPTIMIZATION, - KEY_VPU_PRINT_RECEIVE_TENSOR_TIME, KEY_VPU_CUSTOM_LAYERS, KEY_VPU_MYRIAD_FORCE_RESET, KEY_VPU_MYRIAD_PLATFORM, - CONFIG_KEY(EXCLUSIVE_ASYNC_REQUESTS), - CONFIG_KEY(PERF_COUNT), CONFIG_KEY(CONFIG_FILE), - CONFIG_KEY(DEVICE_ID) }; IE_SUPPRESS_DEPRECATED_END @@ -127,7 +120,7 @@ std::string MyriadMetrics::DeviceArchitecture(const std::map& config) const { - auto throughput_streams_str = config.find(ie::MYRIAD_THROUGHPUT_STREAMS); + auto throughput_streams_str = config.find(InferenceEngine::MYRIAD_THROUGHPUT_STREAMS); if (throughput_streams_str != config.end()) { try { int throughput_streams = std::stoi(throughput_streams_str->second); diff --git a/inference-engine/src/vpu/myriad_plugin/myriad_plugin.cpp b/inference-engine/src/vpu/myriad_plugin/myriad_plugin.cpp index 7771cc8bfbf..e84877890a6 100644 --- a/inference-engine/src/vpu/myriad_plugin/myriad_plugin.cpp +++ b/inference-engine/src/vpu/myriad_plugin/myriad_plugin.cpp @@ -13,7 +13,8 @@ #include #include -#include +#include +#include #include #include #include @@ -21,6 +22,51 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "myriad_plugin.h" @@ -54,6 +100,30 @@ void Engine::SetConfig(const std::map &config) { if (const auto envVar = std::getenv("IE_VPU_LOG_LEVEL")) { _parsedConfig.set(LogLevelOption::key(), envVar); } + if (const auto envVar = std::getenv("IE_VPU_TILING_CMX_LIMIT_KB")) { + _parsedConfig.set(TilingCMXLimitKBOption::key(), envVar); + } + if (const auto envVar = std::getenv("IE_VPU_MYRIAD_WATCHDOG_INTERVAL")) { + _parsedConfig.set(WatchdogIntervalOption::key(), envVar); + } + if (const auto envVar = std::getenv("IE_VPU_NUMBER_OF_SHAVES_AND_CMX_SLICES")) { + _parsedConfig.set(NumberOfSHAVEsOption::key(), envVar); + _parsedConfig.set(NumberOfCMXSlicesOption::key(), envVar); + } + if (const auto envVar = std::getenv("IE_VPU_DUMP_INTERNAL_GRAPH_FILE_NAME")) { + _parsedConfig.set(DumpInternalGraphFileNameOption::key(), envVar); + } + if (const auto envVar = std::getenv("IE_VPU_DUMP_INTERNAL_GRAPH_DIRECTORY")) { + _parsedConfig.set(DumpAllPassesDirectoryOption::key(), envVar); + } + if (const auto envVar = std::getenv("IE_VPU_DUMP_ALL_PASSES")) { + _parsedConfig.set(DumpAllPassesOption::key(), std::stoi(envVar) != 0 + ? InferenceEngine::PluginConfigParams::YES : InferenceEngine::PluginConfigParams::NO); + } + if (const auto envVar = std::getenv("IE_VPU_MYRIAD_FORCE_RESET")) { + _parsedConfig.set(EnableForceResetOption::key(), std::stoi(envVar) != 0 + ? InferenceEngine::PluginConfigParams::YES : InferenceEngine::PluginConfigParams::NO); + } #endif } @@ -82,7 +152,7 @@ QueryNetworkResult Engine::QueryNetwork( auto parsedConfigCopy = _parsedConfig; parsedConfigCopy.from(config); - const auto deviceName = parsedConfigCopy.deviceName(); + const auto deviceName = parsedConfigCopy.get(); if (!deviceName.empty()) { const auto deviceIDs = GetMetric(METRIC_KEY(AVAILABLE_DEVICES), {}).as>(); VPU_THROW_UNLESS(!(std::find(deviceIDs.begin(), deviceIDs.end(), deviceName) == deviceIDs.end()), "Myriad device: {} not found.", deviceName); @@ -91,11 +161,11 @@ QueryNetworkResult Engine::QueryNetwork( const auto log = std::make_shared( "GraphCompiler", _parsedConfig.get(), - defaultOutput(parsedConfigCopy.compilerLogFilePath())); + consoleOutput()); const auto supportedLayers = getSupportedLayers( network, - parsedConfigCopy.platform(), + ncDevicePlatform_t::NC_ANY_PLATFORM, parsedConfigCopy, log, GetCore()); @@ -121,34 +191,63 @@ Engine::Engine(std::shared_ptr mvnc) : _pluginName = "MYRIAD"; - // TODO: remove once all options are migrated -IE_SUPPRESS_DEPRECATED_START - _config = { - { MYRIAD_ENABLE_HW_ACCELERATION, CONFIG_VALUE(YES) }, - { MYRIAD_ENABLE_RECEIVING_TENSOR_TIME, CONFIG_VALUE(NO) }, - { MYRIAD_CUSTOM_LAYERS, "" }, - { MYRIAD_ENABLE_FORCE_RESET, CONFIG_VALUE(NO) }, - { MYRIAD_THROUGHPUT_STREAMS, "-1" }, - - // Deprecated - { KEY_VPU_HW_STAGES_OPTIMIZATION, CONFIG_VALUE(YES) }, - { KEY_VPU_PRINT_RECEIVE_TENSOR_TIME, CONFIG_VALUE(NO) }, - { KEY_VPU_CUSTOM_LAYERS, "" }, - { KEY_VPU_MYRIAD_FORCE_RESET, CONFIG_VALUE(NO) }, - { KEY_VPU_MYRIAD_PLATFORM, "" }, - - { KEY_EXCLUSIVE_ASYNC_REQUESTS, CONFIG_VALUE(NO) }, - { KEY_PERF_COUNT, CONFIG_VALUE(NO) }, - { KEY_CONFIG_FILE, "" }, - { KEY_DEVICE_ID, "" }, - }; -IE_SUPPRESS_DEPRECATED_END - _parsedConfig.registerOption(); _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); + _parsedConfig.registerOption(); IE_SUPPRESS_DEPRECATED_START + _parsedConfig.registerDeprecatedOption(InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES); + _parsedConfig.registerDeprecatedOption(InferenceEngine::MYRIAD_DISABLE_REORDER); _parsedConfig.registerDeprecatedOption(VPU_CONFIG_KEY(LOG_LEVEL)); + _parsedConfig.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(PROTOCOL)); + _parsedConfig.registerDeprecatedOption(VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION)); + _parsedConfig.registerDeprecatedOption(VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME)); + _parsedConfig.registerDeprecatedOption(VPU_CONFIG_KEY(DETECT_NETWORK_BATCH)); + _parsedConfig.registerDeprecatedOption(VPU_CONFIG_KEY(CUSTOM_LAYERS)); + _parsedConfig.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE)); + _parsedConfig.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(FORCE_RESET)); + _parsedConfig.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(PLATFORM)); IE_SUPPRESS_DEPRECATED_END } diff --git a/inference-engine/src/vpu/myriad_plugin/myriad_plugin.h b/inference-engine/src/vpu/myriad_plugin/myriad_plugin.h index 1d7536600c2..d62b5c3cc60 100644 --- a/inference-engine/src/vpu/myriad_plugin/myriad_plugin.h +++ b/inference-engine/src/vpu/myriad_plugin/myriad_plugin.h @@ -8,7 +8,7 @@ #include "myriad_executable_network.h" #include "myriad_mvnc_wrapper.h" #include "myriad_metrics.h" -#include "configuration/myriad_configuration.hpp" +#include "vpu/configuration/plugin_configuration.hpp" #include #include #include @@ -51,7 +51,7 @@ public: const std::map& options) const override; private: - MyriadConfiguration _parsedConfig; + PluginConfiguration _parsedConfig; std::vector _devicePool; std::shared_ptr _mvnc; std::shared_ptr _metrics; diff --git a/inference-engine/tests/functional/inference_engine/ir_serialization/deterministicity.cpp b/inference-engine/tests/functional/inference_engine/ir_serialization/deterministicity.cpp index 8fb248ed7dc..cbcd1b3093d 100644 --- a/inference-engine/tests/functional/inference_engine/ir_serialization/deterministicity.cpp +++ b/inference-engine/tests/functional/inference_engine/ir_serialization/deterministicity.cpp @@ -124,3 +124,49 @@ TEST_F(SerializationDeterministicityTest, ModelWithConstants) { ASSERT_TRUE(files_equal(xml_1, xml_2)); ASSERT_TRUE(files_equal(bin_1, bin_2)); } + +TEST_F(SerializationDeterministicityTest, SerializeToStream) { + const std::string model = + IR_SERIALIZATION_MODELS_PATH "add_abc_initializers.xml"; + const std::string weights = + IR_SERIALIZATION_MODELS_PATH "add_abc_initializers.bin"; + + std::stringstream m_out_xml_buf, m_out_bin_buf; + InferenceEngine::Blob::Ptr binBlob; + + InferenceEngine::Core ie; + auto expected = ie.ReadNetwork(model, weights); + expected.serialize(m_out_xml_buf, m_out_bin_buf); + + std::streambuf* pbuf = m_out_bin_buf.rdbuf(); + unsigned long bufSize = m_out_bin_buf.tellp(); + + InferenceEngine::TensorDesc tensorDesc(InferenceEngine::Precision::U8, + { bufSize }, InferenceEngine::Layout::C); + binBlob = InferenceEngine::make_shared_blob(tensorDesc); + binBlob->allocate(); + pbuf->sgetn(binBlob->buffer(), bufSize); + + auto result = ie.ReadNetwork(m_out_xml_buf.str(), binBlob); + + ASSERT_TRUE(expected.layerCount() == result.layerCount()); + ASSERT_TRUE(expected.getInputShapes() == result.getInputShapes()); +} + +TEST_F(SerializationDeterministicityTest, SerializeToBlob) { + const std::string model = + IR_SERIALIZATION_MODELS_PATH "add_abc_initializers.xml"; + const std::string weights = + IR_SERIALIZATION_MODELS_PATH "add_abc_initializers.bin"; + + std::stringstream m_out_xml_buf; + InferenceEngine::Blob::Ptr m_out_bin_buf; + + InferenceEngine::Core ie; + auto expected = ie.ReadNetwork(model, weights); + expected.serialize(m_out_xml_buf, m_out_bin_buf); + auto result = ie.ReadNetwork(m_out_xml_buf.str(), m_out_bin_buf); + + ASSERT_TRUE(expected.layerCount() == result.layerCount()); + ASSERT_TRUE(expected.getInputShapes() == result.getInputShapes()); +} diff --git a/inference-engine/tests/functional/inference_engine/serialization/single_layer/prior_box_clustered.cpp b/inference-engine/tests/functional/inference_engine/serialization/single_layer/prior_box_clustered.cpp index f59e469660b..c9682960dc9 100644 --- a/inference-engine/tests/functional/inference_engine/serialization/single_layer/prior_box_clustered.cpp +++ b/inference-engine/tests/functional/inference_engine/serialization/single_layer/prior_box_clustered.cpp @@ -37,6 +37,10 @@ namespace { 0.0f, 1.5f }; + const std::vector step = { + 0.0f + }; + const std::vector offsets = { 0.5f }; @@ -58,6 +62,7 @@ namespace { ::testing::ValuesIn(clips), ::testing::ValuesIn(step_widths), ::testing::ValuesIn(step_heights), + ::testing::ValuesIn(step), ::testing::ValuesIn(offsets), ::testing::ValuesIn(variances)); diff --git a/inference-engine/tests/functional/inference_engine/transformations/simplify_shape_of_sub_graph.cpp b/inference-engine/tests/functional/inference_engine/transformations/simplify_shape_of_sub_graph.cpp index d4b0e166573..bdcd16823a9 100644 --- a/inference-engine/tests/functional/inference_engine/transformations/simplify_shape_of_sub_graph.cpp +++ b/inference-engine/tests/functional/inference_engine/transformations/simplify_shape_of_sub_graph.cpp @@ -79,3 +79,41 @@ TEST(TransformationTests, ShapeSubGraphTest) { auto res = compare_functions(f, f_ref, true); ASSERT_TRUE(res.first) << res.second; } + +TEST(TransformationTests, ShapeNopSubGraphTest) { + std::shared_ptr f(nullptr), f_ref(nullptr); + + PartialShape data_shape{-1, -1}; + { + auto data = std::make_shared(element::f32, data_shape); + + auto shape_op_1 = std::make_shared(data); + auto gather_1 = gather(shape_op_1, {0}, true); + auto unsqueeze_1 = std::make_shared( + gather_1, opset7::Constant::create(element::i64, {1}, {0})); + + auto shape_op_2 = std::make_shared(data); + auto gather_2 = gather(shape_op_2, {1}, true); + auto unsqueeze_2 = std::make_shared( + gather_2, opset7::Constant::create(element::i64, {1}, {0})); + + auto concat = std::make_shared(OutputVector{unsqueeze_1, unsqueeze_2}, 0); + + auto reshape = std::make_shared(data, concat, false); + f = std::make_shared(NodeVector{reshape}, ParameterVector{data}); + pass::Manager m; + m.register_pass(); + m.register_pass(); + m.run_passes(f); + ASSERT_NO_THROW(check_rt_info(f)); + } + { + auto data = std::make_shared(element::f32, data_shape); + auto shape_op_1 = std::make_shared(data); + auto reshape = std::make_shared(data, shape_op_1, false); + f_ref = std::make_shared(NodeVector{reshape}, ParameterVector{data}); + } + + auto res = compare_functions(f, f_ref, true); + ASSERT_TRUE(res.first) << res.second; +} diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/add_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/add_transformation.cpp index f575a6cc2ec..c2d0c9ccf0c 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/add_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/add_transformation.cpp @@ -71,7 +71,7 @@ const std::vector params = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, AddTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(params)), AddTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/clamp_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/clamp_transformation.cpp index 6f45a17b352..8b9a1c407c6 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/clamp_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/clamp_transformation.cpp @@ -79,7 +79,7 @@ const std::vector params{ INSTANTIATE_TEST_SUITE_P(smoke_LPT, ClampTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_transformation.cpp index 60d5e1ff730..ffd5c2b1d43 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_transformation.cpp @@ -44,7 +44,7 @@ const std::vector testValues = { }, }; -const std::vector shapes = { +const std::vector shapes = { ngraph::Shape({ 1, 3, 16, 16 }), ngraph::Shape({ 4, 3, 16, 16 }) }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_child_and_output.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_child_and_output.cpp index 0141d37d23a..205e23656e4 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_child_and_output.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_child_and_output.cpp @@ -45,7 +45,7 @@ const std::vector testValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatWithChildAndOutputTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 6, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 6, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(testValues), ::testing::ValuesIn(trasformationParamValues)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp index dc7d9936e6a..64b6b0b4d2a 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp @@ -48,7 +48,7 @@ const std::vector multiChannel = { true/*, false*/ }; INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatWithDifferentChildrenTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 6, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 6, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(testValues), ::testing::ValuesIn(trasformationParamValues), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_intermediate_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_intermediate_transformation.cpp index 8c24e9cec20..0033b65b1c3 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_intermediate_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_intermediate_transformation.cpp @@ -26,7 +26,7 @@ const std::vector tras const std::vector transparentIntermediateValues = { true, false }; const std::vector multiChannelValues = { /*true,*/ false }; -const std::vector shapes = { +const std::vector shapes = { { 1, 3, 16, 16 }, { 4, 3, 16, 16 } }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_neighbors_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_neighbors_transformation.cpp index a0724e1bfe6..8d41c2b4086 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_neighbors_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_neighbors_transformation.cpp @@ -23,7 +23,7 @@ const std::vector tras LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8() }; -const std::vector shapes = { +const std::vector shapes = { { 1, 3, 16, 16 }, { 4, 3, 16, 16 } }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_split_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_split_transformation.cpp index f6d2f1c16b7..47dfa3385f6 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_split_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/concat_with_split_transformation.cpp @@ -48,7 +48,7 @@ const std::vector testValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatWithSplitTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 6, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 6, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(testValues), ::testing::ValuesIn(trasformationParamValues)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp index 180ef107e02..2aa5610a922 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp @@ -100,7 +100,7 @@ const std::vector> inputShapes = { +const std::vector> inputShapes = { {{ 1, 8, 16, 16 }, true} }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_qdq_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_qdq_transformation.cpp index 5cb46fc2ee8..61050800444 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_qdq_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/convolution_qdq_transformation.cpp @@ -233,7 +233,7 @@ const std::vector para }, }; -const std::vector shapes = { +const std::vector shapes = { { 1, 3, 4, 4 }, { 4, 3, 4, 4 } }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/depth_to_space_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/depth_to_space_transformation.cpp index d9057f66a92..e016bb04786 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/depth_to_space_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/depth_to_space_transformation.cpp @@ -22,7 +22,7 @@ const std::vector modes = { DepthToSpace::DepthToSpaceMode::DEPTH_FIRST }; -const std::vector inputShapesBS2 = { +const std::vector inputShapesBS2 = { {1, 4, 3, 3}, {2, 16, 5, 4} }; @@ -36,7 +36,7 @@ const auto DepthToSpaceBS2 = ::testing::Combine( INSTANTIATE_TEST_SUITE_P(LPT_BS2, DepthToSpaceTransformation, DepthToSpaceBS2, DepthToSpaceTransformation::getTestCaseName); -const std::vector inputShapesBS3 = { +const std::vector inputShapesBS3 = { {1, 9, 3, 3}, {2, 27, 5, 4} }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_avg_pool_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_avg_pool_transformation.cpp index d0f2b614f43..b4d81223f58 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_avg_pool_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_avg_pool_transformation.cpp @@ -29,7 +29,7 @@ const std::vector fakeQuantizes = INSTANTIATE_TEST_SUITE_P(smoke_LPT, FakeQuantizeAndAvgPoolTransformation, ::testing::Combine( ::testing::ValuesIn(precisions), - ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })), + ::testing::Values(ngraph::PartialShape({ 1, 32, 72, 48 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(fakeQuantizes)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_max_pool_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_max_pool_transformation.cpp index 78df11d2f78..f0e626509dc 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_max_pool_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_max_pool_transformation.cpp @@ -29,7 +29,7 @@ const std::vector fakeQuantizes = INSTANTIATE_TEST_SUITE_P(smoke_LPT, FakeQuantizeAndMaxPoolTransformation, ::testing::Combine( ::testing::ValuesIn(precisions), - ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })), + ::testing::Values(ngraph::PartialShape({ 1, 32, 72, 48 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(fakeQuantizes)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp index adb79c659ec..2df5b908a0b 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp @@ -31,7 +31,7 @@ const std::vector testValues = INSTANTIATE_TEST_SUITE_P(smoke_LPT, FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })), + ::testing::Values(ngraph::PartialShape({ 1, 32, 72, 48 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(testValues)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_precision_selection_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_precision_selection_transformation.cpp index f2e7df2acde..efced0be774 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_precision_selection_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_precision_selection_transformation.cpp @@ -59,7 +59,7 @@ const std::vector testVa INSTANTIATE_TEST_SUITE_P(smoke_LPT, FakeQuantizePrecisionSelectionTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })), + ::testing::Values(ngraph::PartialShape({ 1, 32, 72, 48 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(testValues)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_transformation.cpp index 69ce1065c20..52cf2b24ba7 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_transformation.cpp @@ -62,7 +62,7 @@ const std::vector fakeQuantizeOnDataValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, FakeQuantizeTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })), + ::testing::Values(ngraph::PartialShape({ 1, 32, 72, 48 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(fakeQuantizeOnDataValues)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp index af1a82dcd41..792323057f1 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp @@ -104,7 +104,7 @@ const std::vector fakeQuanti INSTANTIATE_TEST_SUITE_P(smoke_LPT, FakeQuantizeWithNotOptimalTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(fakeQuantizeOnDataValues)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fully_connected_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fully_connected_transformation.cpp index a285b41a536..26125f65ba4 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fully_connected_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fully_connected_transformation.cpp @@ -18,20 +18,20 @@ const std::vector netPrecisions = { const std::vector shapes = { { - ngraph::Shape{ 1, 16 }, - ngraph::Shape{ 16, 8 }, + ngraph::PartialShape{ 1, 16 }, + ngraph::PartialShape{ 16, 8 }, false, false }, { - ngraph::Shape{ 1, 16 }, - ngraph::Shape{ 8, 16 }, + ngraph::PartialShape{ 1, 16 }, + ngraph::PartialShape{ 8, 16 }, false, true }, { - ngraph::Shape{ 16, 1 }, - ngraph::Shape{ 16, 8 }, + ngraph::PartialShape{ 16, 1 }, + ngraph::PartialShape{ 16, 8 }, true, false }, diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_convert_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_convert_transformation.cpp index 8082ecfe96d..d8c5370b37b 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_convert_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_convert_transformation.cpp @@ -12,8 +12,8 @@ const std::vector precisions = { element::f32 }; -const std::vector< ngraph::Shape > inputAndQuantizationShapes = { - Shape{ 1, 4, 16, 16 }, +const std::vector< ngraph::PartialShape > inputAndQuantizationShapes = { + { 1, 4, 16, 16 }, }; const std::vector deqOperations = { diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_and_scale_shift_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_and_scale_shift_transformation.cpp index 8d4b127eb48..791be4c2c5a 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_and_scale_shift_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_and_scale_shift_transformation.cpp @@ -36,7 +36,7 @@ const std::vector fakeQuantizeOnD INSTANTIATE_TEST_SUITE_P(smoke_LPT, FuseFakeQuantizeAndScaleShiftTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 9, 9 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 9, 9 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(fakeQuantizeOnDataValues)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_transformation.cpp index d1d38ed94d7..cf04e0e5b3c 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_transformation.cpp @@ -14,7 +14,7 @@ namespace { const std::vector testValues = { // 1) Multiply { - ngraph::Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { ngraph::element::f32, @@ -26,7 +26,7 @@ const std::vector testValues = { } }, { - ngraph::Shape{128, 3}, + {128, 3}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { ngraph::element::f32, @@ -39,7 +39,7 @@ const std::vector testValues = { }, // 1) Multiply by zero { - ngraph::Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { ngraph::element::f32, @@ -52,7 +52,7 @@ const std::vector testValues = { }, // 1) Subtract + Multiply { - ngraph::Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { ngraph::element::f32, @@ -65,7 +65,7 @@ const std::vector testValues = { }, // 1) Convert + Subtract + Multiply { - ngraph::Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { ngraph::element::f32, @@ -78,7 +78,7 @@ const std::vector testValues = { }, // 1) Convert + Subtract + Multiply 2) Add { - ngraph::Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { ngraph::element::f32, @@ -91,7 +91,7 @@ const std::vector testValues = { }, // issue #40611 for FP32 { - ngraph::Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { { }, diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_multiply_to_fake_quantize_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_multiply_to_fake_quantize_transformation.cpp index 81674818d6b..25a9d1c74d8 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_multiply_to_fake_quantize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_multiply_to_fake_quantize_transformation.cpp @@ -14,7 +14,7 @@ namespace { const std::vector testValues = { { - Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { { 256ul, {}, { 0.f }, { 2.55f }, { 0.f }, { 2.55f } }, @@ -22,7 +22,7 @@ const std::vector testValues } }, { - Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { { 256ul, {}, { -1.28f }, { 1.27f }, { 10.f }, { 2.55f } }, diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_subtract_to_fake_quantize_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_subtract_to_fake_quantize_transformation.cpp index 4a65f1eb27b..cfac0fe5fd7 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_subtract_to_fake_quantize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/fuse_subtract_to_fake_quantize_transformation.cpp @@ -14,7 +14,7 @@ namespace { const std::vector testValues = { { - Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { { 256ul, {}, { 0.f }, { 2.55f }, { 10.f }, { 255.f } }, @@ -22,7 +22,7 @@ const std::vector testValues } }, { - Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { { 256ul, {}, { -1.28f }, { 1.27f }, { 0.f }, { 255.f } }, diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/gemm_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/gemm_transformation.cpp index 242df59cfff..4aef2c749c4 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/gemm_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/gemm_transformation.cpp @@ -16,7 +16,7 @@ const std::vector netPrecisions = { // ngraph::element::f16 }; -const std::vector dimensions = { +const std::vector dimensions = { { 1, 3, 16, 16 } }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp index d8a81076d61..cc62ec4db63 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp @@ -23,8 +23,8 @@ const std::vector tras const std::vector params = { // group convolution, tensor quantization { - ngraph::Shape{ 1, 6, 24, 24 }, - ngraph::Shape{ 1, 24, 18, 18 }, + { 1, 6, 24, 24 }, + { 1, 24, 18, 18 }, 3ul, -1, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, @@ -34,8 +34,8 @@ const std::vector pa }, // group convolution, tensor quantization { - ngraph::Shape{ 1, 6, 24, 24 }, - ngraph::Shape{ 1, 24, 18, 18 }, + { 1, 6, 24, 24 }, + { 1, 24, 18, 18 }, 3ul, 0, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, @@ -45,8 +45,8 @@ const std::vector pa }, // group convolution, tensor quantization { - ngraph::Shape{ 1, 6, 24, 24 }, - ngraph::Shape{ 1, 24, 18, 18 }, + { 1, 6, 24, 24 }, + { 1, 24, 18, 18 }, 3ul, 1, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, @@ -56,8 +56,8 @@ const std::vector pa }, // group convolution, per-channel quantization { - ngraph::Shape{ 1, 6, 24, 24 }, - ngraph::Shape{ 1, 24, 18, 18 }, + { 1, 6, 24, 24 }, + { 1, 24, 18, 18 }, 3ul, -1, { @@ -72,8 +72,8 @@ const std::vector pa }, // depth-wise convolution, tensor quantization { - ngraph::Shape{ 1, 6, 24, 24 }, - ngraph::Shape{ 1, 6, 18, 18 }, + { 1, 6, 24, 24 }, + { 1, 6, 18, 18 }, 6ul, -1, { 256ul, ngraph::Shape { 1, 1, 1, 1 }, { 0.f }, { 25.5f }, { 0.f }, { 25.5f } }, @@ -81,8 +81,8 @@ const std::vector pa }, // depth-wise convolution, per-channel quantization { - ngraph::Shape{ 1, 6, 24, 24 }, - ngraph::Shape{ 1, 6, 18, 18 }, + { 1, 6, 24, 24 }, + { 1, 6, 18, 18 }, 6ul, -1, { diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/groupconvolution_qdq_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/groupconvolution_qdq_transformation.cpp index 74c60def9fc..8a80f2b13b1 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/groupconvolution_qdq_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/groupconvolution_qdq_transformation.cpp @@ -488,7 +488,7 @@ const std::vector }, }; -const std::vector shapes = { +const std::vector shapes = { { 1, 4, 7, 7 } }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/interpolate_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/interpolate_transformation.cpp index 7954fac1a23..769d78abf72 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/interpolate_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/interpolate_transformation.cpp @@ -12,7 +12,7 @@ const std::vector precisions = { ngraph::element::f32 }; -const std::vector> shapes = { +const std::vector> shapes = { {{1, 4, 16, 16}, {32, 32}}, {{1, 2, 48, 80}, {50, 60}}, }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/mat_mul_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/mat_mul_transformation.cpp index 2df46fe0bfc..a3c782b39d0 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/mat_mul_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/mat_mul_transformation.cpp @@ -45,7 +45,7 @@ std::vector testValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, MatMulTransformation, ::testing::Combine( ::testing::ValuesIn(precisions), - ::testing::Values(ngraph::Shape({ 1, 384, 1024 })), + ::testing::Values(ngraph::PartialShape({ 1, 384, 1024 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(testValues)), MatMulTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.cpp index 76ec3422c06..dfad0664275 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.cpp @@ -21,9 +21,9 @@ const std::vector> inputShapes = { - std::pair({ 1, 16 }, { 10, 16 }), - std::pair({ 1, 16 }, { 16, 10 }) +const std::vector> inputShapes = { + {{ 1, 16 }, { 10, 16 }}, + {{ 1, 16 }, { 16, 10 }} }; INSTANTIATE_TEST_SUITE_P(smoke_LPT, MatMulWithOptimizedConstantFakeQuantizeTransformation, diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution_transformation.cpp index 39dc081f402..10f45879810 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution_transformation.cpp @@ -12,8 +12,8 @@ const std::vector precisions = { element::f32 }; -const std::vector< ngraph::Shape > inputShapes = { - Shape{ 1ul, 4ul, 16ul, 16ul }, Shape{ 1ul, 4ul, 16ul, 16ul, 16ul } +const std::vector< ngraph::PartialShape > inputShapes = { + { 1ul, 4ul, 16ul, 16ul }, { 1ul, 4ul, 16ul, 16ul, 16ul } }; const std::vector fqOnData = { diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/multiply_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/multiply_transformation.cpp index 8f791dc2e7c..de85a663877 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/multiply_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/multiply_transformation.cpp @@ -70,7 +70,7 @@ const std::vector params = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, MultiplyTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(params)), MultiplyTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/multiply_with_one_parent_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/multiply_with_one_parent_transformation.cpp index 2c790eb7023..0b483c5fecf 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/multiply_with_one_parent_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/multiply_with_one_parent_transformation.cpp @@ -24,7 +24,7 @@ const std::vector values = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, MultiplyWithOneParentTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(values)), MultiplyWithOneParentTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/mvn_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/mvn_transformation.cpp index 505fffa8d54..1051ef8d15b 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/mvn_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/mvn_transformation.cpp @@ -12,8 +12,8 @@ const std::vector precisions = { element::f32 }; -const std::vector< ngraph::Shape > inputAndQuantizationShapes = { - Shape{ 1ul, 4ul, 16ul, 16ul }, +const std::vector inputAndQuantizationShapes = { + { 1ul, 4ul, 16ul, 16ul }, }; const std::vector reductionAxes = { { 2, 3 }, { 1, 2, 3 } }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/normalize_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/normalize_transformation.cpp index 6a88af8938d..c1a8a31dd3e 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/normalize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/normalize_transformation.cpp @@ -16,9 +16,9 @@ const std::vector precisions = { //ngraph::element::f16 }; -const std::vector > inputAndQuantizationShapes = { - { ngraph::Shape({ 1ul, 4ul, 16ul, 16ul }), ngraph::Shape({ 1ul }) }, - { ngraph::Shape({ 1ul, 4ul, 16ul, 16ul }), ngraph::Shape({ 1ul, 4ul, 1ul, 1ul }) }, +const std::vector > inputAndQuantizationShapes = { + { { 1ul, 4ul, 16ul, 16ul }, { 1ul } }, + { { 1ul, 4ul, 16ul, 16ul }, { 1ul, 4ul, 1ul, 1ul } }, }; const std::vector> axes = { diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/prelu_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/prelu_transformation.cpp index bb35f882e62..43878ff0fc5 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/prelu_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/prelu_transformation.cpp @@ -26,7 +26,7 @@ std::vector testValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, PReluTransformation, ::testing::Combine( ::testing::ValuesIn(precisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(testValues)), PReluTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp index 0d8ca9c2284..6c064b4e70e 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp @@ -61,7 +61,7 @@ const std::vector params = { } }; -const std::vector inputShapes = { +const std::vector inputShapes = { { 1, 16, 9, 9 }, { 4, 16, 9, 9 } }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_max_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_max_transformation.cpp index a24ef762ea5..ec5a659c72b 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_max_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_max_transformation.cpp @@ -107,7 +107,7 @@ const std::vector params = INSTANTIATE_TEST_SUITE_P(smoke_LPT, ReduceMaxTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_mean_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_mean_transformation.cpp index 7c6d1b60c6b..d77121a8e5c 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_mean_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_mean_transformation.cpp @@ -107,7 +107,7 @@ const std::vector params = INSTANTIATE_TEST_SUITE_P(smoke_LPT, ReduceMeanTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_min_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_min_transformation.cpp index af56b057a33..0e92bfdc7a8 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_min_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_min_transformation.cpp @@ -107,7 +107,7 @@ const std::vector params = INSTANTIATE_TEST_SUITE_P(smoke_LPT, ReduceMinTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_sum_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_sum_transformation.cpp index cf767b71e4d..a7ca938ddbe 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_sum_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reduce_sum_transformation.cpp @@ -93,7 +93,7 @@ const std::vector params = INSTANTIATE_TEST_SUITE_P(smoke_LPT, ReduceSumTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/relu_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/relu_transformation.cpp index 460d050f6aa..e618aa4719d 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/relu_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/relu_transformation.cpp @@ -27,7 +27,7 @@ std::vector testValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, ReluTransformation, ::testing::Combine( ::testing::ValuesIn(precisions), - ::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(testValues)), ReluTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reshape_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reshape_transformation.cpp index 599b3de32e6..c8de61e3fd4 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reshape_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/reshape_transformation.cpp @@ -24,28 +24,28 @@ const std::vector tras const std::vector params = { // 3D -> 4D { - ngraph::Shape{ 1, 3, 32 }, + { 1, 3, 32 }, { 1, 3, 4, 8 }, { 256ul, ngraph::Shape{ 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, true }, // 4D -> 3D { - ngraph::Shape{ 1, 3, 16, 16 }, + { 1, 3, 16, 16 }, { 1, 3, 256 }, { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, true }, // 4D -> 3D { - ngraph::Shape{ 1, 3, 16, 16 }, + { 1, 3, 16, 16 }, { 0, 3, -1 }, { 256ul, ngraph::Shape{ 1, 3, 1, 1 }, { 0.f }, { 255.f }, { 0.f, 0.f, 0.f }, { 255.f, 25.5f, 2.55f } }, true }, // 4D -> 2D { - ngraph::Shape{ 1, 3, 4, 8 }, + { 1, 3, 4, 8 }, { 1, -1 }, { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, true diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/shuffle_channels_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/shuffle_channels_transformation.cpp index 2a214de6d3a..c086cdb5767 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/shuffle_channels_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/shuffle_channels_transformation.cpp @@ -15,7 +15,7 @@ const std::vector netPrecisions = { // ngraph::element::f16 }; -const std::vector inputShapes = { +const std::vector inputShapes = { { 1, 3, 16, 16 }, { 4, 3, 16, 16 } }; diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/split_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/split_transformation.cpp index 56f3c7e2f25..6170a5c77af 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/split_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/split_transformation.cpp @@ -87,7 +87,7 @@ const std::vector params = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, SplitTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/strided_slice_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/strided_slice_transformation.cpp index a66106064a1..f184a6e7658 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/strided_slice_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/strided_slice_transformation.cpp @@ -92,7 +92,7 @@ const std::vector params INSTANTIATE_TEST_SUITE_P(smoke_LPT, StridedSliceTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 24, 24 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 24, 24 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/subtract_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/subtract_transformation.cpp index 3a5d5d6a32f..e2a82110508 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/subtract_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/subtract_transformation.cpp @@ -25,7 +25,7 @@ const std::vector trasformationParamValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, SubtractTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues)), SubtractTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/transpose_after_matmul_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/transpose_after_matmul_transformation.cpp index 98eb3cdde77..4057c6bdd58 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/transpose_after_matmul_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/transpose_after_matmul_transformation.cpp @@ -29,7 +29,7 @@ const std::vector transposeChannelDimValues = { true, false }; INSTANTIATE_TEST_SUITE_P(smoke_LPT, TransposeAfterMatMulTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(perTensorValues), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/transpose_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/transpose_transformation.cpp index 390daa853c2..fb62c214a78 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/transpose_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/transpose_transformation.cpp @@ -18,7 +18,7 @@ const std::vector precisions = { const std::vector testValues = { // U8: per-tensor quantization { - ngraph::Shape({ 1, 1000, 1, 1}), + { 1, 1000, 1, 1}, { 0, 2, 3, 1}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), ngraph::element::f32, @@ -26,7 +26,7 @@ const std::vector testValues = { }, // U8: per-channel quantization { - ngraph::Shape({ 1, 3, 1, 1}), + { 1, 3, 1, 1}, { 0, 2, 3, 1}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), ngraph::element::f32, diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/variadic_split_transformation.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/variadic_split_transformation.cpp index 247dce33444..55924de077a 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/variadic_split_transformation.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/low_precision_transformations/variadic_split_transformation.cpp @@ -93,7 +93,7 @@ const std::vector param INSTANTIATE_TEST_SUITE_P(smoke_LPT, VariadicSplitTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_CPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/convert.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/convert.cpp index 70ed6c6512f..e7ac96b6540 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/convert.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/convert.cpp @@ -14,13 +14,23 @@ namespace { const std::vector> inShape = {{1, 2, 3, 4}}; const std::vector precisions = { - Precision::U8, + // Ticket: 59594 + // Precision::I4, Precision::I8, - Precision::U16, Precision::I16, Precision::I32, - Precision::U64, Precision::I64, + // Ticket: 59594 + // Precision::BIN, + // Precision::BOOL, + // Precision::U4, + Precision::U8, + Precision::U16, + // Ticket: 59594 + // Precision::U32, + Precision::U64, + Precision::BF16, + Precision::FP16, Precision::FP32 }; @@ -34,4 +44,4 @@ INSTANTIATE_TEST_SUITE_P(smoke_ConvertLayerTest, ConvertLayerTest, ::testing::Values(CommonTestUtils::DEVICE_CPU)), ConvertLayerTest::getTestCaseName); -} // namespace \ No newline at end of file +} // namespace diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/normalize_l2.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/normalize_l2.cpp index 843609102e4..15b5b453642 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/normalize_l2.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/normalize_l2.cpp @@ -14,30 +14,162 @@ const std::vector netPrecisions = { InferenceEngine::Precision::FP16 }; -const std::vector> axes = { - {}, - {1}, -}; -const std::vector eps = {1e-7f, 1e-6f, 1e-5f, 1e-4f}; +const std::vector eps = {1e-12f, 1e-6f, 1e-3f, 0.1, 100}; const std::vector epsMode = { ngraph::op::EpsMode::ADD, ngraph::op::EpsMode::MAX, }; -const auto normL2params = testing::Combine( - testing::ValuesIn(axes), +/* ============= 1D ============= */ +// [SKIPPED][CPU] Unsupported rank, Issue: 35627 +const std::vector> axes_1D = { + {}, + {0} +}; + +const auto normL2params_1D = testing::Combine( + testing::ValuesIn(axes_1D), testing::ValuesIn(eps), testing::ValuesIn(epsMode), - testing::ValuesIn(std::vector>({{1, 3, 10, 5}, {1, 5, 3}})), + testing::ValuesIn(std::vector>({{5}})), testing::ValuesIn(netPrecisions), testing::Values(CommonTestUtils::DEVICE_CPU) ); INSTANTIATE_TEST_SUITE_P( - NormalizeL2, + smoke_NormalizeL2_1D, NormalizeL2LayerTest, - normL2params, + normL2params_1D, + NormalizeL2LayerTest::getTestCaseName +); + +/* ============= 2D ============= */ +const std::vector> axes_2D = { + {}, + {1}, + + // [CPU] Unsupported axes, Issue: 59791 + // {0}, + // {0, 1}, +}; + +const auto normL2params_2D = testing::Combine( + testing::ValuesIn(axes_2D), + testing::ValuesIn(eps), + testing::ValuesIn(epsMode), + testing::ValuesIn(std::vector>({{5, 3}})), + testing::ValuesIn(netPrecisions), + testing::Values(CommonTestUtils::DEVICE_CPU) +); + +INSTANTIATE_TEST_SUITE_P( + smoke_NormalizeL2_2D, + NormalizeL2LayerTest, + normL2params_2D, + NormalizeL2LayerTest::getTestCaseName +); + +/* ============= 3D ============= */ +const std::vector> axes_3D = { + {}, + {1}, + {1, 2}, + + // [CPU] Unsorted axes, Issue: 59794 + // {2, 1}, + + // [CPU] Unsupported axes, Issue: 59791 + // {0}, + // {2}, + // {0, 1}, + // {0, 1, 2} +}; + +const auto normL2params_3D = testing::Combine( + testing::ValuesIn(axes_3D), + testing::ValuesIn(eps), + testing::ValuesIn(epsMode), + testing::ValuesIn(std::vector>({{2, 5, 3}})), + testing::ValuesIn(netPrecisions), + testing::Values(CommonTestUtils::DEVICE_CPU) +); + +INSTANTIATE_TEST_SUITE_P( + smoke_NormalizeL2_3D, + NormalizeL2LayerTest, + normL2params_3D, + NormalizeL2LayerTest::getTestCaseName +); + +/* ============= 4D ============= */ +const std::vector> axes_4D = { + {}, + {1}, + {1, 2, 3}, + + // [CPU] Unsorted axes, Issue: 59794 + // {3, 1, 2}, + + // [CPU] Unsupported axes, Issue: 59791 + // {0}, + // {2}, + // {3}, + // {0, 1}, + // {1, 2}, + // {2, 3}, + // {0, 1, 2, 3} +}; + +const auto normL2params_4D = testing::Combine( + testing::ValuesIn(axes_4D), + testing::ValuesIn(eps), + testing::ValuesIn(epsMode), + testing::ValuesIn(std::vector>({{2, 3, 10, 5}})), + testing::ValuesIn(netPrecisions), + testing::Values(CommonTestUtils::DEVICE_CPU) +); + +INSTANTIATE_TEST_SUITE_P( + smoke_NormalizeL2_4D, + NormalizeL2LayerTest, + normL2params_4D, + NormalizeL2LayerTest::getTestCaseName +); + +/* ============= 5D ============= */ +// [SKIPPED][CPU] Unsupported rank, Issue: 35627 +const std::vector> axes_5D = { + {}, + {0}, + {1}, + {2}, + {3}, + {4}, + {0, 1}, + {1, 2}, + {2, 3}, + {3, 4}, + {1, 2, 3}, + {2, 3, 4}, + {4, 3, 2}, + {1, 2, 3, 4}, + {0, 1, 2, 3} +}; + +const auto normL2params_5D = testing::Combine( + testing::ValuesIn(axes_5D), + testing::ValuesIn(eps), + testing::ValuesIn(epsMode), + testing::ValuesIn(std::vector>({{2, 2, 3, 10, 5}})), + testing::ValuesIn(netPrecisions), + testing::Values(CommonTestUtils::DEVICE_CPU) +); + +INSTANTIATE_TEST_SUITE_P( + smoke_NormalizeL2_5D, + NormalizeL2LayerTest, + normL2params_5D, NormalizeL2LayerTest::getTestCaseName ); } // namespace diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/prior_box_clustered.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/prior_box_clustered.cpp new file mode 100644 index 00000000000..0ec5abbdb7f --- /dev/null +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/single_layer_tests/prior_box_clustered.cpp @@ -0,0 +1,80 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include +#include "single_layer_tests/prior_box_clustered.hpp" +#include "common_test_utils/test_constants.hpp" + +using namespace LayerTestsDefinitions; +using namespace ngraph::helpers; + +namespace { +// Common params +const std::vector netPrecisions = { + InferenceEngine::Precision::FP32, + InferenceEngine::Precision::FP16 +}; + +const std::vector> widths = { + { 5.12f, 14.6f, 13.5f }, + { 7.0f, 8.2f, 33.39f } +}; + +const std::vector> heights = { + { 15.12f, 15.6f, 23.5f }, + { 10.0f, 16.2f, 36.2f } +}; + +const std::vector step_widths = { + 0.0f, 2.0f +}; + +const std::vector step_heights = { + 0.0f, 1.5f +}; + +const std::vector step = { + 0.0f, 1.0f, 1.5f +}; + +const std::vector offsets = { + 0.5f +}; + +const std::vector> variances = { + {0.1f, 0.1f, 0.2f, 0.2f}, + {0.2f}, + {} +}; + +const std::vector clips = { + true, false +}; + +const auto layerSpeficParams = ::testing::Combine( + ::testing::ValuesIn(widths), + ::testing::ValuesIn(heights), + ::testing::ValuesIn(clips), + ::testing::ValuesIn(step_widths), + ::testing::ValuesIn(step_heights), + ::testing::ValuesIn(step), + ::testing::ValuesIn(offsets), + ::testing::ValuesIn(variances) +); + +INSTANTIATE_TEST_SUITE_P(smoke_PriorBoxClustered_Basic, PriorBoxClusteredLayerTest, + ::testing::Combine( + layerSpeficParams, + ::testing::ValuesIn(netPrecisions), + ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), + ::testing::Values(InferenceEngine::Precision::UNSPECIFIED), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(InferenceEngine::Layout::ANY), + ::testing::Values(std::vector({ 4, 4 })), + ::testing::Values(std::vector({ 50, 50 })), + ::testing::Values(CommonTestUtils::DEVICE_CPU)), + PriorBoxClusteredLayerTest::getTestCaseName +); + +} // namespace diff --git a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp index cbae9c59b25..296be4032b4 100644 --- a/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp +++ b/inference-engine/tests/functional/plugin/cpu/shared_tests_instances/skip_tests_config.cpp @@ -51,14 +51,17 @@ std::vector disabledTestPatterns() { R"(.*ConvolutionLayerCPUTest.*BF16.*_inFmts=(ndhwc|nhwc).*)", // TODO: 56827. Sporadic test failures R"(.*smoke_Conv.+_FP32.ConvolutionLayerCPUTest\.CompareWithRefs.IS=\(1\.67.+\).*inFmts=n.+c.*_primitive=jit_avx2.*)", - - // incorrect reference implementation - R"(.*NormalizeL2LayerTest.*axes=\(\).*)", // lpt transformation produce the same names for MatMul and Multiply R"(.*MatMulTransformation.*)", // incorrect jit_uni_planar_convolution with dilation = {1, 2, 1} and output channel 1 R"(.*smoke_Convolution3D.*D=\(1.2.1\)_O=1.*)", + // TODO: Issue: 35627. CPU Normalize supports from 2D to 4D blobs + R"(.*NormalizeL2_1D.*)", + R"(.*NormalizeL2_5D.*)", + // Issue: 59788. mkldnn_normalize_nchw applies eps after sqrt for across_spatial + R"(.*NormalizeL2_.*axes=\(1.2.*_eps=100.*)", + // Unsupported operation of type: NormalizeL2 name : Doesn't support reduction axes: (2.2) R"(.*BF16NetworkRestore1.*)", R"(.*MobileNet_ssd_with_branching.*)", @@ -67,8 +70,6 @@ std::vector disabledTestPatterns() { R"(.*CoreThreading.*smoke_QueryNetwork.*targetDevice=AUTO_config.*)", // Unsupported config KEY_ENFORCE_BF16 for AUTO plugin R"(.*smoke_SetBlobOfKindAUTO.*SetBlobOfKindTest.CompareWithRefs.*)", - // reference doesn't cover I8, U8 cases. Issue: 55842 - R"(.*Gather7LayerTest.*netPRC=I8.*)", // TODO: 57562 No dynamic output shape support R"(.*NonZeroLayerTest.*)", // need to implement Export / Import diff --git a/inference-engine/tests/functional/plugin/gna/pass_tests/convert_padded2valid_conv.cpp b/inference-engine/tests/functional/plugin/gna/pass_tests/convert_padded2valid_conv.cpp index 0823567e578..45faab02e84 100644 --- a/inference-engine/tests/functional/plugin/gna/pass_tests/convert_padded2valid_conv.cpp +++ b/inference-engine/tests/functional/plugin/gna/pass_tests/convert_padded2valid_conv.cpp @@ -117,19 +117,19 @@ protected: std::tie(bias, transpBias, maxpoolPool, maxpoolStride) = miscParams; auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); - Shape biasShape{ bias }; - Shape transpBiasShape{ transpBias }; - Shape maxpoolShape{ maxpoolPool }; - Strides maxpoolStrides{ maxpoolStride }; + Shape biasShape{bias}; + Shape transpBiasShape{transpBias}; + Shape maxpoolShape{maxpoolPool}; + Strides maxpoolStrides{maxpoolStride}; - auto input = builder::makeParams(ngPrc, { inputShape }); - auto transposeInOrder = op::Constant::create(element::i64, Shape{ 4 }, { 0, 3, 1, 2 }); + auto input = builder::makeParams(ngPrc, {inputShape}); + auto transposeInOrder = op::Constant::create(element::i64, Shape{4}, {0, 3, 1, 2}); auto transposeIn = std::make_shared(input[0], transposeInOrder); auto filterSize = std::accumulate(std::begin(kernel), std::end(kernel), 1ull, std::multiplies()); auto filterWeights = CommonTestUtils::generate_float_numbers(numOutChannels * inputShape[3] * filterSize, -0.05f, 0.05f); auto conv = builder::makeConvolution(transposeIn, ngPrc, kernel, stride, padBegin, padEnd, dilation, padType, numOutChannels, false, filterWeights); - auto transposeOutOrder = op::Constant::create(element::i64, Shape{ 4 }, { 0, 2, 3, 1 }); + auto transposeOutOrder = op::Constant::create(element::i64, Shape{4}, {0, 2, 3, 1}); auto biasWeights = CommonTestUtils::generate_float_numbers(shape_size(biasShape), -1.5f, 1.5f); Output biasConst = std::make_shared(ngPrc, biasShape, biasWeights); Output lastOp = std::make_shared(conv, transposeOutOrder); @@ -145,9 +145,10 @@ protected: case modelType::TranspConvBcastAddMaxPoolTransp: { auto bcastAdd = std::make_shared(conv, biasConst); - auto maxpool = std::make_shared(bcastAdd, maxpoolStrides, Shape{ 0, 0 }, Shape{ 0, 0 }, maxpoolShape, + auto maxpool = std::make_shared(bcastAdd, maxpoolStrides, Shape{0, 0}, Shape{0, 0}, maxpoolShape, op::RoundingType::FLOOR, op::PadType::VALID); - lastOp = std::make_shared(maxpool, transposeOutOrder); + auto transpose = std::make_shared(maxpool, transposeOutOrder); + auto lastOp = std::make_shared(transpose); } break; @@ -162,7 +163,7 @@ protected: case modelType::TranspConvBcastAddMaxPoolActTransp: { auto bcastAdd = std::make_shared(conv, biasConst); - auto maxpool = std::make_shared(bcastAdd, maxpoolStrides, Shape{ 0, 0 }, Shape{ 0, 0 }, maxpoolShape, + auto maxpool = std::make_shared(bcastAdd, maxpoolStrides, Shape{0, 0}, Shape{0, 0}, maxpoolShape, op::RoundingType::FLOOR, op::PadType::VALID); auto activation = std::make_shared(maxpool); lastOp = std::make_shared(activation, transposeOutOrder); @@ -190,7 +191,7 @@ protected: } auto result = std::make_shared(lastOp); - function = std::make_shared(ResultVector{ result }, ParameterVector{ input }); + function = std::make_shared(ResultVector{result}, ParameterVector{input}); } }; @@ -259,34 +260,33 @@ const std::vector models = { modelType::TranspConvBcastAddActTransp, modelType::TranspConvTranspBcastAdd, modelType::TranspConvTranspBcastAddAct, - //TODO: enable when 50386 and 50379 are fixed - //modelType::TranspConvBcastAddMaxPoolTransp, - //modelType::TranspConvBcastAddMaxPoolActTransp, + modelType::TranspConvBcastAddMaxPoolTransp, + modelType::TranspConvBcastAddMaxPoolActTransp }; -const std::vector> input1DNHWC = { {1, 1, 16, 8} }; -const std::vector> kernels1D = { {1, 2}, {1, 3}, {1, 4} }; -const std::vector> strides1D = { {1, 1} }; -const std::vector> padBegins1D = { {0, 2} }; -const std::vector> padEnds1D = { {0, 3} }; -const std::vector> dilations1D = { {1, 1} }; -const std::vector numOutChannels1D = { 4 }; -const std::vector> biases1D = { {1, 4, 1, 1} }; -const std::vector> transpBiases1D = { {1, 1, 1, 4} }; -const std::vector> maxpool1DPools = { {1, 2} }; -const std::vector> maxpool1DStrides = { {1, 1} }; +const std::vector> input1DNHWC = {{1, 1, 16, 8}}; +const std::vector> kernels1D = {{1, 2}, {1, 3}, {1, 4}}; +const std::vector> strides1D = {{1, 1}}; +const std::vector> padBegins1D = {{0, 2}}; +const std::vector> padEnds1D = {{0, 3}}; +const std::vector> dilations1D = {{1, 1}}; +const std::vector numOutChannels1D = {4}; +const std::vector> biases1D = {{1, 4, 1, 1}}; +const std::vector> transpBiases1D = {{1, 1, 1, 4}}; +const std::vector> maxpool1DPools = {{1, 2}}; +const std::vector> maxpool1DStrides = {{1, 1}}; -const std::vector> input2DNHWC = { {1, 16, 16, 32} }; -const std::vector> kernels2D = { {2, 2}, {4, 1}, {1, 3} }; -const std::vector> strides2D = { {1, 1}, {1, 2}, {2, 1}, {2, 2} }; -const std::vector> padBegins2D = { {1, 2} }; -const std::vector> padEnds2D = { {3, 1} }; -const std::vector> dilations2D = { {1, 1} }; -const std::vector numOutChannels2D = { 8 }; -const std::vector> biases2D = { {1, 8, 1, 1} }; -const std::vector> transpBiases2D = { {1, 1, 1, 8} }; -const std::vector> maxpool2DPools = { {2, 2} }; -const std::vector> maxpool2DStrides = { {2, 1} }; +const std::vector> input2DNHWC = {{1, 16, 16, 32}}; +const std::vector> kernels2D = {{2, 2}, {4, 1}, {1, 3}}; +const std::vector> strides2D = {{1, 1}, {1, 2}, {2, 1}, {2, 2}}; +const std::vector> padBegins2D = {{1, 2}}; +const std::vector> padEnds2D = {{3, 1}}; +const std::vector> dilations2D = {{1, 1}}; +const std::vector numOutChannels2D = {8}; +const std::vector> biases2D = {{1, 8, 1, 1}}; +const std::vector> transpBiases2D = {{1, 1, 1, 8}}; +const std::vector> maxpool2DPools = {{2, 2}}; +const std::vector> maxpool2DStrides = {{2, 1}}; const auto conv1DParams = ::testing::Combine( ::testing::ValuesIn(kernels1D), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/add_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/add_transformation.cpp index 7b51e051339..905103d681e 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/add_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/add_transformation.cpp @@ -71,7 +71,7 @@ const std::vector params = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, AddTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(params)), AddTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/clamp_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/clamp_transformation.cpp index 408cbb55071..59ba772fcca 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/clamp_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/clamp_transformation.cpp @@ -79,7 +79,7 @@ const std::vector params = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, ClampTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_transformation.cpp index f22eb9f63a1..f7dab096215 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_transformation.cpp @@ -42,7 +42,7 @@ const std::vector testValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatTransformation, ::testing::Combine( ::testing::ValuesIn(precisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(testValues)), ConcatTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_child_and_output.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_child_and_output.cpp index f53eb289438..841b2871b39 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_child_and_output.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_child_and_output.cpp @@ -45,7 +45,7 @@ const std::vector testValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatWithChildAndOutputTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 6, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 6, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(testValues), ::testing::ValuesIn(trasformationParamValues)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp index d7605440afe..71913315cfb 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_different_precision_on_children.cpp @@ -48,7 +48,7 @@ const std::vector multiChannel = { true/*, false*/ }; INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatWithDifferentChildrenTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(testValues), ::testing::ValuesIn(trasformationParamValues), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_intermediate_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_intermediate_transformation.cpp index 00f5467b33c..13b0791ba90 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_intermediate_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_intermediate_transformation.cpp @@ -29,7 +29,7 @@ const std::vector multiChannelValues = { /*true,*/ false }; INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatWithIntermediateTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(transparentIntermediateValues), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_neighbors_graph_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_neighbors_graph_transformation.cpp index 2dc3a2b4fde..90790ca04b9 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_neighbors_graph_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_neighbors_graph_transformation.cpp @@ -26,7 +26,7 @@ const std::vector tras INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatWithNeighborsGraphTransformation, ::testing::Combine( ::testing::ValuesIn(precisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues)), ConcatWithNeighborsGraphTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_split_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_split_transformation.cpp index 2c969a1775f..418cf879fb8 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_split_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/concat_with_split_transformation.cpp @@ -48,7 +48,7 @@ const std::vector testValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, ConcatWithSplitTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 6, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 6, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(testValues), ::testing::ValuesIn(trasformationParamValues)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp index e656b6f3ff5..32adecae944 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/convolution_backprop_data_transformation.cpp @@ -102,7 +102,7 @@ const std::vector> inputShapes = { +const std::vector> inputShapes = { {{ 1, 8, 16, 16 }, false}, {{ 1, 32, 16, 16 }, true} }; diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/convolution_qdq_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/convolution_qdq_transformation.cpp index bb1bd0cb8dc..b629703ae6d 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/convolution_qdq_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/convolution_qdq_transformation.cpp @@ -233,7 +233,7 @@ const std::vector para }, }; -const std::vector shapes = { +const std::vector shapes = { { 1, 3, 4, 4 }, { 4, 3, 4, 4 } }; diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/depth_to_space_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/depth_to_space_transformation.cpp index 85e076155cc..3cc179973b3 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/depth_to_space_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/depth_to_space_transformation.cpp @@ -22,7 +22,7 @@ const std::vector modes = { DepthToSpace::DepthToSpaceMode::DEPTH_FIRST }; -const std::vector inputShapesBS2 = { +const std::vector inputShapesBS2 = { {1, 4, 3, 3}, {2, 16, 5, 4} }; @@ -36,7 +36,7 @@ const auto DepthToSpaceBS2 = ::testing::Combine( INSTANTIATE_TEST_SUITE_P(LPT_BS2, DepthToSpaceTransformation, DepthToSpaceBS2, DepthToSpaceTransformation::getTestCaseName); -const std::vector inputShapesBS3 = { +const std::vector inputShapesBS3 = { {1, 9, 3, 3}, {2, 27, 5, 4} }; diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_avg_pool_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_avg_pool_transformation.cpp index ea2587340ff..0341ccf8357 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_avg_pool_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_avg_pool_transformation.cpp @@ -30,7 +30,7 @@ const std::vector fakeQuantizes = INSTANTIATE_TEST_SUITE_P(smoke_LPT, FakeQuantizeAndAvgPoolTransformation, ::testing::Combine( ::testing::ValuesIn(precisions), - ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })), + ::testing::Values(ngraph::PartialShape({ 1, 32, 72, 48 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(fakeQuantizes)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_max_pool_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_max_pool_transformation.cpp index ba1bc5bb20a..8a2e17bb04b 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_max_pool_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_max_pool_transformation.cpp @@ -30,7 +30,7 @@ const std::vector fakeQuantizes = INSTANTIATE_TEST_SUITE_P(smoke_LPT, FakeQuantizeAndMaxPoolTransformation, ::testing::Combine( ::testing::ValuesIn(precisions), - ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })), + ::testing::Values(ngraph::PartialShape({ 1, 32, 72, 48 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(fakeQuantizes)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp index fa47c845378..77571dc66f0 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp @@ -31,7 +31,7 @@ const std::vector testValues = INSTANTIATE_TEST_SUITE_P(smoke_LPT, FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })), + ::testing::Values(ngraph::PartialShape({ 1, 32, 72, 48 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(testValues)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_precision_selection_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_precision_selection_transformation.cpp index 2b67ce0720c..86354110d54 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_precision_selection_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_precision_selection_transformation.cpp @@ -60,7 +60,7 @@ const std::vector testVa INSTANTIATE_TEST_SUITE_P(DISABLED_LPT, FakeQuantizePrecisionSelectionTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })), + ::testing::Values(ngraph::PartialShape({ 1, 32, 72, 48 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(testValues)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_transformation.cpp index fe2ae3c55d6..7cb9d409e9e 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_transformation.cpp @@ -62,7 +62,7 @@ const std::vector fakeQuantizeOnDataValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, FakeQuantizeTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 32, 72, 48 })), + ::testing::Values(ngraph::PartialShape({ 1, 32, 72, 48 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(fakeQuantizeOnDataValues)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp index 6e780a94ed2..f7b5f76aa32 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp @@ -104,7 +104,7 @@ const std::vector fakeQuanti INSTANTIATE_TEST_SUITE_P(smoke_LPT, FakeQuantizeWithNotOptimalTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(fakeQuantizeOnDataValues)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fully_connected_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fully_connected_transformation.cpp index 45bf73121d2..b486eca6282 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fully_connected_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fully_connected_transformation.cpp @@ -18,20 +18,20 @@ const std::vector netPrecisions = { const std::vector shapes = { { - ngraph::Shape{ 1, 16 }, - ngraph::Shape{ 16, 8 }, + { 1, 16 }, + { 16, 8 }, false, false }, { - ngraph::Shape{ 1, 16 }, - ngraph::Shape{ 8, 16 }, + { 1, 16 }, + { 8, 16 }, false, true }, { - ngraph::Shape{ 16, 1 }, - ngraph::Shape{ 16, 8 }, + { 16, 1 }, + { 16, 8 }, true, false }, diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_convert_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_convert_transformation.cpp index 537f95363e1..9a1fdd7526b 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_convert_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_convert_transformation.cpp @@ -13,8 +13,8 @@ const std::vector precisions = { // element::f16 // TODO: temporarily commented due to failing in GPU Plugin on constant folding stage }; -const std::vector< ngraph::Shape > inputAndQuantizationShapes = { - Shape{ 1, 4, 16, 16 }, +const std::vectorinputAndQuantizationShapes = { + { 1, 4, 16, 16 }, }; const std::vector deqOperations = { diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_and_scale_shift_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_and_scale_shift_transformation.cpp index f78feda5ce6..36c09e796a4 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_and_scale_shift_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_and_scale_shift_transformation.cpp @@ -37,7 +37,7 @@ const std::vector fakeQuantizeOnD INSTANTIATE_TEST_SUITE_P(smoke_LPT, FuseFakeQuantizeAndScaleShiftTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 9, 9 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 9, 9 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(fakeQuantizeOnDataValues)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_transformation.cpp index 07b0f0a8ad8..fa3c80cdca6 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_fake_quantize_transformation.cpp @@ -13,7 +13,7 @@ namespace { const std::vector testValues = { // 1) Multiply { - ngraph::Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { ngraph::element::f32, @@ -26,7 +26,7 @@ const std::vector testValues = { }, // 1) Multiply with different input and output shape { - ngraph::Shape{128, 3}, + {128, 3}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { ngraph::element::f32, @@ -39,7 +39,7 @@ const std::vector testValues = { }, // 1) Multiply by zero { - ngraph::Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { ngraph::element::f32, @@ -52,7 +52,7 @@ const std::vector testValues = { }, // 1) Subtract + Multiply { - ngraph::Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { ngraph::element::f32, @@ -65,7 +65,7 @@ const std::vector testValues = { }, // 1) Convert + Subtract + Multiply { - ngraph::Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { ngraph::element::f32, @@ -78,7 +78,7 @@ const std::vector testValues = { }, // 1) Convert + Subtract + Multiply 2) Add { - ngraph::Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { ngraph::element::f32, @@ -91,7 +91,7 @@ const std::vector testValues = { }, // issue #40611 for FP32 { - ngraph::Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { { }, diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_multiply_to_fake_quantize_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_multiply_to_fake_quantize_transformation.cpp index 58fee1528c2..6e328d0d9cc 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_multiply_to_fake_quantize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_multiply_to_fake_quantize_transformation.cpp @@ -13,7 +13,7 @@ using namespace ngraph; namespace { const std::vector testValues = { { - Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { { 256ul, {}, { 0.f }, { 2.55f }, { 0.f }, { 2.55f } }, @@ -21,7 +21,7 @@ namespace { } }, { - Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { { 256ul, {}, { -1.28f }, { 1.27f }, { 10.f }, { 2.55f } }, diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_subtract_to_fake_quantize_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_subtract_to_fake_quantize_transformation.cpp index 0b25acfc569..5762ca291de 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_subtract_to_fake_quantize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/fuse_subtract_to_fake_quantize_transformation.cpp @@ -13,7 +13,7 @@ using namespace ngraph; namespace { const std::vector testValues = { { - Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { { 256ul, {}, { 0.f }, { 2.55f }, { 10.f }, { 255.f } }, @@ -21,7 +21,7 @@ namespace { } }, { - Shape{1, 3, 16, 16}, + {1, 3, 16, 16}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), { { 256ul, {}, { -1.28f }, { 1.27f }, { 0.f }, { 255.f } }, diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/gemm_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/gemm_transformation.cpp index cd2b40ceb26..5708e2e6476 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/gemm_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/gemm_transformation.cpp @@ -16,7 +16,7 @@ const std::vector netPrecisions = { ngraph::element::f16 }; -const std::vector dimensions = { +const std::vector dimensions = { {1, 3, 16, 16} }; diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp index 18325c824f4..9a404a11b89 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/group_convolution_transformation.cpp @@ -23,7 +23,7 @@ const std::vector tras const std::vector params = { // group convolution, tensor quantization { - ngraph::Shape{ 1, 6, 24, 24 }, + { 1, 6, 24, 24 }, ngraph::Shape{ 1, 24, 18, 18 }, 3ul, -1, @@ -34,7 +34,7 @@ const std::vector pa }, // group convolution, tensor quantization { - ngraph::Shape{ 1, 6, 24, 24 }, + { 1, 6, 24, 24 }, ngraph::Shape{ 1, 24, 18, 18 }, 3ul, 0, @@ -45,7 +45,7 @@ const std::vector pa }, // group convolution, tensor quantization { - ngraph::Shape{ 1, 6, 24, 24 }, + { 1, 6, 24, 24 }, ngraph::Shape{ 1, 24, 18, 18 }, 3ul, 1, @@ -56,7 +56,7 @@ const std::vector pa }, // group convolution, per-channel quantization { - ngraph::Shape{ 1, 6, 24, 24 }, + { 1, 6, 24, 24 }, ngraph::Shape{ 1, 24, 18, 18 }, 3ul, -1, @@ -72,7 +72,7 @@ const std::vector pa }, // depthwise convolution, tensor quantization { - ngraph::Shape{ 1, 6, 24, 24 }, + { 1, 6, 24, 24 }, ngraph::Shape{ 1, 6, 18, 18 }, 6ul, -1, @@ -81,7 +81,7 @@ const std::vector pa }, // depthwise convolution, per-channel quantization { - ngraph::Shape{ 1, 6, 24, 24 }, + { 1, 6, 24, 24 }, ngraph::Shape{ 1, 6, 18, 18 }, 6ul, -1, diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/groupconvolution_qdq_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/groupconvolution_qdq_transformation.cpp index b95d0e7f8c6..4f5977a99a5 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/groupconvolution_qdq_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/groupconvolution_qdq_transformation.cpp @@ -488,7 +488,7 @@ const std::vector }, }; -const std::vector shapes = { +const std::vector shapes = { { 1, 4, 7, 7 } }; diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/interpolate_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/interpolate_transformation.cpp index 33135bb451a..82a785cc02d 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/interpolate_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/interpolate_transformation.cpp @@ -13,7 +13,7 @@ const std::vector precisions = { ngraph::element::f16 }; -const std::vector> shapes = { +const std::vector> shapes = { {{1, 4, 16, 16}, {32, 32}}, {{1, 2, 48, 80}, {50, 60}}, }; diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mat_mul_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mat_mul_transformation.cpp index 6d0df41c7f4..868fd742059 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mat_mul_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mat_mul_transformation.cpp @@ -33,7 +33,7 @@ std::vector testValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, MatMulTransformation, ::testing::Combine( ::testing::ValuesIn(precisions), - ::testing::Values(ngraph::Shape({ 1, 384, 1024 })), + ::testing::Values(ngraph::PartialShape({ 1, 384, 1024 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(testValues)), MatMulTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.cpp index 8759d2903bc..1fb29134b4c 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.cpp @@ -22,9 +22,9 @@ const std::vector> inputShapes = { - std::pair({ 1, 16 }, { 10, 16 }), - std::pair({ 1, 16 }, { 16, 10 }) +const std::vector> inputShapes = { + {{ 1, 16 }, { 10, 16 }}, + {{ 1, 16 }, { 16, 10 }} }; INSTANTIATE_TEST_SUITE_P(smoke_LPT, MatMulWithOptimizedConstantFakeQuantizeTransformation, diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution_transformation.cpp index 4f60cc1a3bb..cee4583f67a 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/multiply_to_group_convolution_transformation.cpp @@ -13,8 +13,8 @@ const std::vector precisions = { element::f16 }; -const std::vector< ngraph::Shape > inputShapes = { - Shape{ 1ul, 4ul, 16ul, 16ul }, Shape{ 1ul, 4ul, 16ul, 16ul, 16ul } +const std::vectorinputShapes = { + { 1ul, 4ul, 16ul, 16ul }, { 1ul, 4ul, 16ul, 16ul, 16ul } }; const std::vector fqOnData = { diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/multiply_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/multiply_transformation.cpp index 6c294cb6d9c..815f096e85c 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/multiply_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/multiply_transformation.cpp @@ -70,7 +70,7 @@ const std::vector params = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, MultiplyTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(params)), MultiplyTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/multiply_with_one_parent_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/multiply_with_one_parent_transformation.cpp index 083b4e8357b..99a9436995c 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/multiply_with_one_parent_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/multiply_with_one_parent_transformation.cpp @@ -24,7 +24,7 @@ const std::vector values = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, MultiplyWithOneParentTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(InferenceEngine::SizeVector({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(values)), MultiplyWithOneParentTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mvn_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mvn_transformation.cpp index da5fbff9e91..8b23929625a 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mvn_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/mvn_transformation.cpp @@ -13,8 +13,8 @@ namespace { element::f16 }; - const std::vector inputAndQuantizationShapes = { - Shape{ 1ul, 4ul, 16ul, 16ul }, + const std::vector inputAndQuantizationShapes = { + { 1ul, 4ul, 16ul, 16ul }, }; const std::vector reductionAxes = { { 2, 3 }, { 1, 2, 3 } }; diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/normalize_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/normalize_transformation.cpp index fe30318107a..9ceb37d6b5b 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/normalize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/normalize_transformation.cpp @@ -16,9 +16,9 @@ const std::vector precisions = { ngraph::element::f16 }; -const std::vector > inputAndQuantizationShapes = { - { ngraph::Shape({ 1ul, 4ul, 16ul, 16ul }), ngraph::Shape({ 1ul }) }, - { ngraph::Shape({ 1ul, 4ul, 16ul, 16ul }), ngraph::Shape({ 1ul, 4ul, 1ul, 1ul }) }, +const std::vector > inputAndQuantizationShapes = { + { { 1ul, 4ul, 16ul, 16ul }, { 1ul } }, + { { 1ul, 4ul, 16ul, 16ul }, { 1ul, 4ul, 1ul, 1ul } }, }; const std::vector> axes = { diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/prelu_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/prelu_transformation.cpp index aea8e1be969..ceb5294a4ff 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/prelu_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/prelu_transformation.cpp @@ -28,7 +28,7 @@ std::vector testValues = { INSTANTIATE_TEST_SUITE_P(DISABLED_LPT, PReluTransformation, ::testing::Combine( ::testing::ValuesIn(precisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(testValues)), PReluTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp index 04c82dfaff6..9ad74ec60e0 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp @@ -61,7 +61,7 @@ const std::vector params = { } }; -const std::vector inputShapes = { +const std::vector inputShapes = { { 1, 16, 9, 9 }, { 4, 16, 9, 9 } }; diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_max_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_max_transformation.cpp index f53880f5df7..d3f24e78f99 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_max_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_max_transformation.cpp @@ -91,7 +91,7 @@ const std::vector params = INSTANTIATE_TEST_SUITE_P(smoke_LPT, ReduceMaxTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_mean_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_mean_transformation.cpp index 5b343f98747..3b5ead6568f 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_mean_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_mean_transformation.cpp @@ -91,7 +91,7 @@ const std::vector params = INSTANTIATE_TEST_SUITE_P(smoke_LPT, ReduceMeanTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_min_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_min_transformation.cpp index 89aeb83f875..1b1252c6dbf 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_min_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_min_transformation.cpp @@ -91,7 +91,7 @@ const std::vector params = INSTANTIATE_TEST_SUITE_P(smoke_LPT, ReduceMinTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_sum_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_sum_transformation.cpp index 46cd094fcc1..d2cd0bff4c5 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_sum_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reduce_sum_transformation.cpp @@ -81,7 +81,7 @@ const std::vector params = INSTANTIATE_TEST_SUITE_P(smoke_LPT, ReduceSumTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 10, 10 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 10, 10 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/relu_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/relu_transformation.cpp index a1d65bbf658..3621e570e23 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/relu_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/relu_transformation.cpp @@ -27,7 +27,7 @@ std::vector testValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, ReluTransformation, ::testing::Combine( ::testing::ValuesIn(precisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(testValues)), ReluTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reshape_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reshape_transformation.cpp index a8d40ca957f..5dc8a212412 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reshape_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/reshape_transformation.cpp @@ -24,28 +24,28 @@ const std::vector tras const std::vector params = { // 3D -> 4D { - ngraph::Shape{ 1, 3, 32 }, + { 1, 3, 32 }, { 1, 3, 4, 8 }, { 256ul, ngraph::Shape{ 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, true }, // 4D -> 3D { - ngraph::Shape{ 1, 3, 16, 16 }, + { 1, 3, 16, 16 }, { 1, 3, 256 }, { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, true }, // 4D -> 3D { - ngraph::Shape{ 1, 3, 16, 16 }, + { 1, 3, 16, 16 }, { 0, 3, -1 }, { 256ul, ngraph::Shape{ 1, 3, 1, 1 }, { 0.f }, { 255.f }, { 0.f, 0.f, 0.f }, { 255.f, 25.5f, 2.55f } }, true }, // 4D -> 2D { - ngraph::Shape{ 1, 3, 4, 8 }, + { 1, 3, 4, 8 }, { 1, -1 }, { 256ul, ngraph::Shape{ 1, 1, 1, 1 }, { 0.f }, { 255.f }, { 0.f }, { 25.5f } }, true diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/shuffle_channels_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/shuffle_channels_transformation.cpp index 19a0cfbd015..2cbeedd9de1 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/shuffle_channels_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/shuffle_channels_transformation.cpp @@ -15,7 +15,7 @@ const std::vector netPrecisions = { ngraph::element::f16 }; -const std::vector inputShapes = { +const std::vector inputShapes = { { 1, 3, 16, 16 } }; diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/split_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/split_transformation.cpp index 18535a437da..5e0e56c0306 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/split_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/split_transformation.cpp @@ -87,7 +87,7 @@ const std::vector params = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, SplitTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/strided_slice_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/strided_slice_transformation.cpp index 477fb83a158..5ca38dd35f5 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/strided_slice_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/strided_slice_transformation.cpp @@ -89,7 +89,7 @@ const std::vector params INSTANTIATE_TEST_SUITE_P(smoke_LPT, StridedSliceTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 24, 24 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 24, 24 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/subtract_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/subtract_transformation.cpp index f58f01d8fc5..004dba7eb22 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/subtract_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/subtract_transformation.cpp @@ -23,7 +23,7 @@ const std::vector trasformationParamValues = { INSTANTIATE_TEST_SUITE_P(smoke_LPT, SubtractTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues)), SubtractTransformation::getTestCaseName); diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/transpose_after_matmul_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/transpose_after_matmul_transformation.cpp index 7377d54b6cd..4b7147c0f7e 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/transpose_after_matmul_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/transpose_after_matmul_transformation.cpp @@ -27,7 +27,7 @@ const std::vector transposeChannelDimValues = { true, false }; INSTANTIATE_TEST_SUITE_P(smoke_LPT, TransposeAfterMatMulTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(perTensorValues), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/transpose_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/transpose_transformation.cpp index b1913f592d1..90a78c92b43 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/transpose_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/transpose_transformation.cpp @@ -18,7 +18,7 @@ const std::vector precisions = { const std::vector testValues = { // U8: per-tensor quantization { - ngraph::Shape({ 1, 1000, 1, 1}), + { 1, 1000, 1, 1}, { 0, 2, 3, 1}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), ngraph::element::f32, @@ -26,7 +26,7 @@ const std::vector testValues = { }, // U8: per-channel quantization { - ngraph::Shape({ 1, 3, 1, 1}), + { 1, 3, 1, 1}, { 0, 2, 3, 1}, LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(), ngraph::element::f32, diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/variadic_split_transformation.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/variadic_split_transformation.cpp index 95f4e4487aa..3cdded43eb6 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/variadic_split_transformation.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/low_precision_transformations/variadic_split_transformation.cpp @@ -93,7 +93,7 @@ const std::vector param INSTANTIATE_TEST_SUITE_P(smoke_LPT, VariadicSplitTransformation, ::testing::Combine( ::testing::ValuesIn(netPrecisions), - ::testing::Values(ngraph::Shape({ 1, 3, 16, 16 })), + ::testing::Values(ngraph::PartialShape({ 1, 3, 16, 16 })), ::testing::Values(CommonTestUtils::DEVICE_GPU), ::testing::ValuesIn(trasformationParamValues), ::testing::ValuesIn(params)), diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/prior_box_clustered.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/prior_box_clustered.cpp index 108deb8d3f2..bcafe7e6ee0 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/prior_box_clustered.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/single_layer_tests/prior_box_clustered.cpp @@ -34,6 +34,10 @@ const std::vector step_heights = { 0.0f, 1.5f }; +const std::vector step = { + 0.0f, 1.0f, 1.5f +}; + const std::vector offsets = { 0.5f }; @@ -52,6 +56,7 @@ const auto layerSpeficParams = ::testing::Combine( ::testing::ValuesIn(clips), ::testing::ValuesIn(step_widths), ::testing::ValuesIn(step_heights), + ::testing::ValuesIn(step), ::testing::ValuesIn(offsets), ::testing::ValuesIn(variances) ); diff --git a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/skip_tests_config.cpp b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/skip_tests_config.cpp index 5863309efe4..bbf9fe9b7e8 100644 --- a/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/skip_tests_config.cpp +++ b/inference-engine/tests/functional/plugin/gpu/shared_tests_instances/skip_tests_config.cpp @@ -55,6 +55,9 @@ std::vector disabledTestPatterns() { // TODO: Issue: 54194 R"(.*ActivationLayerTest.*SoftPlus.*)", // need to implement Export / Import - R"(.*IEClassImportExportTestP.*)" + R"(.*IEClassImportExportTestP.*)", + + // TODO: Issue: 59586, NormalizeL2 output mismatch for empty axes case + R"(.*NormalizeL2LayerTest.*axes=\(\).*)" }; } diff --git a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/config.cpp b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/config.cpp index 8faa44804a7..69d84a1e4aa 100644 --- a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/config.cpp +++ b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/config.cpp @@ -4,6 +4,7 @@ #include "vpu/vpu_plugin_config.hpp" #include "vpu/private_plugin_config.hpp" +#include "vpu/utils/optional.hpp" #include "behavior/config.hpp" #include "myriad_devices.hpp" @@ -37,7 +38,6 @@ std::vector> getCorrectConfigs() { {{InferenceEngine::MYRIAD_ENABLE_HW_ACCELERATION, CONFIG_VALUE(YES)}}, {{InferenceEngine::MYRIAD_ENABLE_HW_ACCELERATION, CONFIG_VALUE(NO)}}, - {{InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, "-1"}}, {{InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, "0"}}, {{InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, "10"}}, @@ -51,6 +51,105 @@ std::vector> getCorrectConfigs() { {{InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, CONFIG_VALUE(YES)}}, {{InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, CONFIG_VALUE(NO)}}, + {{InferenceEngine::MYRIAD_POWER_MANAGEMENT, InferenceEngine::MYRIAD_POWER_FULL}}, + {{InferenceEngine::MYRIAD_POWER_MANAGEMENT, InferenceEngine::MYRIAD_POWER_INFER}}, + {{InferenceEngine::MYRIAD_POWER_MANAGEMENT, InferenceEngine::MYRIAD_POWER_STAGE}}, + {{InferenceEngine::MYRIAD_POWER_MANAGEMENT, InferenceEngine::MYRIAD_POWER_STAGE_SHAVES}}, + {{InferenceEngine::MYRIAD_POWER_MANAGEMENT, InferenceEngine::MYRIAD_POWER_STAGE_NCES}}, + + {{InferenceEngine::MYRIAD_HW_EXTRA_SPLIT, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_HW_EXTRA_SPLIT, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_HW_POOL_CONV_MERGE, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_HW_POOL_CONV_MERGE, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_HW_BLACK_LIST, "deconv"}}, + {{InferenceEngine::MYRIAD_HW_BLACK_LIST, "conv,pool"}}, + + {{InferenceEngine::MYRIAD_HW_INJECT_STAGES, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_HW_INJECT_STAGES, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_HW_DILATION, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_HW_DILATION, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_WATCHDOG, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_WATCHDOG, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_PERF_REPORT_MODE, InferenceEngine::MYRIAD_PER_LAYER}}, + {{InferenceEngine::MYRIAD_PERF_REPORT_MODE, InferenceEngine::MYRIAD_PER_STAGE}}, + + {{KEY_PERF_COUNT, CONFIG_VALUE(YES)}}, + {{KEY_PERF_COUNT, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_PACK_DATA_IN_CMX, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_PACK_DATA_IN_CMX, CONFIG_VALUE(NO)}}, + + { + {InferenceEngine::MYRIAD_NUMBER_OF_SHAVES, "2"}, + {InferenceEngine::MYRIAD_NUMBER_OF_CMX_SLICES, "2"}, + }, + + {{InferenceEngine::MYRIAD_TENSOR_STRIDES, "tensor[1,2,3,4]"}}, + + {{InferenceEngine::MYRIAD_IGNORE_UNKNOWN_LAYERS, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_IGNORE_UNKNOWN_LAYERS, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_FORCE_PURE_TENSOR_ITERATOR, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_FORCE_PURE_TENSOR_ITERATOR, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING, CONFIG_VALUE(NO)}}, + + {{KEY_EXCLUSIVE_ASYNC_REQUESTS, CONFIG_VALUE(YES)}}, + {{KEY_EXCLUSIVE_ASYNC_REQUESTS, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_ENABLE_REPL_WITH_SCRELU, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_ENABLE_REPL_WITH_SCRELU, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_ENABLE_PERMUTE_MERGING, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_ENABLE_PERMUTE_MERGING, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_DUMP_ALL_PASSES, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_DUMP_ALL_PASSES, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_DISABLE_REORDER, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_DISABLE_REORDER, CONFIG_VALUE(NO)}}, + + {{KEY_DEVICE_ID, ""}}, + + {{InferenceEngine::MYRIAD_DEVICE_CONNECT_TIMEOUT, "10"}}, + {{InferenceEngine::MYRIAD_DEVICE_CONNECT_TIMEOUT, "15"}}, + {{InferenceEngine::MYRIAD_DEVICE_CONNECT_TIMEOUT, "20"}}, + + {{InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_CUSTOM_LAYERS, ""}}, + + {{KEY_CONFIG_FILE, ""}}, + + {{InferenceEngine::MYRIAD_DDR_TYPE, InferenceEngine::MYRIAD_DDR_AUTO}}, + + {{InferenceEngine::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM, CONFIG_VALUE(NO)}}, + + {{InferenceEngine::MYRIAD_NONE_LAYERS, "deconv"}}, + {{InferenceEngine::MYRIAD_NONE_LAYERS, "conv,pool"}}, + + {{InferenceEngine::MYRIAD_ENABLE_ASYNC_DMA, CONFIG_VALUE(YES)}}, + {{InferenceEngine::MYRIAD_ENABLE_ASYNC_DMA, CONFIG_VALUE(NO)}}, + // Deprecated {{VPU_CONFIG_KEY(LOG_LEVEL), LOG_NONE}}, {{VPU_CONFIG_KEY(LOG_LEVEL), LOG_ERROR}}, @@ -70,15 +169,56 @@ std::vector> getCorrectConfigs() { {{VPU_MYRIAD_CONFIG_KEY(PLATFORM), VPU_MYRIAD_CONFIG_VALUE(2480)}}, + {{VPU_CONFIG_KEY(DETECT_NETWORK_BATCH), CONFIG_VALUE(YES)}}, + {{VPU_CONFIG_KEY(DETECT_NETWORK_BATCH), CONFIG_VALUE(NO)}}, + + {{VPU_CONFIG_KEY(CUSTOM_LAYERS), ""}}, + + {{VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), VPU_MYRIAD_CONFIG_VALUE(DDR_AUTO)}}, + { {KEY_LOG_LEVEL, LOG_INFO}, - {InferenceEngine::MYRIAD_COPY_OPTIMIZATION, InferenceEngine::PluginConfigParams::NO}, + {InferenceEngine::MYRIAD_COPY_OPTIMIZATION, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_POWER_MANAGEMENT, InferenceEngine::MYRIAD_POWER_INFER}, + {InferenceEngine::MYRIAD_HW_EXTRA_SPLIT, CONFIG_VALUE(YES)}, + {InferenceEngine::MYRIAD_HW_POOL_CONV_MERGE, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_HW_BLACK_LIST, "deconv"}, + {InferenceEngine::MYRIAD_HW_INJECT_STAGES, CONFIG_VALUE(YES)}, + {InferenceEngine::MYRIAD_HW_DILATION, CONFIG_VALUE(YES)}, {InferenceEngine::MYRIAD_ENABLE_FORCE_RESET, CONFIG_VALUE(YES)}, {InferenceEngine::MYRIAD_ENABLE_HW_ACCELERATION, CONFIG_VALUE(YES)}, + {InferenceEngine::MYRIAD_WATCHDOG, CONFIG_VALUE(YES)}, + {InferenceEngine::MYRIAD_NUMBER_OF_SHAVES, "10"}, + {InferenceEngine::MYRIAD_NUMBER_OF_CMX_SLICES, "10"}, {InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, "10"}, {InferenceEngine::MYRIAD_ENABLE_RECEIVING_TENSOR_TIME, CONFIG_VALUE(YES)}, {InferenceEngine::MYRIAD_THROUGHPUT_STREAMS, "1"}, - {InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, CONFIG_VALUE(YES)}, + {InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_PERF_REPORT_MODE, InferenceEngine::MYRIAD_PER_LAYER}, + {KEY_PERF_COUNT, CONFIG_VALUE(YES)}, + {InferenceEngine::MYRIAD_PACK_DATA_IN_CMX, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_TENSOR_STRIDES, "tensor[1,2,3,4]"}, + {InferenceEngine::MYRIAD_IGNORE_UNKNOWN_LAYERS, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_FORCE_PURE_TENSOR_ITERATOR, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING, CONFIG_VALUE(NO)}, + {KEY_EXCLUSIVE_ASYNC_REQUESTS, CONFIG_VALUE(YES)}, + {InferenceEngine::MYRIAD_ENABLE_REPL_WITH_SCRELU, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_ENABLE_PERMUTE_MERGING, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_DUMP_ALL_PASSES, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_DISABLE_REORDER, CONFIG_VALUE(NO)}, + {KEY_DEVICE_ID, ""}, + {InferenceEngine::MYRIAD_DEVICE_CONNECT_TIMEOUT, "10"}, + {InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_CUSTOM_LAYERS, ""}, + {KEY_CONFIG_FILE, ""}, + {InferenceEngine::MYRIAD_DDR_TYPE, InferenceEngine::MYRIAD_DDR_AUTO}, + {InferenceEngine::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM, CONFIG_VALUE(NO)}, + {InferenceEngine::MYRIAD_NONE_LAYERS, "deconv"}, + {InferenceEngine::MYRIAD_ENABLE_ASYNC_DMA, CONFIG_VALUE(NO)}, }, }; @@ -104,9 +244,11 @@ INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, CorrectConfigTests, CorrectConfigTests::getTestCaseName); const std::vector>& getCorrectMultiConfigs() { - static const std::vector> correctMultiConfigs = {{ + static const std::vector> correctMultiConfigs = { + { {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, - }}; + }, + }; return correctMultiConfigs; } @@ -120,6 +262,52 @@ INSTANTIATE_TEST_SUITE_P(smoke_Multi_BehaviorTests, CorrectConfigTests, const std::vector>& getDefaultEntries() { static const std::vector> defaultEntries = { {KEY_LOG_LEVEL, {LOG_NONE}}, + {InferenceEngine::MYRIAD_PROTOCOL, {std::string()}}, + {InferenceEngine::MYRIAD_COPY_OPTIMIZATION, {true}}, + {InferenceEngine::MYRIAD_POWER_MANAGEMENT, {InferenceEngine::MYRIAD_POWER_FULL}}, + {InferenceEngine::MYRIAD_ENABLE_HW_ACCELERATION, {true}}, + {InferenceEngine::MYRIAD_HW_EXTRA_SPLIT, {false}}, + {InferenceEngine::MYRIAD_HW_BLACK_LIST, {std::string()}}, + {InferenceEngine::MYRIAD_HW_POOL_CONV_MERGE, {true}}, + {InferenceEngine::MYRIAD_HW_INJECT_STAGES, {InferenceEngine::MYRIAD_HW_INJECT_STAGES_AUTO}}, + {InferenceEngine::MYRIAD_HW_DILATION, {false}}, + {InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, {InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB_AUTO}}, + {InferenceEngine::MYRIAD_WATCHDOG, {std::chrono::milliseconds(1000)}}, + {InferenceEngine::MYRIAD_ENABLE_RECEIVING_TENSOR_TIME, {false}}, + {InferenceEngine::MYRIAD_PERF_REPORT_MODE, {InferenceEngine::MYRIAD_PER_LAYER}}, + {KEY_PERF_COUNT, {false}}, + {InferenceEngine::MYRIAD_PACK_DATA_IN_CMX, {true}}, + {InferenceEngine::MYRIAD_NUMBER_OF_SHAVES, {InferenceEngine::MYRIAD_NUMBER_OF_SHAVES_AUTO}}, + {InferenceEngine::MYRIAD_THROUGHPUT_STREAMS, {InferenceEngine::MYRIAD_THROUGHPUT_STREAMS_AUTO}}, + {InferenceEngine::MYRIAD_NUMBER_OF_CMX_SLICES, {InferenceEngine::MYRIAD_NUMBER_OF_CMX_SLICES_AUTO}}, + {InferenceEngine::MYRIAD_IR_WITH_SCALES_DIRECTORY, {std::string()}}, + {InferenceEngine::MYRIAD_TENSOR_STRIDES, {std::map>()}}, + {InferenceEngine::MYRIAD_IGNORE_UNKNOWN_LAYERS, {false}}, + {InferenceEngine::MYRIAD_FORCE_PURE_TENSOR_ITERATOR, {false}}, + {InferenceEngine::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING, {false}}, + {KEY_EXCLUSIVE_ASYNC_REQUESTS, {false}}, + {InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, {true}}, + {InferenceEngine::MYRIAD_ENABLE_REPL_WITH_SCRELU, {false}}, + {InferenceEngine::MYRIAD_ENABLE_PERMUTE_MERGING, {true}}, + {InferenceEngine::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION, {false}}, + {InferenceEngine::MYRIAD_DUMP_INTERNAL_GRAPH_FILE_NAME, {std::string()}}, + {InferenceEngine::MYRIAD_DUMP_ALL_PASSES_DIRECTORY, {std::string()}}, + {InferenceEngine::MYRIAD_DUMP_ALL_PASSES, {false}}, + {InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES, {false}}, + {InferenceEngine::MYRIAD_DISABLE_REORDER, {false}}, + {KEY_DEVICE_ID, {std::string()}}, + {InferenceEngine::MYRIAD_DEVICE_CONNECT_TIMEOUT, {std::chrono::seconds(15)}}, + {InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH, {true}}, + {InferenceEngine::MYRIAD_CUSTOM_LAYERS, {std::string()}}, + {KEY_CONFIG_FILE, {std::string()}}, + {InferenceEngine::MYRIAD_DDR_TYPE, {InferenceEngine::MYRIAD_DDR_AUTO}}, + {InferenceEngine::MYRIAD_ENABLE_FORCE_RESET, {false}}, + {VPU_MYRIAD_CONFIG_KEY(PLATFORM), {std::string()}}, + {InferenceEngine::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL, {true}}, + {InferenceEngine::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION, {true}}, + {InferenceEngine::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM, {false}}, + {InferenceEngine::MYRIAD_NONE_LAYERS, {std::string()}}, + {InferenceEngine::MYRIAD_ENABLE_ASYNC_DMA, {true}}, }; return defaultEntries; } @@ -146,8 +334,235 @@ const std::vector>{{"tensor", {4, 3, 2, 1}}}}), + + std::make_tuple(InferenceEngine::MYRIAD_IGNORE_UNKNOWN_LAYERS, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_IGNORE_UNKNOWN_LAYERS, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_FORCE_PURE_TENSOR_ITERATOR, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_FORCE_PURE_TENSOR_ITERATOR, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(KEY_EXCLUSIVE_ASYNC_REQUESTS, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(KEY_EXCLUSIVE_ASYNC_REQUESTS, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_REPL_WITH_SCRELU, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_REPL_WITH_SCRELU, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_PERMUTE_MERGING, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_PERMUTE_MERGING, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_DUMP_INTERNAL_GRAPH_FILE_NAME, "filename", InferenceEngine::Parameter{"filename"}), + + std::make_tuple(InferenceEngine::MYRIAD_DUMP_ALL_PASSES_DIRECTORY, "/.", InferenceEngine::Parameter{"/."}), + + std::make_tuple(InferenceEngine::MYRIAD_DUMP_ALL_PASSES, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_DUMP_ALL_PASSES, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_DISABLE_REORDER, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_DISABLE_REORDER, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_DEVICE_CONNECT_TIMEOUT, "10", InferenceEngine::Parameter{std::chrono::seconds(10)}), + std::make_tuple(InferenceEngine::MYRIAD_DEVICE_CONNECT_TIMEOUT, "20", InferenceEngine::Parameter{std::chrono::seconds(20)}), + + std::make_tuple(InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(VPU_CONFIG_KEY(DETECT_NETWORK_BATCH), CONFIG_VALUE(YES), InferenceEngine::Parameter{true}), + std::make_tuple(VPU_CONFIG_KEY(DETECT_NETWORK_BATCH), CONFIG_VALUE(NO), InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_DDR_TYPE, InferenceEngine::MYRIAD_DDR_AUTO, + InferenceEngine::Parameter{InferenceEngine::MYRIAD_DDR_AUTO}), + std::make_tuple(InferenceEngine::MYRIAD_DDR_TYPE, InferenceEngine::MYRIAD_DDR_MICRON_2GB, + InferenceEngine::Parameter{InferenceEngine::MYRIAD_DDR_MICRON_2GB}), + std::make_tuple(InferenceEngine::MYRIAD_DDR_TYPE, InferenceEngine::MYRIAD_DDR_SAMSUNG_2GB, + InferenceEngine::Parameter{InferenceEngine::MYRIAD_DDR_SAMSUNG_2GB}), + std::make_tuple(InferenceEngine::MYRIAD_DDR_TYPE, InferenceEngine::MYRIAD_DDR_HYNIX_2GB, + InferenceEngine::Parameter{InferenceEngine::MYRIAD_DDR_HYNIX_2GB}), + std::make_tuple(InferenceEngine::MYRIAD_DDR_TYPE, InferenceEngine::MYRIAD_DDR_MICRON_1GB, + InferenceEngine::Parameter{InferenceEngine::MYRIAD_DDR_MICRON_1GB}), + + std::make_tuple(VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), VPU_MYRIAD_CONFIG_VALUE(DDR_AUTO), + InferenceEngine::Parameter{VPU_MYRIAD_CONFIG_VALUE(DDR_AUTO)}), + std::make_tuple(VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), VPU_MYRIAD_CONFIG_VALUE(MICRON_2GB), + InferenceEngine::Parameter{VPU_MYRIAD_CONFIG_VALUE(MICRON_2GB)}), + std::make_tuple(VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), VPU_MYRIAD_CONFIG_VALUE(SAMSUNG_2GB), + InferenceEngine::Parameter{VPU_MYRIAD_CONFIG_VALUE(SAMSUNG_2GB)}), + std::make_tuple(VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), VPU_MYRIAD_CONFIG_VALUE(HYNIX_2GB), + InferenceEngine::Parameter{VPU_MYRIAD_CONFIG_VALUE(HYNIX_2GB)}), + std::make_tuple(VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), VPU_MYRIAD_CONFIG_VALUE(MICRON_1GB), + InferenceEngine::Parameter{VPU_MYRIAD_CONFIG_VALUE(MICRON_1GB)}), + + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_FORCE_RESET, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_FORCE_RESET, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(VPU_MYRIAD_CONFIG_KEY(FORCE_RESET), CONFIG_VALUE(YES), InferenceEngine::Parameter{true}), + std::make_tuple(VPU_MYRIAD_CONFIG_KEY(FORCE_RESET), CONFIG_VALUE(NO), InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), + + std::make_tuple(InferenceEngine::MYRIAD_NONE_LAYERS, "deconv", InferenceEngine::Parameter{"deconv"}), + std::make_tuple(InferenceEngine::MYRIAD_NONE_LAYERS, "conv,pool", InferenceEngine::Parameter{"conv,pool"}), + + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_ASYNC_DMA, InferenceEngine::PluginConfigParams::YES, + InferenceEngine::Parameter{true}), + std::make_tuple(InferenceEngine::MYRIAD_ENABLE_ASYNC_DMA, InferenceEngine::PluginConfigParams::NO, + InferenceEngine::Parameter{false}), }; return customEntries; } @@ -162,6 +577,23 @@ const std::vector& getPublicOptions() { static const std::vector publicOptions = { KEY_LOG_LEVEL, VPU_CONFIG_KEY(LOG_LEVEL), + InferenceEngine::MYRIAD_PROTOCOL, + VPU_MYRIAD_CONFIG_KEY(PROTOCOL), + InferenceEngine::MYRIAD_ENABLE_HW_ACCELERATION, + VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION), + InferenceEngine::MYRIAD_ENABLE_RECEIVING_TENSOR_TIME, + VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME), + KEY_PERF_COUNT, + InferenceEngine::MYRIAD_THROUGHPUT_STREAMS, + KEY_EXCLUSIVE_ASYNC_REQUESTS, + KEY_DEVICE_ID, + InferenceEngine::MYRIAD_CUSTOM_LAYERS, + VPU_CONFIG_KEY(CUSTOM_LAYERS), + KEY_CONFIG_FILE, + InferenceEngine::MYRIAD_DDR_TYPE, + VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), + InferenceEngine::MYRIAD_ENABLE_FORCE_RESET, + VPU_MYRIAD_CONFIG_KEY(FORCE_RESET), }; return publicOptions; } @@ -175,6 +607,40 @@ INSTANTIATE_TEST_SUITE_P(smoke_BehaviorTests, CorrectConfigPublicOptionsTests, const std::vector& getPrivateOptions() { static const std::vector privateOptions = { InferenceEngine::MYRIAD_COPY_OPTIMIZATION, + InferenceEngine::MYRIAD_POWER_MANAGEMENT, + InferenceEngine::MYRIAD_HW_EXTRA_SPLIT, + InferenceEngine::MYRIAD_HW_POOL_CONV_MERGE, + InferenceEngine::MYRIAD_HW_BLACK_LIST, + InferenceEngine::MYRIAD_HW_INJECT_STAGES, + InferenceEngine::MYRIAD_HW_DILATION, + InferenceEngine::MYRIAD_NUMBER_OF_SHAVES, + InferenceEngine::MYRIAD_NUMBER_OF_CMX_SLICES, + InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, + InferenceEngine::MYRIAD_WATCHDOG, + InferenceEngine::MYRIAD_PERF_REPORT_MODE, + InferenceEngine::MYRIAD_PACK_DATA_IN_CMX, + InferenceEngine::MYRIAD_IR_WITH_SCALES_DIRECTORY, + InferenceEngine::MYRIAD_TENSOR_STRIDES, + InferenceEngine::MYRIAD_IGNORE_UNKNOWN_LAYERS, + InferenceEngine::MYRIAD_FORCE_PURE_TENSOR_ITERATOR, + InferenceEngine::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING, + InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, + InferenceEngine::MYRIAD_ENABLE_REPL_WITH_SCRELU, + InferenceEngine::MYRIAD_ENABLE_PERMUTE_MERGING, + InferenceEngine::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION, + InferenceEngine::MYRIAD_DUMP_INTERNAL_GRAPH_FILE_NAME, + InferenceEngine::MYRIAD_DUMP_ALL_PASSES_DIRECTORY, + InferenceEngine::MYRIAD_DUMP_ALL_PASSES, + InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES, + InferenceEngine::MYRIAD_DISABLE_REORDER, + InferenceEngine::MYRIAD_DEVICE_CONNECT_TIMEOUT, + InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH, + VPU_CONFIG_KEY(DETECT_NETWORK_BATCH), + InferenceEngine::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL, + InferenceEngine::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION, + InferenceEngine::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM, + InferenceEngine::MYRIAD_NONE_LAYERS, + InferenceEngine::MYRIAD_ENABLE_ASYNC_DMA, }; return privateOptions; } @@ -192,6 +658,9 @@ const std::vector>& getIncorrectConfigs() { {{InferenceEngine::MYRIAD_COPY_OPTIMIZATION, "ON"}}, {{InferenceEngine::MYRIAD_COPY_OPTIMIZATION, "OFF"}}, + {{InferenceEngine::MYRIAD_POWER_MANAGEMENT, "FULL"}}, + {{InferenceEngine::MYRIAD_POWER_MANAGEMENT, "ECONOM"}}, + {{InferenceEngine::MYRIAD_PROTOCOL, "BLUETOOTH"}}, {{InferenceEngine::MYRIAD_PROTOCOL, "LAN"}}, @@ -201,6 +670,13 @@ const std::vector>& getIncorrectConfigs() { {{InferenceEngine::MYRIAD_ENABLE_FORCE_RESET, "ON"}}, {{InferenceEngine::MYRIAD_ENABLE_FORCE_RESET, "OFF"}}, + {{InferenceEngine::MYRIAD_NUMBER_OF_SHAVES, "-1"}}, + {{InferenceEngine::MYRIAD_NUMBER_OF_SHAVES, "-10"}}, + + {{InferenceEngine::MYRIAD_NUMBER_OF_CMX_SLICES, "-1"}}, + {{InferenceEngine::MYRIAD_NUMBER_OF_CMX_SLICES, "-10"}}, + + {{InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, "-1"}}, {{InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, "-10"}}, {{InferenceEngine::MYRIAD_ENABLE_RECEIVING_TENSOR_TIME, "ON"}}, @@ -212,6 +688,84 @@ const std::vector>& getIncorrectConfigs() { {{InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, "ON"}}, {{InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, "OFF"}}, + {{InferenceEngine::MYRIAD_HW_EXTRA_SPLIT, "ON"}}, + {{InferenceEngine::MYRIAD_HW_EXTRA_SPLIT, "OFF"}}, + + {{InferenceEngine::MYRIAD_HW_POOL_CONV_MERGE, "ON"}}, + {{InferenceEngine::MYRIAD_HW_POOL_CONV_MERGE, "OFF"}}, + + {{InferenceEngine::MYRIAD_HW_INJECT_STAGES, "ON"}}, + {{InferenceEngine::MYRIAD_HW_INJECT_STAGES, "OFF"}}, + + {{InferenceEngine::MYRIAD_HW_DILATION, "ON"}}, + {{InferenceEngine::MYRIAD_HW_DILATION, "OFF"}}, + + {{InferenceEngine::MYRIAD_WATCHDOG, "ON"}}, + {{InferenceEngine::MYRIAD_WATCHDOG, "OFF"}}, + + {{InferenceEngine::MYRIAD_PERF_REPORT_MODE, "PER_LAYER"}}, + {{InferenceEngine::MYRIAD_PERF_REPORT_MODE, "STAGE"}}, + + {{KEY_PERF_COUNT, "ON"}}, + {{KEY_PERF_COUNT, "OFF"}}, + + {{InferenceEngine::MYRIAD_PACK_DATA_IN_CMX, "ON"}}, + {{InferenceEngine::MYRIAD_PACK_DATA_IN_CMX, "OFF"}}, + + {{InferenceEngine::MYRIAD_TENSOR_STRIDES, "tensor(1,2,3,4)"}}, + + {{InferenceEngine::MYRIAD_IGNORE_UNKNOWN_LAYERS, "ON"}}, + {{InferenceEngine::MYRIAD_IGNORE_UNKNOWN_LAYERS, "OFF"}}, + + {{InferenceEngine::MYRIAD_FORCE_PURE_TENSOR_ITERATOR, "ON"}}, + {{InferenceEngine::MYRIAD_FORCE_PURE_TENSOR_ITERATOR, "OFF"}}, + + {{InferenceEngine::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING, "ON"}}, + {{InferenceEngine::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING, "OFF"}}, + + {{KEY_EXCLUSIVE_ASYNC_REQUESTS, "ON"}}, + {{KEY_EXCLUSIVE_ASYNC_REQUESTS, "OFF"}}, + + {{InferenceEngine::MYRIAD_ENABLE_REPL_WITH_SCRELU, "ON"}}, + {{InferenceEngine::MYRIAD_ENABLE_REPL_WITH_SCRELU, "OFF"}}, + + {{InferenceEngine::MYRIAD_ENABLE_PERMUTE_MERGING, "ON"}}, + {{InferenceEngine::MYRIAD_ENABLE_PERMUTE_MERGING, "OFF"}}, + + {{InferenceEngine::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION, "ON"}}, + {{InferenceEngine::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION, "OFF"}}, + + {{InferenceEngine::MYRIAD_DUMP_ALL_PASSES, "ON"}}, + {{InferenceEngine::MYRIAD_DUMP_ALL_PASSES, "OFF"}}, + + {{InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES, "ON"}}, + {{InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES, "OFF"}}, + + {{InferenceEngine::MYRIAD_DISABLE_REORDER, "ON"}}, + {{InferenceEngine::MYRIAD_DISABLE_REORDER, "OFF"}}, + + {{InferenceEngine::MYRIAD_DEVICE_CONNECT_TIMEOUT, "-1"}}, + {{InferenceEngine::MYRIAD_DEVICE_CONNECT_TIMEOUT, "-10"}}, + + {{InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH, "ON"}}, + {{InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH, "OFF"}}, + + {{InferenceEngine::MYRIAD_DDR_TYPE, "AUTO"}}, + {{InferenceEngine::MYRIAD_DDR_TYPE, "2GB"}}, + {{InferenceEngine::MYRIAD_DDR_TYPE, "1GB"}}, + + {{InferenceEngine::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL, "ON"}}, + {{InferenceEngine::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL, "OFF"}}, + + {{InferenceEngine::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION, "ON"}}, + {{InferenceEngine::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION, "OFF"}}, + + {{InferenceEngine::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM, "ON"}}, + {{InferenceEngine::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM, "OFF"}}, + + {{InferenceEngine::MYRIAD_ENABLE_ASYNC_DMA, "ON"}}, + {{InferenceEngine::MYRIAD_ENABLE_ASYNC_DMA, "OFF"}}, + // Deprecated {{VPU_CONFIG_KEY(LOG_LEVEL), "INCORRECT_LOG_LEVEL"}}, @@ -231,16 +785,52 @@ const std::vector>& getIncorrectConfigs() { {{VPU_MYRIAD_CONFIG_KEY(PLATFORM), "0"}}, {{VPU_MYRIAD_CONFIG_KEY(PLATFORM), "1"}}, + {{VPU_CONFIG_KEY(DETECT_NETWORK_BATCH), "ON"}}, + {{VPU_CONFIG_KEY(DETECT_NETWORK_BATCH), "OFF"}}, + + {{VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), "AUTO"}}, + {{VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), "2GB"}}, + {{VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), "1GB"}}, + { {KEY_LOG_LEVEL, LOG_INFO}, {InferenceEngine::MYRIAD_COPY_OPTIMIZATION, "ON"}, {InferenceEngine::MYRIAD_PROTOCOL, "BLUETOOTH"}, + {InferenceEngine::MYRIAD_POWER_MANAGEMENT, "FULL"}, {InferenceEngine::MYRIAD_ENABLE_HW_ACCELERATION, CONFIG_VALUE(YES)}, + {InferenceEngine::MYRIAD_HW_EXTRA_SPLIT, "ON"}, + {InferenceEngine::MYRIAD_HW_POOL_CONV_MERGE, "ON"}, + {InferenceEngine::MYRIAD_HW_INJECT_STAGES, "ON"}, + {InferenceEngine::MYRIAD_HW_DILATION, "ON"}, {InferenceEngine::MYRIAD_ENABLE_FORCE_RESET, "ON"}, - {InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, "10"}, - {InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, "OFF"}, - {InferenceEngine::MYRIAD_THROUGHPUT_STREAMS, "1"}, + {InferenceEngine::MYRIAD_NUMBER_OF_SHAVES, "-10"}, + {InferenceEngine::MYRIAD_NUMBER_OF_CMX_SLICES, "-10"}, + {InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, "-10"}, + {InferenceEngine::MYRIAD_THROUGHPUT_STREAMS, "Two"}, {InferenceEngine::MYRIAD_ENABLE_WEIGHTS_ANALYSIS, "ON"}, + {InferenceEngine::MYRIAD_WATCHDOG, "OFF"}, + {InferenceEngine::MYRIAD_ENABLE_RECEIVING_TENSOR_TIME, "ON"}, + {InferenceEngine::MYRIAD_PERF_REPORT_MODE, "PER_LAYER"}, + {KEY_PERF_COUNT, "ON"}, + {InferenceEngine::MYRIAD_PACK_DATA_IN_CMX, "OFF"}, + {InferenceEngine::MYRIAD_TENSOR_STRIDES, "tensor(1,2,3,4)"}, + {InferenceEngine::MYRIAD_IGNORE_UNKNOWN_LAYERS, "OFF"}, + {InferenceEngine::MYRIAD_FORCE_PURE_TENSOR_ITERATOR, "OFF"}, + {InferenceEngine::MYRIAD_ENABLE_TENSOR_ITERATOR_UNROLLING, "OFF"}, + {KEY_EXCLUSIVE_ASYNC_REQUESTS, "ON"}, + {InferenceEngine::MYRIAD_ENABLE_REPL_WITH_SCRELU, "OFF"}, + {InferenceEngine::MYRIAD_ENABLE_PERMUTE_MERGING, "OFF"}, + {InferenceEngine::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION, "OFF"}, + {InferenceEngine::MYRIAD_DUMP_ALL_PASSES, "OFF"}, + {InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES, "OFF"}, + {InferenceEngine::MYRIAD_DISABLE_REORDER, "OFF"}, + {InferenceEngine::MYRIAD_DEVICE_CONNECT_TIMEOUT, "-10"}, + {InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH, "OFF"}, + {InferenceEngine::MYRIAD_DDR_TYPE, "AUTO"}, + {InferenceEngine::MYRIAD_CHECK_PREPROCESSING_INSIDE_MODEL, "OFF"}, + {InferenceEngine::MYRIAD_ENABLE_EARLY_ELTWISE_RELU_FUSION, "OFF"}, + {InferenceEngine::MYRIAD_ENABLE_CUSTOM_RESHAPE_PARAM, "OFF"}, + {InferenceEngine::MYRIAD_ENABLE_ASYNC_DMA, "OFF"}, }, }; return incorrectConfigs; @@ -261,7 +851,31 @@ const std::vector>& getIncorrectMultiConfigs( }, { {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, - {InferenceEngine::MYRIAD_ENABLE_HW_ACCELERATION, "ON"}, + {InferenceEngine::MYRIAD_PROTOCOL, "BLUETOOTH"} + }, + { + {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {InferenceEngine::MYRIAD_ENABLE_HW_ACCELERATION, "ON"} + }, + { + {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {InferenceEngine::MYRIAD_ENABLE_RECEIVING_TENSOR_TIME, "ON"} + }, + { + {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {KEY_PERF_COUNT, "ON"} + }, + { + {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {InferenceEngine::MYRIAD_THROUGHPUT_STREAMS, "ONE"} + }, + { + {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {KEY_EXCLUSIVE_ASYNC_REQUESTS, "ON"} + }, + { + {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {InferenceEngine::MYRIAD_DDR_TYPE, "1GB"} }, // Deprecated @@ -271,7 +885,11 @@ const std::vector>& getIncorrectMultiConfigs( }, { {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, - {VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION), "ON"}, + {VPU_MYRIAD_CONFIG_KEY(PROTOCOL), "BLUETOOTH"} + }, + { + {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION), "ON"} }, { {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, @@ -285,6 +903,14 @@ const std::vector>& getIncorrectMultiConfigs( {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, {VPU_MYRIAD_CONFIG_KEY(PLATFORM), "1"}, }, + { + {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME), "OFF"} + }, + { + {InferenceEngine::MultiDeviceConfigParams::KEY_MULTI_DEVICE_PRIORITIES, CommonTestUtils::DEVICE_MYRIAD}, + {VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE), "1GB"} + }, }; return incorrectMultiConfigs; } diff --git a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/infer_request_config.cpp b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/infer_request_config.cpp index eba711f7b20..225936f387d 100644 --- a/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/infer_request_config.cpp +++ b/inference-engine/tests/functional/plugin/myriad/shared_tests_instances/behavior/infer_request_config.cpp @@ -37,7 +37,6 @@ namespace { {{CONFIG_KEY(LOG_LEVEL), CONFIG_VALUE(LOG_DEBUG)}}, {{CONFIG_KEY(LOG_LEVEL), CONFIG_VALUE(LOG_TRACE)}}, - {{InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, "-1"}}, {{InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, "0"}}, {{InferenceEngine::MYRIAD_TILING_CMX_LIMIT_KB, "1"}}, diff --git a/inference-engine/tests/functional/plugin/shared/include/behavior/core_integration.hpp b/inference-engine/tests/functional/plugin/shared/include/behavior/core_integration.hpp index adcd0e525b4..1064edaa570 100644 --- a/inference-engine/tests/functional/plugin/shared/include/behavior/core_integration.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/behavior/core_integration.hpp @@ -62,6 +62,14 @@ namespace BehaviorTestsDefinitions { } +inline Core createCoreWithTemplate() { + Core ie; + std::string pluginName = "templatePlugin"; + pluginName += IE_BUILD_POSTFIX; + ie.RegisterPlugin(pluginName, "TEMPLATE"); + return ie; +} + class IEClassBasicTestP : public ::testing::Test, public WithParamInterface > { protected: std::string deviceName; @@ -211,20 +219,20 @@ TEST(IEClassBasicTest, smoke_createDefault) { TEST_P(IEClassBasicTestP, registerExistingPluginThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_THROW(ie.RegisterPlugin(pluginName, deviceName), Exception); } TEST_P(IEClassBasicTestP, registerNewPluginNoThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.RegisterPlugin(pluginName, "NEW_DEVICE_NAME")); ASSERT_NO_THROW(ie.GetMetric("NEW_DEVICE_NAME", METRIC_KEY(SUPPORTED_CONFIG_KEYS))); } TEST(IEClassBasicTest, smoke_registerExistingPluginFileThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_THROW(ie.RegisterPlugins("nonExistPlugins.xml"), Exception); } @@ -277,7 +285,7 @@ TEST_P(IEClassBasicTestP, smoke_registerPluginsXMLUnicodePath) { GTEST_COUT << "Test " << testIndex << std::endl; - Core ie; + Core ie = createCoreWithTemplate(); GTEST_COUT << "Core created " << testIndex << std::endl; ASSERT_NO_THROW(ie.RegisterPlugins(::FileUtils::wStringtoMBCSstringChar(pluginsXmlW))); CommonTestUtils::removeFile(pluginsXmlW); @@ -310,19 +318,19 @@ TEST_P(IEClassBasicTestP, smoke_registerPluginsXMLUnicodePath) { TEST_P(IEClassBasicTestP, getVersionsByExactDeviceNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.GetVersions(deviceName + ".0")); } TEST_P(IEClassBasicTestP, getVersionsByDeviceClassNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.GetVersions(deviceName)); } TEST_P(IEClassBasicTestP, getVersionsNonEmpty) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_EQ(2, ie.GetVersions(CommonTestUtils::DEVICE_HETERO + std::string(":") + deviceName).size()); } @@ -332,7 +340,7 @@ TEST_P(IEClassBasicTestP, getVersionsNonEmpty) { TEST_P(IEClassBasicTestP, unregisterExistingPluginNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); // device instance is not created yet ASSERT_THROW(ie.UnregisterPlugin(deviceName), Exception); @@ -344,7 +352,7 @@ TEST_P(IEClassBasicTestP, unregisterExistingPluginNoThrow) { TEST_P(IEClassBasicTestP, accessToUnregisteredPluginThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_THROW(ie.UnregisterPlugin(deviceName), Exception); ASSERT_NO_THROW(ie.GetVersions(deviceName)); ASSERT_NO_THROW(ie.UnregisterPlugin(deviceName)); @@ -355,7 +363,7 @@ TEST_P(IEClassBasicTestP, accessToUnregisteredPluginThrows) { TEST(IEClassBasicTest, smoke_unregisterNonExistingPluginThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_THROW(ie.UnregisterPlugin("unkown_device"), Exception); } @@ -365,45 +373,45 @@ TEST(IEClassBasicTest, smoke_unregisterNonExistingPluginThrows) { TEST_P(IEClassBasicTestP, SetConfigAllThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.SetConfig({{"unsupported_key", "4"}})); ASSERT_ANY_THROW(ie.GetVersions(deviceName)); } TEST_P(IEClassBasicTestP, SetConfigForUnRegisteredDeviceThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_THROW(ie.SetConfig({{"unsupported_key", "4"}}, "unregistered_device"), Exception); } TEST_P(IEClassBasicTestP, SetConfigNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.SetConfig({{KEY_PERF_COUNT, YES}}, deviceName)); } TEST_P(IEClassBasicTestP, SetConfigAllNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.SetConfig({{KEY_PERF_COUNT, YES}})); ASSERT_NO_THROW(ie.GetVersions(deviceName)); } TEST(IEClassBasicTest, smoke_SetConfigHeteroThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.SetConfig({{KEY_PERF_COUNT, YES}}, CommonTestUtils::DEVICE_HETERO)); } TEST_P(IEClassBasicTestP, SetConfigHeteroTargetFallbackThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.SetConfig({{"TARGET_FALLBACK", deviceName}}, CommonTestUtils::DEVICE_HETERO)); } TEST(IEClassBasicTest, smoke_SetConfigHeteroNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); bool value = false; ASSERT_NO_THROW(ie.SetConfig({{HETERO_CONFIG_KEY(DUMP_GRAPH_DOT), YES}}, CommonTestUtils::DEVICE_HETERO)); @@ -421,7 +429,7 @@ TEST(IEClassBasicTest, smoke_SetConfigHeteroNoThrow) { TEST_P(IEClassBasicTestP, ImportNetworkThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); if (deviceName == CommonTestUtils::DEVICE_CPU || deviceName == CommonTestUtils::DEVICE_GPU) { @@ -440,20 +448,20 @@ TEST_P(IEClassBasicTestP, ImportNetworkThrows) { TEST(IEClassBasicTest, smoke_ImportNetworkHeteroThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_THROW(ie.ImportNetwork("model", CommonTestUtils::DEVICE_HETERO), NetworkNotRead); } TEST(IEClassBasicTest, smoke_ImportNetworkMultiThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - InferenceEngine::Core ie; + InferenceEngine::Core ie = createCoreWithTemplate(); ASSERT_THROW(ie.ImportNetwork("model", CommonTestUtils::DEVICE_MULTI), NetworkNotRead); } TEST_P(IEClassBasicTestP, ImportNetworkWithNullContextThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); RemoteContext::Ptr context = nullptr; std::istringstream stream("None"); ASSERT_THROW(ie.ImportNetwork(stream, context, {}), Exception); @@ -465,19 +473,19 @@ TEST_P(IEClassBasicTestP, ImportNetworkWithNullContextThrows) { TEST_P(IEClassNetworkTestP, LoadNetworkActualNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.LoadNetwork(actualNetwork, deviceName)); } TEST_P(IEClassNetworkTestP, LoadNetworkActualHeteroDeviceNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.LoadNetwork(actualNetwork, CommonTestUtils::DEVICE_HETERO + std::string(":") + deviceName)); } TEST_P(IEClassNetworkTestP, LoadNetworkActualHeteroDevice2NoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.LoadNetwork(actualNetwork, CommonTestUtils::DEVICE_HETERO, {{"TARGET_FALLBACK", deviceName}})); } @@ -487,7 +495,7 @@ TEST_P(IEClassNetworkTestP, LoadNetworkActualHeteroDevice2NoThrow) { TEST_P(IEClassImportExportTestP, smoke_ImportNetworkThrowsIfNoDeviceName) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); std::stringstream strm; ExecutableNetwork executableNetwork; ASSERT_NO_THROW(executableNetwork = ie.LoadNetwork(actualNetwork, deviceName)); @@ -500,7 +508,7 @@ TEST_P(IEClassImportExportTestP, smoke_ImportNetworkThrowsIfNoDeviceName) { TEST_P(IEClassImportExportTestP, smoke_ImportNetworkNoThrowWithDeviceName) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); std::stringstream strm; ExecutableNetwork executableNetwork; ASSERT_NO_THROW(executableNetwork = ie.LoadNetwork(actualNetwork, deviceName)); @@ -511,7 +519,7 @@ TEST_P(IEClassImportExportTestP, smoke_ImportNetworkNoThrowWithDeviceName) { TEST_P(IEClassImportExportTestP, smoke_ExportUsingFileNameImportFromStreamNoThrowWithDeviceName) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ExecutableNetwork executableNetwork; std::string fileName{"ExportedNetwork"}; { @@ -534,13 +542,13 @@ TEST_P(IEClassImportExportTestP, smoke_ExportUsingFileNameImportFromStreamNoThro TEST_P(IEClassNetworkTestP, QueryNetworkActualThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_NO_THROW(ie.QueryNetwork(actualNetwork, CommonTestUtils::DEVICE_HETERO + std::string(":") + deviceName)); } TEST_P(IEClassNetworkTestP, QueryNetworkActualNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); try { ie.QueryNetwork(actualNetwork, deviceName); @@ -552,7 +560,7 @@ TEST_P(IEClassNetworkTestP, QueryNetworkActualNoThrow) { TEST_P(IEClassNetworkTestP, QueryNetworkWithKSO) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); try { auto rres = ie.QueryNetwork(ksoNetwork, deviceName); @@ -571,7 +579,7 @@ TEST_P(IEClassNetworkTestP, QueryNetworkWithKSO) { TEST_P(IEClassNetworkTestP, SetAffinityWithConstantBranches) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); try { std::shared_ptr func; @@ -623,7 +631,7 @@ TEST_P(IEClassNetworkTestP, SetAffinityWithConstantBranches) { TEST_P(IEClassNetworkTestP, SetAffinityWithKSO) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); try { auto rres = ie.QueryNetwork(ksoNetwork, deviceName); @@ -647,7 +655,7 @@ TEST_P(IEClassNetworkTestP, SetAffinityWithKSO) { TEST_P(IEClassNetworkTestP, QueryNetworkHeteroActualNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); QueryNetworkResult res; ASSERT_NO_THROW(res = ie.QueryNetwork(actualNetwork, CommonTestUtils::DEVICE_HETERO, {{"TARGET_FALLBACK", deviceName}})); ASSERT_LT(0, res.supportedLayersMap.size()); @@ -655,13 +663,13 @@ TEST_P(IEClassNetworkTestP, QueryNetworkHeteroActualNoThrow) { TEST_P(IEClassNetworkTestP, QueryNetworkMultiThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); ASSERT_THROW(ie.QueryNetwork(actualNetwork, CommonTestUtils::DEVICE_MULTI), Exception); } TEST(IEClassBasicTest, smoke_GetMetricSupportedMetricsHeteroNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; std::string deviceName = CommonTestUtils::DEVICE_HETERO; @@ -678,7 +686,7 @@ TEST(IEClassBasicTest, smoke_GetMetricSupportedMetricsHeteroNoThrow) { TEST(IEClassBasicTest, smoke_GetMetricSupportedConfigKeysHeteroNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; std::string deviceName = CommonTestUtils::DEVICE_HETERO; @@ -695,7 +703,7 @@ TEST(IEClassBasicTest, smoke_GetMetricSupportedConfigKeysHeteroNoThrow) { TEST(IEClassBasicTest, smoke_GetMetricSupportedConfigKeysHeteroThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); // TODO: check std::string targetDevice = CommonTestUtils::DEVICE_HETERO + std::string(":") + CommonTestUtils::DEVICE_CPU; ASSERT_THROW(ie.GetMetric(targetDevice, METRIC_KEY(SUPPORTED_CONFIG_KEYS)), Exception); @@ -703,7 +711,7 @@ TEST(IEClassBasicTest, smoke_GetMetricSupportedConfigKeysHeteroThrows) { TEST_P(IEClassGetMetricTest_SUPPORTED_METRICS, GetMetricAndPrintNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(SUPPORTED_METRICS))); @@ -719,7 +727,7 @@ TEST_P(IEClassGetMetricTest_SUPPORTED_METRICS, GetMetricAndPrintNoThrow) { TEST_P(IEClassGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMetricAndPrintNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); @@ -735,7 +743,7 @@ TEST_P(IEClassGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMetricAndPrintNoThrow) { TEST_P(IEClassGetMetricTest_AVAILABLE_DEVICES, GetMetricAndPrintNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(AVAILABLE_DEVICES))); @@ -751,7 +759,7 @@ TEST_P(IEClassGetMetricTest_AVAILABLE_DEVICES, GetMetricAndPrintNoThrow) { TEST_P(IEClassGetMetricTest_FULL_DEVICE_NAME, GetMetricAndPrintNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(FULL_DEVICE_NAME))); @@ -763,7 +771,7 @@ TEST_P(IEClassGetMetricTest_FULL_DEVICE_NAME, GetMetricAndPrintNoThrow) { TEST_P(IEClassGetMetricTest_OPTIMIZATION_CAPABILITIES, GetMetricAndPrintNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(OPTIMIZATION_CAPABILITIES))); @@ -779,7 +787,7 @@ TEST_P(IEClassGetMetricTest_OPTIMIZATION_CAPABILITIES, GetMetricAndPrintNoThrow) TEST_P(IEClassGetMetricTest_DEVICE_GOPS, GetMetricAndPrintNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(DEVICE_GOPS))); @@ -795,7 +803,7 @@ TEST_P(IEClassGetMetricTest_DEVICE_GOPS, GetMetricAndPrintNoThrow) { TEST_P(IEClassGetMetricTest_DEVICE_TYPE, GetMetricAndPrintNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(DEVICE_TYPE))); @@ -808,7 +816,7 @@ TEST_P(IEClassGetMetricTest_DEVICE_TYPE, GetMetricAndPrintNoThrow) { TEST_P(IEClassGetMetricTest_NUMBER_OF_WAITING_INFER_REQUESTS, GetMetricAndPrintNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED() - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(NUMBER_OF_WAITING_INFER_REQUESTS))); @@ -821,7 +829,7 @@ TEST_P(IEClassGetMetricTest_NUMBER_OF_WAITING_INFER_REQUESTS, GetMetricAndPrintN TEST_P(IEClassGetMetricTest_NUMBER_OF_EXEC_INFER_REQUESTS, GetMetricAndPrintNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(NUMBER_OF_EXEC_INFER_REQUESTS))); @@ -834,7 +842,7 @@ TEST_P(IEClassGetMetricTest_NUMBER_OF_EXEC_INFER_REQUESTS, GetMetricAndPrintNoTh TEST_P(IEClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS, GetMetricAndPrintNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(RANGE_FOR_ASYNC_INFER_REQUESTS))); @@ -857,7 +865,7 @@ TEST_P(IEClassGetMetricTest_RANGE_FOR_ASYNC_INFER_REQUESTS, GetMetricAndPrintNoT TEST_P(IEClassGetMetricTest_RANGE_FOR_STREAMS, GetMetricAndPrintNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(RANGE_FOR_STREAMS))); @@ -877,7 +885,7 @@ TEST_P(IEClassGetMetricTest_RANGE_FOR_STREAMS, GetMetricAndPrintNoThrow) { TEST_P(IEClassGetMetricTest_ThrowUnsupported, GetMetricThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_THROW(p = ie.GetMetric(deviceName, "unsupported_metric"), Exception); @@ -885,7 +893,7 @@ TEST_P(IEClassGetMetricTest_ThrowUnsupported, GetMetricThrow) { TEST_P(IEClassGetConfigTest, GetConfigNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); @@ -900,7 +908,7 @@ TEST_P(IEClassGetConfigTest, GetConfigNoThrow) { TEST_P(IEClassGetConfigTest, GetConfigHeteroNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); @@ -913,7 +921,7 @@ TEST_P(IEClassGetConfigTest, GetConfigHeteroNoThrow) { TEST_P(IEClassGetConfigTest_ThrowUnsupported, GetConfigHeteroThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_THROW(p = ie.GetConfig(CommonTestUtils::DEVICE_HETERO, "unsupported_config"), Exception); @@ -921,7 +929,7 @@ TEST_P(IEClassGetConfigTest_ThrowUnsupported, GetConfigHeteroThrow) { TEST_P(IEClassGetConfigTest_ThrowUnsupported, GetConfigHeteroWithDeviceThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_THROW(p = ie.GetConfig(CommonTestUtils::DEVICE_HETERO + std::string(":") + deviceName, HETERO_CONFIG_KEY(DUMP_GRAPH_DOT)), @@ -930,7 +938,7 @@ TEST_P(IEClassGetConfigTest_ThrowUnsupported, GetConfigHeteroWithDeviceThrow) { TEST_P(IEClassGetConfigTest_ThrowUnsupported, GetConfigThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_THROW(p = ie.GetConfig(deviceName, "unsupported_config"), Exception); @@ -938,7 +946,7 @@ TEST_P(IEClassGetConfigTest_ThrowUnsupported, GetConfigThrow) { TEST_P(IEClassGetAvailableDevices, GetAvailableDevicesNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); std::vector devices; ASSERT_NO_THROW(devices = ie.GetAvailableDevices()); @@ -962,7 +970,7 @@ TEST_P(IEClassGetAvailableDevices, GetAvailableDevicesNoThrow) { // TEST_P(IEClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMetricNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ExecutableNetwork exeNetwork = ie.LoadNetwork(simpleNetwork, deviceName); @@ -981,7 +989,7 @@ TEST_P(IEClassExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMetricNoT TEST_P(IEClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS, GetMetricNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ExecutableNetwork exeNetwork = ie.LoadNetwork(simpleNetwork, deviceName); @@ -1000,7 +1008,7 @@ TEST_P(IEClassExecutableNetworkGetMetricTest_SUPPORTED_METRICS, GetMetricNoThrow TEST_P(IEClassExecutableNetworkGetMetricTest_NETWORK_NAME, GetMetricNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ExecutableNetwork exeNetwork = ie.LoadNetwork(simpleNetwork, deviceName); @@ -1015,7 +1023,7 @@ TEST_P(IEClassExecutableNetworkGetMetricTest_NETWORK_NAME, GetMetricNoThrow) { TEST_P(IEClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS, GetMetricNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ExecutableNetwork exeNetwork = ie.LoadNetwork(simpleNetwork, deviceName); @@ -1030,7 +1038,7 @@ TEST_P(IEClassExecutableNetworkGetMetricTest_OPTIMAL_NUMBER_OF_INFER_REQUESTS, G TEST_P(IEClassExecutableNetworkGetMetricTest_ThrowsUnsupported, GetMetricThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ExecutableNetwork exeNetwork = ie.LoadNetwork(simpleNetwork, deviceName); @@ -1040,7 +1048,7 @@ TEST_P(IEClassExecutableNetworkGetMetricTest_ThrowsUnsupported, GetMetricThrow) TEST_P(IEClassExecutableNetworkGetConfigTest, GetConfigNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ExecutableNetwork exeNetwork = ie.LoadNetwork(simpleNetwork, deviceName); @@ -1057,7 +1065,7 @@ TEST_P(IEClassExecutableNetworkGetConfigTest, GetConfigNoThrow) { TEST_P(IEClassExecutableNetworkGetConfigTest, GetConfigThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ExecutableNetwork exeNetwork = ie.LoadNetwork(simpleNetwork, deviceName); @@ -1067,7 +1075,7 @@ TEST_P(IEClassExecutableNetworkGetConfigTest, GetConfigThrows) { TEST_P(IEClassExecutableNetworkSetConfigTest, SetConfigThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ExecutableNetwork exeNetwork = ie.LoadNetwork(simpleNetwork, deviceName); @@ -1077,7 +1085,7 @@ TEST_P(IEClassExecutableNetworkSetConfigTest, SetConfigThrows) { TEST_P(IEClassExecutableNetworkSupportedConfigTest, SupportedConfigWorks) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ExecutableNetwork exeNetwork = ie.LoadNetwork(simpleNetwork, deviceName); @@ -1090,7 +1098,7 @@ TEST_P(IEClassExecutableNetworkSupportedConfigTest, SupportedConfigWorks) { TEST_P(IEClassExecutableNetworkUnsupportedConfigTest, UnsupportedConfigThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); ExecutableNetwork exeNetwork = ie.LoadNetwork(simpleNetwork, deviceName); @@ -1099,7 +1107,7 @@ TEST_P(IEClassExecutableNetworkUnsupportedConfigTest, UnsupportedConfigThrows) { TEST_P(IEClassExecutableNetworkGetConfigTest, GetConfigNoEmptyNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ASSERT_NO_THROW(p = ie.GetMetric(deviceName, METRIC_KEY(SUPPORTED_CONFIG_KEYS))); @@ -1122,7 +1130,7 @@ TEST_P(IEClassExecutableNetworkGetConfigTest, GetConfigNoEmptyNoThrow) { TEST_P(IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMetricNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter pHetero, pDevice; ExecutableNetwork heteroExeNetwork = ie.LoadNetwork(actualNetwork, heteroDeviceName); @@ -1156,7 +1164,7 @@ TEST_P(IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_CONFIG_KEYS, GetMet TEST_P(IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS, GetMetricNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter pHetero, pDevice; ExecutableNetwork heteroExeNetwork = ie.LoadNetwork(actualNetwork, heteroDeviceName); @@ -1196,7 +1204,7 @@ TEST_P(IEClassHeteroExecutableNetworkGetMetricTest_SUPPORTED_METRICS, GetMetricN TEST_P(IEClassHeteroExecutableNetworkGetMetricTest_NETWORK_NAME, GetMetricNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; ExecutableNetwork exeNetwork = ie.LoadNetwork(actualNetwork, heteroDeviceName); @@ -1209,7 +1217,7 @@ TEST_P(IEClassHeteroExecutableNetworkGetMetricTest_NETWORK_NAME, GetMetricNoThro TEST_P(IEClassHeteroExecutableNetworkGetMetricTest_TARGET_FALLBACK, GetMetricNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); Parameter p; setHeteroNetworkAffinity(deviceName); @@ -1237,7 +1245,7 @@ bool supportsDeviceID(Core &ie, const std::string &deviceName) { TEST_P(IEClassQueryNetworkTest, QueryNetworkHETEROWithDeviceIDNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName)) { auto deviceIDs = ie.GetMetric(deviceName, METRIC_KEY(AVAILABLE_DEVICES)).as>(); @@ -1252,7 +1260,7 @@ TEST_P(IEClassQueryNetworkTest, QueryNetworkHETEROWithDeviceIDNoThrow) { TEST_P(IEClassQueryNetworkTest, QueryNetworkWithDeviceID) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName)) { try { @@ -1268,7 +1276,7 @@ TEST_P(IEClassQueryNetworkTest, QueryNetworkWithDeviceID) { TEST_P(IEClassQueryNetworkTest, QueryNetworkWithBigDeviceIDThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName)) { ASSERT_THROW(ie.QueryNetwork(actualNetwork, deviceName + ".110"), Exception); @@ -1279,7 +1287,7 @@ TEST_P(IEClassQueryNetworkTest, QueryNetworkWithBigDeviceIDThrows) { TEST_P(IEClassQueryNetworkTest, QueryNetworkWithInvalidDeviceIDThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName)) { ASSERT_THROW(ie.QueryNetwork(actualNetwork, deviceName + ".l0"), Exception); @@ -1290,7 +1298,7 @@ TEST_P(IEClassQueryNetworkTest, QueryNetworkWithInvalidDeviceIDThrows) { TEST_P(IEClassQueryNetworkTest, QueryNetworkHETEROWithBigDeviceIDThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName)) { ASSERT_THROW(ie.QueryNetwork(actualNetwork, CommonTestUtils::DEVICE_HETERO, @@ -1305,7 +1313,7 @@ TEST_P(IEClassQueryNetworkTest, QueryNetworkHETEROWithBigDeviceIDThrows) { // TEST_P(IEClassLoadNetworkTest, LoadNetworkHETEROWithDeviceIDNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName)) { auto deviceIDs = ie.GetMetric(deviceName, METRIC_KEY(AVAILABLE_DEVICES)).as>(); @@ -1320,7 +1328,7 @@ TEST_P(IEClassLoadNetworkTest, LoadNetworkHETEROWithDeviceIDNoThrow) { TEST_P(IEClassLoadNetworkTest, LoadNetworkWithDeviceIDNoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName)) { auto deviceIDs = ie.GetMetric(deviceName, METRIC_KEY(AVAILABLE_DEVICES)).as>(); @@ -1334,7 +1342,7 @@ TEST_P(IEClassLoadNetworkTest, LoadNetworkWithDeviceIDNoThrow) { TEST_P(IEClassLoadNetworkTest, LoadNetworkWithBigDeviceIDThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName)) { ASSERT_THROW(ie.LoadNetwork(actualNetwork, deviceName + ".10"), Exception); @@ -1345,7 +1353,7 @@ TEST_P(IEClassLoadNetworkTest, LoadNetworkWithBigDeviceIDThrows) { TEST_P(IEClassLoadNetworkTest, LoadNetworkWithInvalidDeviceIDThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName)) { ASSERT_THROW(ie.LoadNetwork(actualNetwork, deviceName + ".l0"), Exception); @@ -1356,7 +1364,7 @@ TEST_P(IEClassLoadNetworkTest, LoadNetworkWithInvalidDeviceIDThrows) { TEST_P(IEClassLoadNetworkTest, LoadNetworkHETEROWithBigDeviceIDThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName)) { ASSERT_THROW(ie.LoadNetwork(actualNetwork, "HETERO", @@ -1368,7 +1376,7 @@ TEST_P(IEClassLoadNetworkTest, LoadNetworkHETEROWithBigDeviceIDThrows) { TEST_P(IEClassLoadNetworkTest, LoadNetworkHETEROAndDeviceIDThrows) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName)) { ASSERT_THROW(ie.LoadNetwork(actualNetwork, CommonTestUtils::DEVICE_HETERO, @@ -1385,7 +1393,7 @@ TEST_P(IEClassLoadNetworkTest, LoadNetworkHETEROAndDeviceIDThrows) { TEST_P(IEClassLoadNetworkTest, LoadNetworkHETEROwithMULTINoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName) && supportsAvaliableDevices(ie, deviceName)) { std::string devices; auto availableDevices = ie.GetMetric(deviceName, METRIC_KEY(AVAILABLE_DEVICES)).as>(); @@ -1406,7 +1414,7 @@ TEST_P(IEClassLoadNetworkTest, LoadNetworkHETEROwithMULTINoThrow) { TEST_P(IEClassLoadNetworkTest, LoadNetworkMULTIwithHETERONoThrow) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName) && supportsAvaliableDevices(ie, deviceName)) { std::string devices; @@ -1431,7 +1439,7 @@ TEST_P(IEClassLoadNetworkTest, LoadNetworkMULTIwithHETERONoThrow) { TEST_P(IEClassLoadNetworkTest, QueryNetworkHETEROWithMULTINoThrow_V10) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName) && supportsAvaliableDevices(ie, deviceName)) { std::string devices; @@ -1466,7 +1474,7 @@ TEST_P(IEClassLoadNetworkTest, QueryNetworkHETEROWithMULTINoThrow_V10) { TEST_P(IEClassLoadNetworkTest, QueryNetworkMULTIWithHETERONoThrow_V10) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); if (supportsDeviceID(ie, deviceName) && supportsAvaliableDevices(ie, deviceName)) { std::string devices; @@ -1500,7 +1508,7 @@ TEST_P(IEClassLoadNetworkTest, QueryNetworkMULTIWithHETERONoThrow_V10) { TEST_P(IEClassLoadNetworkAfterCoreRecreateTest, LoadAfterRecreateCoresAndPlugins) { SKIP_IF_CURRENT_TEST_IS_DISABLED(); - Core ie; + Core ie = createCoreWithTemplate(); { auto versions = ie.GetVersions(std::string(CommonTestUtils::DEVICE_MULTI) + ":" + deviceName + "," + CommonTestUtils::DEVICE_CPU); ASSERT_EQ(3, versions.size()); @@ -1510,7 +1518,7 @@ TEST_P(IEClassLoadNetworkAfterCoreRecreateTest, LoadAfterRecreateCoresAndPlugins config.insert({"CPU_THREADS_NUM", "3"}); } ASSERT_NO_THROW({ - Core ie; + Core ie = createCoreWithTemplate(); std::string name = actualNetwork.getInputsInfo().begin()->first; actualNetwork.getInputsInfo().at(name)->setPrecision(Precision::U8); auto executableNetwork = ie.LoadNetwork(actualNetwork, deviceName, config); diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/add_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/add_transformation.hpp index 1908d91413d..37151d0b1ba 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/add_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/add_transformation.hpp @@ -22,7 +22,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, AddTestValues > AddTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/clamp_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/clamp_transformation.hpp index de7b31c9558..e11672d4973 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/clamp_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/clamp_transformation.hpp @@ -19,7 +19,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, ClampTransformationParam diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_transformation.hpp index 093944bf956..11aeb6701dd 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_transformation.hpp @@ -20,7 +20,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ConcatTransformationTestValues> ConcatTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_child_and_output.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_child_and_output.hpp index 4c96976db6f..2ae292c8002 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_child_and_output.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_child_and_output.hpp @@ -19,7 +19,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, // target device: CPU, GPU ConcatWithChildAndOutputTransformationParam, ngraph::pass::low_precision::LayerTransformation::Params // transformation parameters diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_different_precision_on_children.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_different_precision_on_children.hpp index 50ea25c73d2..385ba9216df 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_different_precision_on_children.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_different_precision_on_children.hpp @@ -19,7 +19,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, // target device: CPU, GPU ConcatWithDifferentChildrenTransformationParam, ngraph::pass::low_precision::LayerTransformation::Params, // transformation parameters diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_intermediate_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_intermediate_transformation.hpp index c560455b1c0..a0881a3950a 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_intermediate_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_intermediate_transformation.hpp @@ -13,7 +13,7 @@ namespace LayerTestsDefinitions { typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, // target device: CPU, GPU ngraph::pass::low_precision::LayerTransformation::Params, // transformation parameters bool, // transparent intermediate diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_neighbors_graph_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_neighbors_graph_transformation.hpp index f3235572fb3..c77dd2cb490 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_neighbors_graph_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_neighbors_graph_transformation.hpp @@ -13,7 +13,7 @@ namespace LayerTestsDefinitions { typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params> ConcatNeighboringGraphTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_split_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_split_transformation.hpp index f1d973410c5..2dfd8560650 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_split_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/concat_with_split_transformation.hpp @@ -19,7 +19,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ConcatWithSplitTransformationParam, ngraph::pass::low_precision::LayerTransformation::Params> ConcatWithSplitTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/convolution_backprop_data_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/convolution_backprop_data_transformation.hpp index 8b690e2df2e..738854ae315 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/convolution_backprop_data_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/convolution_backprop_data_transformation.hpp @@ -43,7 +43,7 @@ public: typedef std::tuple< ngraph::element::Type, // netPrecision - std::pair, // input shape and shape support flag + std::pair, // input shape and shape support flag ngraph::Shape, // outputShape std::string, // targetDevice ngraph::pass::low_precision::LayerTransformation::Params, diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/convolution_qdq_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/convolution_qdq_transformation.hpp index c3e7ea4c9e1..371349f7d55 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/convolution_qdq_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/convolution_qdq_transformation.hpp @@ -47,7 +47,7 @@ inline std::ostream& operator<<(std::ostream& out, const ConvolutionQDqTransform typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, ConvolutionQDqTransformationParam diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/depth_to_space_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/depth_to_space_transformation.hpp index d634e062e12..8b385dca96e 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/depth_to_space_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/depth_to_space_transformation.hpp @@ -13,7 +13,7 @@ namespace LayerTestsDefinitions { typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::opset1::DepthToSpace::DepthToSpaceMode, size_t> DepthToSpaceTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_and_avg_pool_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_and_avg_pool_transformation.hpp index d7967203b7c..ed182705f2d 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_and_avg_pool_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_and_avg_pool_transformation.hpp @@ -14,7 +14,7 @@ namespace LayerTestsDefinitions { typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, ngraph::builder::subgraph::FakeQuantizeOnData> FakeQuantizeAndAvgPoolTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_and_max_pool_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_and_max_pool_transformation.hpp index 3644960ef1e..29a85a20d26 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_and_max_pool_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_and_max_pool_transformation.hpp @@ -14,7 +14,7 @@ namespace LayerTestsDefinitions { typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, ngraph::builder::subgraph::FakeQuantizeOnData> FakeQuantizeAndMaxPoolTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.hpp index be686035361..03a75530d23 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.hpp @@ -22,7 +22,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, FakeQuantizeAndTwoOutputBranchesWithConvolution diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_precision_selection_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_precision_selection_transformation.hpp index 9b99e2f6f09..8f0da855be7 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_precision_selection_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_precision_selection_transformation.hpp @@ -50,7 +50,7 @@ inline std::ostream& operator<<(std::ostream& out, const FakeQuantizePrecisionSe typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, FakeQuantizePrecisionSelectionTransformationTestValues> FakeQuantizeTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_transformation.hpp index f2b82386c5e..c43672edd57 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_transformation.hpp @@ -20,7 +20,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, FakeQuantizeTransformationParam> FakeQuantizeTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.hpp index 7978fc26da6..10521951e6c 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.hpp @@ -50,7 +50,7 @@ inline std::ostream& operator<<(std::ostream& out, const FakeQuantizeWithNotOpti // ngraph::builder::subgraph::FakeQuantizeOnData typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, FakeQuantizeWithNotOptimalTransformationTestValues> FakeQuantizeTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fully_connected_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fully_connected_transformation.hpp index 4e4d56bc01c..8e273f825de 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fully_connected_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fully_connected_transformation.hpp @@ -11,8 +11,8 @@ class MatMulShapes { public: - ngraph::Shape inputA; - ngraph::Shape inputB; + ngraph::PartialShape inputA; + ngraph::PartialShape inputB; bool transposeA; bool transposeB; }; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_convert_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_convert_transformation.hpp index cacacd09bd9..9e87a6ecb09 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_convert_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_convert_transformation.hpp @@ -17,7 +17,7 @@ namespace LayerTestsDefinitions { typedef std::tuple < element::Type, - Shape, + PartialShape, std::string, ngraph::builder::subgraph::DequantizationOperations, bool> FuseConvertTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_fake_quantize_and_scale_shift_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_fake_quantize_and_scale_shift_transformation.hpp index 4b5ce627f6e..0d5036bb8e7 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_fake_quantize_and_scale_shift_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_fake_quantize_and_scale_shift_transformation.hpp @@ -13,7 +13,7 @@ namespace LayerTestsDefinitions { typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, ngraph::builder::subgraph::FakeQuantizeOnData> FuseFakeQuantizeAndScaleShiftTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_fake_quantize_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_fake_quantize_transformation.hpp index 84679690d53..0ef83d52947 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_fake_quantize_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_fake_quantize_transformation.hpp @@ -26,7 +26,7 @@ public: ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fakeQuantizeOnData; }; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; Actual actual; }; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_multiply_to_fake_quantize_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_multiply_to_fake_quantize_transformation.hpp index 21d5024e8bb..d1ce8a01e5b 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_multiply_to_fake_quantize_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_multiply_to_fake_quantize_transformation.hpp @@ -22,7 +22,7 @@ public: ngraph::builder::subgraph::DequantizationOperations dequantization; }; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; Actual actual; }; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_subtract_to_fake_quantize_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_subtract_to_fake_quantize_transformation.hpp index 3dab656bcca..6c88512ea9b 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_subtract_to_fake_quantize_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/fuse_subtract_to_fake_quantize_transformation.hpp @@ -22,7 +22,7 @@ public: ngraph::builder::subgraph::DequantizationOperations dequantization; }; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; Actual actual; }; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/gemm_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/gemm_transformation.hpp index 90eb782daac..0e54077bb83 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/gemm_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/gemm_transformation.hpp @@ -13,7 +13,7 @@ namespace LayerTestsDefinitions { typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params> GemmTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/group_convolution_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/group_convolution_transformation.hpp index b7d92417182..506763418d8 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/group_convolution_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/group_convolution_transformation.hpp @@ -15,7 +15,7 @@ namespace LayerTestsDefinitions { class GroupConvolutionTransformationParam { public: - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::Shape outputShape; size_t group; int groupCalculationDimention; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/groupconvolution_qdq_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/groupconvolution_qdq_transformation.hpp index 6caa548bc72..99dffb4714f 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/groupconvolution_qdq_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/groupconvolution_qdq_transformation.hpp @@ -51,7 +51,7 @@ inline std::ostream& operator<<(std::ostream& out, const GroupConvolutionQDqTran typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, GroupConvolutionQDqTransformationParam diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/interpolate_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/interpolate_transformation.hpp index 6a643ee2650..83311f46929 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/interpolate_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/interpolate_transformation.hpp @@ -37,7 +37,7 @@ public: typedef std::tuple< ngraph::element::Type, - std::pair, + std::pair, std::string, interpAttributes> InterpolateTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mat_mul_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mat_mul_transformation.hpp index 65022a7bbaf..37f8d88151b 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mat_mul_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mat_mul_transformation.hpp @@ -25,7 +25,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, MatMulTransformationTestValues> MatMulTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mat_mul_with_constant_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mat_mul_with_constant_transformation.hpp index ed0ef0e9967..6c058727d69 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mat_mul_with_constant_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mat_mul_with_constant_transformation.hpp @@ -19,7 +19,7 @@ namespace LayerTestsDefinitions { class MatMulWithConstantTransformationTestValues { public: - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::builder::subgraph::FakeQuantizeOnDataWithConstant fqOnData; ngraph::builder::subgraph::Constant weights; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.hpp index 71d175006ce..ddb24903d3f 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.hpp @@ -20,7 +20,7 @@ public: typedef std::tuple< ngraph::element::Type, - std::pair, + std::pair, std::string, MatMulWithOptimizedConstantFakeQuantizeTransformationTestValues > MatMulWithOptimizedConstantFakeQuantizeTransformationTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/multiply_to_group_convolution_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/multiply_to_group_convolution_transformation.hpp index ee49b11d892..29827eeb0d9 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/multiply_to_group_convolution_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/multiply_to_group_convolution_transformation.hpp @@ -17,7 +17,7 @@ namespace LayerTestsDefinitions { typedef std::tuple < element::Type, - Shape, + PartialShape, std::string, builder::subgraph::FakeQuantizeOnData> MultiplyToGroupConvolutionTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/multiply_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/multiply_transformation.hpp index 63d4d527f13..db868f7438e 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/multiply_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/multiply_transformation.hpp @@ -23,7 +23,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, MultiplyTestValues > MultiplyTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/multiply_with_one_parent_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/multiply_with_one_parent_transformation.hpp index a2dea7f9ec6..4fa9d821e30 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/multiply_with_one_parent_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/multiply_with_one_parent_transformation.hpp @@ -19,7 +19,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, MultiplyWithOneParentTransformationValues > MultiplyWithOneParentTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mvn_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mvn_transformation.hpp index 6bb4fdcaf92..ac01efe9895 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mvn_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/mvn_transformation.hpp @@ -16,7 +16,7 @@ namespace LayerTestsDefinitions { typedef std::tuple < element::Type, - Shape, + PartialShape, std::string, AxisSet, bool> MVNTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/normalize_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/normalize_transformation.hpp index 8edae228202..fefecb17bec 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/normalize_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/normalize_transformation.hpp @@ -14,7 +14,7 @@ namespace LayerTestsDefinitions { typedef std::tuple < ngraph::element::Type, - std::pair, + std::pair, std::string, std::vector, bool, diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/prelu_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/prelu_transformation.hpp index a46ffef511e..493edfe3182 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/prelu_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/prelu_transformation.hpp @@ -19,7 +19,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, PReluTestValues> PReluTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/pull_reshape_through_dequantization_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/pull_reshape_through_dequantization_transformation.hpp index 61292175942..198a879ff30 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/pull_reshape_through_dequantization_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/pull_reshape_through_dequantization_transformation.hpp @@ -36,7 +36,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, ngraph::Shape, diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_max_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_max_transformation.hpp index 7a14601aebe..911b3d13f4f 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_max_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_max_transformation.hpp @@ -20,7 +20,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, ReduceMaxTransformationParam diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_mean_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_mean_transformation.hpp index 1e4e79c9551..5ea34628530 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_mean_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_mean_transformation.hpp @@ -19,7 +19,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, ReduceMeanTransformationParam diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_min_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_min_transformation.hpp index 74a2d90fc14..a52e4df34eb 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_min_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_min_transformation.hpp @@ -20,7 +20,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, ReduceMinTransformationParam diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_sum_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_sum_transformation.hpp index 4bb6e8ea38d..ec7af415c10 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_sum_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reduce_sum_transformation.hpp @@ -20,7 +20,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, ReduceSumTransformationParam diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/relu_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/relu_transformation.hpp index 064aedd1c84..5155fd8f32b 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/relu_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/relu_transformation.hpp @@ -19,7 +19,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ReluTestValues> ReluTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reshape_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reshape_transformation.hpp index 47d8a1876fd..912066a6e35 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reshape_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/reshape_transformation.hpp @@ -14,7 +14,7 @@ namespace LayerTestsDefinitions { class ReshapeTransformationParam { public: - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::vector reshapeConstValues; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize; bool isTransformed; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/shuffle_channels_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/shuffle_channels_transformation.hpp index 217eb2f7ea9..8439211c839 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/shuffle_channels_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/shuffle_channels_transformation.hpp @@ -23,7 +23,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, ShuffleChannelsTransformationParam diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/split_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/split_transformation.hpp index 6598bdfb59b..adcae0a25d8 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/split_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/split_transformation.hpp @@ -17,7 +17,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, SplitTransformationParam diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/squeeze_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/squeeze_transformation.hpp index b8aa50a11ce..4ddb1178f1e 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/squeeze_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/squeeze_transformation.hpp @@ -16,7 +16,7 @@ class SqueezeTransformationParam { public: ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize; std::vector squeezeAxes; - ngraph::Shape shape; + ngraph::PartialShape shape; }; std::string stringifySqueezeArgs(const std::vector& axes); diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/strided_slice_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/strided_slice_transformation.hpp index 321a5bb3716..c2e769e1b04 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/strided_slice_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/strided_slice_transformation.hpp @@ -24,7 +24,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, StridedSliceTransformationParam diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/subtract_multiply_to_multiply_add_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/subtract_multiply_to_multiply_add_transformation.hpp index 2a1cc62a91e..19fa50096be 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/subtract_multiply_to_multiply_add_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/subtract_multiply_to_multiply_add_transformation.hpp @@ -14,7 +14,7 @@ namespace LayerTestsDefinitions { class SubtractMultiplyToMultiplyAddTransformationTestValues { public: - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::element::Type precision; ngraph::builder::subgraph::FakeQuantizeOnData fqOnData; }; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/subtract_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/subtract_transformation.hpp index 5743a49d885..43a58471a94 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/subtract_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/subtract_transformation.hpp @@ -13,7 +13,7 @@ namespace LayerTestsDefinitions { typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params > SubtractTransformationParams; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/transpose_after_matmul_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/transpose_after_matmul_transformation.hpp index 6c73e0198ff..f2258619b7f 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/transpose_after_matmul_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/transpose_after_matmul_transformation.hpp @@ -13,7 +13,7 @@ namespace LayerTestsDefinitions { typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, bool, diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/transpose_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/transpose_transformation.hpp index 8701bdc2b2d..6e26c6d6e7b 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/transpose_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/transpose_transformation.hpp @@ -14,7 +14,7 @@ namespace LayerTestsDefinitions { class TransposeTransformationTestValues { public: - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::vector transposeConstValues; ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::element::Type precisionBeforeFq; diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/unsqueeze_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/unsqueeze_transformation.hpp index 416640b06df..3abee33a5b1 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/unsqueeze_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/unsqueeze_transformation.hpp @@ -16,7 +16,7 @@ class UnsqueezeTransformationParam { public: ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize; std::vector unsqueezeAxes; - ngraph::Shape shape; + ngraph::PartialShape shape; }; typedef std::tuple< diff --git a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/variadic_split_transformation.hpp b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/variadic_split_transformation.hpp index 44205e2c703..5f4665940fd 100644 --- a/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/variadic_split_transformation.hpp +++ b/inference-engine/tests/functional/plugin/shared/include/low_precision_transformations/variadic_split_transformation.hpp @@ -17,7 +17,7 @@ public: typedef std::tuple< ngraph::element::Type, - ngraph::Shape, + ngraph::PartialShape, std::string, ngraph::pass::low_precision::LayerTransformation::Params, VariadicSplitTransformationParam diff --git a/inference-engine/tests/functional/plugin/shared/src/behavior/cpp_holders.cpp b/inference-engine/tests/functional/plugin/shared/src/behavior/cpp_holders.cpp index f253ee322bf..49d955c25f6 100644 --- a/inference-engine/tests/functional/plugin/shared/src/behavior/cpp_holders.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/behavior/cpp_holders.cpp @@ -8,6 +8,13 @@ #include "behavior/cpp_holders.hpp" namespace BehaviorTestsDefinitions { + inline InferenceEngine::Core createCoreWithTemplate() { + InferenceEngine::Core ie; + std::string pluginName = "templatePlugin"; + pluginName += IE_BUILD_POSTFIX; + ie.RegisterPlugin(pluginName, "TEMPLATE"); + return ie; + } std::string HoldersTest::getTestCaseName(testing::TestParamInfo obj) { std::string targetDevice; std::vector order; @@ -47,7 +54,7 @@ namespace BehaviorTestsDefinitions { void release_order_test(std::vector order, const std::string &deviceName, std::shared_ptr function) { InferenceEngine::CNNNetwork cnnNet(function); - InferenceEngine::Core core; + InferenceEngine::Core core = createCoreWithTemplate(); auto exe_net = core.LoadNetwork(cnnNet, deviceName); auto request = exe_net.CreateInferRequest(); std::vector states = {}; @@ -60,7 +67,7 @@ namespace BehaviorTestsDefinitions { auto release = [&](int i) { switch (i) { case 0: - core = InferenceEngine::Core{}; + core = createCoreWithTemplate(); break; case 1: exe_net = {}; @@ -84,7 +91,7 @@ namespace BehaviorTestsDefinitions { std::vector order, const std::string &deviceName, std::shared_ptr function) { InferenceEngine::CNNNetwork cnnNet(function); - InferenceEngine::Core core; + InferenceEngine::Core core = createCoreWithTemplate(); std::stringstream stream; { auto exe_net = core.LoadNetwork(cnnNet, deviceName); @@ -142,7 +149,7 @@ namespace BehaviorTestsDefinitions { TEST_P(HoldersTestOnImportedNetwork, CreateRequestWithCoreRemoved) { InferenceEngine::CNNNetwork cnnNet(function); - InferenceEngine::Core core; + InferenceEngine::Core core = createCoreWithTemplate(); std::stringstream stream; { auto exe_net = core.LoadNetwork(cnnNet, targetDevice); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/add_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/add_transformation.cpp index cffa033cc1b..2448bf7984f 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/add_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/add_transformation.cpp @@ -18,7 +18,7 @@ namespace LayerTestsDefinitions { std::string AddTransformation::getTestCaseName(testing::TestParamInfo< AddTransformationParams> obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); AddTestValues param; @@ -50,7 +50,7 @@ std::string AddTransformation::getTestCaseName(testing::TestParamInfo< AddTransf void AddTransformation::SetUp() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; AddTestValues param; std::tie(precision, inputShape, targetDevice, param) = this->GetParam(); @@ -64,7 +64,7 @@ void AddTransformation::SetUp() { void AddTransformation::validate() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; AddTestValues param; std::tie(precision, inputShape, targetDevice, param) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/clamp_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/clamp_transformation.cpp index 7c0a07aeb0d..d23da32cc56 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/clamp_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/clamp_transformation.cpp @@ -14,7 +14,7 @@ namespace LayerTestsDefinitions { std::string ClampTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ClampTransformationParam param;; @@ -30,7 +30,7 @@ std::string ClampTransformation::getTestCaseName(testing::TestParamInfoGetParam(); @@ -47,7 +47,7 @@ void ClampTransformation::SetUp() { void ClampTransformation::validate() { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ClampTransformationParam param; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_transformation.cpp index 0b4d3bfb1d9..a2e6f85c705 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_transformation.cpp @@ -18,7 +18,7 @@ namespace LayerTestsDefinitions { std::string ConcatTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type precision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ConcatTransformationTestValues testValues; std::tie(precision, inputShapes, targetDevice, testValues) = obj.param; @@ -31,7 +31,7 @@ std::string ConcatTransformation::getTestCaseName(testing::TestParamInfoGetParam(); @@ -63,7 +63,7 @@ void ConcatTransformation::SetUp() { void ConcatTransformation::validate() { ngraph::element::Type precision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ConcatTransformationTestValues testValues; std::tie(precision, inputShapes, targetDevice, testValues) = GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_child_and_output.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_child_and_output.cpp index 0d3bf4acfef..debf6671ec0 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_child_and_output.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_child_and_output.cpp @@ -21,7 +21,7 @@ namespace LayerTestsDefinitions { std::string ConcatWithChildAndOutputTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ConcatWithChildAndOutputTransformationParam param; ngraph::pass::low_precision::LayerTransformation::Params params; @@ -47,7 +47,7 @@ std::string ConcatWithChildAndOutputTransformation::getTestCaseName(testing::Tes void ConcatWithChildAndOutputTransformation::SetUp() { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; ConcatWithChildAndOutputTransformationParam param; ngraph::pass::low_precision::LayerTransformation::Params params; std::tie(netPrecision, inputShapes, targetDevice, param, params) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_different_precision_on_children.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_different_precision_on_children.cpp index 7688d4e7a8b..c74d9740871 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_different_precision_on_children.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_different_precision_on_children.cpp @@ -21,7 +21,7 @@ namespace LayerTestsDefinitions { std::string ConcatWithDifferentChildrenTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ConcatWithDifferentChildrenTransformationParam param; ngraph::pass::low_precision::LayerTransformation::Params params; @@ -38,7 +38,7 @@ std::string ConcatWithDifferentChildrenTransformation::getTestCaseName(testing:: InferenceEngine::Blob::Ptr ConcatWithDifferentChildrenTransformation::GenerateInput(const InferenceEngine::InputInfo &info) const { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ConcatWithDifferentChildrenTransformationParam param; ngraph::pass::low_precision::LayerTransformation::Params params; @@ -51,7 +51,7 @@ InferenceEngine::Blob::Ptr ConcatWithDifferentChildrenTransformation::GenerateIn void ConcatWithDifferentChildrenTransformation::SetUp() { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; ConcatWithDifferentChildrenTransformationParam param; ngraph::pass::low_precision::LayerTransformation::Params params; bool multiChannel; @@ -65,7 +65,7 @@ void ConcatWithDifferentChildrenTransformation::SetUp() { void ConcatWithDifferentChildrenTransformation::validate() { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ConcatWithDifferentChildrenTransformationParam param; ngraph::pass::low_precision::LayerTransformation::Params params; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_intermediate_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_intermediate_transformation.cpp index 2bf15a14c32..12f3bf17565 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_intermediate_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_intermediate_transformation.cpp @@ -21,7 +21,7 @@ namespace LayerTestsDefinitions { std::string ConcatWithIntermediateTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; bool transparentIntermediate; @@ -39,7 +39,7 @@ std::string ConcatWithIntermediateTransformation::getTestCaseName(testing::TestP InferenceEngine::Blob::Ptr ConcatWithIntermediateTransformation::GenerateInput(const InferenceEngine::InputInfo &info) const { ngraph::element::Type netPrecision; - InferenceEngine::SizeVector inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params trasformationParams; bool transparentIntermediate; @@ -60,7 +60,7 @@ InferenceEngine::Blob::Ptr ConcatWithIntermediateTransformation::GenerateInput(c void ConcatWithIntermediateTransformation::SetUp() { ngraph::element::Type ngPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params trasformationParams; bool transparentIntermediate; bool multichannel; @@ -78,7 +78,7 @@ void ConcatWithIntermediateTransformation::SetUp() { void ConcatWithIntermediateTransformation::validate() { ngraph::element::Type netPrecision; - InferenceEngine::SizeVector inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; bool transparentIntermediate; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_neighbors_graph_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_neighbors_graph_transformation.cpp index 912982c2ea6..2c7c1a100fa 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_neighbors_graph_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_neighbors_graph_transformation.cpp @@ -18,7 +18,7 @@ namespace LayerTestsDefinitions { std::string ConcatWithNeighborsGraphTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type precision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; std::tie(precision, inputShapes, targetDevice, params) = obj.param; @@ -28,7 +28,7 @@ std::string ConcatWithNeighborsGraphTransformation::getTestCaseName(testing::Tes InferenceEngine::Blob::Ptr ConcatWithNeighborsGraphTransformation::GenerateInput(const InferenceEngine::InputInfo &info) const { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; std::tie(netPrecision, inputShape, targetDevice, params) = this->GetParam(); @@ -43,7 +43,7 @@ InferenceEngine::Blob::Ptr ConcatWithNeighborsGraphTransformation::GenerateInput void ConcatWithNeighborsGraphTransformation::SetUp() { threshold = 2.e-2; ngraph::element::Type ngPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; std::tie(ngPrecision, inputShape, targetDevice, params) = this->GetParam(); @@ -61,7 +61,7 @@ void ConcatWithNeighborsGraphTransformation::SetUp() { void ConcatWithNeighborsGraphTransformation::validate() { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; std::tie(netPrecision, inputShape, targetDevice, params) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_split_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_split_transformation.cpp index 3c67dd1b729..728656b4e28 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_split_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/concat_with_split_transformation.cpp @@ -21,7 +21,7 @@ namespace LayerTestsDefinitions { std::string ConcatWithSplitTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ConcatWithSplitTransformationParam param; ngraph::pass::low_precision::LayerTransformation::Params params; @@ -34,7 +34,7 @@ std::string ConcatWithSplitTransformation::getTestCaseName(testing::TestParamInf InferenceEngine::Blob::Ptr ConcatWithSplitTransformation::GenerateInput(const InferenceEngine::InputInfo &info) const { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ConcatWithSplitTransformationParam param; ngraph::pass::low_precision::LayerTransformation::Params params; @@ -54,7 +54,7 @@ InferenceEngine::Blob::Ptr ConcatWithSplitTransformation::GenerateInput(const In void ConcatWithSplitTransformation::SetUp() { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; ConcatWithSplitTransformationParam param; ngraph::pass::low_precision::LayerTransformation::Params params; std::tie(netPrecision, inputShapes, targetDevice, param, params) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_backprop_data_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_backprop_data_transformation.cpp index c8d15a5702e..913ec3e39a6 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_backprop_data_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_backprop_data_transformation.cpp @@ -14,7 +14,7 @@ namespace LayerTestsDefinitions { std::string ConvolutionBackpropDataTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - std::pair inputShape; + std::pair inputShape; ngraph::Shape outputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; @@ -34,7 +34,7 @@ void ConvolutionBackpropDataTransformation::SetUp() { threshold = 0.1f; ngraph::element::Type netPrecision; - std::pair inputShapeAndHandling; + std::pair inputShapeAndHandling; ngraph::Shape outputShape; ngraph::pass::low_precision::LayerTransformation::Params params; ConvolutionBackpropDataTransformationParam param; @@ -43,14 +43,18 @@ void ConvolutionBackpropDataTransformation::SetUp() { std::shared_ptr weights; const auto inputShape = inputShapeAndHandling.first; + ngraph::Shape weightsShape(4, 1ul); + weightsShape[0] = inputShape[1].get_length(); + weightsShape[1] = inputShape[1].get_length() / 2; + if (!param.fakeQuantizeOnWeights.empty()) { weights = ngraph::builder::subgraph::ConvolutionBackpropDataFunction::getWeights( - ngraph::Shape{inputShape[1], inputShape[1] / 2, 1, 1}, + weightsShape, netPrecision, param.fakeQuantizeOnWeights); } else { weights = ngraph::builder::subgraph::ConvolutionBackpropDataFunction::getWeights( - ngraph::Shape{inputShape[1], inputShape[1] / 2, 1, 1}, + weightsShape, netPrecision, param.dequantizationOnWeights); } diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_qdq_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_qdq_transformation.cpp index a55cc05d284..d90427b904b 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_qdq_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_qdq_transformation.cpp @@ -22,7 +22,7 @@ namespace LayerTestsDefinitions { std::string ConvolutionQDqTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ConvolutionQDqTransformationParam param; @@ -37,7 +37,7 @@ void ConvolutionQDqTransformation::SetUp() { // threshold = 0.1f; ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; ConvolutionQDqTransformationParam param; std::tie(netPrecision, inputShape, targetDevice, params, param) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_transformation.cpp index f6e0a544fde..221a7cd8a2a 100755 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_transformation.cpp @@ -22,7 +22,7 @@ namespace LayerTestsDefinitions { std::string ConvolutionTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ConvolutionTransformationParam param; @@ -39,7 +39,7 @@ void ConvolutionTransformation::SetUp() { threshold = 0.1f; ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; ConvolutionTransformationParam param; std::tie(netPrecision, inputShape, targetDevice, params, param) = this->GetParam(); @@ -68,7 +68,7 @@ void ConvolutionTransformation::Run() { void ConvolutionTransformation::validate() { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ConvolutionTransformationParam param; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_with_incorrect_weights.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_with_incorrect_weights.cpp index 63087b13a43..89d05397da3 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_with_incorrect_weights.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/convolution_with_incorrect_weights.cpp @@ -22,7 +22,7 @@ namespace LayerTestsDefinitions { std::string ConvolutionWIthIncorrectWeightsTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ConvolutionWIthIncorrectWeightsParam param; @@ -40,7 +40,7 @@ void ConvolutionWIthIncorrectWeightsTransformation::SetUp() { threshold = 0.1f; ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; ConvolutionWIthIncorrectWeightsParam param; std::tie(netPrecision, inputShape, targetDevice, params, param) = this->GetParam(); @@ -57,7 +57,7 @@ void ConvolutionWIthIncorrectWeightsTransformation::SetUp() { void ConvolutionWIthIncorrectWeightsTransformation::validate() { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ConvolutionWIthIncorrectWeightsParam param; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/depth_to_space_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/depth_to_space_transformation.cpp index f3169ba9c60..28df2617b6a 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/depth_to_space_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/depth_to_space_transformation.cpp @@ -39,7 +39,7 @@ std::string DepthToSpaceTransformation::getTestCaseName(testing::TestParamInfoGetParam(); - if (inputShape.size() != 4ul) { - IE_THROW() << "not supported input shape size " << inputShape.size(); + if (inputShape.rank().is_dynamic() || inputShape.rank().get_length() != 4) { + IE_THROW() << "not supported input shape size " << inputShape.rank(); } function = ngraph::builder::subgraph::DepthToSpaceFunction::getOriginal(precision, inputShape, mode, blockSize); @@ -71,7 +71,7 @@ void DepthToSpaceTransformation::SetUp() { void DepthToSpaceTransformation::validate() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; DepthToSpace::DepthToSpaceMode mode; size_t blockSize; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_avg_pool_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_avg_pool_transformation.cpp index 368a0265dff..de0e5715300 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_avg_pool_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_avg_pool_transformation.cpp @@ -18,7 +18,7 @@ namespace LayerTestsDefinitions { std::string FakeQuantizeAndAvgPoolTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type precision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize; @@ -30,7 +30,7 @@ std::string FakeQuantizeAndAvgPoolTransformation::getTestCaseName(testing::TestP void FakeQuantizeAndAvgPoolTransformation::SetUp() { threshold = 0.5f; ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize; std::tie(precision, inputShape, targetDevice, params, fakeQuantize) = this->GetParam(); @@ -46,7 +46,7 @@ void FakeQuantizeAndAvgPoolTransformation::SetUp() { void FakeQuantizeAndAvgPoolTransformation::validate() { ngraph::element::Type precision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_max_pool_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_max_pool_transformation.cpp index eda5c291126..f71a4a6bba9 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_max_pool_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_max_pool_transformation.cpp @@ -18,7 +18,7 @@ namespace LayerTestsDefinitions { std::string FakeQuantizeAndMaxPoolTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type precision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize; @@ -29,7 +29,7 @@ std::string FakeQuantizeAndMaxPoolTransformation::getTestCaseName(testing::TestP void FakeQuantizeAndMaxPoolTransformation::SetUp() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize; std::tie(precision, inputShape, targetDevice, params, fakeQuantize) = this->GetParam(); @@ -45,7 +45,7 @@ void FakeQuantizeAndMaxPoolTransformation::SetUp() { void FakeQuantizeAndMaxPoolTransformation::validate() { ngraph::element::Type precision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp index 6c1d90e537d..1ee2255a1ad 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_and_two_output_branches_with_convolution.cpp @@ -22,7 +22,7 @@ namespace LayerTestsDefinitions { std::string FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation::getTestCaseName( testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; FakeQuantizeAndTwoOutputBranchesWithConvolution testValues; @@ -38,7 +38,7 @@ std::string FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation::getTe void FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation::SetUp() { threshold = 0.1f; ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; FakeQuantizeAndTwoOutputBranchesWithConvolution testValues; std::tie(netPrecision, inputShape, targetDevice, params, testValues) = this->GetParam(); @@ -55,7 +55,7 @@ void FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation::SetUp() { void FakeQuantizeAndTwoOutputBranchesWithConvolutionTransformation::validate() { ngraph::element::Type precision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; FakeQuantizeAndTwoOutputBranchesWithConvolution testValues; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_precision_selection_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_precision_selection_transformation.cpp index bb2acd8bd64..321da6f49bb 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_precision_selection_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_precision_selection_transformation.cpp @@ -17,7 +17,7 @@ namespace LayerTestsDefinitions { std::string FakeQuantizePrecisionSelectionTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; FakeQuantizePrecisionSelectionTransformationTestValues testValues; @@ -30,7 +30,7 @@ std::string FakeQuantizePrecisionSelectionTransformation::getTestCaseName(testin void FakeQuantizePrecisionSelectionTransformation::SetUp() { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; FakeQuantizePrecisionSelectionTransformationTestValues testValues; std::tie(netPrecision, inputShape, targetDevice, params, testValues) = this->GetParam(); @@ -50,7 +50,7 @@ void FakeQuantizePrecisionSelectionTransformation::SetUp() { void FakeQuantizePrecisionSelectionTransformation::validate() { ngraph::element::Type precision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; FakeQuantizePrecisionSelectionTransformationTestValues param; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_transformation.cpp index 4f14e33a757..25d5f3760dd 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_transformation.cpp @@ -19,7 +19,7 @@ namespace LayerTestsDefinitions { std::string FakeQuantizeTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; FakeQuantizeTransformationParam testParams; @@ -32,7 +32,7 @@ std::string FakeQuantizeTransformation::getTestCaseName(testing::TestParamInfoGetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp index 9667650a641..4f726d8e217 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fake_quantize_with_dq_not_optimal_transformation.cpp @@ -17,7 +17,7 @@ namespace LayerTestsDefinitions { std::string FakeQuantizeWithNotOptimalTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; FakeQuantizeWithNotOptimalTransformationTestValues testValues; @@ -29,7 +29,7 @@ std::string FakeQuantizeWithNotOptimalTransformation::getTestCaseName(testing::T } void FakeQuantizeWithNotOptimalTransformation::SetUp() { - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::element::Type netPrecision; ngraph::pass::low_precision::LayerTransformation::Params params; FakeQuantizeWithNotOptimalTransformationTestValues testValues; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fuse_convert_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fuse_convert_transformation.cpp index 84ddf440f32..0682f617127 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fuse_convert_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/fuse_convert_transformation.cpp @@ -23,7 +23,7 @@ namespace LayerTestsDefinitions { std::string FuseConvertTransformation::getTestCaseName(testing::TestParamInfo obj) { std::string targetDevice; - ngraph::Shape shape; + ngraph::PartialShape shape; ngraph::element::Type precision; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); ngraph::builder::subgraph::DequantizationOperations deqOperations; @@ -37,7 +37,7 @@ std::string FuseConvertTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantizeOnData; @@ -29,7 +29,7 @@ std::string FuseFakeQuantizeAndScaleShiftTransformation::getTestCaseName(testing void FuseFakeQuantizeAndScaleShiftTransformation::SetUp() { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantizeOnData; std::tie(netPrecision, inputShape, targetDevice, params, fakeQuantizeOnData) = this->GetParam(); @@ -45,7 +45,7 @@ void FuseFakeQuantizeAndScaleShiftTransformation::SetUp() { void FuseFakeQuantizeAndScaleShiftTransformation::validate() { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantizeOnData; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/gemm_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/gemm_transformation.cpp index aabc93f115a..0657458f6be 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/gemm_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/gemm_transformation.cpp @@ -23,7 +23,7 @@ namespace LayerTestsDefinitions { std::string GemmTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; std::tie(netPrecision, inputShape, targetDevice, params) = obj.param; @@ -33,7 +33,7 @@ std::string GemmTransformation::getTestCaseName(testing::TestParamInfoGetParam(); @@ -51,7 +51,7 @@ void GemmTransformation::SetUp() { void GemmTransformation::validate() { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; std::tie(netPrecision, inputShape, targetDevice, params) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/groupconvolution_qdq_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/groupconvolution_qdq_transformation.cpp index 454581e8b8a..40c4afae04f 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/groupconvolution_qdq_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/groupconvolution_qdq_transformation.cpp @@ -22,7 +22,7 @@ namespace LayerTestsDefinitions { std::string GroupConvolutionQDqTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; GroupConvolutionQDqTransformationParam param; @@ -37,7 +37,7 @@ void GroupConvolutionQDqTransformation::SetUp() { // threshold = 0.1f; ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; GroupConvolutionQDqTransformationParam param; std::tie(netPrecision, inputShape, targetDevice, params, param) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/interpolate_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/interpolate_transformation.cpp index 983e8ddb642..5df9c905c9e 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/interpolate_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/interpolate_transformation.cpp @@ -30,7 +30,7 @@ inline std::ostream& operator<<(std::ostream& os, const std::vector& values) std::string InterpolateTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type precision; - std::pair shapes; + std::pair shapes; std::string targetDevice; interpAttributes attributes; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); @@ -51,7 +51,7 @@ std::string InterpolateTransformation::getTestCaseName(testing::TestParamInfo shapes; + std::pair shapes; interpAttributes attributes; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); std::tie(precision, shapes, targetDevice, attributes) = this->GetParam(); @@ -71,7 +71,7 @@ void InterpolateTransformation::SetUp() { void InterpolateTransformation::validate() { ngraph::element::Type precision; - std::pair shapes; + std::pair shapes; std::string targetDevice; interpAttributes attributes; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/mat_mul_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/mat_mul_transformation.cpp index 60a785ac920..cba7e5c048a 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/mat_mul_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/mat_mul_transformation.cpp @@ -21,7 +21,7 @@ namespace LayerTestsDefinitions { std::string MatMulTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; MatMulTransformationTestValues testValues; std::tie(precision, inputShape, targetDevice, testValues) = obj.param; @@ -60,7 +60,7 @@ InferenceEngine::Blob::Ptr MatMulTransformation::GenerateInput(const InferenceEn void MatMulTransformation::SetUp() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; MatMulTransformationTestValues testValues; std::tie(precision, inputShape, targetDevice, testValues) = this->GetParam(); @@ -77,7 +77,7 @@ void MatMulTransformation::SetUp() { void MatMulTransformation::validate() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; MatMulTransformationTestValues testValues; std::tie(precision, inputShape, targetDevice, testValues) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.cpp index da706b482f7..6aa6de62656 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/mat_mul_with_optimized_constant_fake_quantize_transformation.cpp @@ -23,7 +23,7 @@ namespace LayerTestsDefinitions { std::string MatMulWithOptimizedConstantFakeQuantizeTransformation::getTestCaseName( testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - std::pair shapes; + std::pair shapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; MatMulWithOptimizedConstantFakeQuantizeTransformationTestValues param; @@ -32,7 +32,7 @@ std::string MatMulWithOptimizedConstantFakeQuantizeTransformation::getTestCaseNa std::ostringstream result; result << netPrecision << "_" << - CommonTestUtils::vec2str(shapes.first) << "_" << CommonTestUtils::vec2str(shapes.second) << "_" << + shapes.first << "_" << shapes.second << "_" << targetDevice << "_" << param.fqOnData << "_" << param.fqOnWeights; @@ -43,7 +43,7 @@ void MatMulWithOptimizedConstantFakeQuantizeTransformation::SetUp() { threshold = 0.01f; ngraph::element::Type precision; - std::pair shapes; + std::pair shapes; ngraph::pass::low_precision::LayerTransformation::Params params; MatMulWithOptimizedConstantFakeQuantizeTransformationTestValues param; std::tie(precision, shapes, targetDevice, param) = this->GetParam(); @@ -60,7 +60,7 @@ void MatMulWithOptimizedConstantFakeQuantizeTransformation::SetUp() { void MatMulWithOptimizedConstantFakeQuantizeTransformation::validate() { ngraph::element::Type precision; - std::pair shapes; + std::pair shapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; MatMulWithOptimizedConstantFakeQuantizeTransformationTestValues param; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/multiply_to_group_convolution_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/multiply_to_group_convolution_transformation.cpp index 6ef2bb26eb4..f9d62e4e172 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/multiply_to_group_convolution_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/multiply_to_group_convolution_transformation.cpp @@ -24,7 +24,7 @@ namespace LayerTestsDefinitions { std::string MultiplyToGroupConvolutionTransformation::getTestCaseName(testing::TestParamInfo obj) { std::string targetDevice; ngraph::element::Type precision; - ngraph::Shape shape; + ngraph::PartialShape shape; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); builder::subgraph::FakeQuantizeOnData fqOnData; std::tie(precision, shape, targetDevice, fqOnData) = obj.param; @@ -35,7 +35,7 @@ std::string MultiplyToGroupConvolutionTransformation::getTestCaseName(testing::T } void MultiplyToGroupConvolutionTransformation::SetUp() { - ngraph::Shape shape; + ngraph::PartialShape shape; ngraph::element::Type precision; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); builder::subgraph::FakeQuantizeOnData fqOnData; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/multiply_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/multiply_transformation.cpp index b2e9e9bdf59..48c0ea0f042 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/multiply_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/multiply_transformation.cpp @@ -19,7 +19,7 @@ namespace LayerTestsDefinitions { std::string MultiplyTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type precision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); MultiplyTestValues param; @@ -51,7 +51,7 @@ std::string MultiplyTransformation::getTestCaseName(testing::TestParamInfoGetParam(); @@ -68,7 +68,7 @@ void MultiplyTransformation::SetUp() { void MultiplyTransformation::validate() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; MultiplyTestValues param; std::tie(precision, inputShape, targetDevice, param) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/multiply_with_one_parent_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/multiply_with_one_parent_transformation.cpp index ab16aa4c14b..34a78299be7 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/multiply_with_one_parent_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/multiply_with_one_parent_transformation.cpp @@ -17,14 +17,14 @@ namespace LayerTestsDefinitions { std::string MultiplyWithOneParentTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; MultiplyWithOneParentTransformationValues values; std::tie(netPrecision, inputShape, targetDevice, values) = obj.param; std::ostringstream result; - result << netPrecision << "_" << CommonTestUtils::vec2str(inputShape); + result << netPrecision << "_" << inputShape; return result.str(); } @@ -32,7 +32,7 @@ void MultiplyWithOneParentTransformation::SetUp() { threshold = 0.01f; ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; MultiplyWithOneParentTransformationValues values; std::tie(netPrecision, inputShape, targetDevice, values) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/mvn_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/mvn_transformation.cpp index 6c7afd6f970..383f0a62a12 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/mvn_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/mvn_transformation.cpp @@ -23,7 +23,7 @@ namespace LayerTestsDefinitions { std::string MVNTransformation::getTestCaseName(testing::TestParamInfo obj) { std::string targetDevice; - ngraph::Shape shape; + ngraph::PartialShape shape; ngraph::element::Type precision; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); ngraph::AxisSet reductionAxes; @@ -37,7 +37,7 @@ std::string MVNTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - std::pair shapes; + std::pair shapes; std::string targetDevice; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); std::vector axes; @@ -45,7 +45,7 @@ std::string NormalizeL2Transformation::getTestCaseName(testing::TestParamInfo shapes; + std::pair shapes; ngraph::element::Type precision; auto params = LayerTestsUtils::LayerTransformationParamsNGraphFactory::createParamsU8I8(); std::vector axes; @@ -66,7 +66,7 @@ void NormalizeL2Transformation::SetUp() { void NormalizeL2Transformation::validate() { ngraph::element::Type precision; - std::pair shapes; + std::pair shapes; std::string targetDevice; std::vector axes; bool fuseMultiply; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/prelu_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/prelu_transformation.cpp index 125de3e4ff0..56bbbe8a5ae 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/prelu_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/prelu_transformation.cpp @@ -17,7 +17,7 @@ namespace LayerTestsDefinitions { std::string PReluTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; PReluTestValues testValues; std::tie(precision, inputShape, targetDevice, testValues) = obj.param; @@ -33,7 +33,7 @@ std::string PReluTransformation::getTestCaseName(testing::TestParamInfoGetParam(); @@ -48,7 +48,7 @@ InferenceEngine::Blob::Ptr PReluTransformation::GenerateInput(const InferenceEng void PReluTransformation::SetUp() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; PReluTestValues testValues; std::tie(precision, inputShape, targetDevice, testValues) = this->GetParam(); @@ -60,7 +60,7 @@ void PReluTransformation::SetUp() { void PReluTransformation::validate() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; PReluTestValues testValues; std::tie(precision, inputShape, targetDevice, testValues) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp index fa9cdeeba90..2824a2adc3c 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/pull_reshape_through_dequantization_transformation.cpp @@ -22,7 +22,7 @@ namespace LayerTestsDefinitions { std::string PullReshapeThroughDequantizationTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::Shape elementwiseConstantShapes; @@ -45,7 +45,7 @@ void PullReshapeThroughDequantizationTransformation::SetUp() { // threshold = 0.1f; ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; ngraph::Shape elementwiseConstantShapes; PullReshapeThroughDequantizationTestValues testValues; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/reduce_max_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/reduce_max_transformation.cpp index b458d5055d9..3c7830a2c49 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/reduce_max_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/reduce_max_transformation.cpp @@ -14,7 +14,7 @@ namespace LayerTestsDefinitions { std::string ReduceMaxTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ReduceMaxTransformationParam param;; @@ -32,7 +32,7 @@ std::string ReduceMaxTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ReduceMeanTransformationParam param;; @@ -32,7 +32,7 @@ std::string ReduceMeanTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ReduceMinTransformationParam param;; @@ -32,7 +32,7 @@ std::string ReduceMinTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ReduceSumTransformationParam param;; @@ -32,7 +32,7 @@ std::string ReduceSumTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ReluTestValues testValues; std::tie(precision, inputShape, targetDevice, testValues) = obj.param; @@ -33,7 +33,7 @@ std::string ReluTransformation::getTestCaseName(testing::TestParamInfoGetParam(); @@ -48,7 +48,7 @@ InferenceEngine::Blob::Ptr ReluTransformation::GenerateInput(const InferenceEngi void ReluTransformation::SetUp() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ReluTestValues testValues; std::tie(precision, inputShape, targetDevice, testValues) = this->GetParam(); @@ -60,7 +60,7 @@ void ReluTransformation::SetUp() { void ReluTransformation::validate() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ReluTestValues testValues; std::tie(precision, inputShape, targetDevice, testValues) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/shuffle_channels_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/shuffle_channels_transformation.cpp index 06d502a69d8..476f30b6ad1 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/shuffle_channels_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/shuffle_channels_transformation.cpp @@ -20,7 +20,7 @@ namespace LayerTestsDefinitions { std::string ShuffleChannelsTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; ShuffleChannelsTransformationParam param; @@ -34,7 +34,7 @@ std::string ShuffleChannelsTransformation::getTestCaseName(testing::TestParamInf void ShuffleChannelsTransformation::SetUp() { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; ShuffleChannelsTransformationParam param; std::tie(netPrecision, inputShape, targetDevice, params, param) = this->GetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/split_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/split_transformation.cpp index 7c9eb6e8379..95316108aa9 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/split_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/split_transformation.cpp @@ -17,7 +17,7 @@ namespace LayerTestsDefinitions { std::string SplitTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; SplitTransformationParam param; @@ -31,7 +31,7 @@ std::string SplitTransformation::getTestCaseName(testing::TestParamInfoGetParam(); @@ -64,7 +64,7 @@ void SplitTransformation::SetUp() { void SplitTransformation::validate() { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; SplitTransformationParam param; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/strided_slice_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/strided_slice_transformation.cpp index a0c4d48a9c2..9712ebf0121 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/strided_slice_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/strided_slice_transformation.cpp @@ -26,7 +26,7 @@ inline std::ostream& operator<<(std::ostream& os, const std::vector& va std::string StridedSliceTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; StridedSliceTransformationParam param;; @@ -42,7 +42,7 @@ std::string StridedSliceTransformation::getTestCaseName(testing::TestParamInfoGetParam(); @@ -65,7 +65,7 @@ void StridedSliceTransformation::SetUp() { void StridedSliceTransformation::validate() { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; StridedSliceTransformationParam param; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/subtract_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/subtract_transformation.cpp index afb24897f82..55841cc8760 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/subtract_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/subtract_transformation.cpp @@ -19,7 +19,7 @@ namespace LayerTestsDefinitions { std::string SubtractTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; std::tie(netPrecision, inputShapes, targetDevice, params) = obj.param; @@ -29,7 +29,7 @@ std::string SubtractTransformation::getTestCaseName(testing::TestParamInfoGetParam(); diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/transpose_after_matmul_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/transpose_after_matmul_transformation.cpp index d6682af481b..7135ab31f31 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/transpose_after_matmul_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/transpose_after_matmul_transformation.cpp @@ -23,7 +23,7 @@ namespace LayerTestsDefinitions { std::string TransposeAfterMatMulTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; bool perTensor; @@ -39,7 +39,7 @@ std::string TransposeAfterMatMulTransformation::getTestCaseName(testing::TestPar void TransposeAfterMatMulTransformation::SetUp() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; bool perTensor; bool transposeChannelDim; @@ -52,7 +52,7 @@ void TransposeAfterMatMulTransformation::SetUp() { void TransposeAfterMatMulTransformation::validate() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; bool perTensor; diff --git a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/variadic_split_transformation.cpp b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/variadic_split_transformation.cpp index 5c5444ee0fd..10ed9808061 100644 --- a/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/variadic_split_transformation.cpp +++ b/inference-engine/tests/functional/plugin/shared/src/low_precision_transformations/variadic_split_transformation.cpp @@ -17,7 +17,7 @@ namespace LayerTestsDefinitions { std::string VariadicSplitTransformation::getTestCaseName(testing::TestParamInfo obj) { ngraph::element::Type netPrecision; - ngraph::Shape inputShapes; + ngraph::PartialShape inputShapes; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; VariadicSplitTransformationParam param; @@ -38,7 +38,7 @@ std::string VariadicSplitTransformation::getTestCaseName(testing::TestParamInfo< InferenceEngine::Blob::Ptr VariadicSplitTransformation::GenerateInput(const InferenceEngine::InputInfo& info) const { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; VariadicSplitTransformationParam param; @@ -54,7 +54,7 @@ InferenceEngine::Blob::Ptr VariadicSplitTransformation::GenerateInput(const Infe void VariadicSplitTransformation::SetUp() { ngraph::element::Type precision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; ngraph::pass::low_precision::LayerTransformation::Params params; VariadicSplitTransformationParam param; std::tie(precision, inputShape, targetDevice, params, param) = this->GetParam(); @@ -71,7 +71,7 @@ void VariadicSplitTransformation::SetUp() { void VariadicSplitTransformation::validate() { ngraph::element::Type netPrecision; - ngraph::Shape inputShape; + ngraph::PartialShape inputShape; std::string targetDevice; ngraph::pass::low_precision::LayerTransformation::Params params; VariadicSplitTransformationParam param; diff --git a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/base/layer_test_utils.hpp b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/base/layer_test_utils.hpp index 9d132515743..72172e69924 100644 --- a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/base/layer_test_utils.hpp +++ b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/base/layer_test_utils.hpp @@ -101,7 +101,7 @@ public: double diff = static_cast(absoluteDifference) / max; if (max == 0 || (diff > static_cast(threshold)) || std::isnan(static_cast(res)) || std::isnan(static_cast(ref))) { - IE_THROW() << "Relative comparison of values expected: " << ref << " and actual: " << res + IE_THROW() << "Relative comparison of values expected: " << std::to_string(ref) << " and actual: " << std::to_string(res) << " at index " << i << " with threshold " << threshold << " failed"; } diff --git a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/base/low_precision_transformations/layer_transformation.hpp b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/base/low_precision_transformations/layer_transformation.hpp index 298c03f4e30..942e836d828 100644 --- a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/base/low_precision_transformations/layer_transformation.hpp +++ b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/base/low_precision_transformations/layer_transformation.hpp @@ -57,7 +57,7 @@ protected: static std::string getTestCaseNameByParams( const ngraph::element::Type precision, - const ngraph::Shape& inputShapes, + const ngraph::PartialShape& inputShapes, const std::string& targetDevice, const ngraph::pass::low_precision::LayerTransformation::Params& params); }; diff --git a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/normalize_l2.hpp b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/normalize_l2.hpp index 833f6ef0591..c0740d48f40 100644 --- a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/normalize_l2.hpp +++ b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/normalize_l2.hpp @@ -29,7 +29,7 @@ public: protected: void SetUp() override; + InferenceEngine::Blob::Ptr GenerateInput(const InferenceEngine::InputInfo &info) const override; }; } // namespace LayerTestsDefinitions - diff --git a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/prior_box_clustered.hpp b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/prior_box_clustered.hpp index 37f06fa3373..bc3411f5e4d 100644 --- a/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/prior_box_clustered.hpp +++ b/inference-engine/tests/functional/shared_test_classes/include/shared_test_classes/single_layer/prior_box_clustered.hpp @@ -34,6 +34,7 @@ typedef std::tuple< bool, // clip float, // step_width float, // step_height + float, // step float, // offset std::vector> priorBoxClusteredSpecificParams; @@ -63,6 +64,7 @@ protected: std::vector variances; float step_width; float step_height; + float step; float offset; bool clip; diff --git a/inference-engine/tests/functional/shared_test_classes/src/base/low_precision_transformations/layer_transformation.cpp b/inference-engine/tests/functional/shared_test_classes/src/base/low_precision_transformations/layer_transformation.cpp index 3a6dd4dc4ea..a3e110a9f97 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/base/low_precision_transformations/layer_transformation.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/base/low_precision_transformations/layer_transformation.cpp @@ -103,7 +103,7 @@ std::string LayerTransformation::getTestCaseNameByParams( std::string LayerTransformation::getTestCaseNameByParams( const ngraph::element::Type precision, - const ngraph::Shape& inputShapes, + const ngraph::PartialShape& inputShapes, const std::string& targetDevice, const ngraph::pass::low_precision::LayerTransformation::Params& params) { std::ostringstream result; diff --git a/inference-engine/tests/functional/shared_test_classes/src/single_layer/normalize_l2.cpp b/inference-engine/tests/functional/shared_test_classes/src/single_layer/normalize_l2.cpp index 58fd09d41d1..a7816e39571 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/single_layer/normalize_l2.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/single_layer/normalize_l2.cpp @@ -25,6 +25,17 @@ std::string NormalizeL2LayerTest::getTestCaseName(testing::TestParamInfo axes; @@ -34,7 +45,9 @@ void NormalizeL2LayerTest::SetUp() { std::tie(axes, eps, epsMode, inputShape, netPrecision, targetDevice) = this->GetParam(); auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision); auto params = ngraph::builder::makeParams(ngPrc, {inputShape}); - auto norm = ngraph::builder::makeNormalizeL2(params[0], axes, eps, epsMode); + auto data_input = params[0]; + data_input->set_friendly_name("data"); + auto norm = ngraph::builder::makeNormalizeL2(data_input, axes, eps, epsMode); ngraph::ResultVector results{std::make_shared(norm)}; function = std::make_shared(results, params, "NormalizeL2"); } diff --git a/inference-engine/tests/functional/shared_test_classes/src/single_layer/prior_box_clustered.cpp b/inference-engine/tests/functional/shared_test_classes/src/single_layer/prior_box_clustered.cpp index 45c608f9887..c2a599b1133 100644 --- a/inference-engine/tests/functional/shared_test_classes/src/single_layer/prior_box_clustered.cpp +++ b/inference-engine/tests/functional/shared_test_classes/src/single_layer/prior_box_clustered.cpp @@ -20,13 +20,14 @@ std::string PriorBoxClusteredLayerTest::getTestCaseName(const testing::TestParam targetDevice) = obj.param; std::vector widths, heights, variances; - float step_width, step_height, offset; + float step_width, step_height, step, offset; bool clip; std::tie(widths, heights, clip, step_width, step_height, + step, offset, variances) = specParams; @@ -49,9 +50,10 @@ std::string PriorBoxClusteredLayerTest::getTestCaseName(const testing::TestParam result << CommonTestUtils::vec2str(variances) << separator; result << "stepWidth=" << step_width << separator; result << "stepHeight=" << step_height << separator; + result << "step=" << step << separator; result << "offset=" << offset << separator; - result << "clip=" << std::boolalpha << clip << separator; - result << "trgDev=" << targetDevice; + result << "clip=" << std::boolalpha << clip << separator; + result << "trgDev=" << targetDevice; return result.str(); } @@ -66,6 +68,7 @@ void PriorBoxClusteredLayerTest::SetUp() { clip, step_width, step_height, + step, offset, variances) = specParams; @@ -78,6 +81,7 @@ void PriorBoxClusteredLayerTest::SetUp() { attributes.clip = clip; attributes.step_widths = step_width; attributes.step_heights = step_height; + attributes.step = step; attributes.offset = offset; attributes.variances = variances; diff --git a/inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py b/inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py index 3241dfd7013..469a3aa9e8e 100644 --- a/inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py +++ b/inference-engine/tests/ie_test_utils/functional_test_utils/layer_tests_summary/utils/constants.py @@ -62,7 +62,9 @@ VERIFIED_OP_REFERENCES = [ 'NonMaxSuppression-4', 'NonMaxSuppression-5', 'NonZero-3', + 'NormalizeL2-1', 'PriorBox-1', + 'PriorBoxClustered-1', 'Proposal-1', 'Proposal-4', 'PSROIPooling-1', diff --git a/inference-engine/tests/ie_test_utils/functional_test_utils/src/plugin_cache.cpp b/inference-engine/tests/ie_test_utils/functional_test_utils/src/plugin_cache.cpp index 95b8e29eff4..95c7e18a181 100644 --- a/inference-engine/tests/ie_test_utils/functional_test_utils/src/plugin_cache.cpp +++ b/inference-engine/tests/ie_test_utils/functional_test_utils/src/plugin_cache.cpp @@ -49,6 +49,13 @@ std::shared_ptr PluginCache::ie(const std::string &device } assert(0 != ie_core.use_count()); + // register template plugin if it is needed + try { + std::string pluginName = "templatePlugin"; + pluginName += IE_BUILD_POSTFIX; + ie_core->RegisterPlugin(pluginName, "TEMPLATE"); + } catch (...) {} + if (!deviceToCheck.empty()) { std::vector metrics = ie_core->GetMetric(deviceToCheck, METRIC_KEY(SUPPORTED_METRICS)); @@ -61,11 +68,13 @@ std::shared_ptr PluginCache::ie(const std::string &device std::exit(EXIT_FAILURE); } +#ifndef NDEBUG std::cout << "Available devices for " << deviceToCheck << ":" << std::endl; for (const auto &device : availableDevices) { std::cout << " " << device << std::endl; } +#endif } } return ie_core; diff --git a/inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_icnn_network.hpp b/inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_icnn_network.hpp index a3f7d337dd0..3d157842b4d 100644 --- a/inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_icnn_network.hpp +++ b/inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_icnn_network.hpp @@ -48,4 +48,8 @@ class MockICNNNetwork final : public InferenceEngine::ICNNNetwork { (const, noexcept)); MOCK_METHOD(InferenceEngine::StatusCode, serialize, (const std::string &, const std::string &, InferenceEngine::ResponseDesc*), (const, noexcept)); + MOCK_METHOD(InferenceEngine::StatusCode, serialize, + (std::ostream &, std::ostream &, InferenceEngine::ResponseDesc*), (const, noexcept)); + MOCK_METHOD(InferenceEngine::StatusCode, serialize, + (std::ostream &, InferenceEngine::Blob::Ptr &, InferenceEngine::ResponseDesc*), (const, noexcept)); }; diff --git a/inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_not_empty_icnn_network.hpp b/inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_not_empty_icnn_network.hpp index f9ffeab2f2d..d861ded519a 100644 --- a/inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_not_empty_icnn_network.hpp +++ b/inference-engine/tests/ie_test_utils/unit_test_utils/mocks/mock_not_empty_icnn_network.hpp @@ -43,6 +43,10 @@ public: MOCK_METHOD(StatusCode, reshape, (const ICNNNetwork::InputShapes &, ResponseDesc *), (noexcept)); MOCK_METHOD(StatusCode, serialize, (const std::string &, const std::string &, InferenceEngine::ResponseDesc*), (const, noexcept)); + MOCK_METHOD(StatusCode, serialize, + (std::ostream &, std::ostream &, InferenceEngine::ResponseDesc*), (const, noexcept)); + MOCK_METHOD(StatusCode, serialize, + (std::ostream &, Blob::Ptr &, InferenceEngine::ResponseDesc*), (const, noexcept)); }; IE_SUPPRESS_DEPRECATED_END diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/add_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/add_function.hpp index aa9cb1e0e71..b0b4e9ad693 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/add_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/add_function.hpp @@ -71,7 +71,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const bool broadcast, const ngraph::builder::subgraph::FakeQuantizeOnData& fqOnData1, const ngraph::builder::subgraph::FakeQuantizeOnData& fqOnData2); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/avg_pool_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/avg_pool_function.hpp index c48330a806c..3b411e3621f 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/avg_pool_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/avg_pool_function.hpp @@ -27,7 +27,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData); static std::shared_ptr getReference( diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/clamp_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/clamp_function.hpp index c09cf4b60dd..e48f1aa0575 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/clamp_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/clamp_function.hpp @@ -27,7 +27,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize, const double clampLowConst, const double clampHighConst); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/concat_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/concat_function.hpp index 21b3289d513..e3456ad2a4b 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/concat_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/concat_function.hpp @@ -19,7 +19,7 @@ class ConcatFunction { public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantize1, const FakeQuantizeOnData& fakeQuantize2); @@ -31,7 +31,7 @@ public: static std::shared_ptr getOriginalWithChildAndOutput( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantize1, const FakeQuantizeOnData& fakeQuantize2); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/convolution_backprop_data_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/convolution_backprop_data_function.hpp index e276c15cc9e..77fd6d53cb9 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/convolution_backprop_data_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/convolution_backprop_data_function.hpp @@ -29,7 +29,7 @@ public: const std::shared_ptr& value = nullptr); static std::shared_ptr get( const element::Type netPrecision, - const Shape& inputShape, + const PartialShape& inputShape, const Shape& outputShape, const builder::subgraph::FakeQuantizeOnData& fqOnData, const std::shared_ptr& weights); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/convolution_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/convolution_function.hpp index 85ec80922a4..0bff29ac9c3 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/convolution_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/convolution_function.hpp @@ -34,7 +34,7 @@ public: bool isCrorrect); static std::shared_ptr getOriginalWithIncorrectWeights( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, ngraph::element::Type precision, ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights, ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantizeOnData, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/depth_to_space_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/depth_to_space_function.hpp index 6eb90026e19..2c24f740f7a 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/depth_to_space_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/depth_to_space_function.hpp @@ -21,7 +21,7 @@ class DepthToSpaceFunction { public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::opset1::DepthToSpace::DepthToSpaceMode mode, const size_t blockSize); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_and_convolution_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_and_convolution_function.hpp index a0c8718a5f3..8823779f613 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_and_convolution_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_and_convolution_function.hpp @@ -25,7 +25,7 @@ public: // TODO: move to ConvolutionFunction static std::shared_ptr get( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData, const FakeQuantizeOnWeights& fakeQuantizeOnWeights); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_and_two_output_branches_with_convolution_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_and_two_output_branches_with_convolution_function.hpp index 74c471a04b7..49f613818f8 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_and_two_output_branches_with_convolution_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_and_two_output_branches_with_convolution_function.hpp @@ -20,7 +20,7 @@ class FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction { public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fqOnData, const FakeQuantizeOnWeights fqOnWeights1, FakeQuantizeOnWeights fqOnWeights2); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_function.hpp index 3c2cda0e7fd..d1a212490da 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_function.hpp @@ -25,7 +25,7 @@ public: static std::shared_ptr getOriginalWithMaxPool( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData); static std::shared_ptr getReference( diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_precision_selection_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_precision_selection_function.hpp index f0775e4a383..18422faaf62 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_precision_selection_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fake_quantize_precision_selection_function.hpp @@ -35,7 +35,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ActualValues& values); static std::shared_ptr getReference( diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fuse_convert_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fuse_convert_function.hpp index 22d37e27962..0530422e097 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fuse_convert_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fuse_convert_function.hpp @@ -23,7 +23,7 @@ public: const bool constInput); static std::shared_ptr getWithFQ( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::element::Type inputPrecision, const ngraph::builder::subgraph::DequantizationOperations& dequantization, const bool constInput); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fuse_fake_quantize_and_scale_shift_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fuse_fake_quantize_and_scale_shift_function.hpp index 30c28261f01..2ac798cc0f2 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fuse_fake_quantize_and_scale_shift_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fuse_fake_quantize_and_scale_shift_function.hpp @@ -17,7 +17,7 @@ class FuseFakeQuantizeAndScaleShiftFunction { public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData); }; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fuse_fake_quantize_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fuse_fake_quantize_function.hpp index 9cb401132c5..4de97eb813b 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fuse_fake_quantize_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/fuse_fake_quantize_function.hpp @@ -46,7 +46,7 @@ public: const FakeQuantizeOnDataWithConstant& fqOnData); static std::shared_ptr get( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const std::vector& branches, const ngraph::element::Type precisionFqOnData, const FakeQuantizeOnData& fqOnData); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/group_convolution_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/group_convolution_function.hpp index dd9d8ae32a9..e4f4499e26c 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/group_convolution_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/group_convolution_function.hpp @@ -29,7 +29,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::Shape& outputShape, const size_t groupCount, const int groupCalculationDimention, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/interpolate_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/interpolate_function.hpp index 5ba5d38eeeb..b0fff2eedc4 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/interpolate_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/interpolate_function.hpp @@ -23,7 +23,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::Shape& outputShape, const ngraph::op::InterpolateAttrs& interpAttrs); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/mat_mul_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/mat_mul_function.hpp index 89bf9d29125..803eedaccae 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/mat_mul_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/mat_mul_function.hpp @@ -19,14 +19,14 @@ class MatMulFunction { public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape inputShape, + const ngraph::PartialShape inputShape, const float low, const float high); static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape inputShape1, - const ngraph::Shape inputShape2, + const ngraph::PartialShape inputShape1, + const ngraph::PartialShape inputShape2, const bool transpose1, const bool transpose2); @@ -75,7 +75,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnDataWithConstant& fqOnData, const Constant& weights, const FakeQuantizeOnDataWithConstant& fqOnWeights, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/mat_mul_with_optimized_constant_fake_quantize_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/mat_mul_with_optimized_constant_fake_quantize_function.hpp index e77c1e1d1cc..80b311b16a9 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/mat_mul_with_optimized_constant_fake_quantize_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/mat_mul_with_optimized_constant_fake_quantize_function.hpp @@ -16,8 +16,8 @@ class MatMulWithOptimizedConstantFakeQuantizeFunction { public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape1, - const ngraph::Shape& inputShape2, + const ngraph::PartialShape& inputShape1, + const ngraph::PartialShape& inputShape2, const FakeQuantizeOnData& fqOnData, const FakeQuantizeOnData& fqOnWeights); }; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/max_pool_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/max_pool_function.hpp index 268c23f9e14..330aa690401 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/max_pool_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/max_pool_function.hpp @@ -18,7 +18,7 @@ class MaxPoolFunction { public: static std::shared_ptr getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData); static std::shared_ptr get( diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/multiply_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/multiply_function.hpp index 0a4087f8c36..96c1b387e34 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/multiply_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/multiply_function.hpp @@ -45,7 +45,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const bool broadcast, const ngraph::builder::subgraph::FakeQuantizeOnData& fqOnData1, const ngraph::builder::subgraph::FakeQuantizeOnData& fqOnData2); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/multiply_to_group_convolution_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/multiply_to_group_convolution_function.hpp index 060ec7309f2..0c366a5637f 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/multiply_to_group_convolution_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/multiply_to_group_convolution_function.hpp @@ -25,7 +25,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fqOnData); static std::shared_ptr getReference( diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/multiply_with_one_parent_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/multiply_with_one_parent_function.hpp index 3aab5f89747..49dcc4f56c2 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/multiply_with_one_parent_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/multiply_with_one_parent_function.hpp @@ -16,7 +16,7 @@ class MultiplyWithOneParentFunction { public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantize); }; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/mvn_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/mvn_function.hpp index cba5c68893d..6fe7c6b2f79 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/mvn_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/mvn_function.hpp @@ -25,7 +25,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const AxisSet& reductionAxes, const bool& normalizeVariance); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/normalize_l2_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/normalize_l2_function.hpp index 41fdd7917d2..d37d2ddfd54 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/normalize_l2_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/normalize_l2_function.hpp @@ -21,7 +21,7 @@ class NormalizeL2Function { public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const std::pair& shapes, + const std::pair& shapes, const ngraph::element::Type precisionOnActivation, const std::vector& axes, const bool fuseMultiply, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/prelu_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/prelu_function.hpp index a098b4c8b17..d1bf93feac3 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/prelu_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/prelu_function.hpp @@ -20,7 +20,7 @@ public: const ngraph::builder::subgraph::DequantizationOperations& dequantization); static std::shared_ptr getOriginal( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::element::Type precisionBeforeFq, const FakeQuantizeOnData& fqOnData); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/reduce_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/reduce_function.hpp index deba5d14a34..c9f9162b8d6 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/reduce_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/reduce_function.hpp @@ -54,7 +54,7 @@ public: template static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::builder::subgraph::FakeQuantizeOnData& fqOnData, const std::vector& constantValues, const bool keepDims) { diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/relu_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/relu_function.hpp index d343899d5db..56b05246342 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/relu_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/relu_function.hpp @@ -20,7 +20,7 @@ public: const ngraph::builder::subgraph::DequantizationOperations& dequantization); static std::shared_ptr getOriginal( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::element::Type precisionBeforeFq, const FakeQuantizeOnData& fqOnData); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/reshape_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/reshape_function.hpp index 17ef54ed450..44d817051bd 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/reshape_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/reshape_function.hpp @@ -23,7 +23,7 @@ public: const ngraph::builder::subgraph::DequantizationOperations& dequantization); static std::shared_ptr getOriginal( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const std::vector& reshapeConstValues, const ngraph::element::Type precisionBeforeFq, const FakeQuantizeOnData& fqOnData); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/shuffle_channels_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/shuffle_channels_function.hpp index 0d9cc65fec9..8d1a87c11a9 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/shuffle_channels_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/shuffle_channels_function.hpp @@ -26,7 +26,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type inputPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::builder::subgraph::FakeQuantizeOnData& fqOnData, const std::int64_t axis, const std::int64_t group); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/split_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/split_function.hpp index 73b1ef7dfd8..4300fdd172c 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/split_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/split_function.hpp @@ -30,7 +30,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize, const int64_t splitedAxis, const size_t numSplit); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/squeeze_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/squeeze_function.hpp index dddf8e6802d..13f68240343 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/squeeze_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/squeeze_function.hpp @@ -22,7 +22,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData, const std::vector& axes); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/strided_slice_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/strided_slice_function.hpp index 3c048da6044..aaead6e245a 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/strided_slice_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/strided_slice_function.hpp @@ -32,7 +32,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type inputPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::builder::subgraph::FakeQuantizeOnData& fakeQuantize, const std::vector& begin, const std::vector& end, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/subtract_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/subtract_function.hpp index 2de725ca64e..c849d46b3f3 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/subtract_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/subtract_function.hpp @@ -19,7 +19,7 @@ class SubtractFunction { public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape); + const ngraph::PartialShape& inputShape); }; } // namespace subgraph diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/subtract_multiply_to_multiply_add_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/subtract_multiply_to_multiply_add_function.hpp index b88da01c183..4617455d674 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/subtract_multiply_to_multiply_add_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/subtract_multiply_to_multiply_add_function.hpp @@ -26,7 +26,7 @@ public: const ngraph::element::Type precisionAfterDequantization); static std::shared_ptr getOriginal( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::element::Type precision, const ngraph::builder::subgraph::FakeQuantizeOnData& fqOnData); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/transpose_after_mat_mul_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/transpose_after_mat_mul_function.hpp index e8a13074078..544444b7e2a 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/transpose_after_mat_mul_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/transpose_after_mat_mul_function.hpp @@ -19,7 +19,7 @@ class TransposeAfterMatMulFunction { public: static std::shared_ptr getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape); + const ngraph::PartialShape& inputShape); }; } // namespace subgraph diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/transpose_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/transpose_function.hpp index c61e67756e9..51de8537d7b 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/transpose_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/transpose_function.hpp @@ -23,7 +23,7 @@ public: const ngraph::builder::subgraph::DequantizationOperations& dequantization); static std::shared_ptr getOriginal( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const std::vector& transposeConstValues, const ngraph::element::Type precisionBeforeFq, const FakeQuantizeOnData& fqOnData); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/unsqueeze_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/unsqueeze_function.hpp index 2e450e56192..bc472fbad6d 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/unsqueeze_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/unsqueeze_function.hpp @@ -22,7 +22,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData, const std::vector& axes); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/variadic_split_function.hpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/variadic_split_function.hpp index 51bde4c9815..01bef64c4bf 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/variadic_split_function.hpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/include/lpt_ngraph_functions/variadic_split_function.hpp @@ -28,7 +28,7 @@ public: static std::shared_ptr getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize, const int64_t splitedAxis, const std::vector& splitLengths); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/add_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/add_function.cpp index 56aadb2a249..438af17ff92 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/add_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/add_function.cpp @@ -152,11 +152,11 @@ std::shared_ptr AddFunction::getOriginal( std::shared_ptr AddFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const bool broadcast, const ngraph::builder::subgraph::FakeQuantizeOnData& fqOnData1, const ngraph::builder::subgraph::FakeQuantizeOnData& fqOnData2) { - ngraph::Shape inputShape2 = inputShape; + ngraph::PartialShape inputShape2 = inputShape; if (broadcast) { inputShape2[2] = 1; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/avg_pool_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/avg_pool_function.cpp index cf22df3b01b..ea3bccd1322 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/avg_pool_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/avg_pool_function.cpp @@ -62,9 +62,9 @@ std::shared_ptr AvgPoolFunction::getOriginal( std::shared_ptr AvgPoolFunction::getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData) { - const auto input = std::make_shared(originalFunctionPrecision, ngraph::Shape(inputShape)); + const auto input = std::make_shared(originalFunctionPrecision, inputShape); const auto fakeQuantize = ngraph::builder::makeFakeQuantize( input, originalFunctionPrecision, fakeQuantizeOnData.quantizationLevel, fakeQuantizeOnData.constantShape, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/clamp_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/clamp_function.cpp index d61d9dbc359..cddaa740283 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/clamp_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/clamp_function.cpp @@ -33,7 +33,7 @@ std::shared_ptr ClampFunction::getOriginal( std::shared_ptr ClampFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize, const double clampLowConst, const double clampHighConst) { diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/concat_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/concat_function.cpp index 257f5535095..1b5a9d863a3 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/concat_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/concat_function.cpp @@ -20,15 +20,15 @@ using namespace ngraph::pass; std::shared_ptr ConcatFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fqOnData1, const FakeQuantizeOnData& fqOnData2) { const auto input1 = std::make_shared(precision, inputShape); input1->set_friendly_name("input1"); const auto fakeQuantize1 = makeFakeQuantize(input1, precision, fqOnData1); - const std::vector inputShape2 = inputShape; - const auto input2 = std::make_shared(precision, ngraph::Shape(inputShape2)); + const auto inputShape2 = inputShape; + const auto input2 = std::make_shared(precision, inputShape2); input2->set_friendly_name("input2"); const auto fakeQuantize2 = makeFakeQuantize(input2, precision, fqOnData2); @@ -79,7 +79,7 @@ std::shared_ptr ConcatFunction::getOriginal( std::shared_ptr ConcatFunction::getOriginalWithChildAndOutput( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fqOnData1, const FakeQuantizeOnData& fqOnData2) { const auto input1 = std::make_shared(precision, inputShape); @@ -87,8 +87,8 @@ std::shared_ptr ConcatFunction::getOriginalWithChildAndOutput( const auto fakeQuantize1 = makeFakeQuantize(input1, precision, fqOnData1); std::shared_ptr res1; - const std::vector inputShape2 = inputShape; - const auto input2 = std::make_shared(precision, ngraph::Shape(inputShape2)); + const auto inputShape2 = inputShape; + const auto input2 = std::make_shared(precision, inputShape2); input2->set_friendly_name("input2"); const auto fakeQuantize2 = makeFakeQuantize(input2, precision, fqOnData2); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_backprop_data_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_backprop_data_function.cpp index 8e78c677819..2e841c399d9 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_backprop_data_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_backprop_data_function.cpp @@ -24,7 +24,7 @@ namespace subgraph { std::shared_ptr ConvolutionBackpropDataFunction::get( const element::Type netPrecision, - const Shape& inputShape, + const PartialShape& inputShape, const Shape& outputShape, const builder::subgraph::FakeQuantizeOnData& fqOnData, const std::shared_ptr& weights) { diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_function.cpp index ea42797a427..2295010e12b 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/convolution_function.cpp @@ -122,20 +122,20 @@ std::shared_ptr ConvolutionFunction::getOriginalWithIncorrectW } std::shared_ptr ConvolutionFunction::getOriginalWithIncorrectWeights( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, ngraph::element::Type precision, ngraph::builder::subgraph::FakeQuantizeOnWeights fakeQuantizeOnWeights, ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantizeOnData, bool isCorrect) { - const auto input = std::make_shared(precision, ngraph::Shape(inputShape)); + const auto input = std::make_shared(precision, inputShape); const auto fqOnData = fakeQuantizeOnData.empty() ? nullptr : ngraph::builder::makeFakeQuantize( input, precision, fakeQuantizeOnData.quantizationLevel, fakeQuantizeOnData.constantShape, fakeQuantizeOnData.inputLowValues, fakeQuantizeOnData.inputHighValues, fakeQuantizeOnData.outputLowValues, fakeQuantizeOnData.outputHighValues); - const size_t inputChannelsCount = inputShape[1]; - const size_t outputChannelsCount = 2 * inputShape[1]; + const size_t inputChannelsCount = inputShape[1].get_length(); + const size_t outputChannelsCount = 2 * inputShape[1].get_length(); const auto weights = ngraph::opset1::Constant::create( precision, ngraph::Shape{ outputChannelsCount, inputChannelsCount, 1, 1 }, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/depth_to_space_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/depth_to_space_function.cpp index 8eb721f23df..6ec71836c8e 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/depth_to_space_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/depth_to_space_function.cpp @@ -13,7 +13,7 @@ namespace subgraph { std::shared_ptr DepthToSpaceFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::opset1::DepthToSpace::DepthToSpaceMode mode, const size_t blockSize) { const float low = 0.f; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_and_convolution_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_and_convolution_function.cpp index a70b40ff74d..88b70645bd7 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_and_convolution_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_and_convolution_function.cpp @@ -16,19 +16,19 @@ namespace subgraph { // TODO: remove, reuse mode extended method std::shared_ptr FakeQuantizeAndConvolutionFunction::get( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fqOnData, const FakeQuantizeOnWeights& fqOnWeights) { - const auto input = std::make_shared(precision, ngraph::Shape(inputShape)); + const auto input = std::make_shared(precision, inputShape); const auto fakeQuantizeOnActivations = fqOnData.empty() ? nullptr : ngraph::builder::makeFakeQuantize( input, precision, fqOnData.quantizationLevel, fqOnData.constantShape, fqOnData.inputLowValues, fqOnData.inputHighValues, fqOnData.outputLowValues, fqOnData.outputHighValues); - const size_t inputChannelsCount = inputShape[1]; - const size_t outputChannelsCount = 2 * inputShape[1]; + const size_t inputChannelsCount = inputShape[1].get_length(); + const size_t outputChannelsCount = 2 * inputShape[1].get_length(); const auto weights = ngraph::opset1::Constant::create( precision, ngraph::Shape{ outputChannelsCount, inputChannelsCount, 1, 1 }, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_and_two_output_branches_with_convolution_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_and_two_output_branches_with_convolution_function.cpp index 650e88b698c..c2283e33fd4 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_and_two_output_branches_with_convolution_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_and_two_output_branches_with_convolution_function.cpp @@ -16,12 +16,12 @@ namespace subgraph { std::shared_ptr createConvolution( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const std::shared_ptr& parent, const FakeQuantizeOnWeights& fqOnWeights, bool typeRelaxed) { - const size_t inputChannelsCount = inputShape[1]; - const size_t outputChannelsCount = 2 * inputShape[1]; + const size_t inputChannelsCount = inputShape[1].get_length(); + const size_t outputChannelsCount = 2 * inputShape[1].get_length(); const auto weights = ngraph::opset1::Constant::create( precision, ngraph::Shape{ outputChannelsCount, inputChannelsCount, 1, 1 }, @@ -56,7 +56,7 @@ std::shared_ptr createConvolution( std::shared_ptr FakeQuantizeAndTwoOutputBranchesWithConvolutionFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fqOnData, const FakeQuantizeOnWeights fqOnWeights1, FakeQuantizeOnWeights fqOnWeights2) { diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_function.cpp index 40554f46d65..e7ab4fe73ba 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_function.cpp @@ -22,9 +22,9 @@ using namespace ngraph::pass; std::shared_ptr FakeQuantizeFunction::getOriginalWithMaxPool( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData) { - const auto input = std::make_shared(precision, ngraph::Shape(inputShape)); + const auto input = std::make_shared(precision, inputShape); input->set_friendly_name("input"); const auto fakeQuantize = ngraph::builder::makeFakeQuantize( diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_precision_selection_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_precision_selection_function.cpp index 20c71967588..cb645f11401 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_precision_selection_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fake_quantize_precision_selection_function.cpp @@ -18,9 +18,9 @@ using namespace ngraph::pass; std::shared_ptr FakeQuantizePrecisionSelectionFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ActualValues& values) { - const auto input = std::make_shared(precision, ngraph::Shape(inputShape)); + const auto input = std::make_shared(precision, inputShape); input->set_friendly_name("input"); std::shared_ptr parent = input; @@ -48,8 +48,8 @@ std::shared_ptr FakeQuantizePrecisionSelectionFunction::getOri std::make_shared(element::f32, Shape{}, std::vector{ 0.01 })), element::f32); - const size_t inputChannelsCount = inputShape[1]; - const size_t outputChannelsCount = 2 * inputShape[1]; + const size_t inputChannelsCount = inputShape[1].get_length(); + const size_t outputChannelsCount = 2 * inputShape[1].get_length(); const auto weights = ngraph::opset1::Constant::create( precision, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fuse_convert_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fuse_convert_function.cpp index f4f4721267b..09f6577e6cc 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fuse_convert_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fuse_convert_function.cpp @@ -40,18 +40,18 @@ std::shared_ptr FuseConvertFunction::get( } std::shared_ptr FuseConvertFunction::getWithFQ( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::element::Type inputPrecision, const ngraph::builder::subgraph::DequantizationOperations& dequantization, const bool constInput) { std::shared_ptr parent; std::shared_ptr input1; if (constInput) { - parent = std::make_shared(inputPrecision, inputShape, std::vector{ 128.f }); + parent = std::make_shared(inputPrecision, inputShape.to_shape(), std::vector{ 128.f }); } else { input1 = std::make_shared( inputPrecision, - ngraph::Shape(inputShape)); + inputShape); parent = input1; } auto deqStructure = dequantization; @@ -60,7 +60,7 @@ std::shared_ptr FuseConvertFunction::getWithFQ( std::shared_ptr input2 = std::make_shared( inputPrecision, - ngraph::Shape(inputShape)); + inputShape); const auto fakeQuantizeOnActivations = ngraph::builder::makeFakeQuantize( input2, inputPrecision, 256ul, { 1ul }, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fuse_fake_quantize_and_scale_shift_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fuse_fake_quantize_and_scale_shift_function.cpp index 6bb28eff007..48126da8baf 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fuse_fake_quantize_and_scale_shift_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fuse_fake_quantize_and_scale_shift_function.cpp @@ -15,9 +15,9 @@ using namespace ngraph::pass; std::shared_ptr FuseFakeQuantizeAndScaleShiftFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData) { - const auto input = std::make_shared(precision, ngraph::Shape(inputShape)); + const auto input = std::make_shared(precision, inputShape); input->set_friendly_name("input"); const std::shared_ptr fakeQuantize = ngraph::builder::makeFakeQuantize( diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fuse_fake_quantize_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fuse_fake_quantize_function.cpp index 0ba9bdc5fd9..9befe458858 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fuse_fake_quantize_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/fuse_fake_quantize_function.cpp @@ -86,7 +86,7 @@ std::shared_ptr FuseFakeQuantizeFunction::getOriginal( } std::shared_ptr FuseFakeQuantizeFunction::get( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const std::vector& branches, const ngraph::element::Type precisionFqOnData, const FakeQuantizeOnData& fqOnData) { @@ -101,7 +101,7 @@ std::shared_ptr FuseFakeQuantizeFunction::get( ngraph::ParameterVector inputs; std::vector> lastDequantizations; for (const Branch& branch : branches) { - const auto input = std::make_shared(branch.precisionBeforeDequantization, ngraph::Shape(inputShape)); + const auto input = std::make_shared(branch.precisionBeforeDequantization, inputShape); inputs.push_back(input); const std::shared_ptr lastDequantization = makeDequantization(input, branch.dequantization); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/group_convolution_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/group_convolution_function.cpp index 5d41f680410..6946e6219b1 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/group_convolution_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/group_convolution_function.cpp @@ -129,13 +129,13 @@ std::shared_ptr GroupConvolutionFunction::getOriginal( std::shared_ptr GroupConvolutionFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::Shape& outputShape, const size_t groupCount, const int groupCalculationDimention, const FakeQuantizeOnData& fakeQuantizeOnData, const FakeQuantizeOnWeights& fakeQuantizeOnWeights) { - const auto input = std::make_shared(precision, ngraph::Shape(inputShape)); + const auto input = std::make_shared(precision, inputShape); std::shared_ptr fakeQuantizeOnActivations; if (fakeQuantizeOnData.empty()) { @@ -154,7 +154,7 @@ std::shared_ptr GroupConvolutionFunction::getOriginal( //const size_t groupCount = 3ul; const size_t outputChannelsCount = outputShape[1]; const size_t kernelSize = 5ul; - const size_t inputChannelsCount = inputShape[1]; + const size_t inputChannelsCount = inputShape[1].get_length(); std::vector weightsValues = { 1.f }; std::shared_ptr weights = createWeightsOriginal( diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/interpolate_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/interpolate_function.cpp index ba4491cb5d0..96a6782441d 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/interpolate_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/interpolate_function.cpp @@ -30,7 +30,7 @@ std::shared_ptr InterpolateFunction::getOriginal( std::shared_ptr InterpolateFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::Shape& outputShape, const ngraph::op::InterpolateAttrs& interpAttrs) { float k = 50.f; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_function.cpp index e4e6c55472c..a1004ad01c9 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_function.cpp @@ -19,16 +19,16 @@ namespace subgraph { std::shared_ptr MatMulFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape inputShape, + const ngraph::PartialShape inputShape, const float low, const float high) { - const auto input1 = std::make_shared(precision, ngraph::Shape(inputShape)); + const auto input1 = std::make_shared(precision, inputShape); const auto fakeQuantize1 = ngraph::builder::makeFakeQuantize( input1, precision, 256ul, { 1ul }, { low / 4.f }, { high / 4.f }, { low / 4.f }, { high / 4.f }); fakeQuantize1->set_friendly_name("fakeQuantize1"); - const auto input2 = std::make_shared(precision, ngraph::Shape(inputShape)); + const auto input2 = std::make_shared(precision, inputShape); const auto fakeQuantize2 = ngraph::builder::makeFakeQuantize( input2, precision, 256ul, { 1ul }, { low / 8.f }, { high / 8.f }, { low / 8.f }, { high / 8.f }); @@ -51,12 +51,12 @@ std::shared_ptr MatMulFunction::getOriginal( std::shared_ptr MatMulFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape inputShape1, - const ngraph::Shape inputShape2, + const ngraph::PartialShape inputShape1, + const ngraph::PartialShape inputShape2, const bool transpose1, const bool transpose2) { const auto paramNode = std::make_shared(precision, inputShape1); - const std::vector constShapes(inputShape1.size(), 1ul); + const std::vector constShapes(inputShape1.rank().get_length(), 1ul); const auto fakeQuantizeOnAcitvations = ngraph::builder::makeFakeQuantize( paramNode, precision, 256ul, constShapes, { 0.f }, { 255.f / 4.f }, { 0.f }, { 255.f / 4.f }); @@ -64,7 +64,7 @@ std::shared_ptr MatMulFunction::getOriginal( auto weightsConst = std::make_shared( precision, - inputShape2, + inputShape2.to_shape(), std::vector({ 1.f })); const auto fakeQuantizeOnWeights = ngraph::builder::makeFakeQuantize( weightsConst, precision, 256ul, { 1ul, 1ul }, @@ -298,7 +298,7 @@ std::shared_ptr MatMulFunction::getReference( std::shared_ptr MatMulFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnDataWithConstant& fqOnData, const Constant& weights, const FakeQuantizeOnDataWithConstant& fqOnWeights, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_with_optimized_constant_fake_quantize_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_with_optimized_constant_fake_quantize_function.cpp index 066eeb8226b..2522a2a1876 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_with_optimized_constant_fake_quantize_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mat_mul_with_optimized_constant_fake_quantize_function.cpp @@ -13,11 +13,11 @@ namespace subgraph { std::shared_ptr MatMulWithOptimizedConstantFakeQuantizeFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape1, - const ngraph::Shape& inputShape2, + const ngraph::PartialShape& inputShape1, + const ngraph::PartialShape& inputShape2, const FakeQuantizeOnData& fqOnData, const FakeQuantizeOnData& fqOnWeights) { - const auto input = std::make_shared(precision, ngraph::Shape(inputShape1)); + const auto input = std::make_shared(precision, inputShape1); const auto lowConstantOnActivations = std::make_shared(precision, fqOnData.constantShape, fqOnData.inputLowValues); const auto highConstantOnActivations = std::make_shared(precision, fqOnData.constantShape, fqOnData.inputHighValues); @@ -29,7 +29,7 @@ std::shared_ptr MatMulWithOptimizedConstantFakeQuantizeFunctio highConstantOnActivations, fqOnWeights.quantizationLevel); - const ngraph::Shape weightsShape = { inputShape2[0], inputShape1[1] }; + const ngraph::Shape weightsShape = { static_cast(inputShape2[0].get_length()), static_cast(inputShape1[1].get_length()) }; const std::vector weigths(weightsShape[0] * weightsShape[1], 10.f); const auto weightsConst = std::make_shared(precision, weightsShape, weigths); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/max_pool_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/max_pool_function.cpp index 3a010e011d8..8132d4cfec2 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/max_pool_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/max_pool_function.cpp @@ -16,9 +16,9 @@ namespace subgraph { std::shared_ptr MaxPoolFunction::getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData) { - const auto input = std::make_shared(originalFunctionPrecision, ngraph::Shape(inputShape)); + const auto input = std::make_shared(originalFunctionPrecision, inputShape); const auto fakeQuantize = ngraph::builder::makeFakeQuantize( input, originalFunctionPrecision, fakeQuantizeOnData.quantizationLevel, fakeQuantizeOnData.constantShape, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_function.cpp index af50d3717e7..1d36d0f8e35 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_function.cpp @@ -94,11 +94,11 @@ std::shared_ptr MultiplyFunction::get( std::shared_ptr MultiplyFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const bool broadcast, const ngraph::builder::subgraph::FakeQuantizeOnData& fq1, const ngraph::builder::subgraph::FakeQuantizeOnData& fq2) { - ngraph::Shape inputShape2 = inputShape; + auto inputShape2 = inputShape; if (broadcast) { inputShape2[2] = 1; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_to_group_convolution_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_to_group_convolution_function.cpp index 4ae1873092f..e86d74ee7c7 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_to_group_convolution_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_to_group_convolution_function.cpp @@ -37,13 +37,13 @@ std::shared_ptr MultiplyToGroupConvolutionFunction::getOrigina std::shared_ptr MultiplyToGroupConvolutionFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fqOnData) { const auto input = std::make_shared(precision, inputShape); const auto fakeQuantizeOnActivations = makeFakeQuantize(input, precision, fqOnData); const auto reshape = std::make_shared( fakeQuantizeOnActivations, - std::make_shared(element::i32, Shape{ inputShape.size() }, inputShape), + std::make_shared(element::i32, Shape{ static_cast(inputShape.rank().get_length()) }, inputShape.to_shape()), true); reshape->set_friendly_name("output"); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_with_one_parent_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_with_one_parent_function.cpp index f23b0e6d66f..9cbeb8f2abd 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_with_one_parent_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/multiply_with_one_parent_function.cpp @@ -13,9 +13,9 @@ namespace subgraph { std::shared_ptr MultiplyWithOneParentFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fqOnData) { - const auto input = std::make_shared(precision, ngraph::Shape(inputShape)); + const auto input = std::make_shared(precision, inputShape); const auto fakeQuantize = ngraph::builder::makeFakeQuantize( input, precision, fqOnData.quantizationLevel, fqOnData.constantShape, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mvn_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mvn_function.cpp index 5820582492f..b18ce655711 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mvn_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/mvn_function.cpp @@ -45,7 +45,7 @@ std::shared_ptr MVNFunction::getOriginal( std::shared_ptr MVNFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const AxisSet& reductionAxes, const bool& normalizeVariance) { float k = 50.f; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/normalize_l2_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/normalize_l2_function.cpp index cd0a05e1371..693a042115d 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/normalize_l2_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/normalize_l2_function.cpp @@ -16,7 +16,7 @@ namespace subgraph { std::shared_ptr NormalizeL2Function::getOriginal( const ngraph::element::Type precision, - const std::pair& shapes, + const std::pair& shapes, const ngraph::element::Type precisionOnActivation, const std::vector& axes, const bool fuseMultiply, @@ -43,8 +43,11 @@ std::shared_ptr NormalizeL2Function::getOriginal( ngraph::ResultVector results; if (fuseMultiply) { - const auto multiplyConst = std::make_shared( - precision, ngraph::Shape{ shapes.first[0], shapes.first[1], 1ul, 1ul }, std::vector{ 2.f }); + ngraph::Shape constantShape(4ul, 1ul); + constantShape[0] = shapes.first[0].get_length(); + constantShape[1] = shapes.first[1].get_length(); + + const auto multiplyConst = std::make_shared(precision, constantShape, std::vector{ 2.f }); multiplyConst->set_friendly_name("multiplyConst"); const auto multiply = std::make_shared(normalizeL2->output(0), multiplyConst); multiply->set_friendly_name("output"); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/prelu_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/prelu_function.cpp index f962d60e010..aefbfe3c0cf 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/prelu_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/prelu_function.cpp @@ -32,12 +32,10 @@ std::shared_ptr PReluFunction::getOriginal( } std::shared_ptr PReluFunction::getOriginal( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::element::Type precisionBeforeFq, const FakeQuantizeOnData& fqOnData) { - const std::shared_ptr input = std::make_shared( - precisionBeforeFq, - ngraph::Shape(inputShape)); + const auto input = std::make_shared(precisionBeforeFq, inputShape); const std::shared_ptr quantizationOp = fqOnData.empty() ? std::dynamic_pointer_cast(input) : diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/relu_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/relu_function.cpp index 4a3c5a0e341..f7690715879 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/relu_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/relu_function.cpp @@ -30,12 +30,10 @@ std::shared_ptr ReluFunction::getOriginal( } std::shared_ptr ReluFunction::getOriginal( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::element::Type precisionBeforeFq, const FakeQuantizeOnData& fqOnData) { - const std::shared_ptr input = std::make_shared( - precisionBeforeFq, - ngraph::Shape(inputShape)); + const auto input = std::make_shared(precisionBeforeFq, inputShape); const std::shared_ptr quantizationOp = fqOnData.empty() ? std::dynamic_pointer_cast(input) : diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/reshape_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/reshape_function.cpp index a425d0ddfa1..e03dae4b27a 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/reshape_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/reshape_function.cpp @@ -31,13 +31,11 @@ std::shared_ptr ReshapeFunction::getOriginal( } std::shared_ptr ReshapeFunction::getOriginal( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const std::vector& reshapeConstValues, const ngraph::element::Type precisionBeforeFq, const FakeQuantizeOnData& fqOnData) { - const auto input = std::make_shared( - precisionBeforeFq, - ngraph::Shape(inputShape)); + const auto input = std::make_shared(precisionBeforeFq, inputShape); const std::shared_ptr quantizationOp = fqOnData.empty() ? std::dynamic_pointer_cast(input) : diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/shuffle_channels_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/shuffle_channels_function.cpp index ab77765b47b..7884372138c 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/shuffle_channels_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/shuffle_channels_function.cpp @@ -35,7 +35,7 @@ std::shared_ptr ShuffleChannelsFunction::getOriginal( std::shared_ptr ShuffleChannelsFunction::getOriginal( const ngraph::element::Type inputPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::builder::subgraph::FakeQuantizeOnData& fqOnData, const std::int64_t axis, const std::int64_t group) { diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/split_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/split_function.cpp index 641555d9718..044c490c3c6 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/split_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/split_function.cpp @@ -48,7 +48,7 @@ std::shared_ptr SplitFunction::getOriginal( std::shared_ptr SplitFunction::getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize, int64_t splitedAxis, size_t numSplit) { const auto input = std::make_shared(originalFunctionPrecision, inputShape); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/squeeze_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/squeeze_function.cpp index d584f2c64c6..3799349f773 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/squeeze_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/squeeze_function.cpp @@ -33,10 +33,10 @@ std::shared_ptr SqueezeFunction::getOriginal( std::shared_ptr SqueezeFunction::getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData, const std::vector& axes) { - const auto input = std::make_shared(originalFunctionPrecision, ngraph::Shape(inputShape)); + const auto input = std::make_shared(originalFunctionPrecision, inputShape); const auto fakeQuantize = fakeQuantizeOnData.empty() ? nullptr : diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/strided_slice_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/strided_slice_function.cpp index b12019355c1..aa2e5421b62 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/strided_slice_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/strided_slice_function.cpp @@ -54,7 +54,7 @@ std::shared_ptr StridedSliceFunction::getOriginal( std::shared_ptr StridedSliceFunction::getOriginal( const ngraph::element::Type inputPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::builder::subgraph::FakeQuantizeOnData& fakeQuantize, const std::vector& begin, const std::vector& end, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/subtract_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/subtract_function.cpp index c90d774a042..cf2726ac776 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/subtract_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/subtract_function.cpp @@ -16,18 +16,19 @@ namespace builder { namespace subgraph { std::shared_ptr SubtractFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape) { + const ngraph::PartialShape& inputShape) { const float k = 50.f; - const auto input = std::make_shared(precision, ngraph::Shape(inputShape)); + const auto input = std::make_shared(precision, inputShape); const auto fakeQuantizeOnActivations = ngraph::builder::makeFakeQuantize( input, precision, 256ul, { 1ul }, { 0.f }, { 255.f / k }, { 0.f }, { 255.f / k }); + const size_t channelsValue = inputShape[1].get_length(); const auto weights = ngraph::opset1::Constant::create( precision, - ngraph::Shape{ inputShape[1], inputShape[1], 1, 1 }, - std::vector(inputShape[1] * inputShape[1], 1)); + ngraph::Shape{ channelsValue, channelsValue, 1, 1 }, + std::vector(channelsValue * channelsValue, 1)); const auto convolution = std::make_shared( fakeQuantizeOnActivations == nullptr ? input : fakeQuantizeOnActivations, diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/subtract_multiply_to_multiply_add_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/subtract_multiply_to_multiply_add_function.cpp index 9317d199be2..d34ed6198fb 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/subtract_multiply_to_multiply_add_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/subtract_multiply_to_multiply_add_function.cpp @@ -30,13 +30,10 @@ std::shared_ptr SubtractMultiplyToMultiplyAddFunction::getOrig } std::shared_ptr SubtractMultiplyToMultiplyAddFunction::getOriginal( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::element::Type precision, const ngraph::builder::subgraph::FakeQuantizeOnData& fqOnData) { - const std::shared_ptr input = std::make_shared( - precision, - ngraph::Shape(inputShape)); - + const auto input = std::make_shared(precision, inputShape); const std::shared_ptr fq = makeFakeQuantize(input, precision, fqOnData); const std::shared_ptr reshape1 = std::make_shared( @@ -44,12 +41,12 @@ std::shared_ptr SubtractMultiplyToMultiplyAddFunction::getOrig std::make_shared( ngraph::element::i64, Shape({ 3 }), - std::vector({ static_cast(inputShape[0]), static_cast(inputShape[1]), -1 })), + std::vector({ inputShape[0].get_length(), inputShape[1].get_length(), -1 })), false); const std::shared_ptr reshape2 = std::make_shared( reshape1, - std::make_shared(ngraph::element::i64, Shape({ 4 }), inputShape), + std::make_shared(ngraph::element::i64, Shape({ 4 }), inputShape.to_shape()), false); ngraph::ResultVector results{ std::make_shared(reshape2) }; diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/transpose_after_mat_mul_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/transpose_after_mat_mul_function.cpp index 4e698c7908b..250f5de0c07 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/transpose_after_mat_mul_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/transpose_after_mat_mul_function.cpp @@ -16,7 +16,7 @@ namespace builder { namespace subgraph { std::shared_ptr TransposeAfterMatMulFunction::getOriginal( const ngraph::element::Type precision, - const ngraph::Shape& inputShape) { + const ngraph::PartialShape& inputShape) { const auto input1 = std::make_shared(precision, inputShape); input1->set_friendly_name("input1"); diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/transpose_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/transpose_function.cpp index ea02fbe0beb..892cb19f231 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/transpose_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/transpose_function.cpp @@ -30,13 +30,11 @@ std::shared_ptr TransposeFunction::getOriginal( } std::shared_ptr TransposeFunction::getOriginal( - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const std::vector& transposeConstValues, const ngraph::element::Type precisionBeforeFq, const FakeQuantizeOnData& fqOnData) { - const std::shared_ptr input = std::make_shared( - precisionBeforeFq, - ngraph::Shape(inputShape)); + const auto input = std::make_shared(precisionBeforeFq, inputShape); const std::shared_ptr quantizationOp = fqOnData.empty() ? std::dynamic_pointer_cast(input) : diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/unsqueeze_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/unsqueeze_function.cpp index b272acf01e2..7b292871794 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/unsqueeze_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/unsqueeze_function.cpp @@ -33,10 +33,10 @@ namespace subgraph { std::shared_ptr UnsqueezeFunction::getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const FakeQuantizeOnData& fakeQuantizeOnData, const std::vector& axes) { - const auto input = std::make_shared(originalFunctionPrecision, ngraph::Shape(inputShape)); + const auto input = std::make_shared(originalFunctionPrecision, inputShape); const auto fakeQuantize = fakeQuantizeOnData.empty() ? nullptr : diff --git a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/variadic_split_function.cpp b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/variadic_split_function.cpp index c60acbbb237..a9ffe853d8e 100644 --- a/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/variadic_split_function.cpp +++ b/inference-engine/tests/ngraph_helpers/lpt_ngraph_functions/src/variadic_split_function.cpp @@ -37,7 +37,7 @@ namespace subgraph { std::shared_ptr VariadicSplitFunction::getOriginal( const ngraph::element::Type originalFunctionPrecision, - const ngraph::Shape& inputShape, + const ngraph::PartialShape& inputShape, const ngraph::builder::subgraph::FakeQuantizeOnData fakeQuantize, const int64_t splitedAxis, const std::vector& splitLengths) { diff --git a/inference-engine/tests/unit/gna/ngraph/transformations/gna_convert_padded2valid_conv.cpp b/inference-engine/tests/unit/gna/ngraph/transformations/gna_convert_padded2valid_conv.cpp index b8259bf3d84..662ded11485 100644 --- a/inference-engine/tests/unit/gna/ngraph/transformations/gna_convert_padded2valid_conv.cpp +++ b/inference-engine/tests/unit/gna/ngraph/transformations/gna_convert_padded2valid_conv.cpp @@ -24,9 +24,28 @@ enum class modelType { TranspConvBcastAddActTransp, /* Transpose(NHWC->NCHW) => Conv => Broadcasted Add (Bias) => Activation Function => Transpose(NCHW->NHWC) */ TranspConvBcastAddMaxPoolActTransp, /* Transpose(NHWC->NCHW) => Conv => Broadcasted Add (Bias) => MaxPool => Activation Function => Transpose(NCHW->NHWC) */ TranspConvTranspBcastAdd, /* Transpose(NHWC->NCHW) => conv => Transpose(NCHW->NHWC) => Bias */ - TranspConvTranspBcastAddAct /* Transpose(NHWC->NCHW) => Conv => Transpose(NCHW->NHWC) => Bias => Activation Function */ + TranspConvTranspBcastAddAct, /* Transpose(NHWC->NCHW) => Conv => Transpose(NCHW->NHWC) => Bias => Activation Function */ }; +typedef std::tuple< + modelType, // Test model + ngraph::PartialShape, // Input shape + ngraph::Shape, // Convolution filter shape + ngraph::Strides, // Convolution stride + ngraph::CoordinateDiff, // Convolution pads begin + ngraph::CoordinateDiff, // Convolution pads end + ngraph::Strides, // Convolution dilation + ngraph::Shape, // Bias shape + ngraph::Strides, // Max Pool stride + ngraph::Shape, // Max Pool shape + ngraph::op::PadType // Padding type +> padded2ValidParams; + +typedef std::tuple< + bool, // With / without Fake Quantize layers + padded2ValidParams // Test parameters +> fqPadded2ValidParams; + struct ConvData { size_t input_height; size_t input_width; @@ -47,40 +66,66 @@ void GetConvParams(std::shared_ptr conv, ConvData& conv_data.pads_end_width = conv->get_pads_end()[1]; } -std::shared_ptr createFunction(const modelType& model, - const ngraph::Output& input_node, - const ngraph::Shape& filters_shape, - const ngraph::Strides& conv_stride, - const ngraph::CoordinateDiff& pads_begin, - const ngraph::CoordinateDiff& pads_end, - const ngraph::Strides& conv_dilation, - const ngraph::Shape& bias_shape, - const ngraph::Strides& maxpool_stride, - const ngraph::Shape& maxpool_shape, - const ngraph::op::PadType& pad_type, - ConvData* conv_data) { - auto transpose_in_order = std::make_shared(ngraph::element::i64, ngraph::Shape{4}, ngraph::Shape{0, 3, 1, 2}); +std::shared_ptr createFQ(ngraph::Output& in_node) { + auto input_low = ngraph::opset7::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {1}); + auto input_high = ngraph::opset7::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {5}); + auto output_low = ngraph::opset7::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {0}); + auto output_high = ngraph::opset7::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {10}); + return std::make_shared(in_node, input_low, input_high, output_low, output_high, 11); +} + +ngraph::Output createBiasFQ(const ngraph::Output& in_node, + std::shared_ptr& bias_const, const bool& fq) { + ngraph::Output bcast_add = std::make_shared(in_node, bias_const); + + if (fq) { + bcast_add = createFQ(bcast_add); + } + + return bcast_add; +} + +std::shared_ptr createFunction(const bool& fq, + const modelType& model, + const ngraph::Output& input_node, + const ngraph::Shape& filters_shape, + const ngraph::Strides& conv_stride, + const ngraph::CoordinateDiff& pads_begin, + const ngraph::CoordinateDiff& pads_end, + const ngraph::Strides& conv_dilation, + const ngraph::Shape& bias_shape, + const ngraph::Strides& maxpool_stride, + const ngraph::Shape& maxpool_shape, + const ngraph::op::PadType& pad_type, + ConvData* conv_data) { + auto transpose_in_order = std::make_shared(ngraph::element::i64, ngraph::Shape{4}, std::vector{0, 3, 1, 2}); auto transpose_in = std::make_shared(input_node, transpose_in_order); - auto filters = std::make_shared(ngraph::element::i64, + ngraph::Output filters = std::make_shared(ngraph::element::i64, ngraph::Shape{4, input_node.get_shape()[3], filters_shape[0], filters_shape[1]}); + + if (fq) { + filters = createFQ(filters); + } + auto conv = std::make_shared(transpose_in, filters, conv_stride, pads_begin, pads_end, conv_dilation, pad_type); if (conv_data) GetConvParams(conv, *conv_data); - auto transpose_out_order = std::make_shared(ngraph::element::i64, ngraph::Shape{4}, ngraph::Shape{0, 2, 3, 1}); + auto transpose_out_order = std::make_shared(ngraph::element::i64, ngraph::Shape{4}, std::vector{0, 2, 3, 1}); auto bias_const = std::make_shared(ngraph::element::i64, bias_shape); + ngraph::Output last_op = std::make_shared(conv, transpose_out_order); switch (model) { case modelType::TranspConvBcastAddTransp: { - auto bcast_add = std::make_shared(conv, bias_const); + auto bcast_add = createBiasFQ(conv, bias_const, fq); last_op = std::make_shared(bcast_add, transpose_out_order); } break; case modelType::TranspConvBcastAddMaxPoolTransp: { - auto bcast_add = std::make_shared(conv, bias_const); + auto bcast_add = createBiasFQ(conv, bias_const, fq); auto maxpool = std::make_shared(bcast_add, maxpool_stride, ngraph::Shape{0, 0}, ngraph::Shape{0, 0}, maxpool_shape, ngraph::op::RoundingType::FLOOR, ngraph::op::PadType::VALID); auto transpose = std::make_shared(maxpool, transpose_out_order); @@ -90,7 +135,7 @@ std::shared_ptr createFunction(const modelType& model, case modelType::TranspConvBcastAddActTransp: { - auto bcast_add = std::make_shared(conv, bias_const); + auto bcast_add = createBiasFQ(conv, bias_const, fq); auto activation = std::make_shared(bcast_add); last_op = std::make_shared(activation, transpose_out_order); } @@ -98,7 +143,7 @@ std::shared_ptr createFunction(const modelType& model, case modelType::TranspConvBcastAddMaxPoolActTransp: { - auto bcast_add = std::make_shared(conv, bias_const); + auto bcast_add = createBiasFQ(conv, bias_const, fq); auto maxpool = std::make_shared(bcast_add, maxpool_stride, ngraph::Shape{0, 0}, ngraph::Shape{0, 0}, maxpool_shape, ngraph::op::RoundingType::FLOOR, ngraph::op::PadType::VALID); auto activation = std::make_shared(maxpool); @@ -108,13 +153,13 @@ std::shared_ptr createFunction(const modelType& model, case modelType::TranspConvTranspBcastAdd: { - last_op = std::make_shared(last_op, bias_const); + last_op = createBiasFQ(last_op, bias_const, fq); } break; case modelType::TranspConvTranspBcastAddAct: { - auto bcast_add = std::make_shared(last_op, bias_const); + auto bcast_add = createBiasFQ(last_op, bias_const, fq); last_op = std::make_shared(bcast_add); } break; @@ -127,7 +172,8 @@ std::shared_ptr createFunction(const modelType& model, return std::make_shared(last_op); } -std::shared_ptr get_initial_function(const modelType& model, +std::shared_ptr get_initial_function(const bool& fq, + const modelType& model, const ngraph::PartialShape& input_shape, const ngraph::Shape& filters_shape, const ngraph::Strides& conv_stride, @@ -140,7 +186,7 @@ std::shared_ptr get_initial_function(const modelType& model, const ngraph::op::PadType& pad_type, ConvData& conv_data) { auto inputParams = std::make_shared(ngraph::element::i64, input_shape); - auto result = createFunction(model, inputParams, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, bias_shape, + auto result = createFunction(fq, model, inputParams, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, bias_shape, maxpool_stride, maxpool_shape, pad_type, &conv_data); return std::make_shared(ngraph::ResultVector{result}, ngraph::ParameterVector{inputParams}); } @@ -148,11 +194,7 @@ std::shared_ptr get_initial_function(const modelType& model, // --------------------------------------------------------------------------------------------------------------------- class ConvertPadded2ValidConvTestInvalidFixture : public CommonTestUtils::TestsCommon, - public ::testing::WithParamInterface> { + public ::testing::WithParamInterface { public: void SetUp() override; public: @@ -161,32 +203,32 @@ public: }; void ConvertPadded2ValidConvTestInvalidFixture::SetUp() { + bool fq; + padded2ValidParams params; ngraph::PartialShape input_shape; ngraph::Shape filters_shape, bias_shape, maxpool_shape; ngraph::Strides conv_stride, conv_dilation, maxpool_stride; ngraph::CoordinateDiff pads_begin, pads_end; ngraph::op::PadType pad_type; ConvData conv_data; + std::tie(fq, params) = this->GetParam(); std::tie(model, input_shape, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, - bias_shape, maxpool_stride, maxpool_shape, pad_type) = this->GetParam(); + bias_shape, maxpool_stride, maxpool_shape, pad_type) = params; - function = get_initial_function(model, input_shape, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, + function = get_initial_function(fq, model, input_shape, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, bias_shape, maxpool_stride, maxpool_shape, pad_type, conv_data); - reference_function = get_initial_function(model, input_shape, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, + reference_function = get_initial_function(fq, model, input_shape, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, bias_shape, maxpool_stride, maxpool_shape, pad_type, conv_data); } // --------------------------------------------------------------------------------------------------------------------- class ConvertPadded2ValidConvTestFixture: public CommonTestUtils::TestsCommon, - public ::testing::WithParamInterface> { + public ::testing::WithParamInterface { public: void SetUp() override; - std::shared_ptr get_reference(const modelType& model, + std::shared_ptr get_reference(const bool& fq, + const modelType& model, const ngraph::PartialShape& input_shape, const ngraph::Shape& filters_shape, const ngraph::Strides& conv_stride, @@ -204,18 +246,21 @@ public: }; void ConvertPadded2ValidConvTestFixture::SetUp() { + bool fq; + padded2ValidParams params; ngraph::PartialShape input_shape; ngraph::Shape filters_shape, bias_shape, maxpool_shape; ngraph::Strides conv_stride, conv_dilation, maxpool_stride; ngraph::CoordinateDiff pads_begin, pads_end; ngraph::op::PadType pad_type; ConvData conv_data; + std::tie(fq, params) = this->GetParam(); std::tie(model, input_shape, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, - bias_shape, maxpool_stride, maxpool_shape, pad_type) = this->GetParam(); + bias_shape, maxpool_stride, maxpool_shape, pad_type) = params; - function = get_initial_function(model, input_shape, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, + function = get_initial_function(fq, model, input_shape, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, bias_shape, maxpool_stride, maxpool_shape, pad_type, conv_data); - reference_function = get_reference(model, input_shape, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, + reference_function = get_reference(fq, model, input_shape, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, bias_shape, maxpool_stride, maxpool_shape, pad_type, conv_data); } @@ -309,7 +354,8 @@ std::shared_ptr CreatePaddedNet(const ngraph::Output return padded_input_plane; } -std::shared_ptr ConvertPadded2ValidConvTestFixture::get_reference(const modelType& model, +std::shared_ptr ConvertPadded2ValidConvTestFixture::get_reference(const bool& fq, + const modelType& model, const ngraph::PartialShape& input_shape, const ngraph::Shape& filters_shape, const ngraph::Strides& conv_stride, @@ -343,12 +389,12 @@ std::shared_ptr ConvertPadded2ValidConvTestFixture::get_refere conv_data.pads_begin_width + conv_data.input_width + conv_data.pads_end_width, conv_data.input_channel_count}); auto padded_input_plane_reshaped = std::make_shared(padded_input_plane, shape_const, false); - result = createFunction(model, padded_input_plane_reshaped, filters_shape, conv_stride, + result = createFunction(fq, model, padded_input_plane_reshaped, filters_shape, conv_stride, ngraph::CoordinateDiff{0, 0}, ngraph::CoordinateDiff{0, 0}, conv_dilation, bias_shape, maxpool_stride, maxpool_shape, ngraph::op::PadType::EXPLICIT, nullptr); } else { // Valid padding - result = createFunction(model, inputParams, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, bias_shape, + result = createFunction(fq, model, inputParams, filters_shape, conv_stride, pads_begin, pads_end, conv_dilation, bias_shape, maxpool_stride, maxpool_shape, pad_type, nullptr); } @@ -364,25 +410,13 @@ void execute_test(const modelType& model, std::shared_ptr func switch (model) { default: case modelType::TranspConvTransp: - manager.register_pass(); - break; case modelType::TranspConvBcastAddTransp: - manager.register_pass(); - break; case modelType::TranspConvBcastAddMaxPoolTransp: - manager.register_pass(); - break; case modelType::TranspConvBcastAddActTransp: - manager.register_pass(); - break; case modelType::TranspConvBcastAddMaxPoolActTransp: - manager.register_pass(); - break; case modelType::TranspConvTranspBcastAdd: - manager.register_pass(); - break; case modelType::TranspConvTranspBcastAddAct: - manager.register_pass(); + manager.register_pass(); break; } @@ -397,56 +431,62 @@ TEST_P(ConvertPadded2ValidConvTestFixture, CompareFunctions) { } INSTANTIATE_TEST_SUITE_P(ConvertPadded2ValidConvTestSuite, ConvertPadded2ValidConvTestFixture, - ::testing::Values( - std::make_tuple(modelType::TranspConvTransp, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT), - std::make_tuple(modelType::TranspConvBcastAddTransp, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT), - std::make_tuple(modelType::TranspConvBcastAddMaxPoolTransp, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT), - std::make_tuple(modelType::TranspConvBcastAddActTransp, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::SAME_LOWER), - std::make_tuple(modelType::TranspConvBcastAddMaxPoolActTransp, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::SAME_UPPER), - std::make_tuple(modelType::TranspConvTranspBcastAdd, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 1, 1, 4}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT), - std::make_tuple(modelType::TranspConvTranspBcastAddAct, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 1, 1, 4}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT))); + ::testing::Combine( + // With / without Fake Quantize layers + ::testing::Values(true, false), + ::testing::Values( + std::make_tuple(modelType::TranspConvTransp, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT), + std::make_tuple(modelType::TranspConvBcastAddTransp, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT), + std::make_tuple(modelType::TranspConvBcastAddMaxPoolTransp, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT), + std::make_tuple(modelType::TranspConvBcastAddActTransp, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::SAME_LOWER), + std::make_tuple(modelType::TranspConvBcastAddMaxPoolActTransp, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::SAME_UPPER), + std::make_tuple(modelType::TranspConvTranspBcastAdd, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 1, 1, 4}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT), + std::make_tuple(modelType::TranspConvTranspBcastAddAct, ngraph::PartialShape{1, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 1, 1, 4}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT)))); TEST_P(ConvertPadded2ValidConvTestInvalidFixture, CompareFunctions) { execute_test(model, function, reference_function); } INSTANTIATE_TEST_SUITE_P(ConvertPadded2ValidConvInvalidTestSuite, ConvertPadded2ValidConvTestInvalidFixture, - ::testing::Values( - std::make_tuple(modelType::TranspConvTransp, ngraph::PartialShape{2, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::SAME_UPPER), - std::make_tuple(modelType::TranspConvBcastAddTransp, ngraph::PartialShape{2, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT), - std::make_tuple(modelType::TranspConvBcastAddMaxPoolTransp, ngraph::PartialShape{2, 16, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{5, 1}, ngraph::op::PadType::EXPLICIT), - std::make_tuple(modelType::TranspConvBcastAddActTransp, ngraph::PartialShape{2, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::SAME_LOWER), - std::make_tuple(modelType::TranspConvBcastAddMaxPoolActTransp, ngraph::PartialShape{2, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 5}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 4}, ngraph::op::PadType::SAME_UPPER), - std::make_tuple(modelType::TranspConvTranspBcastAdd, ngraph::PartialShape{2, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 1, 1, 4}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT), - std::make_tuple(modelType::TranspConvTranspBcastAddAct, ngraph::PartialShape{2, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, - ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, - ngraph::Shape{1, 1, 1, 4}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT))); + ::testing::Combine( + // With / without Fake Quantize layers + ::testing::Values(true, false), + ::testing::Values( + std::make_tuple(modelType::TranspConvTransp, ngraph::PartialShape{2, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::SAME_UPPER), + std::make_tuple(modelType::TranspConvBcastAddTransp, ngraph::PartialShape{2, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT), + std::make_tuple(modelType::TranspConvBcastAddMaxPoolTransp, ngraph::PartialShape{2, 16, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{5, 1}, ngraph::op::PadType::EXPLICIT), + std::make_tuple(modelType::TranspConvBcastAddActTransp, ngraph::PartialShape{2, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::SAME_LOWER), + std::make_tuple(modelType::TranspConvBcastAddMaxPoolActTransp, ngraph::PartialShape{2, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 5}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 4, 1, 1}, ngraph::Strides{1, 1}, ngraph::Shape{1, 4}, ngraph::op::PadType::SAME_UPPER), + std::make_tuple(modelType::TranspConvTranspBcastAdd, ngraph::PartialShape{2, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 1, 1, 4}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT), + std::make_tuple(modelType::TranspConvTranspBcastAddAct, ngraph::PartialShape{2, 1, 16, 8}, ngraph::Shape{1, 2}, ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 2}, ngraph::CoordinateDiff{0, 3}, ngraph::Strides{1, 1}, + ngraph::Shape{1, 1, 1, 4}, ngraph::Strides{1, 1}, ngraph::Shape{1, 2}, ngraph::op::PadType::EXPLICIT)))); } // namespace diff --git a/inference-engine/tests/unit/gna/ngraph/transformations/gna_insert_transpose_after_convolution_or_pooling.cpp b/inference-engine/tests/unit/gna/ngraph/transformations/gna_insert_transpose_after_convolution_or_pooling.cpp new file mode 100644 index 00000000000..302f5047c22 --- /dev/null +++ b/inference-engine/tests/unit/gna/ngraph/transformations/gna_insert_transpose_after_convolution_or_pooling.cpp @@ -0,0 +1,249 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "transformations/insert_transpose_after_convolution_or_pooling.hpp" + +#include "common_test_utils/ngraph_test_utils.hpp" +#include +#include +#include +#include + +namespace testing { + +TEST(TransformationTests, InsertTransposeAfterConvOrPoolTestStartConvolution) { + std::shared_ptr func(nullptr), reference_func(nullptr); + + { + auto input_params_convolution = std::make_shared(ngraph::element::i64, + ngraph::Shape{1, 3, 1, 64}); + + auto weights = ngraph::opset7::Constant::create(ngraph::element::i64, + ngraph::Shape{3, 3, 1, 2}, {1}); + auto convolution_operation = std::make_shared(input_params_convolution, + weights, + ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 0}, + ngraph::CoordinateDiff{0, 1}, + ngraph::Strides{1, 1}); + + auto new_shape = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {1, 1, 1, 3 * 64}); + auto reshape_operation = std::make_shared(convolution_operation, new_shape, true); + + auto weights_next_convolution = ngraph::opset7::Constant::create(ngraph::element::i64, + ngraph::Shape{1, 1, 1, 3 * 63}, {1}); + auto next_convolution_operation = std::make_shared(reshape_operation, + weights_next_convolution, + ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 0}, + ngraph::CoordinateDiff{0, 1}, + ngraph::Strides{1, 1}); + + auto result = std::make_shared(next_convolution_operation); + func = std::make_shared(ngraph::ResultVector{result}, + ngraph::ParameterVector{input_params_convolution}); + ngraph::pass::Manager m; + m.register_pass(); + m.register_pass(); + m.run_passes(func); + ASSERT_NO_THROW(check_rt_info(func)); + } + + { + auto input_params_convolution = std::make_shared(ngraph::element::i64, + ngraph::Shape{1, 3, 1, 64}); + + auto weights = ngraph::opset7::Constant::create(ngraph::element::i64, + ngraph::Shape{3, 3, 1, 2}, {1}); + auto convolution_operation = std::make_shared(input_params_convolution, + weights, + ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 0}, + ngraph::CoordinateDiff{0, 1}, + ngraph::Strides{1, 1}); + + auto new_shape_out = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {1, 64, 1, 3}); + auto reshape_out_operation = std::make_shared(convolution_operation, new_shape_out, false); + + auto transpose = std::make_shared(reshape_out_operation, + ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {0, 3, 1, 2})); + + auto new_shape = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {1, 1, 1, 3 * 64}); + auto reshape_operation = std::make_shared(transpose, new_shape, true); + + auto weights_next_convolution = ngraph::opset7::Constant::create(ngraph::element::i64, + ngraph::Shape{1, 1, 1, 3 * 63}, {1}); + auto next_convolution_operation = std::make_shared(reshape_operation, + weights_next_convolution, + ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 0}, + ngraph::CoordinateDiff{0, 1}, + ngraph::Strides{1, 1}); + + auto result = std::make_shared(next_convolution_operation); + reference_func = std::make_shared(ngraph::ResultVector{result}, + ngraph::ParameterVector{input_params_convolution}); + } + + const FunctionsComparator func_comparator = FunctionsComparator::with_default().enable(FunctionsComparator::ATTRIBUTES); + const FunctionsComparator::Result result = func_comparator(func, reference_func); + ASSERT_TRUE(result.valid); +} + +TEST(TransformationTests, InsertTransposeAfterConvOrPoolTestStartMaxPool) { + std::shared_ptr func(nullptr), reference_func(nullptr); + + { + auto input_params = std::make_shared(ngraph::element::i64, + ngraph::Shape{1, 3, 1, 64}); + + auto max_pool_operation = std::make_shared(input_params, + ngraph::Strides{1, 1}, + ngraph::Shape{0, 0}, + ngraph::Shape{0, 1}, + ngraph::Shape{1, 2}); + + auto new_shape = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {1, 1, 1, 3 * 64}); + auto reshape_operation = std::make_shared(max_pool_operation, new_shape, true); + + auto weights_next_convolution = ngraph::opset7::Constant::create(ngraph::element::i64, + ngraph::Shape{1, 1, 1, 3 * 63}, {1}); + auto next_convolution_operation = std::make_shared(reshape_operation, + weights_next_convolution, + ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 0}, + ngraph::CoordinateDiff{0, 1}, + ngraph::Strides{1, 1}); + + auto result = std::make_shared(next_convolution_operation); + func = std::make_shared(ngraph::ResultVector{result}, + ngraph::ParameterVector{input_params}); + ngraph::pass::Manager m; + m.register_pass(); + m.register_pass(); + m.run_passes(func); + ASSERT_NO_THROW(check_rt_info(func)); + } + + { + auto input_params = std::make_shared(ngraph::element::i64, + ngraph::Shape{1, 3, 1, 64}); + + auto max_pool_operation = std::make_shared(input_params, + ngraph::Strides{1, 1}, + ngraph::Shape{0, 0}, + ngraph::Shape{0, 1}, + ngraph::Shape{1, 2}); + + auto new_shape_out = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {1, 64, 1, 3}); + auto reshape_out_operation = std::make_shared(max_pool_operation, new_shape_out, false); + + auto transpose = std::make_shared(reshape_out_operation, + ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {0, 3, 1, 2})); + + auto new_shape = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{4}, {1, 1, 1, 3 * 64}); + auto reshape_operation = std::make_shared(transpose, new_shape, true); + + auto weights_next_convolution = ngraph::opset7::Constant::create(ngraph::element::i64, + ngraph::Shape{1, 1, 1, 3 * 63}, {1}); + auto next_convolution_operation = std::make_shared(reshape_operation, + weights_next_convolution, + ngraph::Strides{1, 1}, + ngraph::CoordinateDiff{0, 0}, + ngraph::CoordinateDiff{0, 1}, + ngraph::Strides{1, 1}); + + auto result = std::make_shared(next_convolution_operation); + reference_func = std::make_shared(ngraph::ResultVector{result}, + ngraph::ParameterVector{input_params}); + } + + const FunctionsComparator func_comparator = FunctionsComparator::with_default().enable(FunctionsComparator::ATTRIBUTES); + const FunctionsComparator::Result result = func_comparator(func, reference_func); + ASSERT_TRUE(result.valid); +} + +TEST(TransformationTests, InsertTransposeAfterConvOrPoolTestInputRank3) { + std::shared_ptr func(nullptr), reference_func(nullptr); + + { + auto input_params_convolution = std::make_shared(ngraph::element::i64, + ngraph::Shape{1, 3, 64}); + + auto weights = ngraph::opset7::Constant::create(ngraph::element::i64, + ngraph::Shape{2, 3, 2}, {1}); + auto convolution_operation = std::make_shared(input_params_convolution, + weights, + ngraph::Strides{1}, + ngraph::CoordinateDiff{0}, + ngraph::CoordinateDiff{1}, + ngraph::Strides{1}); + + auto new_shape = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {1, 1, 128}); + auto reshape_operation = std::make_shared(convolution_operation, new_shape, true); + + auto weights_next_convolution = ngraph::opset7::Constant::create(ngraph::element::i64, + ngraph::Shape{1, 1, 63}, {1}); + auto next_convolution_operation = std::make_shared(reshape_operation, + weights_next_convolution, + ngraph::Strides{1}, + ngraph::CoordinateDiff{0}, + ngraph::CoordinateDiff{1}, + ngraph::Strides{1}); + + auto result = std::make_shared(next_convolution_operation); + + func = std::make_shared(ngraph::ResultVector{result}, + ngraph::ParameterVector{input_params_convolution}); + ngraph::pass::Manager m; + m.register_pass(); + m.register_pass(); + m.run_passes(func); + ASSERT_NO_THROW(check_rt_info(func)); + } + + { + auto input_params_convolution = std::make_shared(ngraph::element::i64, + ngraph::Shape{1, 3, 64}); + + auto weights = ngraph::opset7::Constant::create(ngraph::element::i64, + ngraph::Shape{2, 3, 2}, {1}); + auto convolution_operation = std::make_shared(input_params_convolution, + weights, + ngraph::Strides{1}, + ngraph::CoordinateDiff{0}, + ngraph::CoordinateDiff{1}, + ngraph::Strides{1}); + + auto new_shape_out = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {1, 64, 2}); + auto reshape_out_operation = std::make_shared(convolution_operation, new_shape_out, false); + + auto transpose = std::make_shared(reshape_out_operation, + ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {0, 2, 1})); + + auto new_shape = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {1, 1, 128}); + auto reshape_operation = std::make_shared(transpose, new_shape, true); + + auto weights_next_convolution = ngraph::opset7::Constant::create(ngraph::element::i64, + ngraph::Shape{1, 1, 63}, {1}); + auto next_convolution_operation = std::make_shared(reshape_operation, + weights_next_convolution, + ngraph::Strides{1}, + ngraph::CoordinateDiff{0}, + ngraph::CoordinateDiff{1}, + ngraph::Strides{1}); + + auto result = std::make_shared(next_convolution_operation); + reference_func = std::make_shared(ngraph::ResultVector{result}, + ngraph::ParameterVector{input_params_convolution}); + } + + const FunctionsComparator func_comparator = FunctionsComparator::with_default().enable(FunctionsComparator::ATTRIBUTES); + const FunctionsComparator::Result result = func_comparator(func, reference_func); + ASSERT_TRUE(result.valid); +} + +} // namespace testing diff --git a/inference-engine/tests/unit/gna/ngraph/transformations/gna_swap_input_matmul.cpp b/inference-engine/tests/unit/gna/ngraph/transformations/gna_swap_input_matmul.cpp new file mode 100644 index 00000000000..2a80bb9f847 --- /dev/null +++ b/inference-engine/tests/unit/gna/ngraph/transformations/gna_swap_input_matmul.cpp @@ -0,0 +1,171 @@ +// Copyright (C) 2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "transformations/swap_input_matmul_gna.hpp" + +#include "common_test_utils/ngraph_test_utils.hpp" +#include +#include +#include +#include + +namespace testing { + +TEST(TransformationTests, SwapInputMatMulTestValidConstShape) { + std::shared_ptr func(nullptr), reference_func(nullptr); + const ngraph::Shape data_shape{8, 8}; + + { + auto input_params = std::make_shared(ngraph::element::i64, data_shape); + + auto constant = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{1, 8}, {1}); + auto matmul_operation = std::make_shared(constant, input_params); + + auto result = std::make_shared(matmul_operation); + func = std::make_shared(ngraph::ResultVector{result}, + ngraph::ParameterVector{input_params}); + + reference_func = ngraph::clone_function(*func); + + ngraph::pass::Manager m; + m.register_pass(); + m.register_pass(); + m.run_passes(func); + ASSERT_NO_THROW(check_rt_info(func)); + } + + const FunctionsComparator func_comparator = FunctionsComparator::with_default().enable(FunctionsComparator::ATTRIBUTES); + const FunctionsComparator::Result result = func_comparator(func, reference_func); + ASSERT_TRUE(result.valid); +} + +TEST(TransformationTests, SwapInputMatMulTest) { + std::shared_ptr func(nullptr), reference_func(nullptr); + const ngraph::Shape data_shape{8, 8}; + + { + auto input_params = std::make_shared(ngraph::element::i64, data_shape); + + auto constant = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{16, 8}, {1}); + auto matmul_operation = std::make_shared(constant, input_params); + + auto result = std::make_shared(matmul_operation); + func = std::make_shared(ngraph::ResultVector{result}, + ngraph::ParameterVector{input_params}); + + ngraph::pass::Manager m; + m.register_pass(); + m.register_pass(); + m.run_passes(func); + ASSERT_NO_THROW(check_rt_info(func)); + } + + { + auto input_params = std::make_shared(ngraph::element::i64, data_shape); + + auto constant = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{16, 8}, {1}); + auto matmul_operation = std::make_shared(input_params, constant, 1, 1); + + auto transpose_order = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{2}, + std::vector{1, 0}); + auto transpose_operation = std::make_shared(matmul_operation, transpose_order); + + auto result = std::make_shared(transpose_operation); + reference_func = std::make_shared(ngraph::ResultVector{result}, + ngraph::ParameterVector{input_params}); + } + + const FunctionsComparator func_comparator = FunctionsComparator::with_default().enable(FunctionsComparator::ATTRIBUTES); + const FunctionsComparator::Result result = func_comparator(func, reference_func); + ASSERT_TRUE(result.valid); +} + +TEST(TransformationTests, SwapInputMatMulTestFakeQuantize) { + std::shared_ptr func(nullptr), reference_func(nullptr); + const ngraph::Shape data_shape{8, 8}; + + { + auto input_params = std::make_shared(ngraph::element::i64, data_shape); + + auto constant = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{16, 8}, {1}); + + auto input_low = ngraph::opset7::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {1}); + auto input_high = ngraph::opset7::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {20}); + auto output_low = ngraph::opset7::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {0}); + auto output_high = ngraph::opset7::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {10}); + auto fake_quantize_op = std::make_shared(constant, input_low, + input_high, output_low, + output_high, 11); + auto matmul_operation = std::make_shared(fake_quantize_op, input_params); + + auto result = std::make_shared(matmul_operation); + func = std::make_shared(ngraph::ResultVector{result}, + ngraph::ParameterVector{input_params}); + + ngraph::pass::Manager m; + m.register_pass(); + m.register_pass(); + m.run_passes(func); + ASSERT_NO_THROW(check_rt_info(func)); + } + + { + auto input_params = std::make_shared(ngraph::element::i64, data_shape); + + auto constant = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{16, 8}, {1}); + + auto input_low = ngraph::opset7::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {1}); + auto input_high = ngraph::opset7::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {20}); + auto output_low = ngraph::opset7::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {0}); + auto output_high = ngraph::opset7::Constant::create(ngraph::element::f32, ngraph::Shape{1}, {10}); + auto fake_quantize_op = std::make_shared(constant, input_low, + input_high, output_low, + output_high, 11); + auto matmul_operation = std::make_shared(input_params, fake_quantize_op, 1 , 1); + + auto transpose_order = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{2}, + std::vector{1, 0}); + auto transpose_operation = std::make_shared(matmul_operation, transpose_order); + + auto result = std::make_shared(transpose_operation); + reference_func = std::make_shared(ngraph::ResultVector{result}, + ngraph::ParameterVector{input_params}); + } + + const FunctionsComparator func_comparator = FunctionsComparator::with_default().enable(FunctionsComparator::ATTRIBUTES); + const FunctionsComparator::Result result = func_comparator(func, reference_func); + ASSERT_TRUE(result.valid); +} + +TEST(TransformationTests, SwapInputMatMulTestRank1) { + std::shared_ptr func(nullptr), reference_func(nullptr); + const ngraph::Shape data_shape{8, 8}; + + { + auto input_params = std::make_shared(ngraph::element::i64, data_shape); + + auto constant = ngraph::opset7::Constant::create(ngraph::element::i64, ngraph::Shape{8}, {1}); + auto matmul_operation = std::make_shared(constant, input_params); + + auto result = std::make_shared(matmul_operation); + func = std::make_shared(ngraph::ResultVector{result}, + ngraph::ParameterVector{input_params}); + + reference_func = ngraph::clone_function(*func); + + ngraph::pass::Manager m; + m.register_pass(); + m.register_pass(); + m.run_passes(func); + ASSERT_NO_THROW(check_rt_info(func)); + } + + const FunctionsComparator func_comparator = FunctionsComparator::with_default().enable(FunctionsComparator::ATTRIBUTES); + const FunctionsComparator::Result result = func_comparator(func, reference_func); + ASSERT_TRUE(result.valid); +} + +} // namespace testing diff --git a/inference-engine/tests/unit/vpu/base/graph_transformer_tests.cpp b/inference-engine/tests/unit/vpu/base/graph_transformer_tests.cpp index 5adcca5f224..0b57b4527a1 100644 --- a/inference-engine/tests/unit/vpu/base/graph_transformer_tests.cpp +++ b/inference-engine/tests/unit/vpu/base/graph_transformer_tests.cpp @@ -5,9 +5,55 @@ #include "graph_transformer_tests.hpp" #include +#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -306,13 +352,14 @@ void GraphTransformerTest::TearDown() { void GraphTransformerTest::InitCompileEnv() { if (const auto envVar = std::getenv("IE_VPU_DUMP_INTERNAL_GRAPH_FILE_NAME")) { - config.compileConfig().dumpInternalGraphFileName = envVar; + config.set(InferenceEngine::MYRIAD_DUMP_INTERNAL_GRAPH_FILE_NAME, envVar); } if (const auto envVar = std::getenv("IE_VPU_DUMP_INTERNAL_GRAPH_DIRECTORY")) { - config.compileConfig().dumpInternalGraphDirectory = envVar; + config.set(InferenceEngine::MYRIAD_DUMP_ALL_PASSES_DIRECTORY, envVar); } if (const auto envVar = std::getenv("IE_VPU_DUMP_ALL_PASSES")) { - config.compileConfig().dumpAllPasses = std::stoi(envVar) != 0; + config.set(InferenceEngine::MYRIAD_DUMP_ALL_PASSES, std::stoi(envVar) != 0 + ? InferenceEngine::PluginConfigParams::YES : InferenceEngine::PluginConfigParams::NO); } CompileEnv::init(platform, config, _log); @@ -351,9 +398,61 @@ PluginConfiguration createConfiguration() { PluginConfiguration configuration; configuration.registerOption(); configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); IE_SUPPRESS_DEPRECATED_START + configuration.registerDeprecatedOption(InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES); + configuration.registerDeprecatedOption(InferenceEngine::MYRIAD_DISABLE_REORDER); configuration.registerDeprecatedOption(VPU_CONFIG_KEY(LOG_LEVEL)); + configuration.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(PROTOCOL)); + configuration.registerDeprecatedOption(VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION)); + configuration.registerDeprecatedOption(VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME)); + configuration.registerDeprecatedOption(VPU_CONFIG_KEY(DETECT_NETWORK_BATCH)); + configuration.registerDeprecatedOption(VPU_CONFIG_KEY(CUSTOM_LAYERS)); + configuration.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE)); + configuration.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(FORCE_RESET)); + configuration.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(PLATFORM)); IE_SUPPRESS_DEPRECATED_END return configuration; diff --git a/inference-engine/tests/unit/vpu/middleend_tests/passes_tests/annotate_memory_types.cpp b/inference-engine/tests/unit/vpu/middleend_tests/passes_tests/annotate_memory_types.cpp index cb4bd63f44c..3634cc08f84 100644 --- a/inference-engine/tests/unit/vpu/middleend_tests/passes_tests/annotate_memory_types.cpp +++ b/inference-engine/tests/unit/vpu/middleend_tests/passes_tests/annotate_memory_types.cpp @@ -4,6 +4,7 @@ #include "graph_transformer_tests.hpp" #include "common_test_utils/common_utils.hpp" +#include "vpu/private_plugin_config.hpp" namespace vpu { @@ -24,7 +25,7 @@ class AnnotateMemoryTypes : public GraphTransformerTest, public testing::WithPar protected: void SetUp() override { ASSERT_NO_FATAL_FAILURE(GraphTransformerTest::SetUp()); - config.compileConfig().enableMemoryTypesAnnotation = true; + config.set(InferenceEngine::MYRIAD_ENABLE_MEMORY_TYPES_ANNOTATION, InferenceEngine::PluginConfigParams::YES); ASSERT_NO_FATAL_FAILURE(InitCompileEnv()); ASSERT_NO_FATAL_FAILURE(InitPipeline()); diff --git a/inference-engine/tests_deprecated/behavior/vpu/myriad_tests/vpu_load_network_tests.cpp b/inference-engine/tests_deprecated/behavior/vpu/myriad_tests/vpu_load_network_tests.cpp index f59644d3ac2..43e3a2c2ad8 100644 --- a/inference-engine/tests_deprecated/behavior/vpu/myriad_tests/vpu_load_network_tests.cpp +++ b/inference-engine/tests_deprecated/behavior/vpu/myriad_tests/vpu_load_network_tests.cpp @@ -55,27 +55,3 @@ TEST_F(MyriadLoadNetworkTestCase, smoke_ThrowsExeptionWhenNameIsInvalid) { ASSERT_ANY_THROW(ExeNetwork exe_network = ie->LoadNetwork(cnnNetwork, "MYRIAD", config)); } - -TEST_F(MyriadLoadNetworkTestCase, smoke_ThrowsExeptionWhenPlatformConflictWithProtocol) { - std::string wrong_platform; - auto devices = getDevicesList(); - ASSERT_TRUE(devices.size()); - - auto device_to_load = devices[0]; - - IE_SUPPRESS_DEPRECATED_START - if(isMyriadXDevice(device_to_load)) { - wrong_platform = VPU_MYRIAD_2450; - } else { - wrong_platform = VPU_MYRIAD_2480; - } - IE_SUPPRESS_DEPRECATED_END - - std::map config = { - {KEY_DEVICE_ID, device_to_load}, - {KEY_VPU_MYRIAD_PLATFORM, wrong_platform}, - }; - - ASSERT_ANY_THROW(ExeNetwork exe_network = - ie->LoadNetwork(cnnNetwork, "MYRIAD", config)); -} diff --git a/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_strided_slice_test.h b/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_strided_slice_test.h index ef5d8a76e2c..f701314ff2a 100644 --- a/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_strided_slice_test.h +++ b/inference-engine/tests_deprecated/functional/vpu/common/layers/myriad_layers_strided_slice_test.h @@ -252,7 +252,7 @@ TEST_P(myriadLayersTestsStridedSlice_smoke, TestsStridedSlice) { // Create InferRequest. InferenceEngine::InferRequest inferRequest; ASSERT_NO_THROW(inferRequest = _exeNetwork.CreateInferRequest()); - + // Input Data. InferenceEngine::Blob::Ptr inputBlob; ASSERT_NO_THROW(inputBlob = inferRequest.GetBlob("input")); @@ -262,7 +262,7 @@ TEST_P(myriadLayersTestsStridedSlice_smoke, TestsStridedSlice) { InferenceEngine::Blob::Ptr outputBlob; ASSERT_NO_THROW(inferRequest.Infer()); ASSERT_NO_THROW(outputBlob = inferRequest.GetBlob("strided_slice")); - + // Output Reference. Blob::Ptr refBlob = InferenceEngine::make_shared_blob(outputBlob->getTensorDesc()); refBlob->allocate(); diff --git a/inference-engine/tests_deprecated/functional/vpu/graph_transformer/gt_functional_tests.cpp b/inference-engine/tests_deprecated/functional/vpu/graph_transformer/gt_functional_tests.cpp index ca07c26f03a..209a4ef3057 100644 --- a/inference-engine/tests_deprecated/functional/vpu/graph_transformer/gt_functional_tests.cpp +++ b/inference-engine/tests_deprecated/functional/vpu/graph_transformer/gt_functional_tests.cpp @@ -9,6 +9,51 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace InferenceEngine; using namespace vpu; @@ -48,8 +93,61 @@ void graphTransformerFunctionalTests::PrepareGraphCompilation() { _configuration.registerOption(); _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + _configuration.registerOption(); + IE_SUPPRESS_DEPRECATED_START + _configuration.registerDeprecatedOption(InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES); + _configuration.registerDeprecatedOption(InferenceEngine::MYRIAD_DISABLE_REORDER); _configuration.registerDeprecatedOption(VPU_CONFIG_KEY(LOG_LEVEL)); + _configuration.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(PROTOCOL)); + _configuration.registerDeprecatedOption(VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION)); + _configuration.registerDeprecatedOption(VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME)); + _configuration.registerDeprecatedOption(VPU_CONFIG_KEY(DETECT_NETWORK_BATCH)); + _configuration.registerDeprecatedOption(VPU_CONFIG_KEY(CUSTOM_LAYERS)); + _configuration.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE)); + _configuration.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(FORCE_RESET)); + _configuration.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(PLATFORM)); IE_SUPPRESS_DEPRECATED_END _inputsInfo.clear(); diff --git a/inference-engine/tests_deprecated/functional/vpu/graph_transformer/merge_permute_and_reorder_test.cpp b/inference-engine/tests_deprecated/functional/vpu/graph_transformer/merge_permute_and_reorder_test.cpp index f6105b9979c..8dd046a0a2b 100644 --- a/inference-engine/tests_deprecated/functional/vpu/graph_transformer/merge_permute_and_reorder_test.cpp +++ b/inference-engine/tests_deprecated/functional/vpu/graph_transformer/merge_permute_and_reorder_test.cpp @@ -62,8 +62,9 @@ protected: const bool usePermuteMerging, Blob::Ptr& outputBlob) { PrepareGraphCompilation(); - _configuration.compileConfig().detectBatch = false; - _configuration.compileConfig().enablePermuteMerging = usePermuteMerging; + _configuration.set(InferenceEngine::MYRIAD_DETECT_NETWORK_BATCH, InferenceEngine::PluginConfigParams::NO); + _configuration.set(InferenceEngine::MYRIAD_ENABLE_PERMUTE_MERGING, usePermuteMerging + ? InferenceEngine::PluginConfigParams::YES : InferenceEngine::PluginConfigParams::NO); IE_ASSERT(permutationVectors.size() >= 2); diff --git a/inference-engine/tests_deprecated/functional/vpu/myriad_tests/myriad_configs_tests.cpp b/inference-engine/tests_deprecated/functional/vpu/myriad_tests/myriad_configs_tests.cpp index 8fc795322c8..70fdb6c20d2 100644 --- a/inference-engine/tests_deprecated/functional/vpu/myriad_tests/myriad_configs_tests.cpp +++ b/inference-engine/tests_deprecated/functional/vpu/myriad_tests/myriad_configs_tests.cpp @@ -41,19 +41,6 @@ TEST_P(myriadCorrectModelsConfigsTests_nightly, CreateInferRequestWithAvailableD ASSERT_NO_THROW(request = executable.CreateInferRequest()); } -TEST_P(myriadCorrectModelsConfigsTests_nightly, CreateInferRequestWithUnavailableDevice) { - const auto &config = GetParam(); - DISABLE_IF(hasAppropriateStick(config)); - - InferenceEngine::CNNNetwork net(ngraph::builder::subgraph::makeSplitConvConcat()); - InferenceEngine::ExecutableNetwork executable; - ASSERT_NO_THROW(executable = _vpuPluginPtr->LoadNetwork(net, config)); - - InferenceEngine::InferRequest request; - ASSERT_THROW(request = executable.CreateInferRequest(), - InferenceEngine::Exception); -} - //------------------------------------------------------------------------------ // myriadIncorrectModelsConfigsTests_nightly //------------------------------------------------------------------------------ diff --git a/inference-engine/tests_deprecated/functional/vpu/vpu_base/myriad_layers_reference_functions.cpp b/inference-engine/tests_deprecated/functional/vpu/vpu_base/myriad_layers_reference_functions.cpp index 30f5b939e08..5f17d392604 100644 --- a/inference-engine/tests_deprecated/functional/vpu/vpu_base/myriad_layers_reference_functions.cpp +++ b/inference-engine/tests_deprecated/functional/vpu/vpu_base/myriad_layers_reference_functions.cpp @@ -1255,7 +1255,7 @@ namespace topk_impl { typedef std::function CompareFunction; bool compareIndices(const Pair& a, const Pair& b) { - return (a.second < b.second); + return (a.second < b.second); } bool compareValuesMax(const Pair& a, const Pair& b) { diff --git a/inference-engine/tests_deprecated/functional/vpu/vpu_base/vpu_layers_tests.cpp b/inference-engine/tests_deprecated/functional/vpu/vpu_base/vpu_layers_tests.cpp index 183c53c77ac..fad16404aba 100644 --- a/inference-engine/tests_deprecated/functional/vpu/vpu_base/vpu_layers_tests.cpp +++ b/inference-engine/tests_deprecated/functional/vpu/vpu_base/vpu_layers_tests.cpp @@ -181,7 +181,6 @@ void vpuLayersTests::createInferRequest(const NetworkParams& params) { #endif config[CONFIG_KEY(PERF_COUNT)] = CONFIG_VALUE(YES); config[InferenceEngine::MYRIAD_PERF_REPORT_MODE] = InferenceEngine::MYRIAD_PER_STAGE; - config[InferenceEngine::MYRIAD_FORCE_DEPRECATED_CNN_CONVERSION] = CONFIG_VALUE(NO); // Make VPU plugin be able to use NGraph network. ASSERT_NO_THROW(_exeNetwork = _vpuPluginPtr->LoadNetwork(_cnnNetwork, config)); ASSERT_NO_THROW(_inferRequest = _exeNetwork.CreateInferRequest()); diff --git a/inference-engine/tests_deprecated/unit/engines/vpu/adjust_data_location_tests.cpp b/inference-engine/tests_deprecated/unit/engines/vpu/adjust_data_location_tests.cpp index 77ce658129f..16f14c583be 100644 --- a/inference-engine/tests_deprecated/unit/engines/vpu/adjust_data_location_tests.cpp +++ b/inference-engine/tests_deprecated/unit/engines/vpu/adjust_data_location_tests.cpp @@ -6,6 +6,7 @@ #include #include #include +#include #include "graph_transformer_tests.hpp" @@ -25,8 +26,8 @@ using VPU_AdjustDataLocationTest = GraphTransformerTest; // TEST_F(VPU_AdjustDataLocationTest, FlushCMX_TwoSpecialConsumers) { - config.compileConfig().numSHAVEs = 1; - config.compileConfig().numCMXSlices = 1; + config.set(InferenceEngine::MYRIAD_NUMBER_OF_SHAVES, "1"); + config.set(InferenceEngine::MYRIAD_NUMBER_OF_CMX_SLICES, "1"); InitCompileEnv(); DataDesc dataDesc1(DataType::FP16, DimsOrder::NCHW, {CMX_SLICE_SIZE / (2 * 2), 1, 2, 1}); diff --git a/inference-engine/tests_deprecated/unit/engines/vpu/get_vpu_scale_from_ir_tests.cpp b/inference-engine/tests_deprecated/unit/engines/vpu/get_vpu_scale_from_ir_tests.cpp index d0c2855f679..66f8493b563 100644 --- a/inference-engine/tests_deprecated/unit/engines/vpu/get_vpu_scale_from_ir_tests.cpp +++ b/inference-engine/tests_deprecated/unit/engines/vpu/get_vpu_scale_from_ir_tests.cpp @@ -25,7 +25,7 @@ TEST_F(VPU_AddVpuScaleTest, CanAddVpuScaleToNetwork) { auto& env = CompileEnv::get(); auto config = createConfiguration(); - config.compileConfig().irWithVpuScalesDir = "/"; + config.set(InferenceEngine::MYRIAD_IR_WITH_SCALES_DIRECTORY, "/"); env.updateConfig(config); std::shared_ptr function; @@ -70,7 +70,7 @@ TEST_F(VPU_AddVpuScaleTest, VpuScaleFromIrChangesWeights) { InitCompileEnv(); const auto& env = CompileEnv::get(); auto config = createConfiguration(); - config.compileConfig().irWithVpuScalesDir = "/"; + config.set(InferenceEngine::MYRIAD_IR_WITH_SCALES_DIRECTORY, "/"); env.updateConfig(config); std::shared_ptr function; diff --git a/inference-engine/tests_deprecated/unit/engines/vpu/graph_transformer_tests.cpp b/inference-engine/tests_deprecated/unit/engines/vpu/graph_transformer_tests.cpp index 1702d38eb25..eedf042217c 100644 --- a/inference-engine/tests_deprecated/unit/engines/vpu/graph_transformer_tests.cpp +++ b/inference-engine/tests_deprecated/unit/engines/vpu/graph_transformer_tests.cpp @@ -8,8 +8,54 @@ #include #include +#include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include namespace vpu { @@ -164,9 +210,61 @@ PluginConfiguration createConfiguration() { PluginConfiguration configuration; configuration.registerOption(); configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); + configuration.registerOption(); IE_SUPPRESS_DEPRECATED_START + configuration.registerDeprecatedOption(InferenceEngine::MYRIAD_DISABLE_CONVERT_STAGES); + configuration.registerDeprecatedOption(InferenceEngine::MYRIAD_DISABLE_REORDER); configuration.registerDeprecatedOption(VPU_CONFIG_KEY(LOG_LEVEL)); + configuration.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(PROTOCOL)); + configuration.registerDeprecatedOption(VPU_CONFIG_KEY(HW_STAGES_OPTIMIZATION)); + configuration.registerDeprecatedOption(VPU_CONFIG_KEY(PRINT_RECEIVE_TENSOR_TIME)); + configuration.registerDeprecatedOption(VPU_CONFIG_KEY(DETECT_NETWORK_BATCH)); + configuration.registerDeprecatedOption(VPU_CONFIG_KEY(CUSTOM_LAYERS)); + configuration.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(MOVIDIUS_DDR_TYPE)); + configuration.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(FORCE_RESET)); + configuration.registerDeprecatedOption(VPU_MYRIAD_CONFIG_KEY(PLATFORM)); IE_SUPPRESS_DEPRECATED_END return configuration; @@ -202,13 +300,14 @@ void GraphTransformerTest::TearDown() { void GraphTransformerTest::InitCompileEnv() { if (const auto envVar = std::getenv("IE_VPU_DUMP_INTERNAL_GRAPH_FILE_NAME")) { - config.compileConfig().dumpInternalGraphFileName = envVar; + config.set(InferenceEngine::MYRIAD_DUMP_INTERNAL_GRAPH_FILE_NAME, envVar); } if (const auto envVar = std::getenv("IE_VPU_DUMP_INTERNAL_GRAPH_DIRECTORY")) { - config.compileConfig().dumpInternalGraphDirectory = envVar; + config.set(InferenceEngine::MYRIAD_DUMP_ALL_PASSES_DIRECTORY, envVar); } if (const auto envVar = std::getenv("IE_VPU_DUMP_ALL_PASSES")) { - config.compileConfig().dumpAllPasses = std::stoi(envVar) != 0; + config.set(InferenceEngine::MYRIAD_DUMP_ALL_PASSES, std::stoi(envVar) != 0 + ? InferenceEngine::PluginConfigParams::YES : InferenceEngine::PluginConfigParams::NO); } CompileEnv::init(platform, config, _log); diff --git a/inference-engine/tests_deprecated/unit/engines/vpu/myriad_tests/helpers/myriad_test_case.cpp b/inference-engine/tests_deprecated/unit/engines/vpu/myriad_tests/helpers/myriad_test_case.cpp index e50c7f3bb1d..dd55b0f9669 100644 --- a/inference-engine/tests_deprecated/unit/engines/vpu/myriad_tests/helpers/myriad_test_case.cpp +++ b/inference-engine/tests_deprecated/unit/engines/vpu/myriad_tests/helpers/myriad_test_case.cpp @@ -3,6 +3,7 @@ // #include "myriad_test_case.h" +#include "ie_plugin_config.hpp" //------------------------------------------------------------------------------ // Implementation of methods of class MyriadEngineTest diff --git a/inference-engine/tests_deprecated/unit/engines/vpu/myriad_tests/myriad_engine_tests.cpp b/inference-engine/tests_deprecated/unit/engines/vpu/myriad_tests/myriad_engine_tests.cpp index 5fc90e2e678..7bd1ad415b9 100644 --- a/inference-engine/tests_deprecated/unit/engines/vpu/myriad_tests/myriad_engine_tests.cpp +++ b/inference-engine/tests_deprecated/unit/engines/vpu/myriad_tests/myriad_engine_tests.cpp @@ -5,6 +5,9 @@ #include #include "myriad_test_case.h" +#include "vpu/myriad_config.hpp" +#include "vpu/vpu_plugin_config.hpp" +#include "vpu/private_plugin_config.hpp" using MyriadEngineSetCorrectConfigTest = MyriadEngineSetConfigTest; using MyriadEngineSetIncorrectConfigTest = MyriadEngineSetConfigTest; diff --git a/inference-engine/tests_deprecated/unit/engines/vpu/myriad_tests/myriad_metrics_tests.cpp b/inference-engine/tests_deprecated/unit/engines/vpu/myriad_tests/myriad_metrics_tests.cpp index 2c27aea933f..05bc0b6c718 100644 --- a/inference-engine/tests_deprecated/unit/engines/vpu/myriad_tests/myriad_metrics_tests.cpp +++ b/inference-engine/tests_deprecated/unit/engines/vpu/myriad_tests/myriad_metrics_tests.cpp @@ -7,6 +7,9 @@ #include "myriad_test_case.h" #include +#include "vpu/vpu_plugin_config.hpp" +#include "vpu/myriad_config.hpp" + using namespace InferenceEngine; using namespace InferenceEngine::PluginConfigParams; using namespace InferenceEngine::VPUConfigParams; diff --git a/inference-engine/tests_deprecated/unit/engines/vpu/replace_deconv_by_conv_tests.cpp b/inference-engine/tests_deprecated/unit/engines/vpu/replace_deconv_by_conv_tests.cpp index 59e9c77dadc..675bcc0235f 100644 --- a/inference-engine/tests_deprecated/unit/engines/vpu/replace_deconv_by_conv_tests.cpp +++ b/inference-engine/tests_deprecated/unit/engines/vpu/replace_deconv_by_conv_tests.cpp @@ -4,6 +4,8 @@ #include "graph_transformer_tests.hpp" +#include "vpu/private_plugin_config.hpp" + using namespace vpu; class VPU_ReplaceDeconvByConvTest : public GraphTransformerTest { @@ -91,7 +93,7 @@ TEST_F(VPU_ReplaceDeconvByConvTest, deconvReplacedByConvIfKernelSizeFitsHWUnit) } TEST_F(VPU_ReplaceDeconvByConvTest, deconvCannotBeReplacedByConvIfDisabledInConfig) { - config.compileConfig().hwBlackList.insert("deconv"); + config.set(ie::MYRIAD_HW_BLACK_LIST, "deconv"); InitCompileEnv(); InitDeconvStage(16, 15); diff --git a/inference-engine/thirdparty/clDNN/CMakeLists.txt b/inference-engine/thirdparty/clDNN/CMakeLists.txt index 451311d17eb..7f0eb9f7c27 100644 --- a/inference-engine/thirdparty/clDNN/CMakeLists.txt +++ b/inference-engine/thirdparty/clDNN/CMakeLists.txt @@ -3,23 +3,6 @@ # cmake_minimum_required (VERSION 3.1) -include(CheckCXXCompilerFlag) - -# ====================================================================================================== -# ==================================== BUILD CONFIGURATIONS (part 1) =================================== -# ====================================================================================================== -# The section must be before project definition which is a point for configurations generation -# for multi-configuration generators. - -# Available configuration types: -# Two standard configurations. -if(NOT DEFINED CMAKE_CONFIGURATION_TYPES) - set(CMAKE_CONFIGURATION_TYPES - "Debug" - "Release" - "RelWithDebInfo" - ) -endif() # ====================================================================================================== # ====================================================================================================== @@ -31,26 +14,6 @@ set(CLDNN__PROJ_NAME "clDNN") # Default languages: C, C++. project("${CLDNN__PROJ_NAME}") -if(POLICY CMP0063) - cmake_policy(SET CMP0063 NEW) -endif() - -# ====================================================================================================== -# ==================================== BUILD CONFIGURATIONS (part 2) =================================== -# ====================================================================================================== -# The section must be after project definition and its supported languages because otherwise -# used variables are not available yet. - -# Populating global property with list of debug configurations. -set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS "Debug") -# Use solution folders. -set_property(GLOBAL PROPERTY USE_FOLDERS ON) - -# ====================================================================================================== -# ====================================================================================================== -# ====================================================================================================== - - # ====================================================================================================== # ====================================== HELPER CONSTANT VARIABLES ===================================== # ====================================================================================================== diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/runtime/debug_configuration.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/runtime/debug_configuration.hpp index 469993a4691..c16eb97862f 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/runtime/debug_configuration.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/runtime/debug_configuration.hpp @@ -24,8 +24,13 @@ private: debug_configuration(); public: static const char *prefix; - int verbose; - std::string dump_graphs; + int verbose; // Verbose execution + int print_multi_kernel_perf; // Print execution time of each kernel in multi-kernel primitimive + int disable_usm; // Disable usm usage + std::string dump_graphs; // Dump optimized graph + std::string dump_layers_path; // Enable dumping intermediate buffers and set the dest path + std::string dump_layers; // Dump intermediate buffers of specified layers only, separated by space + int dump_layers_dst_only; // Dump only output of layers static const debug_configuration *get_instance(); }; diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/runtime/engine.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/runtime/engine.hpp index b81f626c5e6..8aa53a14fe2 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/runtime/engine.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/runtime/engine.hpp @@ -15,6 +15,11 @@ #include #include #include +#include + +#define CLDNN_THREADING_SEQ 0 +#define CLDNN_THREADING_TBB 1 +#define CLDNN_THREADING_THREADPOOL 2 namespace cldnn { @@ -35,15 +40,6 @@ public: /// Returns runtime type used in the engine virtual runtime_types runtime_type() const = 0; - /// Create memory object with specified @p layout and allocation @p type for primitive with @p id - /// Underlying memory handle can be reused with other primitives from memory pool based on @p dependencies - memory_ptr get_memory_from_pool(const layout& layout, - primitive_id id, - uint32_t network_id, - std::set dependencies, - allocation_type type, - bool reusable = true); - /// Create memory object attached to the buffer allocated by user. /// @param ptr The pointer to user allocated buffer. /// @note Size (in bytes) of the buffer should be equal to @p layout.bytes_count() @@ -97,9 +93,6 @@ public: /// Returns device object associated with the engine const device::ptr get_device() const; - /// Returns memory pool for the engine - memory_pool& get_memory_pool(); - /// Returns user context handle which was used to create the engine virtual void* get_user_context() const = 0; @@ -109,6 +102,12 @@ public: /// Returns the amount of GPU memory currently used by the engine uint64_t get_used_device_memory() const; + /// Adds @p bytes count to currently used memory size + void add_memory_used(uint64_t bytes); + + /// Subtracts @p bytes count from currently used memory size + void subtract_memory_used(uint64_t bytes); + /// Returns true if USM is enabled in engine config and device/driver supports required features bool use_unified_shared_memory() const; @@ -140,11 +139,11 @@ public: protected: /// Create engine for given @p device and @p configuration engine(const device::ptr device, const engine_configuration& configuration); - - // TODO: Consider moving memory pool to cldnn::network - std::unique_ptr _memory_pool; const device::ptr _device; engine_configuration _configuration; + + std::atomic memory_usage = {0}; + std::atomic peak_memory_usage = {0}; }; } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/runtime/kernel_args.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/runtime/kernel_args.hpp index f70d04ee33a..14e068d4973 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/runtime/kernel_args.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/runtime/kernel_args.hpp @@ -127,7 +127,8 @@ struct kernel_string { kernel_string() : str(""), jit(""), undefs(""), options(""), entry_point(""), batch_compilation(false) {} - std::string get_hash() { return str + jit + undefs + options + entry_point; } + std::string get_str() const { return str + jit + undefs + options + entry_point; } + size_t get_hash() const { return std::hash()(get_str()); } }; } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/runtime/memory_caps.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/runtime/memory_caps.hpp index 98f9eee6581..0eeafa97149 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/runtime/memory_caps.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/runtime/memory_caps.hpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace cldnn { @@ -19,6 +20,18 @@ enum class allocation_type { usm_device, // Accessible only by device. Not migratable. }; +inline std::ostream& operator<<(std::ostream& out, const allocation_type& alloc_type) { + switch (alloc_type) { + case allocation_type::cl_mem: out << "cl_mem"; break; + case allocation_type::usm_host: out << "usm_host"; break; + case allocation_type::usm_shared: out << "usm_shared"; break; + case allocation_type::usm_device: out << "usm_device"; break; + default: out << "unknown"; break; + } + + return out; +} + class memory_capabilities { public: memory_capabilities(std::vector supported_allocation_types) : _caps(supported_allocation_types) {} diff --git a/inference-engine/thirdparty/clDNN/api/cldnn/runtime/memory_pool.hpp b/inference-engine/thirdparty/clDNN/api/cldnn/runtime/memory_pool.hpp index 6c3d5d4d766..953c83e416f 100644 --- a/inference-engine/thirdparty/clDNN/api/cldnn/runtime/memory_pool.hpp +++ b/inference-engine/thirdparty/clDNN/api/cldnn/runtime/memory_pool.hpp @@ -97,8 +97,6 @@ class memory_pool { std::map, padded_pool_comparer> _padded_pool; std::multimap _no_reusable_pool; engine* _engine; - std::atomic _temp_memory_used; - std::atomic _max_peak_memory_used; public: explicit memory_pool(engine& engine); @@ -127,11 +125,6 @@ public: void clear_pool(); void clear_pool_for_network(uint32_t network_id); void release_memory(memory* memory, const primitive_id& id, uint32_t network_id); - - uint64_t get_temp_memory_used() const { return _temp_memory_used; } - uint64_t get_max_peak_device_memory_used() const { return _max_peak_memory_used; } - void add_memory_used(size_t value); - void subtract_memory_used(size_t value); }; } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt b/inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt index 32a6a9987ff..adb363d1c78 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt +++ b/inference-engine/thirdparty/clDNN/kernel_selector/CMakeLists.txt @@ -8,12 +8,6 @@ set(CLDNN_BUILD__PROJ "cldnn_kernel_selector") set(CLDNN_BUILD__PROJ_LABEL "${CLDNN_BUILD__PROJ}") set(CLDNN_BUILD__PROJ_OUTPUT_NAME "${CLDNN_BUILD__PROJ}${CLDNN__OUT_CPU_SUFFIX}") -# ================================== Compiler preprocessor definitions ================================= - -if (CLDNN__ENABLE_PERSISTENT_CACHE) - set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS CLDNN_ENABLE_PERSISTENT_CACHE) -endif () - # ========================================= Source/Header files ======================================== set(__CLDNN_Directory__main "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/activation/activation_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/activation/activation_kernel_base.cpp index 2a24a9f18df..a8d25d6b906 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/activation/activation_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/activation/activation_kernel_base.cpp @@ -69,11 +69,10 @@ KernelsData ActivationKernelBase::GetCommonKernelsData(const Params& params, con KernelData kd = KernelData::Default(params); activation_params& newParams = *static_cast(kd.params.get()); - const std::string kernel_id = GetEntryPoint(kernelName, params.layerID, options); auto dispatchData = SetDefault(newParams); auto cldnn_jit = GetJitConstants(newParams, dispatchData); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/arg_max_min/arg_max_min_kernel_axis.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/arg_max_min/arg_max_min_kernel_axis.cpp index 734dd1c9ebb..7c02191576e 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/arg_max_min/arg_max_min_kernel_axis.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/arg_max_min/arg_max_min_kernel_axis.cpp @@ -86,7 +86,7 @@ KernelsData ArgMaxMinKernelAxis::GetKernelsData(const Params& params, const opti KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(orgParams); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/arg_max_min/arg_max_min_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/arg_max_min/arg_max_min_kernel_base.cpp index 236da961e4e..b25f92fe301 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/arg_max_min/arg_max_min_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/arg_max_min/arg_max_min_kernel_base.cpp @@ -45,7 +45,7 @@ KernelsData ArgMaxMinKernelBase::GetCommonKernelsData(const Params& params, cons KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(orgParams); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/arg_max_min/arg_max_min_kernel_opt.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/arg_max_min/arg_max_min_kernel_opt.cpp index 7ff5f8d189c..d31abbd679e 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/arg_max_min/arg_max_min_kernel_opt.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/arg_max_min/arg_max_min_kernel_opt.cpp @@ -47,7 +47,7 @@ KernelsData ArgMaxMinKernelOpt::GetKernelsData(const Params& params, const optio auto& kernel = kd.kernels[i]; DispatchData dispatchData = SetDefault(newParams); auto cldnnJit = GetJitConstants(newParams); - auto entryPoint = GetEntryPoint(kernelName, newParams.layerID, options); + auto entryPoint = GetEntryPoint(kernelName, newParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnnJit, entryPoint); dispatchData.gws = { Align(size, 16), orgParams.inputs[0].Batch().v, 1 }; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/average_unpooling/average_unpooling_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/average_unpooling/average_unpooling_kernel_base.cpp index c3a21a139e4..fe864e5f788 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/average_unpooling/average_unpooling_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/average_unpooling/average_unpooling_kernel_base.cpp @@ -65,7 +65,7 @@ KernelsData AverageUnpoolingKernelBase::GetCommonKernelsData(const Params& param KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(orgParams); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/batch_to_space/batch_to_space_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/batch_to_space/batch_to_space_kernel_base.cpp index cef13342302..a28500034e2 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/batch_to_space/batch_to_space_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/batch_to_space/batch_to_space_kernel_base.cpp @@ -79,7 +79,7 @@ KernelsData BatchToSpaceKernelBase::GetCommonKernelsData(const Params& params, c } auto dispatchData = SetDefault(newParams, options); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/binary_convolution/binary_convolution_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/binary_convolution/binary_convolution_kernel_base.cpp index d7a7ba3ec37..142fda4352f 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/binary_convolution/binary_convolution_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/binary_convolution/binary_convolution_kernel_base.cpp @@ -130,7 +130,7 @@ KernelsData BinaryConvolutionKernelBase::GetCommonKernelsData(const Params& para auto finalKernelName = GetKernelName(newParams); auto cldnnJit = GetJitConstants(newParams, dispatchData); - auto entryPoint = GetEntryPoint(finalKernelName, newParams.layerID, options); + auto entryPoint = GetEntryPoint(finalKernelName, newParams.layerID, params, options); auto jit = CreateJit(finalKernelName, cldnnJit, entryPoint); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/border/border_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/border/border_kernel_base.cpp index efeb5a1d8f3..e63a56b1947 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/border/border_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/border/border_kernel_base.cpp @@ -40,7 +40,7 @@ KernelsData BorderKernelBase::GetCommonKernelsData(const Params& params, KernelData k_data = KernelData::Default(params); auto cldnn_jit = GetJitConstants(prim_params); - auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, options); + auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = k_data.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/broadcast/broadcast_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/broadcast/broadcast_kernel_base.cpp index db7b26a07a4..23b7bfcf54f 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/broadcast/broadcast_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/broadcast/broadcast_kernel_base.cpp @@ -37,7 +37,7 @@ KernelsData BroadcastKernelBase::GetCommonKernelsData(const Params& params, KernelData k_data = KernelData::Default(params); auto cldnn_jit = GetJitConstants(prim_params); - auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, options); + auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = k_data.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/concatenation/concatenation_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/concatenation/concatenation_kernel_base.cpp index f1c20f88767..73255a4bc1b 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/concatenation/concatenation_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/concatenation/concatenation_kernel_base.cpp @@ -108,7 +108,7 @@ KernelsData ConcatenationKernelBase::GetCommonKernelsData(const Params& params, auto& kernel = kd.kernels[i]; DispatchData dispatchData = SetDefault(newParams); auto cldnnJit = GetJitConstants(newParams); - auto entryPoint = GetEntryPoint(kernelName, newParams.layerID, options); + auto entryPoint = GetEntryPoint(kernelName, newParams.layerID, params, options, i); auto jit = CreateJit(kernelName, cldnnJit, entryPoint); kernel.code.kernelString = GetKernelString(kernelName, jit, entryPoint, params.engineInfo); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/concatenation/concatenation_kernel_fs_b_yx_fsv32.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/concatenation/concatenation_kernel_fs_b_yx_fsv32.cpp index 26397613b41..4dd35435db3 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/concatenation/concatenation_kernel_fs_b_yx_fsv32.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/concatenation/concatenation_kernel_fs_b_yx_fsv32.cpp @@ -105,7 +105,7 @@ KernelsData ConcatenationKernel_fs_b_yx_fsv32::GetKernelsData(const Params& para auto& kernel = kd.kernels[i]; DispatchData dispatchData = SetDefault(newParams); auto cldnnJit = GetJitConstants(newParams); - auto entryPoint = GetEntryPoint(kernelName, newParams.layerID, optParams); + auto entryPoint = GetEntryPoint(kernelName, newParams.layerID, params, optParams, i); auto jit = CreateJit(kernelName, cldnnJit, entryPoint); kernel.code.kernelString = GetKernelString(kernelName, jit, entryPoint, params.engineInfo); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_base.cpp index a5674f56f55..ca7c2dab7fe 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/convolution_kernel_base.cpp @@ -214,7 +214,7 @@ KernelsData ConvolutionKernelBase::GetCommonKernelsData(const Params& params, auto finalKernelName = GetKernelName(newParams); auto cldnnJit = GetJitConstants(newParams, dispatchData); - auto entryPoint = GetEntryPoint(finalKernelName, newParams.layerID, options); + auto entryPoint = GetEntryPoint(finalKernelName, newParams.layerID, params, options); auto jit = CreateJit(finalKernelName, cldnnJit, entryPoint); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/deformable_convolution_kernel_bfyx_interp.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/deformable_convolution_kernel_bfyx_interp.cpp index e337b9b68e7..0ee694b0974 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/deformable_convolution_kernel_bfyx_interp.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/convolution/deformable_convolution_kernel_bfyx_interp.cpp @@ -81,7 +81,7 @@ KernelsData DeformableConvolutionKernel_bfyx_interp::GetKernelsData(const Params convolution_params& newParams = *static_cast(kd.params.get()); CommonDispatchData dispatchData = SetDefault(newParams); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/ctc_greedy_decoder/ctc_greedy_decoder_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/ctc_greedy_decoder/ctc_greedy_decoder_kernel_base.cpp index 664ed70fabc..ea825b5ce23 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/ctc_greedy_decoder/ctc_greedy_decoder_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/ctc_greedy_decoder/ctc_greedy_decoder_kernel_base.cpp @@ -56,7 +56,7 @@ KernelsData CTCGreedyDecoderKernelBase::GetCommonKernelsData(const Params& param KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(orgParams, dispatchData); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/cum_sum/cum_sum_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/cum_sum/cum_sum_kernel_base.cpp index 0fc8b0cbb1d..42b573e5c61 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/cum_sum/cum_sum_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/cum_sum/cum_sum_kernel_base.cpp @@ -90,7 +90,7 @@ KernelsData CumSumKernelBase::GetCommonKernelsData(const Params& params, } auto dispatchData = SetDefault(newParams); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams, dispatchData); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/cum_sum/cum_sum_kernel_partial_sum.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/cum_sum/cum_sum_kernel_partial_sum.cpp index 87d2a3cedcc..51689796288 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/cum_sum/cum_sum_kernel_partial_sum.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/cum_sum/cum_sum_kernel_partial_sum.cpp @@ -40,7 +40,7 @@ KernelsData CumSumKernelPartialSum::GetMultiStageKernelsData(const Params& param // partial sum auto cldnn_jit = GetJitConstants(newParams, dispatchData.stage_1); cldnn_jit.AddConstant(MakeJitConstant("CUM_SUM_PARTIAL_SUM", 1)); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; FillCLKernelData(kernel, dispatchData.stage_1, params.engineInfo, kernelName, jit, entry_point); @@ -51,7 +51,7 @@ KernelsData CumSumKernelPartialSum::GetMultiStageKernelsData(const Params& param } { // Final - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options, 1); auto cldnn_jit = GetJitConstants(newParams, dispatchData.stage_final); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/deconvolution/deconvolution_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/deconvolution/deconvolution_kernel_base.cpp index 383427b6075..0552bd22152 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/deconvolution/deconvolution_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/deconvolution/deconvolution_kernel_base.cpp @@ -122,7 +122,7 @@ KernelsData DeconvolutionKernelBase::GetKernelsData(const Params& params, const } auto cldnn_jit = GetJitConstants(newParams); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/depth_to_space/depth_to_space_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/depth_to_space/depth_to_space_kernel_base.cpp index 75c686d4604..2a1631d8d02 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/depth_to_space/depth_to_space_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/depth_to_space/depth_to_space_kernel_base.cpp @@ -61,7 +61,7 @@ KernelsData DepthToSpaceKernelBase::GetCommonKernelsData(const Params& params, c } auto dispatchData = SetDefault(newParams); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_b_fs_yx_fsv16.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_b_fs_yx_fsv16.cpp index 5e23b070865..1df3371f722 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_b_fs_yx_fsv16.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_b_fs_yx_fsv16.cpp @@ -326,7 +326,7 @@ KernelsData EltwiseKernel_b_fs_yx_fsv16::GetKernelsData(const Params& params, co KernelData kd = KernelData::Default(params); eltwise_params& newParams = *static_cast(kd.params.get()); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_b_fs_yx_fsv4.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_b_fs_yx_fsv4.cpp index 264386cdc1b..401452d5516 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_b_fs_yx_fsv4.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_b_fs_yx_fsv4.cpp @@ -39,7 +39,7 @@ KernelsData EltwiseKernel_b_fs_yx_fsv4::GetKernelsData(const Params& params, con KernelData kd = KernelData::Default(params); eltwise_params& newParams = *static_cast(kd.params.get()); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_base.cpp index 25cab6841ff..42fee4026ac 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_base.cpp @@ -613,7 +613,7 @@ KernelsData EltwiseKernelBase::GetCommonKernelsData(const Params& params, const KernelData kd = KernelData::Default(params); eltwise_params& newParams = *static_cast(kd.params.get()); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_fs_b_yx_fsv32.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_fs_b_yx_fsv32.cpp index 91975fde6f1..d973d9d262e 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_fs_b_yx_fsv32.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_fs_b_yx_fsv32.cpp @@ -78,7 +78,7 @@ KernelsData EltwiseKernel_fs_b_yx_fsv32::GetKernelsData(const Params& params, co std::pair jit; - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); try { auto cldnn_jit = GetJitConstants(newParams); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_mixed_byxf_and_fs_b_yx_fsv32.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_mixed_byxf_and_fs_b_yx_fsv32.cpp index bf2ee107612..7a2877c0e11 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_mixed_byxf_and_fs_b_yx_fsv32.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_mixed_byxf_and_fs_b_yx_fsv32.cpp @@ -72,7 +72,7 @@ KernelsData EltwiseKernel_mixed_byxf_and_fs_b_yx_fsv32::GetKernelsData(const Par std::pair jit; - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); try { auto cldnn_jit = GetJitConstants(newParams); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_vload8.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_vload8.cpp index a9470fbb0b7..b5f6b40c5fc 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_vload8.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/eltwise/eltwise_kernel_vload8.cpp @@ -95,7 +95,7 @@ KernelsData EltwiseKernel_vload8::GetKernelsData(const Params& params, const opt std::pair jit; - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); try { auto cldnn_jit = GetJitConstants(newParams); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/embedding_bag/embedding_bag_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/embedding_bag/embedding_bag_kernel_ref.cpp index 1d80c4af4d1..e8d228023c6 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/embedding_bag/embedding_bag_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/embedding_bag/embedding_bag_kernel_ref.cpp @@ -50,7 +50,7 @@ KernelsData EmbeddingBagKernelRef::GetKernelsData(const Params& params, const op } auto dispatchData = SetDefault(newParams); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/extract_image_patches/extract_image_patches_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/extract_image_patches/extract_image_patches_kernel_base.cpp index 470024159ad..38a89e948bb 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/extract_image_patches/extract_image_patches_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/extract_image_patches/extract_image_patches_kernel_base.cpp @@ -63,7 +63,7 @@ KernelsData ExtractImagePatchesKernelBase::GetCommonKernelsData(const Params& pa KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(prim_params); - auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, options); + auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/fully_connected/fully_connected_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/fully_connected/fully_connected_kernel_base.cpp index 2a902dd0f87..691babd7603 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/fully_connected/fully_connected_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/fully_connected/fully_connected_kernel_base.cpp @@ -83,7 +83,7 @@ KernelsData FullyConnectedKernelBase::GetCommonKernelsData(const Params ¶ms, kd.kernels.resize(1); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); const DispatchData dispatchData = SetDefault(newParams, autoTuneIndex); auto cldnn_jit = GetJitConstants(newParams, dispatchData); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/fused_conv_eltwise/fused_conv_eltwise_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/fused_conv_eltwise/fused_conv_eltwise_kernel_base.cpp index a1d86baf9a2..c628dc98fdd 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/fused_conv_eltwise/fused_conv_eltwise_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/fused_conv_eltwise/fused_conv_eltwise_kernel_base.cpp @@ -268,7 +268,7 @@ KernelsData fused_conv_eltwise_kernel_base::GetCommonKernelsData(const Params& p auto finalKernelName = GetKernelName(newParams); auto cldnnJit = GetJitConstants(newParams, dispatchData); - auto entryPoint = GetEntryPoint(finalKernelName, newParams.layerID, options); + auto entryPoint = GetEntryPoint(finalKernelName, newParams.layerID, params, options); auto jit = CreateJit(finalKernelName, cldnnJit, entryPoint); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_kernel_ref.cpp index 28686e2cb35..1a4a1f69e51 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_kernel_ref.cpp @@ -209,7 +209,7 @@ KernelsData GatherKernelRef::GetKernelsData(const Params& params, const optional gather_params& newParams = *static_cast(kd.params.get()); auto dispatchData = SetDefault(newParams, options); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_nd_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_nd_kernel_ref.cpp index fa523d35ef9..4ffd87439a0 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_nd_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather/gather_nd_kernel_ref.cpp @@ -187,7 +187,7 @@ KernelsData GatherNDKernelRef::GetKernelsData(const Params& params, const option auto dispatchData = SetDefault(newParams, options); auto cldnn_jit = GetJitConstants(newParams); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; FillCLKernelData(kernel, dispatchData, params.engineInfo, kernelName, jit, entry_point, "", false, false, 2, GetFusedPrimitiveInputsCount(params)); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather_tree/gather_tree_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather_tree/gather_tree_kernel_base.cpp index a374db7ba73..d87e8ada5c3 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather_tree/gather_tree_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gather_tree/gather_tree_kernel_base.cpp @@ -34,7 +34,7 @@ KernelsData GatherTreeKernelBase::GetCommonKernelsData(const Params& params, auto dispatchData = SetDefault(gt_params); auto kernel_data = KernelData::Default(params); auto cldnn_jit = GetJitConstants(gt_params); - auto entry_point = GetEntryPoint(kernelName, gt_params.layerID, options); + auto entry_point = GetEntryPoint(kernelName, gt_params.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); FillCLKernelData(kernel_data.kernels[0], dispatchData, diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_base.cpp index 5a78ea1ab24..f4f5ac150ca 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_base.cpp @@ -45,7 +45,7 @@ KernelsData GemmKernelBase::GetCommonKernelsData(const Params& params, KernelData k_data = KernelData::Default(params); auto cldnn_jit = GetJitConstants(prim_params); - auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, options); + auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = k_data.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_mmad_int8.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_mmad_int8.cpp index e1334d4b82a..9e5eb462441 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_mmad_int8.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_mmad_int8.cpp @@ -137,7 +137,7 @@ KernelsData GemmKernelMMADint8::GetKernelsData(const Params& params, const optio KernelData k_data = KernelData::Default(params); auto cldnn_jit = GetJitConstants(prim_params); - auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, options); + auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = k_data.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_mmad_int8_slm.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_mmad_int8_slm.cpp index 17a4952af2c..a9cb0652730 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_mmad_int8_slm.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_mmad_int8_slm.cpp @@ -107,7 +107,7 @@ KernelsData GemmKernelMMADslmInt8::GetKernelsData(const Params& params, const op KernelData k_data = KernelData::Default(params); auto cldnn_jit = GetJitConstants(prim_params); - auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, options); + auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = k_data.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_tiled_opt.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_tiled_opt.cpp index 47025a0838d..93df406663c 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_tiled_opt.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_tiled_opt.cpp @@ -48,6 +48,8 @@ GemmKernelBase::DispatchData GemmKernelTiledOpt::SetDefault(const gemm_params& p GemmKernelTiledOpt::GemmTuningData GemmKernelTiledOpt::SetTuningParams(const gemm_params& params) const { const auto& output = params.output; + GemmKernelTiledOpt::GemmTuningData tuning_data; + auto m_size = output.Y().v; auto n_size = output.X().v; auto k_size = params.transpose_input0 ? params.inputs[0].Y().v : params.inputs[0].X().v; @@ -83,6 +85,7 @@ JitConstants GemmKernelTiledOpt::GetJitConstants(const gemm_params& params) cons JitConstants jit = Parent::GetJitConstants(params); const auto& output = params.output; + GemmTuningData tuning_data = SetTuningParams(params); auto m_size = output.Y().v; auto n_size = output.X().v; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_tiled_opt.h b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_tiled_opt.h index 089e928c131..6d2b096b54f 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_tiled_opt.h +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/gemm/gemm_kernel_tiled_opt.h @@ -12,12 +12,12 @@ class GemmKernelTiledOpt : public GemmKernelBase { public: using Parent = GemmKernelBase; - mutable struct GemmTuningData { + struct GemmTuningData { size_t simd_size = 8; size_t tile_m_size = 1; size_t tile_k_size = 1; size_t tile_n_size = 1; - } tuning_data; + }; GemmKernelTiledOpt() : GemmKernelBase("gemm_tiled_opt") {} diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/grn/grn_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/grn/grn_kernel_base.cpp index 8598999df30..3e332e0cff2 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/grn/grn_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/grn/grn_kernel_base.cpp @@ -38,7 +38,7 @@ KernelsData GRNKernelBase::GetCommonKernelsData(const Params& params, KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(orgParams, dispatchData); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lrn/lrn_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lrn/lrn_kernel_base.cpp index 40600e6c40c..85702e695d1 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lrn/lrn_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lrn/lrn_kernel_base.cpp @@ -87,7 +87,7 @@ KernelsData LRNKernelBase::GetCommonKernelsData(const Params& params, KernelData kd = KernelData::Default(params); auto cldnnJit = GetJitConstants(orgParams, dispatchData); - auto entryPoint = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entryPoint = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnnJit, entryPoint); auto fused_deps_total = GetFusedPrimitiveInputsCount(params); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm/lstm_elt_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm/lstm_elt_kernel_base.cpp index 587832da828..daeaed8fa78 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm/lstm_elt_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm/lstm_elt_kernel_base.cpp @@ -77,7 +77,7 @@ KernelsData LSTMEltKernelBase::GetCommonKernelsData(const Params& params, const auto& kernel = kd.kernels[0]; auto cldnnJit = GetJitConstants(newParams); - auto entryPoint = GetEntryPoint(kernelName, newParams.layerID, options); + auto entryPoint = GetEntryPoint(kernelName, newParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnnJit, entryPoint); kernel.params.workGroups.global = {out.X().v, out.Batch().v, 1}; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm/lstm_gemm_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm/lstm_gemm_kernel_base.cpp index e4b547deacb..9aa3bfa10c6 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm/lstm_gemm_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm/lstm_gemm_kernel_base.cpp @@ -47,7 +47,7 @@ KernelsData LSTMGemmKernelBase::GetCommonKernelsData(const Params& params, const // TODO: reorder weights if needed auto& kernel = kd.kernels[0]; auto cldnnJit = GetJitConstants(newParams); - auto entryPoint = GetEntryPoint(kernelName, newParams.layerID, options); + auto entryPoint = GetEntryPoint(kernelName, newParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnnJit, entryPoint); kernel.params.workGroups.global = {out.X().v, out.Batch().v, 1}; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm_dynamic/lstm_dynamic_input_bfyx_opt.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm_dynamic/lstm_dynamic_input_bfyx_opt.cpp index dfd13d8ce5b..ad73129bff5 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm_dynamic/lstm_dynamic_input_bfyx_opt.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm_dynamic/lstm_dynamic_input_bfyx_opt.cpp @@ -85,7 +85,7 @@ KernelsData LSTM_DynamicInputKernelBfyxOpt::GetKernelsData(const Params& params, } auto cldnn_jit = GetJitConstants(dlstm_params); - auto entry_point = GetEntryPoint(kernelName, dlstm_params.layerID, options); + auto entry_point = GetEntryPoint(kernelName, dlstm_params.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm_dynamic/lstm_dynamic_input_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm_dynamic/lstm_dynamic_input_kernel_base.cpp index 2a1491fb41b..cdfbe15aa26 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm_dynamic/lstm_dynamic_input_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm_dynamic/lstm_dynamic_input_kernel_base.cpp @@ -57,7 +57,7 @@ KernelsData LSTM_DynamicInputKernelBase::GetCommonKernelsData(const Params& para KernelData k_data = KernelData::Default(params, 1); auto cldnn_jit = GetJitConstants(orgParams); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = k_data.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm_dynamic/lstm_dynamic_timeloop_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm_dynamic/lstm_dynamic_timeloop_kernel_base.cpp index 8327a025c8e..a78e8ce5724 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm_dynamic/lstm_dynamic_timeloop_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/lstm_dynamic/lstm_dynamic_timeloop_kernel_base.cpp @@ -118,7 +118,7 @@ KernelsData LSTM_DynamicTimeloopKernelBase::GetCommonKernelsData(const Params& p KernelData k_data = KernelData::Default(params, 1); auto cldnn_jit = GetJitConstants(org_params); - auto entry_point = GetEntryPoint(kernelName, org_params.layerID, options); + auto entry_point = GetEntryPoint(kernelName, org_params.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = k_data.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/max_unpooling/max_unpooling_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/max_unpooling/max_unpooling_kernel_base.cpp index 5534217a9ce..f00dcbc0dea 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/max_unpooling/max_unpooling_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/max_unpooling/max_unpooling_kernel_base.cpp @@ -65,7 +65,7 @@ KernelsData MaxUnpoolingKernelBase::GetCommonKernelsData(const Params& params, KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(orgParams); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/mvn/mvn_kernel_b_fs_yx_fsv16_imad.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/mvn/mvn_kernel_b_fs_yx_fsv16_imad.cpp index 32fd8e5744c..031963920e3 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/mvn/mvn_kernel_b_fs_yx_fsv16_imad.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/mvn/mvn_kernel_b_fs_yx_fsv16_imad.cpp @@ -182,11 +182,12 @@ KernelsData MVNKernel_b_fs_yx_fsv16_imad::GetMultiStageKernelsData(const mvn_par KernelData kd = KernelData::Default(params, kernels_num); auto finalKernelName = GetKernelName(orgParams); + size_t entry_part_id = 0; { // Mean first stage auto cldnn_jit = GetJitConstants(orgParams, dispatchData.stage_1); cldnn_jit.AddConstant(MakeJitConstant("MVN_KERNEL_MEAN_1", 1)); - auto entry_point = GetEntryPoint(finalKernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(finalKernelName, orgParams.layerID, params, options, entry_part_id++); auto jit = CreateJit(finalKernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; FillCLKernelData(kernel, @@ -210,7 +211,7 @@ KernelsData MVNKernel_b_fs_yx_fsv16_imad::GetMultiStageKernelsData(const mvn_par // Mean second stage auto cldnn_jit = GetJitConstants(orgParams, dispatchData.stage_2); cldnn_jit.AddConstant(MakeJitConstant("MVN_KERNEL_MEAN_2", 1)); - auto entry_point = GetEntryPoint(finalKernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(finalKernelName, orgParams.layerID, params, options, entry_part_id++); auto jit = CreateJit(finalKernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[1]; FillCLKernelData(kernel, @@ -234,7 +235,7 @@ KernelsData MVNKernel_b_fs_yx_fsv16_imad::GetMultiStageKernelsData(const mvn_par // Variance first stage auto cldnn_jit = GetJitConstants(orgParams, dispatchData.stage_1); cldnn_jit.AddConstant(MakeJitConstant("MVN_KERNEL_VAR_1", 1)); - auto entry_point = GetEntryPoint(finalKernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(finalKernelName, orgParams.layerID, params, options, entry_part_id++); auto jit = CreateJit(finalKernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[2]; FillCLKernelData(kernel, @@ -257,7 +258,7 @@ KernelsData MVNKernel_b_fs_yx_fsv16_imad::GetMultiStageKernelsData(const mvn_par // Variance second stage auto cldnn_jit = GetJitConstants(orgParams, dispatchData.stage_2); cldnn_jit.AddConstant(MakeJitConstant("MVN_KERNEL_VAR_2", 1)); - auto entry_point = GetEntryPoint(finalKernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(finalKernelName, orgParams.layerID, params, options, entry_part_id++); auto jit = CreateJit(finalKernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[3]; FillCLKernelData(kernel, @@ -282,7 +283,7 @@ KernelsData MVNKernel_b_fs_yx_fsv16_imad::GetMultiStageKernelsData(const mvn_par cldnn_jit.AddConstant(MakeJitConstant("MVN_KERNEL_MAIN", 1)); cldnn_jit.AddConstant(MakeJitConstant("PRECALC_MEAN", 1)); cldnn_jit.AddConstant(MakeJitConstant("PRECALC_VARIANCE", params.mvnNormalizeVariance)); - auto entry_point = GetEntryPoint(finalKernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(finalKernelName, orgParams.layerID, params, options, entry_part_id); auto jit = CreateJit(finalKernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[kernels_num - 1]; FillCLKernelData(kernel, diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/mvn/mvn_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/mvn/mvn_kernel_base.cpp index 8e85c733ec2..3a602a8eb3f 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/mvn/mvn_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/mvn/mvn_kernel_base.cpp @@ -62,7 +62,7 @@ KernelsData MVNKernelBase::GetCommonKernelsData(const Params& params, auto finalKernelName = GetKernelName(orgParams); auto cldnn_jit = GetJitConstants(orgParams, dispatchData); - auto entry_point = GetEntryPoint(finalKernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(finalKernelName, orgParams.layerID, params, options); auto jit = CreateJit(finalKernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/normalize/normalize_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/normalize/normalize_kernel_base.cpp index a5c6dde629d..881c548568b 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/normalize/normalize_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/normalize/normalize_kernel_base.cpp @@ -56,7 +56,7 @@ KernelsData NormalizeKernelBase::GetCommonKernelsData(const Params& params, KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(orgParams); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/one_hot/one_hot_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/one_hot/one_hot_kernel_base.cpp index cfe546a8406..1b18f86367f 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/one_hot/one_hot_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/one_hot/one_hot_kernel_base.cpp @@ -45,7 +45,7 @@ KernelsData OneHotKernelBase::GetCommonKernelsData(const Params& params, KernelData k_data = KernelData::Default(params); auto cldnn_jit = GetJitConstants(prim_params); - auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, options); + auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = k_data.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/permute/permute_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/permute/permute_kernel_base.cpp index bda85cfc415..eb44d1d35ca 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/permute/permute_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/permute/permute_kernel_base.cpp @@ -36,7 +36,7 @@ KernelsData PermuteKernelBase::GetKernelsData(const Params& params, const option auto dispatchData = SetDefault(newParams); auto cldnn_jit = GetJitConstants(newParams, dispatchData); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); std::pair jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; FillCLKernelData(kernel, dispatchData, params.engineInfo, kernelName, jit, entry_point, "", false, false, 1, GetFusedPrimitiveInputsCount(params)); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/pooling/pooling_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/pooling/pooling_kernel_base.cpp index eb42f283703..5ea0c3753d2 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/pooling/pooling_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/pooling/pooling_kernel_base.cpp @@ -175,7 +175,7 @@ KernelsData PoolingKernelBase::GetCommonKernelsData(const Params& params, KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(orgParams, dispatchData); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/pyramid_roi_align/pyramid_roi_align_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/pyramid_roi_align/pyramid_roi_align_kernel_base.cpp index dc651a42d1d..bad255be02a 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/pyramid_roi_align/pyramid_roi_align_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/pyramid_roi_align/pyramid_roi_align_kernel_base.cpp @@ -36,7 +36,7 @@ KernelsData PyramidROIAlignKernelBase::GetCommonKernelsData(const Params& params auto dispatchData = SetDefault(prim_params); KernelData k_data = KernelData::Default(params); auto cldnn_jit = GetJitConstants(prim_params); - auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, options); + auto entry_point = GetEntryPoint(kernelName, prim_params.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = k_data.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/quantize/quantize_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/quantize/quantize_kernel_base.cpp index b6a6a6a71db..4a3e50d55e3 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/quantize/quantize_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/quantize/quantize_kernel_base.cpp @@ -62,7 +62,7 @@ KernelsData QuantizeKernelBase::GetKernelsData(const Params& params, const optio } auto dispatchData = SetDefault(newParams, options); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams, dispatchData); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reduce/reduce_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reduce/reduce_kernel_base.cpp index b814f23b01e..6d10fd05a31 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reduce/reduce_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reduce/reduce_kernel_base.cpp @@ -231,7 +231,7 @@ KernelsData ReduceKernelBase::GetCommonKernelsData(const Params& p, KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(params); - auto entry_point = GetEntryPoint(kernelName, params.layerID, options); + auto entry_point = GetEntryPoint(kernelName, params.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/region_yolo/region_yolo_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/region_yolo/region_yolo_kernel_ref.cpp index fed2ac12b37..eb9c12a7ebc 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/region_yolo/region_yolo_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/region_yolo/region_yolo_kernel_ref.cpp @@ -80,7 +80,7 @@ KernelsData RegionYoloKernelRef::GetKernelsData(const Params& params, const opti KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(orgParams); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reorder/reorder_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reorder/reorder_kernel_base.cpp index 9629aa2dbc1..70a178a314b 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reorder/reorder_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reorder/reorder_kernel_base.cpp @@ -198,7 +198,7 @@ KernelsData ReorderKernelBase::GetCommonKernelsData(const reorder_weights_params dispatchData = SetDefault(newParams); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); @@ -222,7 +222,7 @@ KernelsData ReorderKernelBase::GetCommonKernelsData(const reorder_params& params DispatchData dispatchData = SetDefault(newParams); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reorg_yolo/reorg_yolo_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reorg_yolo/reorg_yolo_kernel_ref.cpp index 056d1e5af3a..7a07f52d351 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reorg_yolo/reorg_yolo_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reorg_yolo/reorg_yolo_kernel_ref.cpp @@ -52,7 +52,7 @@ KernelsData ReorgYoloKernelRef::GetKernelsData(const Params& params, const optio KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(orgParams); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/resample/resample_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/resample/resample_kernel_base.cpp index 97fee3f405c..7b8079c0770 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/resample/resample_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/resample/resample_kernel_base.cpp @@ -221,7 +221,7 @@ KernelsData ResampleKernelBase::GetCommonKernelsData(const Params& params, const resample_params& newParams = *static_cast(kd.params.get()); auto dispatchData = SetDefault(newParams); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reshape/reshape_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reshape/reshape_kernel_ref.cpp index 401ffc73d9c..b3df228548b 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reshape/reshape_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reshape/reshape_kernel_ref.cpp @@ -37,7 +37,7 @@ KernelsData ReshapeKernelRef::GetKernelsData(const Params& params, const optiona KernelData kd = KernelData::Default(params); reshape_params& newParams = *static_cast(kd.params.get()); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = MakeBaseParamsJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reverse_sequence/reverse_sequence_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reverse_sequence/reverse_sequence_kernel_ref.cpp index da20e77c031..78f92d798fb 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reverse_sequence/reverse_sequence_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/reverse_sequence/reverse_sequence_kernel_ref.cpp @@ -58,7 +58,7 @@ KernelsData ReverseSequenceKernelRef::GetKernelsData(const Params& params, const assert(params.GetType() == KernelType::REVERSE_SEQUENCE); auto dispatchData = SetDefault(newParams, options); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/roi_pooling/roi_pooling_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/roi_pooling/roi_pooling_kernel_base.cpp index 271929559c4..2298d78c2d5 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/roi_pooling/roi_pooling_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/roi_pooling/roi_pooling_kernel_base.cpp @@ -50,7 +50,7 @@ KernelsData ROIPoolingKernelBase::GetCommonKernelsData(const Params& params, KernelData kd = KernelData::Default(params); auto cldnn_jit = GetJitConstants(orgParams); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/scatter_update/scatter_elements_update_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/scatter_update/scatter_elements_update_kernel_ref.cpp index d3c4b93a837..20645fb0f82 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/scatter_update/scatter_elements_update_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/scatter_update/scatter_elements_update_kernel_ref.cpp @@ -145,7 +145,7 @@ KernelsData ScatterElementsUpdateKernelRef::GetKernelsData(const Params& params, for (int i = 0; i < 2; i++) { auto dispatchData = SetDefault(newParams, options, (i == 1)); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options, i); if (i == 1) { cldnn_jit.AddConstant(MakeJitConstant("IS_SECOND_ITER", "true")); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/scatter_update/scatter_nd_update_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/scatter_update/scatter_nd_update_kernel_ref.cpp index 6c13dd74a0c..a3803a38db7 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/scatter_update/scatter_nd_update_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/scatter_update/scatter_nd_update_kernel_ref.cpp @@ -162,7 +162,7 @@ KernelsData ScatterNDUpdateKernelRef::GetKernelsData(const Params& params, const // Second iter - update values specified by updates at specific index position specified by indices for (int i = 0; i < 2; i++) { auto dispatchData = SetDefault(newParams, options, (i == 1)); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options, i); if (i == 1) { cldnn_jit.AddConstant(MakeJitConstant("IS_SECOND_ITER", "true")); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/scatter_update/scatter_update_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/scatter_update/scatter_update_kernel_ref.cpp index 4ccb8ca55a8..2cc46ca7d00 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/scatter_update/scatter_update_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/scatter_update/scatter_update_kernel_ref.cpp @@ -269,7 +269,7 @@ KernelsData ScatterUpdateKernelRef::GetKernelsData(const Params& params, const o for (int i = start_with_iteration; i < 2; i++) { auto dispatchData = SetDefault(newParams, options, (i == 1)); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options, i); if (i == 1) { cldnn_jit.AddConstant(MakeJitConstant("IS_SECOND_ITER", "true")); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/select/select_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/select/select_kernel_base.cpp index d02c6a72028..68d0229dedc 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/select/select_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/select/select_kernel_base.cpp @@ -123,7 +123,7 @@ KernelsData SelectKernelBase::GetCommonKernelsData(const Params& params, const o KernelData kd = KernelData::Default(params); select_params& newParams = *static_cast(kd.params.get()); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/shuffle_channels/shuffle_channels_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/shuffle_channels/shuffle_channels_kernel_ref.cpp index 3f234fa89ed..0c2c2d79552 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/shuffle_channels/shuffle_channels_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/shuffle_channels/shuffle_channels_kernel_ref.cpp @@ -89,7 +89,7 @@ KernelsData ShuffleChannelsKernelRef::GetKernelsData(const Params& params, const assert(params.GetType() == KernelType::SHUFFLE_CHANNELS); auto dispatchData = SetDefault(newParams, options); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/softmax/softmax_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/softmax/softmax_kernel_base.cpp index 7336f3cab13..ef0a19d7373 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/softmax/softmax_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/softmax/softmax_kernel_base.cpp @@ -62,7 +62,7 @@ KernelsData SoftmaxKernelBase::GetCommonKernelsData(const Params& params, const auto dispatchData = SetDefault(orgParams, options); auto cldnn_jit = GetJitConstants(orgParams, dispatchData); - auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, orgParams.layerID, params, options); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); auto& kernel = kd.kernels[0]; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/space_to_batch/space_to_batch_kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/space_to_batch/space_to_batch_kernel_base.cpp index 830b3bfd9cd..83b58c27774 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/space_to_batch/space_to_batch_kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/space_to_batch/space_to_batch_kernel_base.cpp @@ -79,7 +79,7 @@ KernelsData SpaceToBatchKernelBase::GetCommonKernelsData(const Params& params, c } auto dispatchData = SetDefault(newParams, options); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/space_to_depth/space_to_depth_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/space_to_depth/space_to_depth_kernel_ref.cpp index 14316395776..2975c1c40f0 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/space_to_depth/space_to_depth_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/space_to_depth/space_to_depth_kernel_ref.cpp @@ -91,7 +91,7 @@ KernelsData SpaceToDepthKernelRef::GetKernelsData(const Params& params, const op } auto dispatchData = SetDefault(newParams, options); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/strided_slice/strided_slice_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/strided_slice/strided_slice_kernel_ref.cpp index 495292b4f45..46dd741815b 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/strided_slice/strided_slice_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/strided_slice/strided_slice_kernel_ref.cpp @@ -155,7 +155,7 @@ KernelsData StridedSliceKernelRef::GetKernelsData(const Params& params, const op assert(params.GetType() == KernelType::STRIDED_SLICE); auto dispatchData = SetDefault(newParams, options); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/tile/tile_kernel_ref.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/tile/tile_kernel_ref.cpp index d82835b5bc1..40a81b62a5c 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/tile/tile_kernel_ref.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/actual_kernels/tile/tile_kernel_ref.cpp @@ -55,7 +55,7 @@ KernelsData TileKernelRef::GetKernelsData(const Params& params, const optional_p tile_params& newParams = *static_cast(kd.params.get()); auto dispatchData = SetDefault(newParams, options); - auto entry_point = GetEntryPoint(kernelName, newParams.layerID, options); + auto entry_point = GetEntryPoint(kernelName, newParams.layerID, params, options); auto cldnn_jit = GetJitConstants(newParams); auto jit = CreateJit(kernelName, cldnn_jit, entry_point); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/common/kernel_base_opencl.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/common/kernel_base_opencl.cpp index 94dede301d7..a3cb28236ef 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/common/kernel_base_opencl.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/common/kernel_base_opencl.cpp @@ -63,8 +63,10 @@ public: } // namespace std::string KernelBaseOpenCL::GetEntryPoint(const std::string& templateName, - const std::string& layerID, - const optional_params& options) const { + const std::string& layerID, + const Params& params, + const optional_params& options, + const size_t partID) const { std::string kernelID = layerID; if (kernelID.empty() || !options.meaningfulKernelsNames) { @@ -74,7 +76,8 @@ std::string KernelBaseOpenCL::GetEntryPoint(const std::string& templateName, std::replace(kernelID.begin(), kernelID.end(), '.', '_'); std::replace(kernelID.begin(), kernelID.end(), '/', '_'); - kernelID += "_" + toCodeString(UniqeID()); + // UniqueID = program_id + processing_index + additional weight/reorder tag + kernelID += "_" + params.uniqueID + "_" + std::to_string(partID); return kernelID; } diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/common/kernel_base_opencl.h b/inference-engine/thirdparty/clDNN/kernel_selector/core/common/kernel_base_opencl.h index 1e5505b2017..ab1eff3eb9a 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/common/kernel_base_opencl.h +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/common/kernel_base_opencl.h @@ -24,7 +24,9 @@ protected: const std::string& kernel_name) const; std::string GetEntryPoint(const std::string& templateName, const std::string& layerID, - const optional_params& options) const; + const Params& params, + const optional_params& options, + const size_t partID = 0) const; Arguments GetArgsDesc(uint32_t num_of_input, bool use_weights, bool use_bias, diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/common/kernel_selector_utils.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/common/kernel_selector_utils.cpp index 3115d093d52..14a9e21e8c7 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/common/kernel_selector_utils.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/common/kernel_selector_utils.cpp @@ -119,6 +119,7 @@ bool UpdateWeightsParams(weight_bias_params& newParams, r_params.output = newParams.weights.TransformIgnorePadding(reqLayout, dtype, groups, false); r_params.rotate_180 = rotate; r_params.engineInfo = newParams.engineInfo; + r_params.uniqueID = newParams.uniqueID + "_weight"; reorder_optional_params op; KernelsData kernels_data = reorderKS.GetBestKernels(r_params, op); diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_base.cpp b/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_base.cpp index 86fde69ed05..41d067d1f62 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_base.cpp +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_base.cpp @@ -8,7 +8,6 @@ namespace kernel_selector { const primitive_db KernelBase::db; -thread_local size_t KernelBase::counter = 0; std::string toString(const kernel_selector::CommonDispatchData& dispatchData) { auto gws = dispatchData.gws; diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_base.h b/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_base.h index d547b6cf758..1c9335c1a56 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_base.h +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_base.h @@ -56,14 +56,12 @@ public: virtual const std::string GetName() const { return kernelName; } static const primitive_db& get_db() { return db; } - static void ResetCounter() { counter = 0; } protected: static const primitive_db db; const std::string kernelName; static void CheckDispatchData(const std::string& kernelName, const kernel_selector::CommonDispatchData& dispatchData); - static size_t UniqeID() { return counter++; } // TODO: use interlocked virtual Datatype GetUnitType(const base_params& params) const; bool IsFusedPrimitiveSupported(const fused_operation_desc& fused_op) const; @@ -71,8 +69,5 @@ protected: virtual std::vector GetSupportedFusedOps() const; virtual JitConstants MakeFusedOpsJitConstants(const base_params ¶ms, const std::vector &conf) const; virtual JitConstants MakeFusedOpsDeclsJitConstants(const base_params ¶ms, const std::vector &conf) const; - -private: - static thread_local size_t counter; }; } // namespace kernel_selector diff --git a/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_selector_params.h b/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_selector_params.h index ce5d9062c46..67b393e6e10 100644 --- a/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_selector_params.h +++ b/inference-engine/thirdparty/clDNN/kernel_selector/core/kernel_selector_params.h @@ -404,6 +404,7 @@ public: std::string layerID; std::string forceImplementation; EngineInfo engineInfo; + std::string uniqueID; virtual std::string to_string() const; virtual std::string to_cache_string_v2() const; diff --git a/inference-engine/thirdparty/clDNN/runtime/debug_configuration.cpp b/inference-engine/thirdparty/clDNN/runtime/debug_configuration.cpp index cc7d64f71ec..4f07f5e1f09 100644 --- a/inference-engine/thirdparty/clDNN/runtime/debug_configuration.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/debug_configuration.cpp @@ -35,10 +35,26 @@ static void get_str_env(const std::string &var, std::string &val) { debug_configuration::debug_configuration() : verbose(0) - , dump_graphs(std::string()) { + , print_multi_kernel_perf(0) + , disable_usm(0) + , dump_graphs(std::string()) + , dump_layers_path(std::string()) + , dump_layers(std::string()) + , dump_layers_dst_only(0) { #ifdef GPU_DEBUG_CONFIG get_int_env("OV_GPU_Verbose", verbose); + get_int_env("OV_GPU_PrintMultiKernelPerf", print_multi_kernel_perf); + get_int_env("OV_GPU_DisableUsm", disable_usm); get_str_env("OV_GPU_DumpGraphs", dump_graphs); + get_str_env("OV_GPU_DumpLayersPath", dump_layers_path); + get_str_env("OV_GPU_DumpLayers", dump_layers); + get_int_env("OV_GPU_DumpLayersDstOnly", dump_layers_dst_only); + if (dump_layers_path.length() > 0 && !disable_usm) { + disable_usm = 1; + GPU_DEBUG_COUT << "DisableUsm=1 because of DumpLayersPath" << std::endl; + } + if (dump_layers.length() > 0) + dump_layers = " " + dump_layers + " "; // Insert delimiter for easier parsing when used #endif } diff --git a/inference-engine/thirdparty/clDNN/runtime/engine.cpp b/inference-engine/thirdparty/clDNN/runtime/engine.cpp index 561f38f00f4..976e7bae595 100644 --- a/inference-engine/thirdparty/clDNN/runtime/engine.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/engine.cpp @@ -7,6 +7,7 @@ #include "cldnn/runtime/memory.hpp" #include "cldnn/runtime/stream.hpp" #include "cldnn/runtime/device_query.hpp" +#include "cldnn/runtime/debug_configuration.hpp" #include "ocl/ocl_engine_factory.hpp" @@ -19,8 +20,7 @@ namespace cldnn { engine::engine(const device::ptr device, const engine_configuration& configuration) -: _memory_pool(new memory_pool(*this)) -, _device(device) +: _device(device) , _configuration(configuration) {} device_info engine::get_device_info() const { @@ -32,6 +32,10 @@ const device::ptr engine::get_device() const { } bool engine::use_unified_shared_memory() const { + GPU_DEBUG_GET_INSTANCE(debug_config); + GPU_DEBUG_IF(debug_config->disable_usm) { + return false; + } if (_device->get_mem_caps().supports_usm() && _configuration.use_unified_shared_memory) { return true; } @@ -67,17 +71,6 @@ allocation_type engine::get_lockable_preffered_memory_allocation_type(bool is_im throw std::runtime_error("[clDNN internal error] Could not find proper allocation type!"); } -memory::ptr engine::get_memory_from_pool(const layout& layout, - primitive_id id, - uint32_t network_id, - std::set dependencies, - allocation_type type, - bool reusable) { - if (_configuration.use_memory_pool) - return _memory_pool->get_memory(layout, id, network_id, dependencies, type, reusable); - return _memory_pool->get_memory(layout, type); -} - memory::ptr engine::attach_memory(const layout& layout, void* ptr) { return std::make_shared(layout, ptr); } @@ -126,16 +119,23 @@ memory_ptr engine::share_surface(const layout& layout, shared_surface surf, uint } #endif // _WIN32 -memory_pool& engine::get_memory_pool() { - return *_memory_pool.get(); -} - uint64_t engine::get_max_used_device_memory() const { - return _memory_pool->get_max_peak_device_memory_used(); + return peak_memory_usage.load(); } uint64_t engine::get_used_device_memory() const { - return _memory_pool->get_temp_memory_used(); + return memory_usage.load(); +} + +void engine::add_memory_used(size_t bytes) { + memory_usage += bytes; + if (memory_usage > peak_memory_usage) { + peak_memory_usage = memory_usage.load(); + } +} + +void engine::subtract_memory_used(size_t bytes) { + memory_usage -= bytes; } std::shared_ptr engine::create(engine_types engine_type, diff --git a/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp b/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp index 2e7e1272d06..ed135369767 100644 --- a/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/kernels_cache.cpp @@ -242,7 +242,7 @@ kernels_cache::kernels_cache(engine& engine) : _engine(engine) { } kernel_id kernels_cache::set_kernel_source( const std::shared_ptr& kernel_string, bool dump_custom_program) { - + std::lock_guard lock(_mutex); // we need unique id in order to avoid conflict across topologies. const auto kernel_num = _kernels.size() + _kernels_code.size(); kernel_id id = kernel_string->entry_point + "_" + std::to_string(kernel_num); diff --git a/inference-engine/thirdparty/clDNN/runtime/kernels_cache.hpp b/inference-engine/thirdparty/clDNN/runtime/kernels_cache.hpp index 931d267e955..df0d85f5b9d 100644 --- a/inference-engine/thirdparty/clDNN/runtime/kernels_cache.hpp +++ b/inference-engine/thirdparty/clDNN/runtime/kernels_cache.hpp @@ -13,11 +13,7 @@ #include #include #include -#include - -#define CLDNN_THREADING_SEQ 0 -#define CLDNN_THREADING_TBB 1 -#define CLDNN_THREADING_THREADPOOL 2 +#include #if (CLDNN_THREADING == CLDNN_THREADING_TBB) #include @@ -111,26 +107,28 @@ public: std::shared_ptr kernel_strings; std::string id; bool dump_custom_program; + size_t hash_value; kernel_code(const std::shared_ptr& _kernel_strings, const std::string& _id, bool _dump_custom_program) : kernel_strings(_kernel_strings), id(_id), - dump_custom_program(_dump_custom_program) {} + dump_custom_program(_dump_custom_program), + hash_value(_kernel_strings->get_hash()) {} - bool operator == (const kernel_code& c2) const { - return kernel_strings->get_hash() == c2.kernel_strings->get_hash(); + bool operator == (const kernel_code& rhs) const { + return (hash_value == rhs.hash_value); } }; - struct hash_kernel_code { - size_t operator()(const kernel_code& x) const { - return std::hash()(x.kernel_strings->get_hash()); + struct cmp_kernel_code { + bool operator()(const kernel_code& x1, const kernel_code& x2) const { + return (x1.hash_value < x2.hash_value); } }; - using kernels_code = std::unordered_set; + using kernels_code = std::set; private: static std::mutex _mutex; diff --git a/inference-engine/thirdparty/clDNN/runtime/memory.cpp b/inference-engine/thirdparty/clDNN/runtime/memory.cpp index 1a6ff65795b..80a6ee980ed 100644 --- a/inference-engine/thirdparty/clDNN/runtime/memory.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/memory.cpp @@ -5,6 +5,7 @@ #include "cldnn/runtime/memory.hpp" #include "cldnn/runtime/engine.hpp" #include "cldnn/runtime/stream.hpp" +#include "cldnn/runtime/debug_configuration.hpp" #include "ocl/ocl_memory.hpp" @@ -17,12 +18,29 @@ namespace cldnn { memory::memory(engine* engine, const layout& layout, allocation_type type, bool reused) - : _engine(engine), _layout(layout), _bytes_count(_layout.bytes_count()), _type(type), _reused(reused) {} + : _engine(engine), _layout(layout), _bytes_count(_layout.bytes_count()), _type(type), _reused(reused) { + if (!_reused && _engine) { + _engine->add_memory_used(_bytes_count); + } + + GPU_DEBUG_GET_INSTANCE(debug_config); + GPU_DEBUG_IF(debug_config->verbose >= 1) { + GPU_DEBUG_COUT << "Allocate " << _bytes_count << " bytes of " << type << " allocation type" + << " (current=" << _engine->get_used_device_memory() << ";" + << " max=" << _engine->get_max_used_device_memory() << ")" << std::endl; + } +} memory::~memory() { if (!_reused && _engine) { - // TODO: Make memory usage tracker static in memory class - _engine->get_memory_pool().subtract_memory_used(_bytes_count); + _engine->subtract_memory_used(_bytes_count); + } + + GPU_DEBUG_GET_INSTANCE(debug_config); + GPU_DEBUG_IF(debug_config->verbose >= 1) { + GPU_DEBUG_COUT << "Free " << _bytes_count << " bytes" + << " (current=" << _engine->get_used_device_memory() << ";" + << " max=" << _engine->get_max_used_device_memory() << ")" << std::endl; } } diff --git a/inference-engine/thirdparty/clDNN/runtime/memory_pool.cpp b/inference-engine/thirdparty/clDNN/runtime/memory_pool.cpp index 85091ccdd18..74351fda54e 100644 --- a/inference-engine/thirdparty/clDNN/runtime/memory_pool.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/memory_pool.cpp @@ -24,10 +24,6 @@ memory_record::memory_record(memory_set users, : _users(users), _memory(memory), _network_id(net_id), _type(type) {} memory::ptr memory_pool::alloc_memory(const layout& layout, allocation_type type) { - if (_max_peak_memory_used > _engine->get_device_info().max_global_mem_size) { - throw std::runtime_error("exceeded global device memory"); - } - return _engine->allocate_memory(layout, type); } @@ -298,26 +294,6 @@ void memory_pool::clear_pool_for_network(uint32_t network_id) { } } -memory_pool::memory_pool(engine& engine) : _engine(&engine), _temp_memory_used(0), _max_peak_memory_used(0) { } - -void memory_pool::add_memory_used(size_t value) { - // std::cerr << "ADD MEM: " << value - // << " max: " << _engine->get_device_info().max_global_mem_size - // << " peak: " << _max_peak_memory_used - // << " tmp: " << _temp_memory_used << std::endl; - - _temp_memory_used += value; - if (_temp_memory_used > _max_peak_memory_used) { - _max_peak_memory_used = _temp_memory_used.load(); - } -} - -void memory_pool::subtract_memory_used(size_t value) { - _temp_memory_used -= value; - // std::cerr << "FREE MEM: " << value - // << " max: " << _engine->get_device_info().max_global_mem_size - // << " peak: " << _max_peak_memory_used - // << " tmp: " << _temp_memory_used << std::endl; -} +memory_pool::memory_pool(engine& engine) : _engine(&engine) { } } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/runtime/ocl/ocl_engine.cpp b/inference-engine/thirdparty/clDNN/runtime/ocl/ocl_engine.cpp index c7d8e9fa6e6..a980a90f40b 100644 --- a/inference-engine/thirdparty/clDNN/runtime/ocl/ocl_engine.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/ocl/ocl_engine.cpp @@ -73,8 +73,6 @@ memory::ptr ocl_engine::allocate_memory(const layout& layout, allocation_type ty throw std::runtime_error("exceeded max size of memory object allocation"); } - _memory_pool->add_memory_used(layout.bytes_count()); - try { memory::ptr res = nullptr; if (layout.format.is_image_2d()) { diff --git a/inference-engine/thirdparty/clDNN/runtime/ocl/ocl_event.cpp b/inference-engine/thirdparty/clDNN/runtime/ocl/ocl_event.cpp index 76e3c8f94ff..d40dbf7dfa1 100644 --- a/inference-engine/thirdparty/clDNN/runtime/ocl/ocl_event.cpp +++ b/inference-engine/thirdparty/clDNN/runtime/ocl/ocl_event.cpp @@ -3,6 +3,7 @@ // #include "ocl_event.hpp" +#include "cldnn/runtime/debug_configuration.hpp" #include #include @@ -175,6 +176,17 @@ bool ocl_events::get_profiling_info_impl(std::listprint_multi_kernel_perf) { + if (0 == strcmp(period.name, "executing")) { + GPU_DEBUG_COUT << "Multi-kernel time: "; + for (auto& duration : all_durations[period.name]) + std::cout << " " << (duration.second - duration.first) / 1000; + std::cout << " Total " << sum / 1000 << std::endl; + } + } + info.push_back(get_profiling_interval(period.name, 0, sum)); } diff --git a/inference-engine/thirdparty/clDNN/src/CMakeLists.txt b/inference-engine/thirdparty/clDNN/src/CMakeLists.txt index c84041e2443..b9c0af334bc 100644 --- a/inference-engine/thirdparty/clDNN/src/CMakeLists.txt +++ b/inference-engine/thirdparty/clDNN/src/CMakeLists.txt @@ -8,25 +8,6 @@ set(CLDNN_BUILD__PROJ "${CLDNN_BUILD__PROJ__clDNN}") set(CLDNN_BUILD__PROJ_LABEL "${CLDNN_BUILD__PROJ_LABEL__clDNN}") set(CLDNN_BUILD__PROJ_OUTPUT_NAME "${CLDNN_BUILD__PROJ_OUTPUT_NAME__clDNN}") -# ========================================== Compiler options ========================================== -# FIXME: latest findings showed issue with using libgomp inside clDNN -# temporarily disabling OpenMP to ensure clDNN works -#find_package(OpenMP) -if (OPENMP_FOUND) - add_definitions(-DOPENMP_FOUND) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") -endif() - -# ================================== Compiler preprocessor definitions ================================= - -set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS - "CLDNN_VERSION_MAJOR=${CLDNN__VERSION_MAJOR}" - "CLDNN_VERSION_MINOR=${CLDNN__VERSION_MINOR}" - "CLDNN_VERSION_BUILD=${CLDNN__VERSION_BUILD}" - "CLDNN_VERSION_REVISION=${CLDNN__VERSION_REVISION}" - ) - # ========================================= Source/Header files ======================================== set(__CLDNN_Label__api "api") @@ -63,21 +44,6 @@ file(GLOB __CLDNN_Sources__gpu "${__CLDNN_Directory__gpu}/*.h" "${__CLDNN_Directory__gpu}/*.hpp" "${__CLDNN_Directory__gpu}/*.cpp" - "${__CLDNN_Directory__gpu}/*.inc" - ) - -set(__CLDNN_Directory__cache "${__CLDNN_Directory__gpu}/cache") -set(__CLDNN_Label__cache "${__CLDNN_Label__gpu}\\cache") -file(GLOB __CLDNN_Sources__cache - "${__CLDNN_Directory__cache}/*.h" - "${__CLDNN_Directory__cache}/*.hpp" - "${__CLDNN_Directory__cache}/*.cpp" - ) - -set(__CLDNN_Directory__ch_kernels "${__CLDNN_Directory__cache}/kernels") -set(__CLDNN_Label__ch_kernels "${__CLDNN_Label__cache}\\kernels") -file(GLOB __CLDNN_Sources__ch_kernels - "${__CLDNN_Directory__ch_kernels}/*.cl" ) set(__CLDNN_Directory__cg_cache "${CLDNN__CODEGEN_INCDIR}") diff --git a/inference-engine/thirdparty/clDNN/src/gpu/detection_output_cpu.cpp b/inference-engine/thirdparty/clDNN/src/gpu/detection_output_cpu.cpp index 020ac340d48..efe7033fb9c 100644 --- a/inference-engine/thirdparty/clDNN/src/gpu/detection_output_cpu.cpp +++ b/inference-engine/thirdparty/clDNN/src/gpu/detection_output_cpu.cpp @@ -30,6 +30,18 @@ namespace { using bounding_box = cldnn::cpu::bounding_box; } // namespace +template +bool comp_score_descend(const std::pair& pair1, + const std::pair& pair2) { + return (pair1.first > pair2.first) || (pair1.first == pair2.first && pair1.second < pair2.second); +} + +template <> +bool comp_score_descend>(const std::pair>& pair1, + const std::pair>& pair2) { + return (pair1.first > pair2.first) || (pair1.first == pair2.first && pair1.second.second < pair2.second.second); +} + /************************ Detection Output CPU ************************/ struct detection_output_cpu : typed_primitive_impl { enum NMSType {CAFFE, MXNET}; @@ -186,7 +198,9 @@ struct detection_output_cpu : typed_primitive_impl { const bool share_location, std::map>& indices, std::vector>>& scoreIndexPairs) { - std::sort(scoreIndexPairs.begin(), scoreIndexPairs.end(), comp_score_descend>); + std::sort(scoreIndexPairs.begin(), + scoreIndexPairs.end(), + comp_score_descend>); if (top_k != -1) if (scoreIndexPairs.size() > static_cast(top_k)) @@ -244,12 +258,6 @@ struct detection_output_cpu : typed_primitive_impl { } } - template - static bool comp_score_descend(const std::pair& pair1, - const std::pair& pair2) { - return pair1.first > pair2.first; - } - template void generate_detections(stream& stream, const detection_output_inst& instance, const int num_of_images, @@ -311,7 +319,9 @@ struct detection_output_cpu : typed_primitive_impl { } } - std::sort(score_index_pairs.begin(), score_index_pairs.end(), comp_score_descend>); + std::sort(score_index_pairs.begin(), + score_index_pairs.end(), + comp_score_descend>); score_index_pairs.resize(args.keep_top_k); std::vector>> new_indices(args.num_classes); diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/compile_graph.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/compile_graph.cpp index 8c3335aecbb..2a89322c620 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/compile_graph.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/compile_graph.cpp @@ -10,17 +10,49 @@ #include "program_node.h" #include "cldnn/runtime/engine.hpp" #include "runtime/cldnn_itt.hpp" +#include +#include +#include + +#if (CLDNN_THREADING == CLDNN_THREADING_TBB) +#include +#include +#endif using namespace cldnn; void compile_graph::run(program_impl& p) { OV_ITT_SCOPED_TASK(itt::domains::CLDNN, "CLDNN::pass::CompileGraph"); + size_t order_idx = 0; for (auto& node : p.get_processing_order()) { + node->set_unique_id(std::to_string(order_idx++)); if (!node->is_type()) { node->get_output_layout(); - if (!node->is_type() && !(node->is_type() && node->get_dependencies().empty())) { - node->selected_impl = node->type()->choose_impl(p.get_engine(), *node); - } } } + +#if (CLDNN_THREADING == CLDNN_THREADING_TBB) + const auto n_threads = p.get_engine().configuration().n_threads; + auto arena = std::unique_ptr(new tbb::task_arena()); + arena->initialize(n_threads); + arena->execute([this, &p] { + auto& proc_order = p.get_processing_order(); + tbb::parallel_for(tbb::blocked_range(0, proc_order.size()), [&proc_order, &p](const tbb::blocked_range& r) { + for (auto i = r.begin(); i != r.end(); ++i) { + auto& node = *(std::next(proc_order.begin(), i)); + node->set_unique_id(std::to_string(i)); + if (!node->is_type() && !(node->is_type() && node->get_dependencies().empty())) { + node->selected_impl = node->type()->choose_impl(p.get_engine(), *node); + } + } + }); + }); + arena.reset(); +#else + for (auto& node : p.get_processing_order()) { + if (!node->is_type() && !(node->is_type() && node->get_dependencies().empty())) { + node->selected_impl = node->type()->choose_impl(p.get_engine(), *node); + } + } +#endif } diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/post_input_reorder.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/post_input_reorder.cpp index b4371112d11..29581b50e92 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/post_input_reorder.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/post_input_reorder.cpp @@ -59,6 +59,7 @@ void post_input_reorder::run(program_impl& p) { input_layout.size, input_layout.data_padding); auto& reorder = add_reorder(p, input, node, current_layout); + reorder.set_unique_id(node->get_unique_id() + "_input_reorder"); reorder.get_output_layout(false); node->set_output_layout(previous_layout, false); reorder.set_selected_impl(reorder.type()->choose_impl(p.get_engine(), reorder)); diff --git a/inference-engine/thirdparty/clDNN/src/graph_optimizer/remove_redundant_reorders.cpp b/inference-engine/thirdparty/clDNN/src/graph_optimizer/remove_redundant_reorders.cpp index 5d1fc6e6977..2e484c00beb 100644 --- a/inference-engine/thirdparty/clDNN/src/graph_optimizer/remove_redundant_reorders.cpp +++ b/inference-engine/thirdparty/clDNN/src/graph_optimizer/remove_redundant_reorders.cpp @@ -28,6 +28,7 @@ void remove_redundant_reorders::run(program_impl& p) { return; auto& eng = p.get_engine(); + node.set_unique_id(node.get_unique_id() + "_reorder"); auto new_impl = node.type()->choose_impl(eng, node); node.set_selected_impl(std::move(new_impl)); }; diff --git a/inference-engine/thirdparty/clDNN/src/include/network_impl.h b/inference-engine/thirdparty/clDNN/src/include/network_impl.h index 8c5c570cbd4..7da36aaad54 100644 --- a/inference-engine/thirdparty/clDNN/src/include/network_impl.h +++ b/inference-engine/thirdparty/clDNN/src/include/network_impl.h @@ -102,10 +102,19 @@ public: bool is_internal() const { return _internal; } bool is_primary_stream() { return _is_primary_stream; } + /// Create memory object with specified @p layout and allocation @p type for primitive with @p id + /// Underlying memory handle can be reused with other primitives from memory pool based on @p dependencies + memory_ptr get_memory_from_pool(const layout& layout, + primitive_id id, + std::set dependencies, + allocation_type type, + bool reusable = true); + private: uint32_t net_id = 0; program_impl::ptr _program; stream::ptr _stream; + std::unique_ptr _memory_pool; bool _internal; bool _is_primary_stream; bool _reset_arguments; diff --git a/inference-engine/thirdparty/clDNN/src/include/program_node.h b/inference-engine/thirdparty/clDNN/src/include/program_node.h index d0e904d3c56..bbb1748c8ab 100644 --- a/inference-engine/thirdparty/clDNN/src/include/program_node.h +++ b/inference-engine/thirdparty/clDNN/src/include/program_node.h @@ -305,7 +305,12 @@ public: bool need_lockable_memory() const; + std::string get_unique_id() const { return unique_id; } + void set_unique_id(std::string id) { unique_id = id; } + protected: + std::string unique_id; + std::shared_ptr desc; program_impl& myprog; diff --git a/inference-engine/thirdparty/clDNN/src/kernel_selector_helper.cpp b/inference-engine/thirdparty/clDNN/src/kernel_selector_helper.cpp index 716b5fa49eb..cdcc65d95fd 100644 --- a/inference-engine/thirdparty/clDNN/src/kernel_selector_helper.cpp +++ b/inference-engine/thirdparty/clDNN/src/kernel_selector_helper.cpp @@ -734,6 +734,7 @@ void set_params(const program_node& node, kernel_selector::params& params) { const auto& program = node.get_program(); const auto& device_info = program.get_engine().get_device_info(); + params.uniqueID = std::to_string(program.get_id()) + "_" + node.get_unique_id(); params.engineInfo.bSubGroupSupport = device_info.supports_subgroups; params.engineInfo.bSubGroupShortSupport = device_info.supports_subgroups_short; params.engineInfo.bSubGroupCharSupport = device_info.supports_subgroups_char; diff --git a/inference-engine/thirdparty/clDNN/src/network.cpp b/inference-engine/thirdparty/clDNN/src/network.cpp index 0677ea5fbbe..dbba7bfcddd 100644 --- a/inference-engine/thirdparty/clDNN/src/network.cpp +++ b/inference-engine/thirdparty/clDNN/src/network.cpp @@ -33,15 +33,9 @@ #include #include -// #define DEBUG_DUMP_PATH "cldnn_dump/" - -#ifdef DEBUG_DUMP_PATH +#ifdef GPU_DEBUG_CONFIG #include #include - -#define DUMP_VERBOSE 0 -#define DUMP_SINGLE_LAYER 0 -#define DUMP_LAYER_NAME "" #endif namespace cldnn { @@ -131,7 +125,7 @@ std::map network::execute(const std::vector static void dump(memory::ptr mem, stream& stream, std::ofstream& file_stream) { auto&& size = mem->get_layout().size; @@ -189,6 +196,8 @@ static void dump(memory::ptr mem, stream& stream, std::ofstream& file_stream) { mem_lock lock(mem, stream); auto mem_ptr = lock.data(); + auto x_pitch = get_x_pitch(mem->get_layout()); + std::stringstream buffer; for (cldnn::tensor::value_type g = 0; g < size.group[0]; ++g) { for (cldnn::tensor::value_type b = 0; b < size.batch[0]; ++b) { @@ -196,10 +205,11 @@ static void dump(memory::ptr mem, stream& stream, std::ofstream& file_stream) { for (cldnn::tensor::value_type w = 0; w < size.spatial[3]; ++w) { for (cldnn::tensor::value_type z = 0; z < size.spatial[2]; ++z) { for (cldnn::tensor::value_type y = 0; y < size.spatial[1]; ++y) { - for (cldnn::tensor::value_type x = 0; x < size.spatial[0]; ++x) { - cldnn::tensor t(cldnn::group(g), cldnn::batch(b), cldnn::feature(f), cldnn::spatial(x, y, z, w)); - size_t input_it = mem->get_layout().get_linear_offset(t); - file_stream << std::fixed << std::setprecision(6) << convert_element(mem_ptr[input_it]) << std::endl; + cldnn::tensor t(cldnn::group(g), cldnn::batch(b), cldnn::feature(f), cldnn::spatial(0, y, z, w)); + size_t input_it = mem->get_layout().get_linear_offset(t); + + for (cldnn::tensor::value_type x = 0; x < size.spatial[0]; ++x, input_it += x_pitch) { + buffer << std::fixed << std::setprecision(6) << convert_element(mem_ptr[input_it]) << std::endl; } } } @@ -207,6 +217,7 @@ static void dump(memory::ptr mem, stream& stream, std::ofstream& file_stream) { } } } + file_stream << buffer.str(); } template <> void dump(memory::ptr mem, stream& stream, std::ofstream& file_stream) { @@ -238,12 +249,13 @@ void dump(memory::ptr mem, stream& stream, std::ofstream& file_stream) } static void log_memory_to_file(memory::ptr mem, stream& stream, std::string layerName) { + GPU_DEBUG_GET_INSTANCE(debug_config); std::string filename = layerName; std::replace(filename.begin(), filename.end(), '\\', '_'); std::replace(filename.begin(), filename.end(), '/', '_'); std::replace(filename.begin(), filename.end(), ' ', '_'); std::replace(filename.begin(), filename.end(), ':', '_'); - filename = DEBUG_DUMP_PATH + filename + ".txt"; + filename = debug_config->dump_layers_path + filename + ".txt"; std::ofstream file_stream(filename); auto mem_dt = mem->get_layout().data_type; @@ -260,13 +272,24 @@ static void log_memory_to_file(memory::ptr mem, stream& stream, std::string laye else if (mem_dt == cldnn::data_types::u8) dump(mem, stream, file_stream); } +#else +static void log_memory_to_file(memory::ptr mem, stream& stream, std::string layerName) { + (void)mem; + (void)stream; + (void)layerName; +} #endif /* Network_impl will always have net_id = 0 when it will be cldnn internal micronetwork (created i.e by propagate_constants opt pass). */ network_impl::network_impl(program_impl::ptr program, stream::ptr stream, bool is_internal, bool is_primary_stream) - : _program(program), _stream(stream), _internal(is_internal), _is_primary_stream(is_primary_stream), _reset_arguments(true) { + : _program(program) + , _stream(stream) + , _memory_pool(new memory_pool(program->get_engine())) + , _internal(is_internal) + , _is_primary_stream(is_primary_stream) + , _reset_arguments(true) { static std::atomic id_gen{0}; if (!_internal) { net_id = ++id_gen; @@ -280,7 +303,7 @@ network_impl::network_impl(program_impl::ptr program, stream::ptr stream, bool i } network_impl::~network_impl() { - get_engine().get_memory_pool().clear_pool_for_network(net_id); + _memory_pool->clear_pool_for_network(net_id); } network_impl::ptr network_impl::allocate_network(stream::ptr stream, program_impl::ptr program, bool is_internal, bool is_primary_stream) { @@ -487,25 +510,24 @@ void network_impl::execute(const std::vector& events) { set_arguments(); for (auto& inst : _exec_order) { -#ifdef DEBUG_DUMP_PATH - auto& node = _program->get_node(inst->id()); - - std::string layer_name = node.id(); -#if DUMP_VERBOSE - std::cerr << get_primitive_info(inst->id()) << std::endl; -#endif -#if DUMP_SINGLE_LAYER - if (layer_name == DUMP_LAYER_NAME) { -#endif - std::cerr << "Dump " << layer_name << " layer" << std::endl; - for (size_t i = 0; i < get_primitive(inst->id())->dependencies().size(); i++) { - log_memory_to_file(get_primitive(inst->id())->dep_memory_ptr(i), get_stream(), - layer_name + "_src_" + std::to_string(i)); + GPU_DEBUG_IF(debug_config->dump_layers_path.length() > 0) { + auto& node = _program->get_node(inst->id()); + std::string layer_name = node.id(); + GPU_DEBUG_IF(debug_config->verbose >= 2) { + std::cerr << get_primitive_info(inst->id()) << std::endl; + } + + GPU_DEBUG_IF(debug_config->dump_layers_dst_only == 0 && + (debug_config->dump_layers.length() == 0 || + (debug_config->dump_layers.length() != 0 && debug_config->dump_layers.find(" " + layer_name + " ") != std::string::npos))) { + std::cout << "Dump " << layer_name << " layer src" << std::endl; + for (size_t i = 0; i < get_primitive(inst->id())->dependencies().size(); i++) { + log_memory_to_file(get_primitive(inst->id())->dep_memory_ptr(i), get_stream(), + layer_name + "_src_" + std::to_string(i)); + } } -#if DUMP_SINGLE_LAYER } -#endif -#endif + GPU_DEBUG_IF(debug_config->verbose >= 1) { GPU_DEBUG_COUT << "Execute " << inst->id() << std::endl; } @@ -517,16 +539,16 @@ void network_impl::execute(const std::vector& events) { } execute_primitive(inst, events); -#ifdef DEBUG_DUMP_PATH - get_stream().finish(); -#if DUMP_SINGLE_LAYER - if (layer_name == DUMP_LAYER_NAME) -#endif - { - log_memory_to_file(get_primitive(inst->id())->output_memory_ptr(), get_stream(), layer_name + "_dst_0"); + GPU_DEBUG_IF(debug_config->dump_layers_path.length() > 0) { + get_stream().finish(); + auto& node = _program->get_node(inst->id()); + std::string layer_name = node.id(); + GPU_DEBUG_IF(debug_config->dump_layers.length() == 0 || + (debug_config->dump_layers.length() != 0 && debug_config->dump_layers.find(" " + layer_name + " ") != std::string::npos)) { + std::cout << "Dump " << layer_name << " layer dst" << std::endl; + log_memory_to_file(get_primitive(inst->id())->output_memory_ptr(), get_stream(), layer_name + "_dst_0"); + } } - -#endif } for (auto& inst : _program->get_processing_order()) { @@ -694,11 +716,20 @@ void network_impl::transfer_memory_to_device(std::shared_ptr ins if (alloc_type == allocation_type::usm_host || alloc_type == allocation_type::usm_shared) { // Allocate and transfer memory - auto& mem_pool = inst_mem.get_engine()->get_memory_pool(); auto device_mem = inst_mem.get_engine()->allocate_memory(inst_mem.get_layout(), allocation_type::usm_device, false); device_mem->copy_from(get_stream(), inst_mem); - mem_pool.release_memory(&inst_mem, node.id(), get_id()); + _memory_pool->release_memory(&inst_mem, node.id(), get_id()); instance->set_output_memory(device_mem); } } + +memory::ptr network_impl::get_memory_from_pool(const layout& layout, + primitive_id id, + std::set dependencies, + allocation_type type, + bool reusable) { + if (get_engine().configuration().use_memory_pool) + return _memory_pool->get_memory(layout, id, get_id(), dependencies, type, reusable); + return _memory_pool->get_memory(layout, type); +} } // namespace cldnn diff --git a/inference-engine/thirdparty/clDNN/src/primitive_inst.cpp b/inference-engine/thirdparty/clDNN/src/primitive_inst.cpp index 9e1ad0902ce..cef109cd1d7 100644 --- a/inference-engine/thirdparty/clDNN/src/primitive_inst.cpp +++ b/inference-engine/thirdparty/clDNN/src/primitive_inst.cpp @@ -149,7 +149,6 @@ primitive_inst::primitive_inst(network_impl& network, program_node const& node, memory::ptr primitive_inst::allocate_output() { auto layout = _node.get_output_layout(); - auto net_id = get_network_id(); auto& engine = get_network().get_engine(); // For outputs, cpu prim we want to have lockable alloc type @@ -163,12 +162,11 @@ memory::ptr primitive_inst::allocate_output() { : allocation_type::usm_device; if (!_network.is_internal() && (_node.can_be_optimized() || _node.is_type())) { - return engine.get_memory_from_pool(layout, - _node.id(), - net_id, - _node.get_memory_dependencies(), - alloc_type, - false); + return _network.get_memory_from_pool(layout, + _node.id(), + _node.get_memory_dependencies(), + alloc_type, + false); } else if (_network.is_internal() && _node.is_output() && _node.is_type() && engine.supports_allocation(allocation_type::usm_device)) { return engine.allocate_memory(layout, allocation_type::usm_device, false); @@ -179,12 +177,11 @@ memory::ptr primitive_inst::allocate_output() { } else if (_network.is_internal() || (!_node.can_share_buffer()) || _node.can_be_optimized() || _node.is_output()) { return engine.allocate_memory(layout, alloc_type); } else { - return engine.get_memory_from_pool(layout, - _node.id(), - net_id, - _node.get_memory_dependencies(), - alloc_type, - true); + return _network.get_memory_from_pool(layout, + _node.id(), + _node.get_memory_dependencies(), + alloc_type, + true); } } diff --git a/inference-engine/thirdparty/clDNN/src/program.cpp b/inference-engine/thirdparty/clDNN/src/program.cpp index 1bd90364028..62bbf38d317 100644 --- a/inference-engine/thirdparty/clDNN/src/program.cpp +++ b/inference-engine/thirdparty/clDNN/src/program.cpp @@ -94,7 +94,6 @@ program_impl::program_impl(engine& engine_ref, tuning_cache(nullptr), is_body_program(is_body_program) { init_primitives(); - kernel_selector::KernelBase::ResetCounter(); set_options(); pm = std::unique_ptr(new pass_manager(*this)); prepare_nodes(topology); diff --git a/inference-engine/thirdparty/clDNN/tests/test_cases/debug_config_gpu_test.cpp b/inference-engine/thirdparty/clDNN/tests/test_cases/debug_config_gpu_test.cpp new file mode 100644 index 00000000000..4f9fe3d603d --- /dev/null +++ b/inference-engine/thirdparty/clDNN/tests/test_cases/debug_config_gpu_test.cpp @@ -0,0 +1,20 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +/////////////////////////////////////////////////////////////////////////////////////////////////// + +#include "test_utils/test_utils.h" +#include "cldnn/runtime/debug_configuration.hpp" + +using namespace cldnn; +using namespace ::tests; + +TEST(debug_config_test, check_debug_config_off_on_release) { +#ifdef NDEBUG + GPU_DEBUG_GET_INSTANCE(debug_config); + GPU_DEBUG_IF(1) { + GTEST_FAIL(); /* This should be disabled in case of release build */ + } +#endif +} diff --git a/inference-engine/thirdparty/mkl-dnn b/inference-engine/thirdparty/mkl-dnn index 08072cad466..d8304554b2c 160000 --- a/inference-engine/thirdparty/mkl-dnn +++ b/inference-engine/thirdparty/mkl-dnn @@ -1 +1 @@ -Subproject commit 08072cad466a0fddeddd26b9ecf393fb37df617a +Subproject commit d8304554b2caff2ba4e906ff8fcb6efc3b425f7c diff --git a/inference-engine/thirdparty/movidius/XLink/CMakeLists.txt b/inference-engine/thirdparty/movidius/XLink/CMakeLists.txt index 6cdd8b865f2..bf513666b7d 100644 --- a/inference-engine/thirdparty/movidius/XLink/CMakeLists.txt +++ b/inference-engine/thirdparty/movidius/XLink/CMakeLists.txt @@ -41,5 +41,4 @@ endif() set_property(TARGET ${TARGET_NAME} PROPERTY C_STANDARD 99) -# TODO: remove once all options are migrated openvino_developer_export_targets(COMPONENT inference_engine_vpu TARGETS ${TARGET_NAME}) diff --git a/inference-engine/thirdparty/movidius/mvnc/CMakeLists.txt b/inference-engine/thirdparty/movidius/mvnc/CMakeLists.txt index b2a26a24166..94d461ab911 100644 --- a/inference-engine/thirdparty/movidius/mvnc/CMakeLists.txt +++ b/inference-engine/thirdparty/movidius/mvnc/CMakeLists.txt @@ -73,7 +73,6 @@ if(NOT WIN32) ${LIBUSB_LIBRARY}) endif() -# TODO: remove once all options are migrated openvino_developer_export_targets(COMPONENT inference_engine_vpu TARGETS ${TARGET_NAME}) if(ENABLE_TESTS AND ENABLE_MYRIAD_MVNC_TESTS) diff --git a/model-optimizer/automation/package_BOM.txt b/model-optimizer/automation/package_BOM.txt index 671c45fd68b..4adb1e22aa2 100644 --- a/model-optimizer/automation/package_BOM.txt +++ b/model-optimizer/automation/package_BOM.txt @@ -212,6 +212,8 @@ extensions/front/mxnet/instance_norm_ext.py extensions/front/mxnet/leaky_relu.py extensions/front/mxnet/lrn_ext.py extensions/front/mxnet/max_ext.py +extensions/front/mxnet/modulated_deformable_conv_ext.py +extensions/front/mxnet/modulated_deformable_conv_replacer.py extensions/front/mxnet/multibox_detection_ext.py extensions/front/mxnet/mx_reshape_reverse.py extensions/front/mxnet/mx_reshape_to_reshape.py diff --git a/model-optimizer/extensions/back/blob_normalizer.py b/model-optimizer/extensions/back/blob_normalizer.py index 53f1118eac5..4c35de5634e 100644 --- a/model-optimizer/extensions/back/blob_normalizer.py +++ b/model-optimizer/extensions/back/blob_normalizer.py @@ -46,7 +46,7 @@ class BlobNormalizer(BackReplacementPattern): def find_and_replace_pattern(self, graph: Graph): for node in graph.get_op_nodes(): if node.soft_get('type').lower() not in OpVersioning.opset_1_types and \ - not node.soft_get('version') in ["opset2", "opset3", "opset4"]: + not node.soft_get('version') in ["opset2", "opset3", "opset4", "opset8"]: continue for _, d in node.in_edges().items(): diff --git a/model-optimizer/extensions/back/compress_quantized_weights.py b/model-optimizer/extensions/back/compress_quantized_weights.py index ac8918f48c7..62799acc1d1 100644 --- a/model-optimizer/extensions/back/compress_quantized_weights.py +++ b/model-optimizer/extensions/back/compress_quantized_weights.py @@ -218,3 +218,56 @@ class CompressQuantizeWeights(BackReplacementPattern): self.quantize_data(fake_quantize, dst_type, quantized_type, mode) self.dequantize_data(fake_quantize, dst_type, quantized_type) + + +class ZeroPointOptimizer(BackReplacementPattern): + enabled = True + force_clean_up = True + + def run_after(self): + return [CompressQuantizeWeights] + + def pattern(self): + return dict( + nodes=[ + ('const', dict(type='Const')), + ('const_d', dict()), + ('convert', dict(type='Convert')), + ('convert_d', dict()), + ('const_zp', dict(type='Const')), + ('const_zp_d', dict()), + ('sub', dict(type='Subtract')), + ], + edges=[ + ('const', 'const_d'), + ('const_d', 'convert'), + ('convert', 'convert_d'), + ('convert_d', 'sub', {'in': 0}), + ('const_zp', 'const_zp_d'), + ('const_zp_d', 'sub', {'in': 1}), + ] + ) + + def replace_pattern(self, graph: Graph, match: Dict[str, Node]): + sub = match['sub'] + zero_point = sub.in_port(1).data.get_value() + if zero_point is None or np.allclose(zero_point, 0): + return + + convert = match['convert'] + dst_type = convert.dst_type + weights = convert.in_port(0).data.get_value() + if weights is None or weights.dtype != np.int8: + return + + int8_zero_point = np.round(zero_point).astype(np.int8) + adj_zero_point = (zero_point - int8_zero_point).astype(dst_type) + + original = weights.astype(dst_type) - zero_point + transformed = (weights - int8_zero_point).astype(np.int8) - adj_zero_point + + if not np.allclose(original, transformed) or not np.allclose(adj_zero_point, 0): + return + + match['const_d']['value'] = (weights - int8_zero_point).astype(np.int8) + match['const_zp_d']['value'] = np.zeros(adj_zero_point.shape, dst_type) diff --git a/model-optimizer/extensions/back/op_versioning.py b/model-optimizer/extensions/back/op_versioning.py index f8a8141a8c0..5afd10a5d12 100644 --- a/model-optimizer/extensions/back/op_versioning.py +++ b/model-optimizer/extensions/back/op_versioning.py @@ -33,7 +33,6 @@ class OpVersioning(BackReplacementPattern): "ConvolutionBackpropData", "Cos", "Cosh", - "DeformableConvolution", "DeformablePSROIPooling", "DepthToSpace", "DetectionOutput", diff --git a/model-optimizer/extensions/front/mxnet/modulated_deformable_conv_ext.py b/model-optimizer/extensions/front/mxnet/modulated_deformable_conv_ext.py new file mode 100644 index 00000000000..cee2d111c98 --- /dev/null +++ b/model-optimizer/extensions/front/mxnet/modulated_deformable_conv_ext.py @@ -0,0 +1,61 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +import numpy as np + +from mo.front.extractor import FrontExtractorOp +from mo.front.mxnet.extractors.utils import get_mxnet_layer_attrs +from mo.ops.deformable_convolution import DeformableConvolution + + +class ModulatedDeformableConvolutionExtractor(FrontExtractorOp): + op = '_contrib_ModulatedDeformableConvolution' + enabled = True + + @classmethod + def extract(cls, node): + attr = get_mxnet_layer_attrs(node.symbol_dict) + + kernel = attr.tuple("kernel", int, None) + stride = attr.tuple("stride", int, tuple(np.ones(len(kernel), dtype=np.int64))) + padding = attr.tuple("pad", int, tuple(np.zeros(len(kernel), dtype=np.int64))) + dilate = attr.tuple("dilate", int, tuple(np.ones(len(kernel), dtype=np.int64))) + num_deformable_group = attr.int("num_deformable_group", 1) + num_group = attr.int("num_group", 1) + output = attr.int("num_filter", None) + bias_term = attr.str("no_bias", 'False') == 'False' + + final_dilations = np.array([1, 1, *[d for d in dilate]], dtype=np.int64) if dilate is not None else None + + node_attrs = { + 'op': __class__.op, + 'bias_addable': True, + 'bias_term': bias_term, + 'pad': np.array([[0, 0], [0, 0], *[[pad, pad] for pad in padding]], dtype=np.int64), + 'pad_spatial_shape': np.array([[pad, pad] for pad in padding], dtype=np.int64), + 'dilation': final_dilations, + 'output_spatial_shape': None, + 'output_shape': None, + 'stride': np.array([1, 1, *[s for s in stride]], dtype=np.int64), + 'group': num_group, + 'deformable_group': num_deformable_group, + 'output': output, + 'kernel_spatial': np.array([k for k in kernel], dtype=np.int64), + 'bilinear_interpolation_pad': True, + + 'input_feature_channel': 1, + 'output_feature_channel': 0, + 'kernel_spatial_idx': None, + 'reshape_kernel': True, + 'weights_index': 2, + 'in_ports_count': 4, + + 'spatial_dims': None, + 'channel_dims': np.array([1], dtype=np.int64), + 'batch_dims': np.array([0], dtype=np.int64), + 'layout': 'NCHW', + } + + # update the attributes of the node + DeformableConvolution.update_node_stat(node, node_attrs) + return cls.enabled diff --git a/model-optimizer/extensions/front/mxnet/modulated_deformable_conv_replacer.py b/model-optimizer/extensions/front/mxnet/modulated_deformable_conv_replacer.py new file mode 100644 index 00000000000..e3f95fc0f5a --- /dev/null +++ b/model-optimizer/extensions/front/mxnet/modulated_deformable_conv_replacer.py @@ -0,0 +1,22 @@ +# Copyright (C) 2018-2021 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +from mo.front.common.replacement import FrontReplacementPattern +from mo.graph.graph import Graph + + +class DeformableConvolutionReplacer(FrontReplacementPattern): + # swap mask and weights inputs for ModulatedDeformableConvolution according to the specification + enabled = True + + def find_and_replace_pattern(self, graph: Graph): + + for deform_conv in graph.get_op_nodes(type='DeformableConvolution'): + if len(deform_conv.get_inputs()) != 4: + return + + m_source = deform_conv.in_port(2).get_source() + deform_conv.in_port(2).disconnect() + + deform_conv.in_port(3).get_connection().set_destination(deform_conv.in_port(2)) + m_source.connect(deform_conv.in_port(3)) diff --git a/model-optimizer/mo/ops/convolution.py b/model-optimizer/mo/ops/convolution.py index aa884b34721..ee24fcd1370 100644 --- a/model-optimizer/mo/ops/convolution.py +++ b/model-optimizer/mo/ops/convolution.py @@ -102,7 +102,6 @@ class Convolution(Op): node['bias_term'] = len(node.in_nodes()) == 3 weights_index = node.weights_index if node.has_valid('weights_index') else 1 - # Reshape weights kernel to original shape # In case of caffe or MXNet framework, values for weights have no structured shape like OIHW # so we have to reshape weights to normal shape @@ -237,6 +236,8 @@ class Convolution(Op): for n in node.out_nodes(): node.out_node(n).shape = output_shape + # bin attribute is used for pre-processing, but it will be deleted in BlobNormalizer transformation + # and the blobs (weights, biases) will be represented as inputs to the node mark_input_bins(node, start_port=1 if node.type != 'DeformableConvolution' else 2) assign_dims_to_weights(node.in_node(weights_index), node.kernel_spatial_idx, node.input_feature_channel, node.output_feature_channel, len(kernel_shape)) diff --git a/model-optimizer/mo/ops/deformable_convolution.py b/model-optimizer/mo/ops/deformable_convolution.py index f219208cbc0..5eb573fb214 100644 --- a/model-optimizer/mo/ops/deformable_convolution.py +++ b/model-optimizer/mo/ops/deformable_convolution.py @@ -13,7 +13,7 @@ class DeformableConvolution(Op): super().__init__(graph, { 'type': __class__.op, 'op': __class__.op, - 'version': 'opset1', + 'version': 'opset8', 'infer': Convolution.infer, 'group': 1, 'deformable_group': 1, @@ -21,8 +21,10 @@ class DeformableConvolution(Op): 'multiplication_transparent_ports': [(0, 0), (2, 0)], 'in_ports_count': 3, 'out_ports_count': 1, + 'bilinear_interpolation_pad': False, }, attrs) def backend_attrs(self): - # the same attributes as in a regular convolution and one additional attribute 'deformable_group' and 'group' - return Convolution(self.graph, {}).backend_attrs() + ['deformable_group', 'group'] + # the same attributes as in a regular convolution and additional attributes 'deformable_group', 'group' + # and 'bilinear_interpolation_pad' + return Convolution(self.graph, {}).backend_attrs() + ['deformable_group', 'group', 'bilinear_interpolation_pad'] diff --git a/model-optimizer/unit_tests/extensions/back/compress_quantized_weights_test.py b/model-optimizer/unit_tests/extensions/back/compress_quantized_weights_test.py index 73ca749d016..5e4aa87b525 100644 --- a/model-optimizer/unit_tests/extensions/back/compress_quantized_weights_test.py +++ b/model-optimizer/unit_tests/extensions/back/compress_quantized_weights_test.py @@ -7,7 +7,7 @@ from argparse import Namespace import numpy as np from generator import generator, generate -from extensions.back.compress_quantized_weights import CompressQuantizeWeights +from extensions.back.compress_quantized_weights import CompressQuantizeWeights, ZeroPointOptimizer from extensions.ops.Cast import Cast from extensions.ops.elementwise import Sub, Mul from extensions.ops.fakequantize import FakeQuantize @@ -37,7 +37,7 @@ def nodes_dict(original, transformed=None, levels=255, data=None, il=[-127], ih= **regular_op_with_shaped_data( 'FQ', shape, {'type': 'FakeQuantize', 'infer': FakeQuantize.infer, 'stop_value_propagation': True, - 'levels': levels, 'op': 'FakeQuantize'}), + 'levels': levels, 'op': 'FakeQuantize'}), **valued_const_with_data('zp', np.array([0])), **valued_const_with_data('scale', np.array([1])), @@ -49,7 +49,7 @@ def nodes_dict(original, transformed=None, levels=255, data=None, il=[-127], ih= 'mul', shape, {'type': 'Multiply', 'op': 'Mul', 'infer': lambda node: eltwise_infer(node, Mul.operation)}), **result() -} + } class CompressionQuantizeDequantizeSeparateTest(unittest.TestCase): @@ -248,3 +248,38 @@ class NegativeCompressionTestLevels(unittest.TestCase): (flag, resp) = compare_graphs(graph, graph_ref, 'output', check_op_attrs=True) self.assertTrue(flag, resp) + +@generator +class ZeroPointOptimizerTestClass(unittest.TestCase): + @generate(*[ + ([-10, 7], [-1], [-9, 8], [0]), + ([-10, 7], [-0.99999999], [-9, 8], [0]), + ([-128, 7], [1], [-128, 7], [1]), + ([127, 7], [-1], [127, 7], [-1]), + ]) + def test_zero_point_optimization(self, weights, zero_point, adj_weights, adj_zero_point): + nodes = lambda w, zp: { + **valued_const_with_data('weights', np.array(w, dtype=np.int8)), + **regular_op_with_shaped_data( + 'cast', len(w), {'type': 'Convert', 'op': 'Cast', 'infer': Cast.infer, 'dst_type': np.float32}), + **valued_const_with_data('zp', np.array(zp, dtype=np.float32)), + **regular_op_with_shaped_data( + 'sub', len(w), + {'type': 'Subtract', 'op': 'Sub', 'infer': lambda node: eltwise_infer(node, Sub.operation)}), + **result() + } + edges = [ + *connect("weights:0", "0:cast"), + *connect("cast:0", "0:sub"), + *connect("zp:0", "1:sub"), + *connect("sub:0", "0:output"), + ] + graph = build_graph(nodes(weights, zero_point), edges, nodes_with_edges_only=True) + ZeroPointOptimizer().find_and_replace_pattern(graph) + graph.clean_up() + + graph_ref = build_graph(nodes(adj_weights, adj_zero_point), edges, nodes_with_edges_only=True) + graph_ref.clean_up() + + (flag, resp) = compare_graphs(graph, graph_ref, 'output', check_op_attrs=True) + self.assertTrue(flag, resp) diff --git a/ngraph/core/include/ngraph/op/deformable_convolution.hpp b/ngraph/core/include/ngraph/op/deformable_convolution.hpp index f55535cb28f..da6b18c22b5 100644 --- a/ngraph/core/include/ngraph/op/deformable_convolution.hpp +++ b/ngraph/core/include/ngraph/op/deformable_convolution.hpp @@ -171,7 +171,7 @@ namespace ngraph } private: - int64_t m_bilinear_interpolation_pad; + bool m_bilinear_interpolation_pad; }; } // namespace v8 } // namespace op diff --git a/ngraph/core/include/ngraph/op/prior_box_clustered.hpp b/ngraph/core/include/ngraph/op/prior_box_clustered.hpp index 0c6d170bb87..0ef35ab5c32 100644 --- a/ngraph/core/include/ngraph/op/prior_box_clustered.hpp +++ b/ngraph/core/include/ngraph/op/prior_box_clustered.hpp @@ -17,6 +17,7 @@ namespace ngraph // clip Clip output to [0,1] // step_widths Distance between prior box centers // step_heights Distance between prior box centers + // step Distance between prior box centers (when step_w = step_h) // offset Box offset relative to top center of image // variances Values to adjust prior boxes with std::vector widths; @@ -24,6 +25,7 @@ namespace ngraph bool clip = true; float step_widths = 0.0f; float step_heights = 0.0f; + float step = 0.0f; float offset = 0.0f; std::vector variances; }; diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/detection_output.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/detection_output.hpp index 42a2d59d07b..bfc5ff1c584 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/detection_output.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/detection_output.hpp @@ -381,7 +381,8 @@ namespace ngraph static bool SortScorePairDescend(const std::pair& pair1, const std::pair& pair2) { - return pair1.first > pair2.first; + return (pair1.first > pair2.first) || + (pair1.first == pair2.first && pair1.second < pair2.second); } void GetMaxScoreIndex(const std::vector& scores, @@ -505,7 +506,12 @@ namespace ngraph } std::sort(scoreIndexPairs.begin(), scoreIndexPairs.end(), - SortScorePairDescend>); + [](const std::pair>& p1, + const std::pair>& p2) { + return (p1.first > p2.first) || + (p1.first == p2.first && + p1.second.second < p2.second.second); + }); if (attrs.top_k != -1) if (scoreIndexPairs.size() > static_cast(attrs.top_k)) @@ -651,7 +657,12 @@ namespace ngraph } std::sort(scoreIndexPairs.begin(), scoreIndexPairs.end(), - SortScorePairDescend>); + [](const std::pair>& p1, + const std::pair>& p2) { + return (p1.first > p2.first) || + (p1.first == p2.first && + p1.second.second < p2.second.second); + }); scoreIndexPairs.resize(attrs.keep_top_k[0]); std::map> newIndices; for (size_t j = 0; j < scoreIndexPairs.size(); ++j) diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/normalize_l2.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/normalize_l2.hpp index c32ec70488e..866f8798287 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/normalize_l2.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/normalize_l2.hpp @@ -22,27 +22,31 @@ namespace ngraph float eps, op::EpsMode eps_mode) { - AxisSet axes = reduction_axes; if (reduction_axes.empty()) { - std::vector axes_vec(data_shape.size()); - std::iota(axes_vec.begin(), axes_vec.end(), 0); - axes = AxisSet(axes_vec); + // When axes is an empty list, then each `data` element is divided by itself + // resulting value 1 for all non-zero elements + for (size_t i = 0; i < shape_size(data_shape); ++i) + { + out[i] = data[i] == 0 ? 0 : 1; + } + return; } + std::vector sqr_data(shape_size(data_shape)); - for (size_t i = 0; i < shape_size(data_shape); i++) + for (size_t i = 0; i < shape_size(data_shape); ++i) { sqr_data[i] = data[i] * data[i]; } Shape reduce_shape = data_shape; - for (auto axis : axes) + for (auto axis : reduction_axes) { reduce_shape[axis] = 1; } std::vector sum_data(shape_size(reduce_shape)); - sum(sqr_data.data(), sum_data.data(), data_shape, axes); + sum(sqr_data.data(), sum_data.data(), data_shape, reduction_axes); autobroadcast_binop(data, sum_data.data(), out, diff --git a/ngraph/core/reference/include/ngraph/runtime/reference/prior_box_clustered.hpp b/ngraph/core/reference/include/ngraph/runtime/reference/prior_box_clustered.hpp index b597788fcf7..78292587a9f 100644 --- a/ngraph/core/reference/include/ngraph/runtime/reference/prior_box_clustered.hpp +++ b/ngraph/core/reference/include/ngraph/runtime/reference/prior_box_clustered.hpp @@ -27,6 +27,7 @@ namespace ngraph size_t num_priors_ = attrs.widths.size(); auto variances = attrs.variances; + NGRAPH_CHECK(variances.size() == 1 || variances.size() == 4 || variances.empty()); if (variances.empty()) variances.push_back(0.1f); @@ -37,17 +38,8 @@ namespace ngraph int64_t img_width = img[1]; int64_t img_height = img[0]; - // TODO: Uncomment after PriorBoxClustered is aligned with the specification. - - // int img_width = img_w_ == 0 ? img[1] : img_w_; - // int img_height = img_h_ == 0 ? img[0] : img_h_; - - // float step_w = attrs.step_widths == 0 ? step_ : attrs.step_widths; - // float step_h = attrs.step_heights == 0 ? step_ : - // attrs.step_heights; - - float step_w = attrs.step_widths; - float step_h = attrs.step_heights; + float step_w = attrs.step_widths == 0 ? attrs.step : attrs.step_widths; + float step_h = attrs.step_heights == 0 ? attrs.step : attrs.step_heights; if (step_w == 0 && step_h == 0) { @@ -92,9 +84,21 @@ namespace ngraph dst_data[idx + 2] = xmax; dst_data[idx + 3] = ymax; - idx = get_idx(var_size); - for (size_t j = 0; j < var_size; j++) - dst_data[idx + j + out_shape[1]] = variances[j]; + idx = get_idx(4); + + // At this point we have either: + // 1. A single variance value (to be repeated 4 times for each prior) + // 2. 4 variance values + if (var_size == 1) + { + for (size_t j = 0; j < 4; j++) + dst_data[idx + j + out_shape[1]] = variances[0]; + } + else + { + for (size_t j = 0; j < var_size; j++) + dst_data[idx + j + out_shape[1]] = variances[j]; + } } } } diff --git a/ngraph/core/src/op/prior_box_clustered.cpp b/ngraph/core/src/op/prior_box_clustered.cpp index e906921e815..6ebd0948cbd 100644 --- a/ngraph/core/src/op/prior_box_clustered.cpp +++ b/ngraph/core/src/op/prior_box_clustered.cpp @@ -52,9 +52,9 @@ void op::PriorBoxClustered::validate_and_infer_types() NODE_VALIDATION_CHECK(this, m_attrs.widths.size() == m_attrs.heights.size(), - "Size of heights vector", - m_attrs.widths.size(), - " doesn't match size of widths vector ", + "Size of heights vector: ", + m_attrs.heights.size(), + " doesn't match size of widths vector: ", m_attrs.widths.size()); set_input_is_relevant_to_shape(0); diff --git a/ngraph/frontend/onnx_import/CMakeLists.txt b/ngraph/frontend/onnx_import/CMakeLists.txt index 0ddb78ad071..bb6a4e7ff99 100644 --- a/ngraph/frontend/onnx_import/CMakeLists.txt +++ b/ngraph/frontend/onnx_import/CMakeLists.txt @@ -45,7 +45,7 @@ if(COMMAND ie_faster_build) ) endif() -target_link_libraries(onnx_importer PRIVATE onnx_common ngraph::builder +target_link_libraries(onnx_importer PRIVATE onnx_common ngraph::builder inference_engine_transformations PUBLIC ngraph) target_include_directories(onnx_importer PUBLIC $ diff --git a/ngraph/frontend/onnx_import/include/onnx_import/core/node.hpp b/ngraph/frontend/onnx_import/include/onnx_import/core/node.hpp index c2a3e6b820c..cb5d11fde31 100644 --- a/ngraph/frontend/onnx_import/include/onnx_import/core/node.hpp +++ b/ngraph/frontend/onnx_import/include/onnx_import/core/node.hpp @@ -75,9 +75,8 @@ namespace ngraph bool has_attribute(const std::string& name) const; - Subgraph get_subgraph_from_attribute( - const std::string& name, - const std::map& carried_dependencies_map) const; + bool has_subgraph() const; + std::shared_ptr get_subgraph() const; template T get_attribute_value(const std::string& name, T default_value) const; diff --git a/ngraph/frontend/onnx_import/include/onnx_import/onnx_framework_node.hpp b/ngraph/frontend/onnx_import/include/onnx_import/onnx_framework_node.hpp new file mode 100644 index 00000000000..bfa902a5ac4 --- /dev/null +++ b/ngraph/frontend/onnx_import/include/onnx_import/onnx_framework_node.hpp @@ -0,0 +1,100 @@ +//***************************************************************************** +// Copyright 2017-2021 Intel Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//***************************************************************************** + +#pragma once + +#include +#include +#include +#include + +namespace ONNX_NAMESPACE +{ + // forward declaration + class ModelProto; +} // namespace ONNX_NAMESPACE + +namespace ngraph +{ + namespace onnx_import + { + class Model; + } + + namespace frontend + { + class ONNXFrameworkNode : public op::FrameworkNode + { + public: + NGRAPH_RTTI_DECLARATION; + + ONNXFrameworkNode(const onnx_import::Node& node) + : FrameworkNode(node.get_ng_inputs(), node.get_outputs_size()) + , m_node(node) + { + } + + ONNXFrameworkNode(const onnx_import::Node& node, const OutputVector& inputs) + : FrameworkNode(inputs, node.get_outputs_size()) + , m_node(node) + { + } + + const onnx_import::Node& get_onnx_node() const { return m_node; } + + virtual std::shared_ptr + clone_with_new_inputs(const OutputVector& inputs) const override; + + virtual bool visit_attributes(AttributeVisitor& visitor) override + { + // TODO: implement reading as well, now it work for serialization only + std::string domain = m_node.domain(); + std::string op_type = m_node.op_type(); + visitor.on_attribute("ONNX_META_domain", domain); + visitor.on_attribute("ONNX_META_type", op_type); + return true; + } + + private: + onnx_import::Node m_node; + }; + + class ONNXSubgraphFrameworkNode : public ONNXFrameworkNode + { + public: + NGRAPH_RTTI_DECLARATION; + + ONNXSubgraphFrameworkNode(const onnx_import::Node& node, const OutputVector& inputs) + : ONNXFrameworkNode(node, inputs) + { + } + + void infer_inputs_from_parent() + { + get_onnx_node().get_subgraph()->infer_inputs_from_parent(); + } + + std::shared_ptr get_subgraph_body() const + { + auto subgraph = get_onnx_node().get_subgraph(); + return std::make_shared(subgraph->get_ng_outputs(), + subgraph->get_ng_parameters(), + subgraph->get_name()); + } + }; + + } // namespace frontend +} // namespace ngraph diff --git a/ngraph/frontend/onnx_import/src/core/attribute.cpp b/ngraph/frontend/onnx_import/src/core/attribute.cpp index 8eaa8c93517..1fd61931de9 100644 --- a/ngraph/frontend/onnx_import/src/core/attribute.cpp +++ b/ngraph/frontend/onnx_import/src/core/attribute.cpp @@ -11,9 +11,7 @@ namespace ngraph { namespace onnx_import { - Subgraph Attribute::get_subgraph( - const Graph& parent_graph, - const std::map& carried_dependencies_map) const + Subgraph Attribute::get_subgraph(const Graph& parent_graph) const { if (m_attribute_proto->type() != ONNX_NAMESPACE::AttributeProto_AttributeType_GRAPH) { @@ -25,33 +23,6 @@ namespace ngraph const auto& graph = m_attribute_proto->g(); model_proto->mutable_graph()->CopyFrom(graph); - const std::size_t subgraph_inputs_count = - static_cast(model_proto->mutable_graph()->mutable_input()->size()); - // Use the `carried_dependencies_map` to infer the types for the subgraph inputs - for (const auto& carried_dependency : carried_dependencies_map) - { - if (carried_dependency.first >= subgraph_inputs_count) - { - NGRAPH_WARN << "Input with index: '" << carried_dependency.first - << "' was not found in the subgraph"; - } - else - { - const auto& parent_in = - parent_graph.get_ng_node_from_cache(carried_dependency.second); - const auto& carried_type = parent_in.get_element_type(); - auto subgraph_in = - model_proto->mutable_graph()->mutable_input(carried_dependency.first); - auto subgraph_in_tensor_type = - subgraph_in->mutable_type()->mutable_tensor_type(); - if (!subgraph_in_tensor_type->has_elem_type()) - { - subgraph_in_tensor_type->set_elem_type( - onnx_common::ng_to_onnx_data_type(carried_type)); - } - } - } - // set opset version and domain from the parent graph model_proto->mutable_opset_import()->CopyFrom(parent_graph.get_opset_imports()); auto model = common::make_unique(std::move(model_proto)); diff --git a/ngraph/frontend/onnx_import/src/core/attribute.hpp b/ngraph/frontend/onnx_import/src/core/attribute.hpp index bc192e7b392..963dab22cb5 100644 --- a/ngraph/frontend/onnx_import/src/core/attribute.hpp +++ b/ngraph/frontend/onnx_import/src/core/attribute.hpp @@ -316,9 +316,7 @@ namespace ngraph float get_float() const { return m_attribute_proto->f(); } int64_t get_integer() const { return m_attribute_proto->i(); } const std::string& get_string() const { return m_attribute_proto->s(); } - Subgraph get_subgraph( - const Graph& parent_graph, - const std::map& carried_dependencies_map) const; + Subgraph get_subgraph(const Graph& parent_graph) const; std::vector get_tensor_array() const { diff --git a/ngraph/frontend/onnx_import/src/core/graph.cpp b/ngraph/frontend/onnx_import/src/core/graph.cpp index c8f56327d6b..569d3849774 100644 --- a/ngraph/frontend/onnx_import/src/core/graph.cpp +++ b/ngraph/frontend/onnx_import/src/core/graph.cpp @@ -14,6 +14,7 @@ #include "ngraph/node.hpp" #include "ngraph/provenance.hpp" #include "onnx_import/core/node.hpp" +#include "onnx_import/onnx_framework_node.hpp" #include "utils/common.hpp" #include "utils/provenance_tag.hpp" @@ -55,25 +56,6 @@ namespace ngraph Graph::Graph(std::unique_ptr&& model) : Graph(std::move(model), common::make_unique()) { - // Remove dangling Parameters - for (auto param_it = m_parameters.begin(); param_it != m_parameters.end();) - { - if ((*param_it)->get_output_target_inputs(0).size() == 0) - { - const auto& name = (*param_it)->get_friendly_name(); - auto out_it = std::find_if( - m_outputs.begin(), m_outputs.end(), [&name](const ValueInfo& info) { - return info.get_name() == name; - }); - if (out_it == m_outputs.end()) - { - m_cache->remove_node(name); - param_it = m_parameters.erase(param_it); - continue; - } - } - param_it++; - } } Graph::Graph(std::unique_ptr&& model, std::unique_ptr&& cache) @@ -174,14 +156,82 @@ namespace ngraph NGRAPH_CHECK(unknown_operators.empty(), "nGraph does not support the following ONNX operations: ", detail::to_string(unknown_operators)); + } + void Graph::convert_to_ngraph_nodes() + { // Process ONNX graph nodes, convert to nGraph nodes for (const auto& node_proto : m_model->get_graph().node()) { m_nodes.emplace_back(node_proto, *this); const Node& node{m_nodes.back()}; - + if (node.has_subgraph()) + { + auto subgraph = node.get_subgraph(); + auto body_func = subgraph->convert(); + } OutputVector ng_nodes{node.get_ng_nodes()}; + set_friendly_names(node, ng_nodes); + for (std::size_t i{0}; i < node.get_outputs_size(); ++i) + { + m_cache->emplace_node(node.output(i), std::move(ng_nodes.at(i))); + } + } + } + + void Graph::remove_dangling_parameters() + { + for (auto param_it = m_parameters.begin(); param_it != m_parameters.end();) + { + if ((*param_it)->get_output_target_inputs(0).size() == 0) + { + const auto& name = (*param_it)->get_friendly_name(); + auto out_it = std::find_if( + m_outputs.begin(), m_outputs.end(), [&name](const ValueInfo& info) { + return info.get_name() == name; + }); + if (out_it == m_outputs.end()) + { + m_cache->remove_node(name); + param_it = m_parameters.erase(param_it); + continue; + } + } + param_it++; + } + } + + std::shared_ptr Graph::convert() + { + convert_to_ngraph_nodes(); + remove_dangling_parameters(); + return create_function(); + } + + void Graph::decode_to_framework_nodes() + { + // Process ONNX graph nodes, convert to nGraph nodes + for (const auto& node_proto : m_model->get_graph().node()) + { + m_nodes.emplace_back(node_proto, *this); + const Node& node{m_nodes.back()}; + std::shared_ptr framework_node; + if (node.has_subgraph()) + { + auto subgraph = node.get_subgraph(); + auto body_func = subgraph->decode(); + auto inputs = node.get_ng_inputs(); + for (const auto& input : subgraph->get_inputs_from_parent()) + inputs.push_back(input); + framework_node = + std::make_shared(node, inputs); + } + else + { + framework_node = std::make_shared(node); + } + OutputVector ng_nodes{framework_node->outputs()}; + set_friendly_names(node, ng_nodes); // Iterate over the number of outputs for given node in graph. // Some of them may be optional and trimmed. See: // https://github.com/onnx/onnx/blob/master/docs/IR.md#optional-inputs-and-outputs @@ -192,12 +242,24 @@ namespace ngraph } } - const GraphCache& Graph::get_graph_cache() const { return *m_cache.get(); } - bool Graph::is_node_in_cache(const std::string& name) const + std::shared_ptr Graph::create_function() { - return m_cache->contains(name); + auto function = std::make_shared(get_ng_outputs(), m_parameters, get_name()); + for (std::size_t i{0}; i < function->get_output_size(); ++i) + { + function->get_output_op(i)->set_friendly_name(m_outputs.at(i).get_name()); + } + return function; } + std::shared_ptr Graph::decode() + { + decode_to_framework_nodes(); + return create_function(); + } + + const GraphCache& Graph::get_graph_cache() const { return *m_cache.get(); } + Output Graph::get_ng_node_from_cache(const std::string& name) const { return m_cache->get_node(name); @@ -247,6 +309,12 @@ namespace ngraph set_friendly_names(onnx_node, ng_node_vector); add_provenance_tags(onnx_node, ng_node_vector); + for (std::size_t i{0}; i < onnx_node.get_outputs_size(); ++i) + { + auto ng_node = ng_node_vector.at(i); + m_cache->emplace_node(onnx_node.output(i), std::move(ng_node)); + } + return ng_node_vector; } @@ -323,9 +391,21 @@ namespace ngraph } Subgraph::Subgraph(std::unique_ptr&& model, const Graph& parent_graph) - : Graph( - std::move(model), - std::unique_ptr(new SubgraphCache(parent_graph.get_graph_cache()))) + : Graph(std::move(model), common::make_unique()) + , m_parent_graph_cache(&parent_graph.get_graph_cache()) + { + } + + Output Subgraph::get_ng_node_from_cache(const std::string& name) const + { + if (m_cache->contains(name)) + { + return m_cache->get_node(name); + } + return m_parent_graph_cache->get_node(name); + } + + void Subgraph::find_inputs_from_parent() { // find all nodes on edge parent graph-subgraph // (it means input of node from parent graph, output from subgraph) @@ -334,16 +414,16 @@ namespace ngraph int input_index = 0; for (const auto& in_name : node_proto.input()) { - if (m_cache->node_scope(in_name) == NodeScope::ParentGraph) + if (m_parent_graph_cache->contains(in_name)) { - const auto& from_parent_node = m_cache->get_node(in_name); + const auto& from_parent_node = m_parent_graph_cache->get_node(in_name); // constants are skipped if (!ngraph::is_type( from_parent_node.get_node_shared_ptr())) { for (const auto& out_name : node_proto.output()) { - if (m_cache->node_scope(out_name) == NodeScope::SubGraph) + if (m_cache->contains(out_name)) { auto out_node_to_replace_input = m_cache->get_node(out_name); auto new_param = std::make_shared( @@ -353,8 +433,10 @@ namespace ngraph out_node_to_replace_input.get_node() ->input(input_index) .replace_source_output(new_param); + m_parameter_to_parent_node_map.insert({new_param, in_name}); + m_cache->emplace_node(in_name, new_param); m_parameters.push_back(new_param); - m_outputs_from_parent.push_back(from_parent_node); + m_inputs_from_parent.push_back(in_name); } } } @@ -364,11 +446,39 @@ namespace ngraph } } - const std::vector> Subgraph::get_outputs_from_parent() const + std::shared_ptr Subgraph::convert() { - return m_outputs_from_parent; + convert_to_ngraph_nodes(); + find_inputs_from_parent(); + return create_function(); } + void Subgraph::decode_to_framework_nodes() + { + Graph::decode_to_framework_nodes(); + find_inputs_from_parent(); + } + + const std::vector> Subgraph::get_inputs_from_parent() const + { + OutputVector result; + for (const auto& name : m_inputs_from_parent) + { + result.push_back(m_parent_graph_cache->get_node(name)); + } + return result; + } + + void Subgraph::infer_inputs_from_parent() + { + for (auto& it : m_parameter_to_parent_node_map) + { + const auto& node = m_parent_graph_cache->get_node(it.second); + auto& parameter = it.first; + parameter->set_element_type(node.get_element_type()); + parameter->set_partial_shape(node.get_partial_shape()); + } + } } // namespace onnx_import } // namespace ngraph diff --git a/ngraph/frontend/onnx_import/src/core/graph.hpp b/ngraph/frontend/onnx_import/src/core/graph.hpp index 6cbd8804109..33c2be5d4d2 100644 --- a/ngraph/frontend/onnx_import/src/core/graph.hpp +++ b/ngraph/frontend/onnx_import/src/core/graph.hpp @@ -31,13 +31,14 @@ namespace ngraph Graph& operator=(const Graph&) = delete; Graph& operator=(Graph&&) = default; + virtual std::shared_ptr convert(); + std::shared_ptr decode(); const std::vector& get_nodes() const { return m_nodes; } const std::vector& get_inputs() const { return m_inputs; } const std::vector& get_outputs() const { return m_outputs; } OutputVector get_ng_outputs() const; const ParameterVector& get_ng_parameters() const { return m_parameters; } - bool is_node_in_cache(const std::string& name) const; - Output get_ng_node_from_cache(const std::string& name) const; + virtual Output get_ng_node_from_cache(const std::string& name) const; const std::string& get_name() const { return m_model->get_graph().name(); } OutputVector make_ng_nodes(const Node& onnx_node) const; const GraphCache& get_graph_cache() const; @@ -60,6 +61,11 @@ namespace ngraph const OutputVector& ng_node_vector) const; protected: + virtual void decode_to_framework_nodes(); + void convert_to_ngraph_nodes(); + void remove_dangling_parameters(); + std::shared_ptr create_function(); + ParameterVector m_parameters; std::unique_ptr m_model; std::unique_ptr m_cache; @@ -82,9 +88,11 @@ namespace ngraph /// \param[in] parent_graph The reference to the parent graph. Subgraph(std::unique_ptr&& model, const Graph& parent_graph); - /// \brief Return outputs which are on the edge the subgraph and the parent graph. + /// \brief Return nodes which are on the edge the subgraph and the parent graph. /// \return Vector of edge nodes from parent scope. - const std::vector> get_outputs_from_parent() const; + const std::vector> get_inputs_from_parent() const; + + std::shared_ptr convert() override; Subgraph() = delete; @@ -94,8 +102,17 @@ namespace ngraph Subgraph& operator=(const Subgraph&) = delete; Subgraph& operator=(Subgraph&&) = default; + Output get_ng_node_from_cache(const std::string& name) const override; + void infer_inputs_from_parent(); + private: - std::vector> m_outputs_from_parent; + void decode_to_framework_nodes() override; + void find_inputs_from_parent(); + + const GraphCache* m_parent_graph_cache; + std::vector m_inputs_from_parent; + std::unordered_map, std::string> + m_parameter_to_parent_node_map; }; inline std::ostream& operator<<(std::ostream& outs, const Graph& graph) diff --git a/ngraph/frontend/onnx_import/src/core/graph_cache.cpp b/ngraph/frontend/onnx_import/src/core/graph_cache.cpp index 9a0e0b59bbc..69593c062a3 100644 --- a/ngraph/frontend/onnx_import/src/core/graph_cache.cpp +++ b/ngraph/frontend/onnx_import/src/core/graph_cache.cpp @@ -39,55 +39,5 @@ namespace ngraph { return (m_graph_cache_map.count(name) > 0); } - - NodeScope GraphCache::node_scope(const std::string& name) const - { - return contains(name) ? NodeScope::ParentGraph : NodeScope::Lack; - } - - SubgraphCache::SubgraphCache(const GraphCache& parent_graph_cache) - : m_parent_graph_cache{&parent_graph_cache} - { - if (m_parent_graph_cache == nullptr) - { - throw ngraph_error("Parent graph cache is not initialized"); - } - } - - Output SubgraphCache::get_node(const std::string& name) const - { - // present in subgraph scope - if (GraphCache::contains(name)) - { - return GraphCache::get_node(name); - } - else // present in parent graph scope - { - return m_parent_graph_cache->get_node(name); - } - } - - bool SubgraphCache::contains(const std::string& name) const - { - // the node is in subgraph or in parent graph scope - return GraphCache::contains(name) || m_parent_graph_cache->contains(name); - } - - NodeScope SubgraphCache::node_scope(const std::string& name) const - { - if (GraphCache::contains(name)) - { - return NodeScope::SubGraph; - } - else if (m_parent_graph_cache->contains(name)) - { - return NodeScope::ParentGraph; - } - else - { - return NodeScope::Lack; - } - } - } // namespace onnx_import } // namespace ngraph diff --git a/ngraph/frontend/onnx_import/src/core/graph_cache.hpp b/ngraph/frontend/onnx_import/src/core/graph_cache.hpp index a59af9b4a9f..556811a91df 100644 --- a/ngraph/frontend/onnx_import/src/core/graph_cache.hpp +++ b/ngraph/frontend/onnx_import/src/core/graph_cache.hpp @@ -14,17 +14,6 @@ namespace ngraph { namespace onnx_import { - /// \brief Enum which determines scope (visibility) of nodes in GraphCache. - enum class NodeScope - { - // in parent graph scope - ParentGraph = 1, - // in subgraph scope - SubGraph, - // not available at all - Lack - }; - /// \brief GraphCache stores and provides access to ONNX graph initializers. class GraphCache { @@ -58,58 +47,10 @@ namespace ngraph /// \return true if the node named `name` exist in the cache, false otherwise. virtual bool contains(const std::string& name) const; - /// \brief Return NodeScope enum which determines scope of the node. - /// \note If the method is called on GraphCache the ParentGraph enum - /// value is retunred always. - /// - /// \param[in] name The name of the node. - /// - /// \return SubGraph if node belongs to SubgraphCache, ParentGraph if - /// is avalible in parent_graph_cache, otherwise Lack - virtual NodeScope node_scope(const std::string& name) const; - virtual ~GraphCache() = default; private: std::map> m_graph_cache_map; }; - - class SubgraphCache : public GraphCache - { - public: - /// \brief Constructs a SubgraphCache class object. - /// - /// \param[in] parent_graph_cache The reference to the parent graph. - SubgraphCache(const GraphCache& parent_graph_cache); - - /// \brief Get the node from the cache (subgraph or parent graph) - /// - /// \note If the node is not found the ngraph_error exception is thrown. - /// - /// \param[in] name The name of the node. - /// - /// \return The node named `name` from subgraph (as present) or from parent graph. - Output get_node(const std::string& name) const override; - - /// \brief Return true if the node named `name` exist in the cache. - /// - /// \param[in] name The name of the node. - /// - /// \return true if the node named `name` exist in the cache - /// (subgraph or parent graph), false otherwise. - bool contains(const std::string& name) const override; - - /// \brief Return NodeScope enum which determines scope of the node. - /// - /// \param[in] name The name of the node. - /// - /// \return SubGraph if the node belongs to SubgraphCache, ParentGraph if - /// is avalible in parent_graph_cache, otherwise Lack - NodeScope node_scope(const std::string& name) const override; - - private: - const GraphCache* m_parent_graph_cache; - }; - } // namespace onnx_import } // namespace ngraph diff --git a/ngraph/frontend/onnx_import/src/core/model.cpp b/ngraph/frontend/onnx_import/src/core/model.cpp index 452aea7b477..2ddd3edac02 100644 --- a/ngraph/frontend/onnx_import/src/core/model.cpp +++ b/ngraph/frontend/onnx_import/src/core/model.cpp @@ -6,6 +6,7 @@ #include "core/model.hpp" #include "ngraph/log.hpp" +#include "onnx_import/onnx_framework_node.hpp" #include "ops_bridge.hpp" namespace ngraph diff --git a/ngraph/frontend/onnx_import/src/core/node.cpp b/ngraph/frontend/onnx_import/src/core/node.cpp index 1361e802bbf..b6f2797263b 100644 --- a/ngraph/frontend/onnx_import/src/core/node.cpp +++ b/ngraph/frontend/onnx_import/src/core/node.cpp @@ -26,6 +26,29 @@ namespace ngraph , m_graph{&graph} , m_attributes{std::begin(node_proto.attribute()), std::end(node_proto.attribute())} , m_output_names{std::begin(node_proto.output()), std::end(node_proto.output())} + { + const auto it = + std::find_if(std::begin(m_attributes), + std::end(m_attributes), + [&](const Attribute& attribute) { return attribute.is_graph(); }); + m_has_subgraph = it != std::end(m_attributes); + if (m_has_subgraph) + { + m_subgraph = std::make_shared(it->get_subgraph(*m_graph)); + } + } + + Impl(const ONNX_NAMESPACE::NodeProto& node_proto, + const Graph& graph, + std::shared_ptr subgraph) + : m_node_proto{&node_proto} + , m_name{node_proto.has_name() ? node_proto.name() : ""} + , m_domain{get_node_domain(node_proto)} + , m_graph{&graph} + , m_attributes{std::begin(node_proto.attribute()), std::end(node_proto.attribute())} + , m_output_names{std::begin(node_proto.output()), std::end(node_proto.output())} + , m_has_subgraph(subgraph != nullptr) + , m_subgraph(subgraph) { } @@ -44,9 +67,8 @@ namespace ngraph bool has_attribute(const std::string& name) const; - Subgraph get_subgraph_from_attribute( - const std::string& name, - const std::map& carried_dependencies_map) const; + bool has_subgraph() const; + std::shared_ptr get_subgraph() const; template T get_attribute_value(const std::string& name, T default_value) const; @@ -58,6 +80,8 @@ namespace ngraph const Graph& graph() const; private: + Subgraph get_subgraph_from_attribute(const std::string& name) const; + const ONNX_NAMESPACE::NodeProto* m_node_proto; std::string m_name; std::string m_domain; @@ -65,6 +89,9 @@ namespace ngraph std::vector m_attributes; std::vector> m_output_names; mutable std::string m_description; + + bool m_has_subgraph; + std::shared_ptr m_subgraph; }; const ONNX_NAMESPACE::NodeProto& Node::Impl::node_proto() const { return *m_node_proto; } @@ -94,9 +121,7 @@ namespace ngraph return it != std::end(m_attributes); } - Subgraph Node::Impl::get_subgraph_from_attribute( - const std::string& name, - const std::map& carried_dependencies_map) const + Subgraph Node::Impl::get_subgraph_from_attribute(const std::string& name) const { auto it = std::find_if( std::begin(m_attributes), std::end(m_attributes), [&](const Attribute& attribute) { @@ -106,9 +131,13 @@ namespace ngraph { throw error::node::UnknownAttribute{this->name(), name}; } - return it->get_subgraph(graph(), carried_dependencies_map); + return it->get_subgraph(*m_graph); } + bool Node::Impl::has_subgraph() const { return m_has_subgraph; } + + std::shared_ptr Node::Impl::get_subgraph() const { return m_subgraph; } + template T Node::Impl::get_attribute_value(const std::string& name, T default_value) const { @@ -140,8 +169,7 @@ namespace ngraph template <> Subgraph Node::Impl::get_attribute_value(const std::string& name) const { - const std::map empty_map; - return get_subgraph_from_attribute(name, empty_map); + return get_subgraph_from_attribute(name); } OutputVector Node::Impl::get_ng_nodes(const Node& node) const @@ -196,7 +224,9 @@ namespace ngraph } Node::Node(const Node& other) - : m_pimpl{new Impl{other.m_pimpl->node_proto(), other.m_pimpl->graph()}, + : m_pimpl{new Impl{other.m_pimpl->node_proto(), + other.m_pimpl->graph(), + other.get_subgraph()}, [](Impl* impl) { delete impl; }} { } @@ -219,12 +249,9 @@ namespace ngraph return m_pimpl->has_attribute(name); } - Subgraph Node::get_subgraph_from_attribute( - const std::string& name, - const std::map& carried_dependencies_map) const - { - return m_pimpl->get_subgraph_from_attribute(name, carried_dependencies_map); - } + bool Node::has_subgraph() const { return m_pimpl->has_subgraph(); } + + std::shared_ptr Node::get_subgraph() const { return m_pimpl->get_subgraph(); } std::vector Node::get_attribute_names() const { @@ -462,7 +489,6 @@ namespace ngraph { return m_pimpl->template get_attribute_value>(name); } - } // namespace onnx_import } // namespace ngraph diff --git a/ngraph/frontend/onnx_import/src/core/null_node.hpp b/ngraph/frontend/onnx_import/src/core/null_node.hpp index c02a06ecfd2..dd75770488c 100644 --- a/ngraph/frontend/onnx_import/src/core/null_node.hpp +++ b/ngraph/frontend/onnx_import/src/core/null_node.hpp @@ -36,7 +36,10 @@ namespace ngraph public: static constexpr NodeTypeInfo type_info{"NullNode", 0}; const NodeTypeInfo& get_type_info() const override { return type_info; } - NullNode() = default; + NullNode() + : Node(1) + { + } virtual std::shared_ptr clone_with_new_inputs(const OutputVector& new_args) const override; diff --git a/ngraph/frontend/onnx_import/src/core/value_info.hpp b/ngraph/frontend/onnx_import/src/core/value_info.hpp index 67f2c5f7e2b..76b3357c6ab 100644 --- a/ngraph/frontend/onnx_import/src/core/value_info.hpp +++ b/ngraph/frontend/onnx_import/src/core/value_info.hpp @@ -19,20 +19,6 @@ namespace ngraph { namespace onnx_import { - namespace error - { - namespace value_info - { - struct unspecified_element_type : ngraph_error - { - unspecified_element_type() - : ngraph_error{"value info has no element type specified"} - { - } - }; - } // namespace value_info - } // namespace error - class ValueInfo { public: @@ -65,12 +51,12 @@ namespace ngraph const PartialShape& get_shape() const { return m_partial_shape; } const element::Type& get_element_type() const { - if (!m_value_info_proto->type().tensor_type().has_elem_type()) + if (m_value_info_proto->type().tensor_type().has_elem_type()) { - throw error::value_info::unspecified_element_type{}; + return common::get_ngraph_element_type( + m_value_info_proto->type().tensor_type().elem_type()); } - return common::get_ngraph_element_type( - m_value_info_proto->type().tensor_type().elem_type()); + return ngraph::element::dynamic; } std::shared_ptr diff --git a/ngraph/frontend/onnx_import/src/onnx_framework_node.cpp b/ngraph/frontend/onnx_import/src/onnx_framework_node.cpp new file mode 100644 index 00000000000..bf52a1a2c0b --- /dev/null +++ b/ngraph/frontend/onnx_import/src/onnx_framework_node.cpp @@ -0,0 +1,34 @@ +//***************************************************************************** +// Copyright 2017-2021 Intel Corporation +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//***************************************************************************** + +#include + +namespace ngraph +{ + namespace frontend + { + NGRAPH_RTTI_DEFINITION(ONNXFrameworkNode, "ONNXFrameworkNode", 1); + + std::shared_ptr + ONNXFrameworkNode::clone_with_new_inputs(const OutputVector& inputs) const + { + return std::make_shared(m_node, inputs); + } + + NGRAPH_RTTI_DEFINITION(ONNXSubgraphFrameworkNode, "ONNXSubgraphFrameworkNode", 1); + + } // namespace frontend +} // namespace ngraph diff --git a/ngraph/frontend/onnx_import/src/op/loop.cpp b/ngraph/frontend/onnx_import/src/op/loop.cpp index 23ded7464e2..dbe4f68d8c9 100644 --- a/ngraph/frontend/onnx_import/src/op/loop.cpp +++ b/ngraph/frontend/onnx_import/src/op/loop.cpp @@ -77,10 +77,18 @@ namespace ngraph loop_carried_dependencies[i].get_node()->get_friendly_name(); } - const Subgraph& body_graph{ - node.get_subgraph_from_attribute("body", loop_carried_dependencies_map)}; - auto body_outputs = body_graph.get_ng_outputs(); - const auto& body_inputs = body_graph.get_ng_parameters(); + auto body_graph = node.get_subgraph(); + auto body_outputs = body_graph->get_ng_outputs(); + const auto& body_inputs = body_graph->get_ng_parameters(); + + // Infer loop body inputs' element type based on carried dependencies + for (size_t i = 0; i < loop_carried_dependencies.size(); i++) + { + body_inputs[i + 2]->set_element_type( + loop_carried_dependencies[i].get_element_type()); + body_inputs[i + 2]->set_partial_shape( + loop_carried_dependencies[i].get_partial_shape()); + } // optional inputs Output trip_count; @@ -190,22 +198,22 @@ namespace ngraph final_values.push_back(loop->get_iter_value(*body_outputs_it++, -1)); } - const auto& outputs_from_parent = body_graph.get_outputs_from_parent(); + const auto& inputs_from_parent = body_graph->get_inputs_from_parent(); CHECK_VALID_NODE( node, static_cast(std::distance(body_inputs_it, body_inputs.end())) == - outputs_from_parent.size(), + inputs_from_parent.size(), "Expected number of invariant parameters is" - " not equal number of provided outputs from parent scope"); + " not equal number of provided inputs from parent scope"); // Set-up parameters from parent graph which are not changed during Loop's // iterations - for (auto out_from_parent_it = outputs_from_parent.begin(); + for (auto in_from_parent_it = inputs_from_parent.begin(); body_inputs_it != body_inputs.end() && - out_from_parent_it != outputs_from_parent.end(); - ++body_inputs_it, ++out_from_parent_it) + in_from_parent_it != inputs_from_parent.end(); + ++body_inputs_it, ++in_from_parent_it) { - loop->set_invariant_input(*body_inputs_it, *out_from_parent_it); + loop->set_invariant_input(*body_inputs_it, *in_from_parent_it); } // Set-up scan outputs diff --git a/ngraph/frontend/onnx_import/src/utils/onnx_internal.cpp b/ngraph/frontend/onnx_import/src/utils/onnx_internal.cpp index 74bb4a72d5c..8e60171a198 100644 --- a/ngraph/frontend/onnx_import/src/utils/onnx_internal.cpp +++ b/ngraph/frontend/onnx_import/src/utils/onnx_internal.cpp @@ -6,7 +6,9 @@ #include "core/graph.hpp" #include "core/model.hpp" +#include "core/null_node.hpp" #include "core/transform.hpp" +#include "onnx_import/onnx_framework_node.hpp" #include "onnx_import/utils/onnx_internal.hpp" namespace ngraph @@ -15,21 +17,81 @@ namespace ngraph { namespace detail { - std::shared_ptr - convert_to_ng_function(const ONNX_NAMESPACE::ModelProto& model_proto) + void remove_dangling_parameters(std::shared_ptr& function) { - auto p_model_proto = common::make_unique(model_proto); - auto model = common::make_unique(std::move(p_model_proto)); - - Graph graph{std::move(model)}; - auto function = std::make_shared( - graph.get_ng_outputs(), graph.get_ng_parameters(), graph.get_name()); - for (std::size_t i{0}; i < function->get_output_size(); ++i) + const auto parameters = function->get_parameters(); + for (auto parameter : parameters) { - function->get_output_op(i)->set_friendly_name( - graph.get_outputs().at(i).get_name()); + const auto parameter_users = parameter->get_users(); + // if a Parameter is connected to a ONNXFrameworkNode that was not converted + // during convert_function it means, this Parameter is dangling and we can + // remove it from function + const bool is_dangling_parameter = std::all_of( + parameter_users.begin(), + parameter_users.end(), + [](const std::shared_ptr& node) -> bool { + return std::dynamic_pointer_cast(node) != + nullptr; + }); + if (is_dangling_parameter) + { + function->remove_parameter(parameter); + } } - return function; + } + + void remove_dangling_results(std::shared_ptr& function) + { + const auto results = function->get_results(); + for (auto result : results) + { + // we can remove Result from function if after function conversion, + // Result is connected to NullNode only + const auto result_inputs = result->input_values(); + const bool is_dangling_result = + std::all_of(result_inputs.begin(), + result_inputs.end(), + [](const Output& node) -> bool { + return ngraph::op::is_null(node); + }); + if (is_dangling_result) + { + function->remove_result(result); + } + } + } + + void convert_decoded_function(std::shared_ptr function) + { + for (const auto& node : function->get_ordered_ops()) + { + if (auto raw_node = + std::dynamic_pointer_cast(node)) + { + if (auto subgraph_node = + std::dynamic_pointer_cast( + node)) + { + subgraph_node->infer_inputs_from_parent(); + convert_decoded_function(subgraph_node->get_subgraph_body()); + } + const auto& onnx_node = raw_node->get_onnx_node(); + OutputVector ng_nodes{onnx_node.get_ng_nodes()}; + if (ng_nodes.size() > raw_node->get_output_size()) + { + ng_nodes.resize(raw_node->get_output_size()); + } + replace_node(raw_node, ng_nodes); + } + else + { + // Have to revalidate node because new intpus can affect shape/type + // propagation for already translated nodes + node->revalidate_and_infer_types(); + } + } + remove_dangling_parameters(function); + remove_dangling_results(function); } std::shared_ptr import_onnx_model(ONNX_NAMESPACE::ModelProto& model_proto, @@ -39,7 +101,10 @@ namespace ngraph transform::fixup_legacy_operators(model_proto); transform::update_external_data_paths(model_proto, model_path); - return detail::convert_to_ng_function(model_proto); + auto p_model_proto = common::make_unique(model_proto); + auto model = common::make_unique(std::move(p_model_proto)); + Graph graph{std::move(model)}; + return graph.convert(); } } // namespace detail } // namespace onnx_import diff --git a/ngraph/frontend/paddlepaddle/src/op/argmax.cpp b/ngraph/frontend/paddlepaddle/src/op/argmax.cpp new file mode 100644 index 00000000000..7d8c069031d --- /dev/null +++ b/ngraph/frontend/paddlepaddle/src/op/argmax.cpp @@ -0,0 +1,57 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "argmax.hpp" +#include + +namespace ngraph +{ + namespace frontend + { + namespace pdpd + { + namespace op + { + NamedOutputs argmax(const NodeContext& node) + { + auto data = node.get_ng_input("X"); + bool flatten = node.get_attribute("flatten"); + const element::Type& index_element_type = element::i64; + const Output k = + ngraph::opset6::Constant::create(ngraph::element::i64, {}, {1}); + + if (!flatten) + { + auto axis = node.get_attribute("axis"); + const auto axis_to_remove = + ngraph::opset6::Constant::create(element::u64, Shape{}, {axis}); + auto node_topk = std::make_shared( + data, k, axis, "max", "index", index_element_type); + const auto reshaped_indices = std::make_shared( + node_topk->output(1), axis_to_remove); + return node.default_single_output_mapping( + {std::make_shared(reshaped_indices, + element::i64)}, + {"Out"}); + } + else + { + int64_t axis = 0; + const Output reshape_flatten = + ngraph::opset6::Constant::create(ngraph::element::i64, {1}, {-1}); + auto node_reshape = + std::make_shared(data, reshape_flatten, true); + auto node_topk = std::make_shared( + node_reshape, k, axis, "max", "index", index_element_type); + return node.default_single_output_mapping( + {std::make_shared(node_topk->output(1), + element::i64)}, + {"Out"}); + } + } + + } // namespace op + } // namespace pdpd + } // namespace frontend +} // namespace ngraph diff --git a/ngraph/frontend/paddlepaddle/src/op/argmax.hpp b/ngraph/frontend/paddlepaddle/src/op/argmax.hpp new file mode 100644 index 00000000000..20d9db406be --- /dev/null +++ b/ngraph/frontend/paddlepaddle/src/op/argmax.hpp @@ -0,0 +1,20 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once +#include "node_context.hpp" + +namespace ngraph +{ + namespace frontend + { + namespace pdpd + { + namespace op + { + NamedOutputs argmax(const NodeContext& node); + } + } // namespace pdpd + } // namespace frontend +} // namespace ngraph \ No newline at end of file diff --git a/ngraph/frontend/paddlepaddle/src/op/assign_value.cpp b/ngraph/frontend/paddlepaddle/src/op/assign_value.cpp new file mode 100644 index 00000000000..fb503abbba8 --- /dev/null +++ b/ngraph/frontend/paddlepaddle/src/op/assign_value.cpp @@ -0,0 +1,66 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "assign_value.hpp" +#include +namespace ngraph +{ + namespace frontend + { + namespace pdpd + { + namespace op + { + NamedOutputs assign_value(const NodeContext& node) + { + std::vector shape = node.get_attribute>("shape"); + auto dtype = node.get_attribute("dtype"); + std::shared_ptr const_node; + + switch (dtype) + { + case element::i32: + { + auto values = node.get_attribute>("int32_values"); + const_node = {opset6::Constant::create( + dtype, Shape{shape.begin(), shape.end()}, values)}; + break; + } + case element::f32: + { + std::vector values = + node.get_attribute>("fp32_values"); + const_node = {opset6::Constant::create( + dtype, Shape{shape.begin(), shape.end()}, values)}; + break; + } + case element::boolean: + { + auto values = node.get_attribute>("bool_values"); + const_node = {opset6::Constant::create( + dtype, Shape{shape.begin(), shape.end()}, values)}; + break; + } + case element::i64: + { + auto values = node.get_attribute>("int64_values"); + const_node = {opset6::Constant::create( + dtype, Shape{shape.begin(), shape.end()}, values)}; + break; + } + default: + { + PDPD_OP_VALIDATION_CHECK( + node, false, "assign_value only supports int32, int64, float32, bool"); + break; + } + } + + return node.default_single_output_mapping({const_node}, {"Out"}); + } + + } // namespace op + } // namespace pdpd + } // namespace frontend +} // namespace ngraph diff --git a/ngraph/frontend/paddlepaddle/src/op/assign_value.hpp b/ngraph/frontend/paddlepaddle/src/op/assign_value.hpp new file mode 100644 index 00000000000..b954b3a04cc --- /dev/null +++ b/ngraph/frontend/paddlepaddle/src/op/assign_value.hpp @@ -0,0 +1,21 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include "node_context.hpp" + +namespace ngraph +{ + namespace frontend + { + namespace pdpd + { + namespace op + { + NamedOutputs assign_value(const NodeContext& node); + } + } // namespace pdpd + } // namespace frontend +} // namespace ngraph diff --git a/ngraph/frontend/paddlepaddle/src/op/batch_norm.cpp b/ngraph/frontend/paddlepaddle/src/op/batch_norm.cpp new file mode 100644 index 00000000000..c38c4189fa0 --- /dev/null +++ b/ngraph/frontend/paddlepaddle/src/op/batch_norm.cpp @@ -0,0 +1,64 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "batch_norm.hpp" +#include + +namespace ngraph +{ + namespace frontend + { + namespace pdpd + { + namespace op + { + NamedOutputs batch_norm(const NodeContext& node) + { + auto data = node.get_ng_input("X"); + auto gamma = node.get_ng_input("Scale"); + auto beta = node.get_ng_input("Bias"); + auto mean = node.get_ng_input("Mean"); + auto variance = node.get_ng_input("Variance"); + auto data_layout = node.get_attribute("data_layout"); + + PDPD_ASSERT((data_layout == "NCHW" || data_layout == "NHWC"), + "Not supported input data layout!"); + if (data_layout == "NCHW") + { + return node.default_single_output_mapping( + {std::make_shared( + data, + gamma, + beta, + mean, + variance, + node.get_attribute("epsilon"))}, + {"Y"}); + } + else + { + auto input_order = ngraph::opset6::Constant::create( + ngraph::element::i64, {4}, {0, 3, 1, 2}); + auto data_nchw = + std::make_shared(data, input_order); + auto node_batch_norm = std::make_shared( + data_nchw, + gamma, + beta, + mean, + variance, + node.get_attribute("epsilon")); + auto output_order = ngraph::opset6::Constant::create( + ngraph::element::i64, {4}, {0, 2, 3, 1}); + return node.default_single_output_mapping( + {std::make_shared(node_batch_norm, + output_order)}, + {"Y"}); + } + } + + } // namespace op + } // namespace pdpd + } // namespace frontend +} // namespace ngraph diff --git a/ngraph/frontend/paddlepaddle/src/op/batch_norm.hpp b/ngraph/frontend/paddlepaddle/src/op/batch_norm.hpp new file mode 100644 index 00000000000..3757421bba6 --- /dev/null +++ b/ngraph/frontend/paddlepaddle/src/op/batch_norm.hpp @@ -0,0 +1,20 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once +#include "node_context.hpp" + +namespace ngraph +{ + namespace frontend + { + namespace pdpd + { + namespace op + { + NamedOutputs batch_norm(const NodeContext& node); + } + } // namespace pdpd + } // namespace frontend +} // namespace ngraph \ No newline at end of file diff --git a/ngraph/frontend/paddlepaddle/src/op/cast.cpp b/ngraph/frontend/paddlepaddle/src/op/cast.cpp new file mode 100644 index 00000000000..2cb181f0b24 --- /dev/null +++ b/ngraph/frontend/paddlepaddle/src/op/cast.cpp @@ -0,0 +1,28 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "cast.hpp" +#include + +namespace ngraph +{ + namespace frontend + { + namespace pdpd + { + namespace op + { + NamedOutputs cast(const NodeContext& node) + { + auto data = node.get_ng_input("X"); + auto out_dtype = node.get_attribute("out_dtype"); + + return node.default_single_output_mapping( + {std::make_shared(data, out_dtype)}, {"Out"}); + } + + } // namespace op + } // namespace pdpd + } // namespace frontend +} // namespace ngraph \ No newline at end of file diff --git a/ngraph/frontend/paddlepaddle/src/op/cast.hpp b/ngraph/frontend/paddlepaddle/src/op/cast.hpp new file mode 100644 index 00000000000..1e3a19aaf59 --- /dev/null +++ b/ngraph/frontend/paddlepaddle/src/op/cast.hpp @@ -0,0 +1,20 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once +#include "node_context.hpp" + +namespace ngraph +{ + namespace frontend + { + namespace pdpd + { + namespace op + { + NamedOutputs cast(const NodeContext& node); + } + } // namespace pdpd + } // namespace frontend +} // namespace ngraph \ No newline at end of file diff --git a/ngraph/frontend/paddlepaddle/src/op/clip.cpp b/ngraph/frontend/paddlepaddle/src/op/clip.cpp new file mode 100644 index 00000000000..1909e392eaf --- /dev/null +++ b/ngraph/frontend/paddlepaddle/src/op/clip.cpp @@ -0,0 +1,31 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "clip.hpp" +#include + +namespace ngraph +{ + namespace frontend + { + namespace pdpd + { + namespace op + { + NamedOutputs clip(const NodeContext& node) + { + auto data = node.get_ng_input("X"); + auto min = node.get_attribute("min"); + auto max = node.get_attribute("max"); + PDPD_OP_VALIDATION_CHECK( + node, max >= min, "clip: max value must greater than min value!"); + + return node.default_single_output_mapping( + {std::make_shared(data, min, max)}, {"Out"}); + } + + } // namespace op + } // namespace pdpd + } // namespace frontend +} // namespace ngraph \ No newline at end of file diff --git a/ngraph/frontend/paddlepaddle/src/op/clip.hpp b/ngraph/frontend/paddlepaddle/src/op/clip.hpp new file mode 100644 index 00000000000..babfa2ccd95 --- /dev/null +++ b/ngraph/frontend/paddlepaddle/src/op/clip.hpp @@ -0,0 +1,20 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once +#include "node_context.hpp" + +namespace ngraph +{ + namespace frontend + { + namespace pdpd + { + namespace op + { + NamedOutputs clip(const NodeContext& node); + } + } // namespace pdpd + } // namespace frontend +} // namespace ngraph \ No newline at end of file diff --git a/ngraph/frontend/paddlepaddle/src/op/concat.cpp b/ngraph/frontend/paddlepaddle/src/op/concat.cpp new file mode 100644 index 00000000000..a9c6fa6388d --- /dev/null +++ b/ngraph/frontend/paddlepaddle/src/op/concat.cpp @@ -0,0 +1,27 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "concat.hpp" +#include + +namespace ngraph +{ + namespace frontend + { + namespace pdpd + { + namespace op + { + NamedOutputs concat(const NodeContext& node) + { + auto data = node.get_ng_inputs("X"); + auto axis = node.get_attribute("axis"); + return node.default_single_output_mapping( + {std::make_shared(data, axis)}, {"Out"}); + } + + } // namespace op + } // namespace pdpd + } // namespace frontend +} // namespace ngraph \ No newline at end of file diff --git a/ngraph/frontend/paddlepaddle/src/op/concat.hpp b/ngraph/frontend/paddlepaddle/src/op/concat.hpp new file mode 100644 index 00000000000..0d32fa22f6e --- /dev/null +++ b/ngraph/frontend/paddlepaddle/src/op/concat.hpp @@ -0,0 +1,20 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once +#include "node_context.hpp" + +namespace ngraph +{ + namespace frontend + { + namespace pdpd + { + namespace op + { + NamedOutputs concat(const NodeContext& node); + } + } // namespace pdpd + } // namespace frontend +} // namespace ngraph \ No newline at end of file diff --git a/ngraph/frontend/paddlepaddle/src/op_table.cpp b/ngraph/frontend/paddlepaddle/src/op_table.cpp index 411cfe8ecbf..916737fc0c2 100644 --- a/ngraph/frontend/paddlepaddle/src/op_table.cpp +++ b/ngraph/frontend/paddlepaddle/src/op_table.cpp @@ -1,7 +1,12 @@ // Copyright (C) 2018-2021 Intel Corporation // SPDX-License-Identifier: Apache-2.0 // - +#include "op/argmax.hpp" +#include "op/assign_value.hpp" +#include "op/batch_norm.hpp" +#include "op/cast.hpp" +#include "op/clip.hpp" +#include "op/concat.hpp" #include "op/conv2d.hpp" #include "op/elementwise_ops.hpp" #include "op/relu.hpp" @@ -18,7 +23,13 @@ namespace ngraph { std::map get_supported_ops() { - return {{"conv2d", op::conv2d}, + return {{"arg_max", op::argmax}, + {"assign_value", op::assign_value}, + {"batch_norm", op::batch_norm}, + {"cast", op::cast}, + {"clip", op::clip}, + {"concat", op::concat}, + {"conv2d", op::conv2d}, {"elementwise_add", op::elementwise_add}, {"elementwise_div", op::elementwise_div}, {"elementwise_max", op::elementwise_max}, diff --git a/ngraph/python/setup.py b/ngraph/python/setup.py index 059ccd81acb..d81df94f09a 100644 --- a/ngraph/python/setup.py +++ b/ngraph/python/setup.py @@ -34,6 +34,7 @@ packages = [ "ngraph.opset5", "ngraph.opset6", "ngraph.opset7", + "ngraph.opset8", "ngraph.utils", "ngraph.impl", "ngraph.impl.op", diff --git a/ngraph/python/src/ngraph/__init__.py b/ngraph/python/src/ngraph/__init__.py index f7e498c4a60..5dca8a5c68a 100644 --- a/ngraph/python/src/ngraph/__init__.py +++ b/ngraph/python/src/ngraph/__init__.py @@ -108,11 +108,13 @@ from ngraph.opset8 import lrn from ngraph.opset8 import lstm_cell from ngraph.opset8 import lstm_sequence from ngraph.opset8 import matmul +from ngraph.opset8 import matrix_nms from ngraph.opset8 import max_pool from ngraph.opset8 import maximum from ngraph.opset8 import minimum from ngraph.opset8 import mish from ngraph.opset8 import mod +from ngraph.opset8 import multiclass_nms from ngraph.opset8 import multiply from ngraph.opset8 import mvn from ngraph.opset8 import negative diff --git a/ngraph/python/src/ngraph/opset8/__init__.py b/ngraph/python/src/ngraph/opset8/__init__.py index 08a24529d41..2e7acf0f3ce 100644 --- a/ngraph/python/src/ngraph/opset8/__init__.py +++ b/ngraph/python/src/ngraph/opset8/__init__.py @@ -33,7 +33,7 @@ from ngraph.opset6.ops import ctc_greedy_decoder_seq_len from ngraph.opset4.ops import ctc_loss from ngraph.opset3.ops import cum_sum from ngraph.opset3.ops import cum_sum as cumsum -from ngraph.opset1.ops import deformable_convolution +from ngraph.opset8.ops import deformable_convolution from ngraph.opset1.ops import deformable_psroi_pooling from ngraph.opset1.ops import depth_to_space from ngraph.opset1.ops import detection_output @@ -81,11 +81,13 @@ from ngraph.opset1.ops import lrn from ngraph.opset4.ops import lstm_cell from ngraph.opset1.ops import lstm_sequence from ngraph.opset1.ops import matmul +from ngraph.opset8.ops import matrix_nms from ngraph.opset1.ops import max_pool from ngraph.opset1.ops import maximum from ngraph.opset1.ops import minimum from ngraph.opset4.ops import mish from ngraph.opset1.ops import mod +from ngraph.opset8.ops import multiclass_nms from ngraph.opset1.ops import multiply from ngraph.opset6.ops import mvn from ngraph.opset1.ops import negative diff --git a/ngraph/python/src/ngraph/opset8/ops.py b/ngraph/python/src/ngraph/opset8/ops.py index 6ef5990f079..bcc294ad931 100644 --- a/ngraph/python/src/ngraph/opset8/ops.py +++ b/ngraph/python/src/ngraph/opset8/ops.py @@ -43,3 +43,176 @@ _get_node_factory_opset8 = partial(_get_node_factory, "opset8") # -------------------------------------------- ops ------------------------------------------------ + + +@nameable_op +def deformable_convolution( + data: NodeInput, + offsets: NodeInput, + filters: NodeInput, + strides: List[int], + pads_begin: List[int], + pads_end: List[int], + dilations: List[int], + mask: Optional[NodeInput] = None, + auto_pad: str = "EXPLICIT", + group: int = 1, + deformable_group: int = 1, + bilinear_interpolation_pad: bool = False, + name: Optional[str] = None, +) -> Node: + """Return a node which performs deformable convolution operation. + + @param data: The node providing data batch tensor. + @param offsets: The node providing offset tensor. + @param filters: The node providing filters tensor. + @param strides: The distance (in pixels) to slide the filter on the feature map over the axes. + @param pads_begin: The number of pixels to add to the beginning along each axis. + @param pads_end: The number of pixels to add to the end along each axis. + @param dilations: The distance in width and height between elements (weights) in the filter. + @param mask: The node providing modulation scalar (mask) tensor. + @param auto_pad: The type of padding. Range of values: explicit, same_upper, same_lower, valid. + @param group: The number of groups which both output and input should be split into. + @param deformable_group: The number of groups which deformable values and output should be split + into along the channel axis. + @param bilinear_interpolation_pad: The flag that determines the mode of bilinear interpolation + execution. + @param name: The optional new name for output node. + @return New node performing deformable convolution operation. + """ + if mask is None: + inputs = as_nodes(data, offsets, filters) + else: + inputs = as_nodes(data, offsets, filters, mask) + + return _get_node_factory_opset8().create( + "DeformableConvolution", + inputs, + { + "strides": strides, + "pads_begin": pads_begin, + "pads_end": pads_end, + "dilations": dilations, + "auto_pad": auto_pad, + "group": group, + "deformable_group": deformable_group, + "bilinear_interpolation_pad": bilinear_interpolation_pad + }, + ) + + +@nameable_op +def multiclass_nms( + boxes: NodeInput, + scores: NodeInput, + sort_result_type: str = "none", + sort_result_across_batch: bool = False, + output_type: str = "i64", + iou_threshold: float = 0.0, + score_threshold: float = 0.0, + nms_top_k: int = -1, + keep_top_k: int = -1, + background_class: int = -1, + nms_eta: float = 1.0, + normalized: bool = True +) -> Node: + """Return a node which performs MulticlassNms. + + @param boxes: Tensor with box coordinates. + @param scores: Tensor with box scores. + @param sort_result_type: Specifies order of output elements, possible values: + 'class': sort selected boxes by class id (ascending) + 'score': sort selected boxes by score (descending) + 'none': do not guarantee the order. + @param sort_result_across_batch: Specifies whenever it is necessary to sort selected boxes + across batches or not + @param output_type: Specifies the output tensor type, possible values: + 'i64', 'i32' + @param iou_threshold: Specifies intersection over union threshold + @param score_threshold: Specifies minimum score to consider box for the processing + @param nms_top_k: Specifies maximum number of boxes to be selected per class, -1 meaning + to keep all boxes + @param keep_top_k: Specifies maximum number of boxes to be selected per batch element, -1 + meaning to keep all boxes + @param background_class: Specifies the background class id, -1 meaning to keep all classes + @param nms_eta: Specifies eta parameter for adpative NMS, in close range [0, 1.0] + @param normalized: Specifies whether boxes are normalized or not + @return: The new node which performs MuticlassNms + """ + inputs = as_nodes(boxes, scores) + + attributes = { + "sort_result_type": sort_result_type, + "sort_result_across_batch": sort_result_across_batch, + "output_type": output_type, + "iou_threshold": iou_threshold, + "score_threshold": score_threshold, + "nms_top_k": nms_top_k, + "keep_top_k": keep_top_k, + "background_class": background_class, + "nms_eta": nms_eta, + "normalized": normalized + } + + return _get_node_factory_opset8().create("MulticlassNms", inputs, attributes) + + +@nameable_op +def matrix_nms( + boxes: NodeInput, + scores: NodeInput, + sort_result_type: str = "none", + sort_result_across_batch: bool = False, + output_type: str = "i64", + score_threshold: float = 0.0, + nms_top_k: int = -1, + keep_top_k: int = -1, + background_class: int = -1, + decay_function: str = "linear", + gaussian_sigma: float = 2.0, + post_threshold: float = 0.0, + normalized: bool = True +) -> Node: + """Return a node which performs MatrixNms. + + @param boxes: Tensor with box coordinates. + @param scores: Tensor with box scores. + @param sort_result_type: Specifies order of output elements, possible values: + 'class': sort selected boxes by class id (ascending) + 'score': sort selected boxes by score (descending) + 'none': do not guarantee the order. + @param sort_result_across_batch: Specifies whenever it is necessary to sort selected boxes + across batches or not + @param output_type: Specifies the output tensor type, possible values: + 'i64', 'i32' + @param score_threshold: Specifies minimum score to consider box for the processing + @param nms_top_k: Specifies maximum number of boxes to be selected per class, -1 meaning + to keep all boxes + @param keep_top_k: Specifies maximum number of boxes to be selected per batch element, -1 + meaning to keep all boxes + @param background_class: Specifies the background class id, -1 meaning to keep all classes + @param decay_function: Specifies decay function used to decay scores, possible values: + 'gaussian', 'linear' + @param gaussian_sigma: Specifies gaussian_sigma parameter for gaussian decay_function + @param post_threshold: Specifies threshold to filter out boxes with low confidence score + after decaying + @param normalized: Specifies whether boxes are normalized or not + @return: The new node which performs MatrixNms + """ + inputs = as_nodes(boxes, scores) + + attributes = { + "sort_result_type": sort_result_type, + "sort_result_across_batch": sort_result_across_batch, + "output_type": output_type, + "score_threshold": score_threshold, + "nms_top_k": nms_top_k, + "keep_top_k": keep_top_k, + "background_class": background_class, + "decay_function": decay_function, + "gaussian_sigma": gaussian_sigma, + "post_threshold": post_threshold, + "normalized": normalized + } + + return _get_node_factory_opset8().create("MatrixNms", inputs, attributes) diff --git a/ngraph/python/src/pyngraph/node.cpp b/ngraph/python/src/pyngraph/node.cpp index b03a30e949c..33c77d00231 100644 --- a/ngraph/python/src/pyngraph/node.cpp +++ b/ngraph/python/src/pyngraph/node.cpp @@ -248,12 +248,23 @@ void regclass_pyngraph_Node(py::module m) get_rt_info : PyRTMap A dictionary of user defined data. )"); + node.def("get_version", + &ngraph::Node::get_version, + R"( + Returns operation's version of the node. + + Returns + ---------- + get_version : int + Operation version. + )"); node.def_property_readonly("shape", &ngraph::Node::get_shape); node.def_property_readonly("name", &ngraph::Node::get_name); node.def_property_readonly("rt_info", (PyRTMap & (ngraph::Node::*)()) & ngraph::Node::get_rt_info, py::return_value_policy::reference_internal); + node.def_property_readonly("version", &ngraph::Node::get_version); node.def_property( "friendly_name", &ngraph::Node::get_friendly_name, &ngraph::Node::set_friendly_name); diff --git a/ngraph/python/src/pyngraph/node_factory.cpp b/ngraph/python/src/pyngraph/node_factory.cpp index 0f3a10dde69..ba4b0b80d36 100644 --- a/ngraph/python/src/pyngraph/node_factory.cpp +++ b/ngraph/python/src/pyngraph/node_factory.cpp @@ -86,7 +86,7 @@ namespace return it->second(); } - const ngraph::OpSet& m_opset = ngraph::get_opset7(); + const ngraph::OpSet& m_opset = ngraph::get_opset8(); std::unordered_map> m_variables; }; } // namespace diff --git a/ngraph/python/tests/test_ngraph/test_basic.py b/ngraph/python/tests/test_ngraph/test_basic.py index da6cf993d3f..af6d9bb57ce 100644 --- a/ngraph/python/tests/test_ngraph/test_basic.py +++ b/ngraph/python/tests/test_ngraph/test_basic.py @@ -425,3 +425,10 @@ def test_sink_function_ctor(): assert len(function.get_parameters()) == 1 assert len(function.get_results()) == 1 assert function.get_friendly_name() == "TestFunction" + + +def test_node_version(): + node = ng.add([1], [2]) + + assert node.get_version() == 1 + assert node.version == 1 diff --git a/ngraph/python/tests/test_ngraph/test_create_op.py b/ngraph/python/tests/test_ngraph/test_create_op.py index 7d430782e42..e8770b08178 100644 --- a/ngraph/python/tests/test_ngraph/test_create_op.py +++ b/ngraph/python/tests/test_ngraph/test_create_op.py @@ -3,7 +3,7 @@ import numpy as np import pytest -from _pyngraph import PartialShape +from _pyngraph import PartialShape, Dimension import ngraph as ng import ngraph.opset1 as ng_opset1 @@ -104,6 +104,31 @@ def test_ctc_greedy_decoder_seq_len(fp_dtype, int_dtype, int_ci, int_sl, merge_r assert list(node.get_output_shape(0)) == expected_shape +@pytest.mark.parametrize("dtype", np_types) +def test_deformable_convolution_opset1(dtype): + strides = np.array([1, 1]) + pads_begin = np.array([0, 0]) + pads_end = np.array([0, 0]) + dilations = np.array([1, 1]) + + input0_shape = [1, 1, 9, 9] + input1_shape = [1, 18, 7, 7] + input2_shape = [1, 1, 3, 3] + expected_shape = [1, 1, 7, 7] + + parameter_input0 = ng.parameter(input0_shape, name="Input0", dtype=dtype) + parameter_input1 = ng.parameter(input1_shape, name="Input1", dtype=dtype) + parameter_input2 = ng.parameter(input2_shape, name="Input2", dtype=dtype) + + node = ng_opset1.deformable_convolution( + parameter_input0, parameter_input1, parameter_input2, strides, pads_begin, pads_end, dilations, + ) + + assert node.get_type_name() == "DeformableConvolution" + assert node.get_output_size() == 1 + assert list(node.get_output_shape(0)) == expected_shape + + @pytest.mark.parametrize("dtype", np_types) def test_deformable_convolution(dtype): strides = np.array([1, 1]) @@ -129,6 +154,34 @@ def test_deformable_convolution(dtype): assert list(node.get_output_shape(0)) == expected_shape +@pytest.mark.parametrize("dtype", np_types) +def test_deformable_convolution_mask(dtype): + strides = np.array([1, 1]) + pads_begin = np.array([0, 0]) + pads_end = np.array([0, 0]) + dilations = np.array([1, 1]) + + input0_shape = [1, 1, 9, 9] + input1_shape = [1, 18, 7, 7] + input2_shape = [1, 1, 3, 3] + input3_shape = [1, 9, 7, 7] + expected_shape = [1, 1, 7, 7] + + parameter_input0 = ng.parameter(input0_shape, name="Input0", dtype=dtype) + parameter_input1 = ng.parameter(input1_shape, name="Input1", dtype=dtype) + parameter_input2 = ng.parameter(input2_shape, name="Input2", dtype=dtype) + parameter_input3 = ng.parameter(input3_shape, name="Input3", dtype=dtype) + + node = ng.deformable_convolution( + parameter_input0, parameter_input1, parameter_input2, strides, + pads_begin, pads_end, dilations, parameter_input3 + ) + + assert node.get_type_name() == "DeformableConvolution" + assert node.get_output_size() == 1 + assert list(node.get_output_shape(0)) == expected_shape + + @pytest.mark.parametrize("dtype", np_types) def test_deformable_psroi_pooling(dtype): output_dim = 8 @@ -1793,3 +1846,53 @@ def test_rnn_sequence_operator_forward(dtype): assert node.get_type_name() == "RNNSequence" assert node.get_output_size() == 2 + + +def test_multiclass_nms(): + boxes_data = np.array([0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, + 0.0, -0.1, 1.0, 0.9, 0.0, 10.0, 1.0, 11.0, + 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0], dtype="float32") + boxes_data = boxes_data.reshape([1, 6, 4]) + box = ng.constant(boxes_data, dtype=np.float) + scores_data = np.array([0.9, 0.75, 0.6, 0.95, 0.5, 0.3, + 0.95, 0.75, 0.6, 0.80, 0.5, 0.3], dtype="float32") + scores_data = scores_data.reshape([1, 2, 6]) + score = ng.constant(scores_data, dtype=np.float) + + nms_node = ng.multiclass_nms(box, score, output_type="i32", nms_top_k=3, + iou_threshold=0.5, score_threshold=0.0, sort_result_type="classid", + nms_eta=1.0) + + assert nms_node.get_type_name() == "MulticlassNms" + assert nms_node.get_output_size() == 3 + assert nms_node.outputs()[0].get_partial_shape() == PartialShape([Dimension(0, 6), Dimension(6)]) + assert nms_node.outputs()[1].get_partial_shape() == PartialShape([Dimension(0, 6), Dimension(1)]) + assert list(nms_node.outputs()[2].get_shape()) == [1, ] + assert nms_node.get_output_element_type(0) == Type.f32 + assert nms_node.get_output_element_type(1) == Type.i32 + assert nms_node.get_output_element_type(2) == Type.i32 + + +def test_matrix_nms(): + boxes_data = np.array([0.0, 0.0, 1.0, 1.0, 0.0, 0.1, 1.0, 1.1, + 0.0, -0.1, 1.0, 0.9, 0.0, 10.0, 1.0, 11.0, + 0.0, 10.1, 1.0, 11.1, 0.0, 100.0, 1.0, 101.0], dtype="float32") + boxes_data = boxes_data.reshape([1, 6, 4]) + box = ng.constant(boxes_data, dtype=np.float) + scores_data = np.array([0.9, 0.75, 0.6, 0.95, 0.5, 0.3, + 0.95, 0.75, 0.6, 0.80, 0.5, 0.3], dtype="float32") + scores_data = scores_data.reshape([1, 2, 6]) + score = ng.constant(scores_data, dtype=np.float) + + nms_node = ng.matrix_nms(box, score, output_type="i32", nms_top_k=3, + score_threshold=0.0, sort_result_type="score", background_class=0, + decay_function="linear", gaussian_sigma=2.0, post_threshold=0.0) + + assert nms_node.get_type_name() == "MatrixNms" + assert nms_node.get_output_size() == 3 + assert nms_node.outputs()[0].get_partial_shape() == PartialShape([Dimension(0, 6), Dimension(6)]) + assert nms_node.outputs()[1].get_partial_shape() == PartialShape([Dimension(0, 6), Dimension(1)]) + assert list(nms_node.outputs()[2].get_shape()) == [1, ] + assert nms_node.get_output_element_type(0) == Type.f32 + assert nms_node.get_output_element_type(1) == Type.i32 + assert nms_node.get_output_element_type(2) == Type.i32 diff --git a/ngraph/python/tests/test_onnx/test_ops_unary.py b/ngraph/python/tests/test_onnx/test_ops_unary.py index 01c9eeb9f55..22d6b54f539 100644 --- a/ngraph/python/tests/test_onnx/test_ops_unary.py +++ b/ngraph/python/tests/test_onnx/test_ops_unary.py @@ -390,8 +390,7 @@ def test_cast_errors(): for name, value in zip(node.input, [input_data]) ] output_tensors = [ - make_tensor_value_info(name, onnx.TensorProto.FLOAT16, value.shape) - for name, value in zip(node.output, ()) + make_tensor_value_info(node.output[0], onnx.TensorProto.FLOAT16, input_data.shape) ] # type: ignore graph = make_graph([node], "compute_graph", input_tensors, output_tensors) @@ -406,8 +405,7 @@ def test_cast_errors(): for name, value in zip(node.input, [input_data]) ] output_tensors = [ - make_tensor_value_info(name, onnx.TensorProto.INT32, value.shape) - for name, value in zip(node.output, ()) + make_tensor_value_info(node.output[0], onnx.TensorProto.INT32, input_data.shape) ] # type: ignore graph = make_graph([node], "compute_graph", input_tensors, output_tensors) @@ -422,8 +420,7 @@ def test_cast_errors(): for name, value in zip(node.input, [input_data]) ] output_tensors = [ - make_tensor_value_info(name, onnx.TensorProto.INT32, value.shape) - for name, value in zip(node.output, ()) + make_tensor_value_info(node.output[0], onnx.TensorProto.INT32, input_data.shape) ] # type: ignore graph = make_graph([node], "compute_graph", input_tensors, output_tensors) @@ -438,8 +435,7 @@ def test_cast_errors(): for name, value in zip(node.input, [input_data]) ] output_tensors = [ - make_tensor_value_info(name, onnx.TensorProto.COMPLEX128, value.shape) - for name, value in zip(node.output, ()) + make_tensor_value_info(node.output[0], onnx.TensorProto.COMPLEX128, input_data.shape) ] # type: ignore graph = make_graph([node], "compute_graph", input_tensors, output_tensors) diff --git a/ngraph/test/CMakeLists.txt b/ngraph/test/CMakeLists.txt index 8dbf0f888bc..91520b6be26 100644 --- a/ngraph/test/CMakeLists.txt +++ b/ngraph/test/CMakeLists.txt @@ -176,6 +176,7 @@ set(SRC type_prop/prior_box.cpp type_prop/proposal.cpp type_prop/psroi_pooling.cpp + type_prop/prior_box_clustered.cpp type_prop/range.cpp type_prop/read_value.cpp type_prop/reduce_l1.cpp @@ -277,6 +278,7 @@ set(SRC visitors/op/pad.cpp visitors/op/parameter.cpp visitors/op/prior_box.cpp + visitors/op/prior_box_clustered.cpp visitors/op/proposal.cpp visitors/op/psroi_pooling.cpp visitors/op/reduce_l1.cpp @@ -387,7 +389,6 @@ set(MULTI_TEST_SRC backend/comparison.in.cpp backend/concat.in.cpp backend/constant.in.cpp - backend/convert.in.cpp backend/convert_like.in.cpp backend/convolution_backprop.in.cpp backend/convolution.in.cpp @@ -457,6 +458,7 @@ set(MULTI_TEST_SRC backend/parameter_as_output.in.cpp backend/power.in.cpp backend/prelu.in.cpp + backend/prior_box_clustered.in.cpp backend/prior_box.in.cpp backend/proposal.in.cpp backend/psroi_pooling.in.cpp @@ -579,6 +581,7 @@ add_executable(unit-test ${SRC}) target_include_directories(unit-test PRIVATE ".") target_include_directories(unit-test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/runtime) +target_include_directories(unit-test PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/frontend/shared/include) add_definitions("-DCURDIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") add_definitions("-DJSON_INCLUDES=\"${JSON_INCLUDE_DIR}\"") @@ -647,6 +650,7 @@ install(TARGETS unit-test ############ FRONTEND ############ target_include_directories(unit-test PRIVATE ${FRONTEND_INCLUDE_PATH}) target_link_libraries(unit-test PRIVATE frontend_manager) +target_link_libraries(unit-test PRIVATE cnpy) add_subdirectory(frontend) ### END FRONTEND ### diff --git a/ngraph/test/backend/convert.in.cpp b/ngraph/test/backend/convert.in.cpp deleted file mode 100644 index 20cb1d16953..00000000000 --- a/ngraph/test/backend/convert.in.cpp +++ /dev/null @@ -1,1547 +0,0 @@ -// Copyright (C) 2018-2021 Intel Corporation -// SPDX-License-Identifier: Apache-2.0 -// - -#include "gtest/gtest.h" -#include "ngraph/ngraph.hpp" -#include "ngraph/runtime/reference/convert.hpp" -#include "ngraph/runtime/tensor.hpp" -#include "runtime/backend.hpp" -#include "util/all_close.hpp" -#include "util/all_close_f.hpp" -#include "util/engine/test_engines.hpp" -#include "util/ndarray.hpp" -#include "util/test_case.hpp" -#include "util/test_control.hpp" -#include "util/test_tools.hpp" - -using namespace std; -using namespace ngraph; - -static string s_manifest = "${MANIFEST}"; - -using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME}); -namespace -{ - std::shared_ptr CreateFunction(const Shape& input_shape, - const element::Type& input_type, - const element::Type& expected_output_type) - { - const auto in = make_shared(input_type, input_shape); - const auto convert = make_shared(in, expected_output_type); - return make_shared(NodeVector{convert}, ParameterVector{in}); - } - - template - void ConvertTest(const std::vector& input, - const Shape& input_shape, - const ngraph::element::Type& input_type, - const std::vector& expected_output, - const ngraph::element::Type& expected_output_type) - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto test_case = test::TestCase(f); - test_case.add_input(input); - test_case.add_expected_output(expected_output); - - test_case.run(); - } - - // TestCase doesn't support LP types - template - void LPConvertTest(const std::vector& input, - const Shape& input_shape, - const ngraph::element::Type& input_type, - const std::vector& expected_output, - const ngraph::element::Type& expected_output_type) - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint8_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} // namespace - -// destination: boolean -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_boolean) -{ - const uint8_t lowest = std::numeric_limits::lowest(); - const uint8_t max = std::numeric_limits::max(); - - const std::vector input{0, 12, 23, 0, lowest, max}; - const Shape input_shape{2, 3}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0, 1, 1, 0, 0, 1}; - const element::Type expected_output_type = ngraph::element::boolean; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i32_to_boolean) -{ - const int32_t lowest = std::numeric_limits::lowest(); - const int32_t max = std::numeric_limits::max(); - - const std::vector input{0, -12, 23, 0, lowest, max}; - const Shape input_shape{2, 3}; - const element::Type input_type = ngraph::element::i32; - - const std::vector expected_output{0, 1, 1, 0, 1, 1}; - const element::Type expected_output_type = ngraph::element::boolean; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_f32_to_boolean) -{ - const float lowest = std::numeric_limits::lowest(); - const float max = std::numeric_limits::max(); - const float min = std::numeric_limits::min(); - const float pos_inf = std::numeric_limits::infinity(); - const float neg_inf = -std::numeric_limits::infinity(); - - const std::vector input{0.f, 1.5745f, 0.12352f, 0.f, lowest, max, min, pos_inf, neg_inf}; - const Shape input_shape{3, 3}; - const element::Type input_type = ngraph::element::f32; - - const std::vector expected_output{0, 1, 1, 0, 1, 1, 1, 1, 1}; - const element::Type expected_output_type = ngraph::element::boolean; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: bf16 -NGRAPH_TEST(${BACKEND_NAME}, convert_f32_to_bf16) -{ - const std::vector input{ - 0.5f, 1.5f, 0.5f, 2.5f, 1.5f, 0.5f, 3.5f, 2.5f, 0.5f, 0.5f, 2.5f, 0.5f, 0.5f, 0.5f, 1.5f}; - const Shape input_shape{1, 1, 3, 5}; - const element::Type input_type = ngraph::element::f32; - - const std::vector expected_output(std::begin(input), std::end(input)); - const element::Type expected_output_type = ngraph::element::bf16; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: f16 -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_f16) -{ - const std::vector input{0, 10, 15, 20, 43, 56, 78, 99, 102, 130, 142}; - const Shape input_shape{11}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0, 10, 15, 20, 43, 56, 78, 99, 102, 130, 142}; - const element::Type expected_output_type = ngraph::element::f16; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: f32 -NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_f32) -{ - const std::vector input{0xFE, 0xF2}; - const Shape input_shape{2, 2}; - const element::Type input_type = ngraph::element::i4; - - const std::vector expected_output{-1.0f, -2.0f, -1.0f, 2.0f}; - const element::Type expected_output_type = ngraph::element::f32; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(float)); - EXPECT_TRUE(test::all_close_f(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i8_to_f32) -{ - const std::vector input{-127, -0, 0, 127}; - const Shape input_shape{2, 2}; - const element::Type input_type = ngraph::element::i8; - - const std::vector expected_output{-127.0f, -0.0f, 0.0f, 127.0f}; - const element::Type expected_output_type = ngraph::element::f32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i16_to_f32) -{ - const std::vector input{-32000, -0, 0, 32000}; - const Shape input_shape{2, 2}; - const element::Type input_type = ngraph::element::i16; - - const std::vector expected_output{-32000.0f, -0.0f, 0.0f, 32000.0f}; - const element::Type expected_output_type = ngraph::element::f32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i32_to_f32) -{ - const std::vector input{-64000, -0, 0, 64000}; - const Shape input_shape{2, 2}; - const element::Type input_type = ngraph::element::i32; - - const std::vector expected_output{-64000.0f, -0.0f, 0.0f, 64000.0f}; - const element::Type expected_output_type = ngraph::element::f32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i64_to_f32) -{ - const std::vector input{-64000, -0, 0, 64000}; - const Shape input_shape{2, 2}; - const element::Type input_type = ngraph::element::i64; - - const std::vector expected_output{-64000.0f, -0.0f, 0.0f, 64000.0f}; - const element::Type expected_output_type = ngraph::element::f32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_f32) -{ - const std::vector input{0xA0}; - const Shape input_shape{2, 2}; - const element::Type input_type = ngraph::element::u1; - - const std::vector expected_output{1.0f, 0.0f, 1.0f, 0.0f}; - const element::Type expected_output_type = ngraph::element::f32; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(float)); - EXPECT_TRUE(test::all_close_f(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_f32) -{ - const std::vector input{0xFB, 0x0A}; - const Shape input_shape{2, 2}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{15.0f, 11.0f, 0.0f, 10.0f}; - const element::Type expected_output_type = ngraph::element::f32; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(float)); - EXPECT_TRUE(test::all_close_f(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_f32) -{ - const std::vector input{255, 128, 32, 0}; - const Shape input_shape{2, 2}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{255.0f, 128.0f, 32.0f, 0.0f}; - const element::Type expected_output_type = ngraph::element::f32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u16_to_f32) -{ - const std::vector input{64000, 32000, 128, 0}; - const Shape input_shape{2, 2}; - const element::Type input_type = ngraph::element::u16; - - const std::vector expected_output{64000.0f, 32000.0f, 128.0f, 0.0f}; - const element::Type expected_output_type = ngraph::element::f32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u32_to_f32) -{ - const std::vector input{4000000, 2000000, 128, 0}; - const Shape input_shape{2, 2}; - const element::Type input_type = ngraph::element::u32; - - const std::vector expected_output{4000000.0f, 2000000.0f, 128.0f, 0.0f}; - const element::Type expected_output_type = ngraph::element::f32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u64_to_f32) -{ - const std::vector input{4000000, 2000000, 128, 0}; - const Shape input_shape{2, 2}; - const element::Type input_type = ngraph::element::u64; - - const std::vector expected_output{4000000.0f, 2000000.0f, 128.0f, 0.0f}; - const element::Type expected_output_type = ngraph::element::f32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_bf16_to_f32) -{ - const std::vector input{ - 0.5, 1.5, 0.5, 2.5, 1.5, 0.5, 3.5, 2.5, 0.5, 0.5, 2.5, 0.5, 0.5, 0.5, 1.5}; - const Shape input_shape{1, 1, 3, 5}; - const element::Type input_type = ngraph::element::bf16; - - const std::vector expected_output(std::begin(input), std::end(input)); - const element::Type expected_output_type = ngraph::element::f32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_f16_to_f32) -{ - const std::vector input{-20.5, -15, -10.5, -0.5, 0, 0.5, 10.5, 15, 20.5}; - const Shape input_shape{3, 3}; - const element::Type input_type = ngraph::element::f16; - - const std::vector expected_output{-20.5, -15, -10.5, -0.5, 0, 0.5, 10.5, 15, 20.5}; - const element::Type expected_output_type = ngraph::element::f32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_f32_to_f32) -{ - const std::vector input{-20.5, -15, -10.5, -0.5, 0, 0.5, 10.5, 15, 20.5}; - const Shape input_shape{3, 3}; - const element::Type input_type = ngraph::element::f32; - - const std::vector expected_output{-20.5, -15, -10.5, -0.5, 0, 0.5, 10.5, 15, 20.5}; - const element::Type expected_output_type = ngraph::element::f32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: i4 -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_i4) -{ - const std::vector input{0xA0}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u1; - - const std::vector expected_output{0x10, 0x10}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_i4) -{ - const std::vector input{0x12, 0x03}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{0x12, 0x03}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_i4) -{ - const std::vector input{1, 2, 0, 3}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0x12, 0x03}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u16_to_i4) -{ - const std::vector input{1, 2, 0, 3}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u16; - - const std::vector expected_output{0x12, 0x03}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u32_to_i4) -{ - const std::vector input{1, 2, 0, 3}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u32; - - const std::vector expected_output{0x12, 0x03}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u64_to_i4) -{ - const std::vector input{1, 2, 0, 3}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u64; - - const std::vector expected_output{0x12, 0x03}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i8_to_i4) -{ - const std::vector input{-1, -2, 2, 3}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i8; - - const std::vector expected_output{0xFE, 0x23}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i16_to_i4) -{ - const std::vector input{-1, -2, 2, 3}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i16; - - const std::vector expected_output{0xFE, 0x23}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i32_to_i4) -{ - const std::vector input{-1, -2, 2, 3}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i32; - - const std::vector expected_output{0xFE, 0x23}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i64_to_i4) -{ - const std::vector input{-1, -2, 2, 3}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i64; - - const std::vector expected_output{0xFE, 0x23}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_f16_to_i4) -{ - const std::vector input{-1, -2, 0, 3}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::f16; - - const std::vector expected_output{0xFE, 0x03}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_bf16_to_i4) -{ - const std::vector input{-1, -2, 0, 3}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::bf16; - - const std::vector expected_output{0xFE, 0x03}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_f32_to_i4) -{ - const std::vector input{-1, -2, 0, 3}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::f32; - - const std::vector expected_output{0xFE, 0x03}; - const element::Type expected_output_type = ngraph::element::i4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: i8 -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_i8) -{ - const std::vector input{0x81}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u1; - - const std::vector expected_output{1, 0, 0, 0, 0, 0, 0, 1}; - const element::Type expected_output_type = ngraph::element::i8; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(int8_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_i8) -{ - const std::vector input{0x21, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{2, 1, 4, 3}; - const element::Type expected_output_type = ngraph::element::i8; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(int8_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_i8) -{ - const std::vector input{0xFE, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i4; - - const std::vector expected_output{-1, -2, 4, 3}; - const element::Type expected_output_type = ngraph::element::i8; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(int8_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_i8) -{ - const std::vector input{0, 10, 15, 20, 43, 56, 78, 99, 102, 110, 128}; - const Shape input_shape{11}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0, 10, 15, 20, 43, 56, 78, 99, 102, 110, 127}; - const element::Type expected_output_type = ngraph::element::i8; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: i16 -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_i16) -{ - const std::vector input{0x81}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u1; - - const std::vector expected_output{1, 0, 0, 0, 0, 0, 0, 1}; - const element::Type expected_output_type = ngraph::element::i16; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(int16_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_i16) -{ - const std::vector input{0x21, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{2, 1, 4, 3}; - const element::Type expected_output_type = ngraph::element::i16; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(int16_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_i16) -{ - const std::vector input{0xFE, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i4; - - const std::vector expected_output{-1, -2, 4, 3}; - const element::Type expected_output_type = ngraph::element::i16; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(int16_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_i16) -{ - const std::vector input{0, 10, 15, 20, 43, 56, 78, 99, 102, 130, 142}; - const Shape input_shape{11}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0, 10, 15, 20, 43, 56, 78, 99, 102, 130, 142}; - const element::Type expected_output_type = ngraph::element::i16; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: i32 -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_i32) -{ - const std::vector input{0x81}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u1; - - const std::vector expected_output{1, 0, 0, 0, 0, 0, 0, 1}; - const element::Type expected_output_type = ngraph::element::i32; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(int32_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_i32) -{ - const std::vector input{0x21, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{2, 1, 4, 3}; - const element::Type expected_output_type = ngraph::element::i32; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(int32_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_i32) -{ - const std::vector input{0xFE, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i4; - - const std::vector expected_output{-1, -2, 4, 3}; - const element::Type expected_output_type = ngraph::element::i32; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(int32_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_i32) -{ - const std::vector input{0, 10, 15, 20, 43, 56, 78, 99, 102, 130, 142}; - const Shape input_shape{11}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0, 10, 15, 20, 43, 56, 78, 99, 102, 130, 142}; - const element::Type expected_output_type = ngraph::element::i32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: i64 -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_i64) -{ - const std::vector input{0x81}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u1; - - const std::vector expected_output{1, 0, 0, 0, 0, 0, 0, 1}; - const element::Type expected_output_type = ngraph::element::i64; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(int64_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_i64) -{ - const std::vector input{0x21, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{2, 1, 4, 3}; - const element::Type expected_output_type = ngraph::element::i64; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(int64_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_i64) -{ - const std::vector input{0xFE, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i4; - - const std::vector expected_output{-1, -2, 4, 3}; - const element::Type expected_output_type = ngraph::element::i64; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(int64_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_i64) -{ - const std::vector input{0, 10, 15, 20, 43, 56, 78, 99, 102, 130, 142}; - const Shape input_shape{11}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0, 10, 15, 20, 43, 56, 78, 99, 102, 130, 142}; - const element::Type expected_output_type = ngraph::element::i64; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: u1 -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_u1) -{ - const std::vector input{0xF0}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u1; - - const std::vector expected_output{0xF0}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_u1) -{ - const std::vector input{0x10, 0x01, 0x00, 0x00}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{0x90}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u1) -{ - const std::vector input{1, 0, 1, 0, 0, 0, 0, 1}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0xA1}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u16_to_u1) -{ - const std::vector input{1, 0, 1, 0, 0, 0, 0, 1}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u16; - - const std::vector expected_output{0xA1}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u32_to_u1) -{ - const std::vector input{1, 0, 1, 0, 0, 0, 0, 1}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u32; - - const std::vector expected_output{0xA1}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u64_to_u1) -{ - const std::vector input{1, 0, 1, 0, 0, 0, 0, 1}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u64; - - const std::vector expected_output{0xA1}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_u1) -{ - const std::vector input{0x10, 0x01, 0x00, 0x00}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{0x90}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i8_to_u1) -{ - const std::vector input{1, 0, 1, 0, 0, 0, 0, 1}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::i8; - - const std::vector expected_output{0xA1}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i16_to_u1) -{ - const std::vector input{1, 0, 1, 0, 0, 0, 0, 1}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::i16; - - const std::vector expected_output{0xA1}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i32_to_u1) -{ - const std::vector input{1, 0, 1, 0, 0, 0, 0, 1}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::i32; - - const std::vector expected_output{0xA1}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i64_to_u1) -{ - const std::vector input{1, 0, 1, 0, 0, 0, 0, 1}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::i64; - - const std::vector expected_output{0xA1}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_f16_to_u1) -{ - const std::vector input{1, 0, 1, 0, 0, 0, 0, 1}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::f16; - - const std::vector expected_output{0xA1}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_bf16_to_u1) -{ - const std::vector input{1, 0, 1, 0, 0, 0, 0, 1}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::bf16; - - const std::vector expected_output{0xA1}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_f32_to_u1) -{ - const std::vector input{1, 0, 1, 0, 0, 0, 0, 1}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::f32; - - const std::vector expected_output{0xA1}; - const element::Type expected_output_type = ngraph::element::u1; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: u4 -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_u4) -{ - const std::vector input{0xF0}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u1; - - const std::vector expected_output{0x11, 0x11}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_u4) -{ - const std::vector input{0x22, 0x33}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{0x22, 0x33}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u4) -{ - const std::vector input{7, 0, 1, 15}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0x70, 0x1F}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u16_to_u4) -{ - const std::vector input{7, 0, 1, 15}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u16; - - const std::vector expected_output{0x70, 0x1F}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u32_to_u4) -{ - const std::vector input{7, 0, 1, 15}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u32; - - const std::vector expected_output{0x70, 0x1F}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u64_to_u4) -{ - const std::vector input{7, 0, 1, 15}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u64; - - const std::vector expected_output{0x70, 0x1F}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_u4) -{ - const std::vector input{0x22, 0x33}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i4; - - const std::vector expected_output{0x22, 0x33}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i8_to_u4) -{ - const std::vector input{7, 0, 1, 15}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i8; - - const std::vector expected_output{0x70, 0x1F}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i16_to_u4) -{ - const std::vector input{7, 0, 1, 15}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i16; - - const std::vector expected_output{0x70, 0x1F}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i32_to_u4) -{ - const std::vector input{7, 0, 1, 15}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i32; - - const std::vector expected_output{0x70, 0x1F}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i64_to_u4) -{ - const std::vector input{7, 0, 1, 15}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i64; - - const std::vector expected_output{0x70, 0x1F}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_f16_to_u4) -{ - const std::vector input{7, 0, 1, 15}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::f16; - - const std::vector expected_output{0x70, 0x1F}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_bf16_to_u4) -{ - const std::vector input{7, 0, 1, 15}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::bf16; - - const std::vector expected_output{0x70, 0x1F}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_f32_to_u4) -{ - const std::vector input{7, 0, 1, 15}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::f32; - - const std::vector expected_output{0x70, 0x1F}; - const element::Type expected_output_type = ngraph::element::u4; - - LPConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: u8 -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_u8) -{ - const std::vector input{0x81}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u1; - - const std::vector expected_output{1, 0, 0, 0, 0, 0, 0, 1}; - const element::Type expected_output_type = ngraph::element::u8; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint8_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_u8) -{ - const std::vector input{0x21, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{2, 1, 4, 3}; - const element::Type expected_output_type = ngraph::element::u8; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint8_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_u8) -{ - const std::vector input{0x12, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i4; - - const std::vector expected_output{1, 2, 4, 3}; - const element::Type expected_output_type = ngraph::element::u8; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint8_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u8) -{ - const std::vector input{0, 10, 15, 20, 43, 56, 78, 99, 102, 110, 127}; - const Shape input_shape{11}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0, 10, 15, 20, 43, 56, 78, 99, 102, 110, 127}; - const element::Type expected_output_type = ngraph::element::u8; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: u16 -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_u16) -{ - const std::vector input{0x81}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u1; - - const std::vector expected_output{1, 0, 0, 0, 0, 0, 0, 1}; - const element::Type expected_output_type = ngraph::element::u16; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint16_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_u16) -{ - const std::vector input{0x21, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{2, 1, 4, 3}; - const element::Type expected_output_type = ngraph::element::u16; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint16_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_u16) -{ - const std::vector input{0x12, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i4; - - const std::vector expected_output{1, 2, 4, 3}; - const element::Type expected_output_type = ngraph::element::u16; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint16_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u16) -{ - const std::vector input{0, 10, 15, 20, 43, 56, 78, 99, 102, 110, 127}; - const Shape input_shape{11}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0, 10, 15, 20, 43, 56, 78, 99, 102, 110, 127}; - const element::Type expected_output_type = ngraph::element::u16; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: u32 -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_u32) -{ - const std::vector input{0x81}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u1; - - const std::vector expected_output{1, 0, 0, 0, 0, 0, 0, 1}; - const element::Type expected_output_type = ngraph::element::u32; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint32_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_u32) -{ - const std::vector input{0x21, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{2, 1, 4, 3}; - const element::Type expected_output_type = ngraph::element::u32; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint32_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_u32) -{ - const std::vector input{0x12, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i4; - - const std::vector expected_output{1, 2, 4, 3}; - const element::Type expected_output_type = ngraph::element::u32; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint32_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u32) -{ - const std::vector input{0, 10, 15, 20, 43, 56, 78, 99, 102, 110, 127}; - const Shape input_shape{11}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0, 10, 15, 20, 43, 56, 78, 99, 102, 110, 127}; - const element::Type expected_output_type = ngraph::element::u32; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// destination: u64 -NGRAPH_TEST(${BACKEND_NAME}, convert_u1_to_u64) -{ - const std::vector input{0x81}; - const Shape input_shape{8}; - const element::Type input_type = ngraph::element::u1; - - const std::vector expected_output{1, 0, 0, 0, 0, 0, 0, 1}; - const element::Type expected_output_type = ngraph::element::u64; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint64_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u4_to_u64) -{ - const std::vector input{0x21, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::u4; - - const std::vector expected_output{2, 1, 4, 3}; - const element::Type expected_output_type = ngraph::element::u64; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint64_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_i4_to_u64) -{ - const std::vector input{0x12, 0x43}; - const Shape input_shape{4}; - const element::Type input_type = ngraph::element::i4; - - const std::vector expected_output{1, 2, 4, 3}; - const element::Type expected_output_type = ngraph::element::u64; - - { - const auto f = CreateFunction(input_shape, input_type, expected_output_type); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - auto input_tesnor = backend->create_tensor(input_type, input_shape); - copy_data(input_tesnor, input); - auto output = backend->create_tensor(expected_output_type, input_shape); - auto handle = backend->compile(f); - handle->call_with_validate({output}, {input_tesnor}); - - std::vector result(expected_output.size()); - output->read(result.data(), result.size() * sizeof(uint64_t)); - EXPECT_TRUE(test::all_close(expected_output, result)); - } -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_u8_to_u64) -{ - const std::vector input{0, 10, 15, 20, 43, 56, 78, 99, 102, 110, 127}; - const Shape input_shape{11}; - const element::Type input_type = ngraph::element::u8; - - const std::vector expected_output{0, 10, 15, 20, 43, 56, 78, 99, 102, 110, 127}; - const element::Type expected_output_type = ngraph::element::u64; - - ConvertTest(input, input_shape, input_type, expected_output, expected_output_type); -} - -// jit tests -NGRAPH_TEST(${BACKEND_NAME}, convert_float32_int8) -{ - std::vector f32vec = {-100.5, -20.5, -15, -10.5, -0.5, 0, 0.5, 10.5, 15, 20.5, 100.5}; - std::vector result(f32vec.size()); - std::vector i8vec(std::begin(f32vec), std::end(f32vec)); - runtime::reference::convert(f32vec.data(), result.data(), f32vec.size()); - EXPECT_EQ(result, i8vec); -} - -NGRAPH_TEST(${BACKEND_NAME}, convert_fp16_int8) -{ - std::vector f32vec = {-100.5, -20.5, -15, -10.5, -0.5, 0, 0.5, 10.5, 15, 20.5, 100.5}; - std::vector f16vec(std::begin(f32vec), std::end(f32vec)); - std::vector i8vec(std::begin(f16vec), std::end(f16vec)); - std::vector result(i8vec.size()); - runtime::reference::convert(f16vec.data(), result.data(), f16vec.size()); - EXPECT_EQ(result, i8vec); -} diff --git a/ngraph/test/backend/fused_op.in.cpp b/ngraph/test/backend/fused_op.in.cpp index 4899bd2a3e7..3f3c557401e 100644 --- a/ngraph/test/backend/fused_op.in.cpp +++ b/ngraph/test/backend/fused_op.in.cpp @@ -78,222 +78,6 @@ NGRAPH_TEST(${BACKEND_NAME}, hardsigmoid) test_case.run(); } -// TODO: Issue: 37521 -NGRAPH_TEST(${BACKEND_NAME}, DISABLED_normalize_across_chw_4d) -{ - Shape data_shape{1, 2, 3, 4}; - auto data = make_shared(element::f32, data_shape); - const auto axes = make_shared(element::i64, Shape{3}, vector{1, 2, 3}); - float eps{1e-6f}; - auto eps_mode = op::EpsMode::ADD; - - auto normalize = make_shared(data, axes, eps, eps_mode); - auto function = make_shared(NodeVector{normalize}, ParameterVector{data}); - - auto test_case = test::TestCase(function); - - vector input_data(shape_size(data_shape)); - iota(begin(input_data), end(input_data), 1); - - test_case.add_input(input_data); - - test_case.add_expected_output( - data_shape, {0.01428571f, 0.02857143f, 0.04285714f, 0.05714286f, 0.07142857f, 0.08571429f, - 0.1f, 0.11428571f, 0.12857144f, 0.14285715f, 0.15714286f, 0.17142858f, - 0.18571429f, 0.2f, 0.21428572f, 0.22857143f, 0.24285714f, 0.25714287f, - 0.27142859f, 0.2857143f, 0.30000001f, 0.31428573f, 0.32857144f, 0.34285715f}); - - test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1); -} - -NGRAPH_TEST(${BACKEND_NAME}, DISABLED_normalize_across_empty_axes_input) -{ - Shape data_shape{1, 2, 3, 4}; - auto data = make_shared(element::f32, data_shape); - const auto axes = make_shared(element::i64, Shape{0}, vector{}); - float eps{1e-6f}; - auto eps_mode = op::EpsMode::ADD; - - auto normalize = make_shared(data, axes, eps, eps_mode); - auto function = make_shared(NodeVector{normalize}, ParameterVector{data}); - - auto test_case = test::TestCase(function); - - vector input_data(shape_size(data_shape)); - iota(begin(input_data), end(input_data), 1); - - test_case.add_input(input_data); - - test_case.add_expected_output( - data_shape, - vector{0.01428571, 0.02857143, 0.04285714, 0.05714286, 0.07142857, 0.08571429, - 0.1, 0.11428571, 0.12857144, 0.14285715, 0.15714286, 0.17142858, - - 0.18571429, 0.2, 0.21428572, 0.22857143, 0.24285714, 0.25714287, - 0.27142859, 0.2857143, 0.3, 0.31428573, 0.32857144, 0.34285715}); - test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1); -} - -NGRAPH_TEST(${BACKEND_NAME}, DISABLED_normalize_across_h_4d) -{ - Shape data_shape{1, 2, 3, 4}; - auto data = make_shared(element::f32, data_shape); - const auto axes = make_shared(element::i64, Shape{1}, vector{1}); - float eps{1e-6f}; - auto eps_mode = op::EpsMode::ADD; - - auto normalize = make_shared(data, axes, eps, eps_mode); - auto function = make_shared(NodeVector{normalize}, ParameterVector{data}); - - auto test_case = test::TestCase(function); - - vector input_data(shape_size(data_shape)); - iota(begin(input_data), end(input_data), 1); - - test_case.add_input(input_data); - - test_case.add_expected_output( - data_shape, {0.0766965f, 0.14142136f, 0.19611613f, 0.24253564f, 0.28216633f, 0.31622776f, - 0.34570536f, 0.37139067f, 0.39391932f, 0.41380295f, 0.43145549f, 0.44721359f, - 0.99705452f, 0.98994946f, 0.98058069f, 0.97014254f, 0.95936549f, 0.94868332f, - 0.93834311f, 0.92847669f, 0.91914505f, 0.91036648f, 0.90213418f, 0.89442718f}); - test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1); -} - -NGRAPH_TEST(${BACKEND_NAME}, DISABLED_normalize_across_1axis_5d) -{ - Shape data_shape{1, 2, 2, 2, 3}; - auto data = make_shared(element::f32, data_shape); - const auto axes = make_shared(element::i64, Shape{1}, vector{1}); - float eps{1e-6f}; - auto eps_mode = op::EpsMode::ADD; - - auto normalize = make_shared(data, axes, eps, eps_mode); - auto function = make_shared(NodeVector{normalize}, ParameterVector{data}); - - auto test_case = test::TestCase(function); - - vector input_data(shape_size(data_shape)); - iota(begin(input_data), end(input_data), 1); - - test_case.add_input(input_data); - - test_case.add_expected_output( - data_shape, {0.0766965f, 0.14142136f, 0.19611613f, 0.24253564f, 0.28216633f, 0.31622776f, - 0.34570536f, 0.37139067f, 0.39391932f, 0.41380295f, 0.43145549f, 0.44721359f, - 0.99705452f, 0.98994946f, 0.98058069f, 0.97014254f, 0.95936549f, 0.94868332f, - 0.93834311f, 0.92847669f, 0.91914505f, 0.91036648f, 0.90213418f, 0.89442718f}); - test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1); -} - -NGRAPH_TEST(${BACKEND_NAME}, DISABLED_normalize_across_123axes_5d) -{ - Shape data_shape{1, 2, 2, 2, 3}; - auto data = make_shared(element::f32, data_shape); - const auto axes = make_shared(element::i64, Shape{3}, vector{1, 2, 3}); - float eps{1e-6f}; - auto eps_mode = op::EpsMode::ADD; - - auto normalize = make_shared(data, axes, eps, eps_mode); - auto function = make_shared(NodeVector{normalize}, ParameterVector{data}); - - auto test_case = test::TestCase(function); - - vector input_data(shape_size(data_shape)); - iota(begin(input_data), end(input_data), 1); - - test_case.add_input(input_data); - - test_case.add_expected_output( - data_shape, {0.02638899f, 0.04956816f, 0.070014f, 0.10555596f, 0.1239204f, 0.140028f, - 0.18472293f, 0.19827265f, 0.210042f, 0.26388991f, 0.27262488f, 0.280056f, - 0.34305686f, 0.34697714f, 0.35007f, 0.42222384f, 0.42132938f, 0.420084f, - 0.50139081f, 0.49568161f, 0.49009803f, 0.58055776f, 0.57003385f, 0.560112f}); - test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1); -} - -NGRAPH_TEST(${BACKEND_NAME}, DISABLED_normalize_across_c_2x2_shape) -{ - Shape data_shape{2, 2}; - auto data = make_shared(element::f32, data_shape); - const auto axes = make_shared(element::i64, Shape{}, vector{1}); - float eps{1e-6f}; - auto eps_mode = op::EpsMode::ADD; - - auto normalize = make_shared(data, axes, eps, eps_mode); - auto function = make_shared(NodeVector{normalize}, ParameterVector{data}); - - auto test_case = test::TestCase(function); - - vector input_data(shape_size(data_shape)); - iota(begin(input_data), end(input_data), 1); - - test_case.add_input(input_data); - - test_case.add_expected_output(data_shape, - {0.44721353f, 0.89442706f, 0.60000002f, 0.80000001f}); - - test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1); -} - -NGRAPH_TEST(${BACKEND_NAME}, DISABLED_normalize_across_c_2x4_shape) -{ - Shape data_shape{2, 4}; - auto data = make_shared(element::f32, data_shape); - const auto axes = make_shared(element::i64, Shape{}, vector{1}); - float eps{1e-6f}; - auto eps_mode = op::EpsMode::ADD; - - auto normalize = make_shared(data, axes, eps, eps_mode); - auto function = make_shared(NodeVector{normalize}, ParameterVector{data}); - - auto test_case = test::TestCase(function); - - vector input_data(shape_size(data_shape)); - iota(begin(input_data), end(input_data), 1); - - test_case.add_input(input_data); - - test_case.add_expected_output(data_shape, - {0.18257418f, - 0.36514837f, - 0.54772252f, - 0.73029673f, - 0.37904903f, - 0.45485884f, - 0.53066862f, - 0.60647845f}); - - test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1); -} - -NGRAPH_TEST(${BACKEND_NAME}, DISABLED_normalize_across_chw_4d_max_bias) -{ - Shape data_shape{1, 2, 3, 4}; - auto data = make_shared(element::f32, data_shape); - const auto axes = make_shared(element::i64, Shape{3}, vector{1, 2, 3}); - float eps{5000}; - auto eps_mode = op::EpsMode::MAX; - - auto normalize = make_shared(data, axes, eps, eps_mode); - auto function = make_shared(NodeVector{normalize}, ParameterVector{data}); - - auto test_case = test::TestCase(function); - - vector input_data(shape_size(data_shape)); - iota(begin(input_data), end(input_data), 1); - - test_case.add_input(input_data); - - test_case.add_expected_output( - data_shape, {0.01414214f, 0.02828427f, 0.04242641f, 0.05656854f, 0.07071068f, 0.08485281f, - 0.09899495f, 0.11313709f, 0.12727922f, 0.14142136f, 0.15556349f, 0.16970563f, - 0.18384777f, 0.1979899f, 0.21213204f, 0.22627418f, 0.2404163f, 0.25455844f, - 0.26870057f, 0.28284273f, 0.29698485f, 0.31112698f, 0.32526913f, 0.33941126f}); - - test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 1); -} - NGRAPH_TEST(${BACKEND_NAME}, mvn_mean_normalization) { Shape data_shape{1, 2, 5}; diff --git a/ngraph/test/backend/normalize_l2.in.cpp b/ngraph/test/backend/normalize_l2.in.cpp index 863476280e6..e94ff8d4f65 100644 --- a/ngraph/test/backend/normalize_l2.in.cpp +++ b/ngraph/test/backend/normalize_l2.in.cpp @@ -14,8 +14,10 @@ #include "ngraph/ngraph.hpp" #include "util/all_close.hpp" #include "util/all_close_f.hpp" +#include "util/engine/test_engines.hpp" #include "util/ndarray.hpp" #include "util/random.hpp" +#include "util/test_case.hpp" #include "util/test_control.hpp" #include "util/test_tools.hpp" @@ -24,190 +26,865 @@ using namespace ngraph; static string s_manifest = "${MANIFEST}"; -// ----------------------- eps_mode = ngraph::op::EpsMode::ADD ----------------------- // +using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME}); -NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_all_mode_add) +static void normalize_l2_results_test(std::vector& data, + Shape& data_shape, + std::vector& axes, + ngraph::op::EpsMode eps_mode, + float eps, + std::vector& expected_output) { - Shape shape{2, 2}; - auto A = make_shared(element::f32, shape); - auto axes = make_shared(element::i64, Shape{2}, vector{0, 1}); - float eps = 1e-7; - auto f = make_shared( - make_shared(A, axes, eps, ngraph::op::EpsMode::ADD), - ParameterVector{A}); + auto data_input = std::make_shared(element::f32, data_shape); + const auto axes_input = std::make_shared(element::i32, Shape{axes.size()}, axes); - auto backend = runtime::Backend::create("${BACKEND_NAME}"); + auto normalize = std::make_shared(data_input, axes_input, eps, eps_mode); + auto function = std::make_shared(normalize, ParameterVector{data_input}); - // Create some tensors for input/output - auto a = backend->create_tensor(element::f32, shape); - copy_data(a, vector{1, 2, 3, 4}); - auto result = backend->create_tensor(element::f32, shape); + auto test_case = test::TestCase(function); + test_case.add_input(data); + test_case.add_expected_output(data_shape, expected_output); - auto handle = backend->compile(f); - handle->call_with_validate({result}, {a}); - EXPECT_TRUE(test::all_close_f((vector{0.18257418, 0.36514837, 0.5477226, 0.73029673}), - read_vector(result))); + test_case.run(DEFAULT_FLOAT_TOLERANCE_BITS + 4); } -NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_none_mode_add) +// 1D +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_1D_axes_empty_add) { - Shape shape{2, 2}; - auto A = make_shared(element::f32, shape); - auto axes = make_shared(element::i64, Shape{0}, vector{}); + std::vector data{0, 3, 0, 8}; + Shape data_shape{4}; + std::vector axes{}; float eps = 1e-7; - auto f = make_shared( - make_shared(A, axes, eps, ngraph::op::EpsMode::ADD), - ParameterVector{A}); + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{0, 1, 0, 1}; - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - // Create some tensors for input/output - auto a = backend->create_tensor(element::f32, shape); - copy_data(a, vector{1, 2, 3, 4}); - auto result = backend->create_tensor(element::f32, shape); - - auto handle = backend->compile(f); - handle->call_with_validate({result}, {a}); - EXPECT_TRUE(test::all_close_f((vector{0.18257418, 0.36514837, 0.5477226, 0.73029673}), - read_vector(result))); + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); } -NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_zero_mode_add) +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_1D_axes_empty_max) { - Shape shape{2, 2}; - auto A = make_shared(element::f32, shape); - auto axes = make_shared(element::i64, Shape{}, vector{0}); + std::vector data{0, 3, 0, 8}; + Shape data_shape{4}; + std::vector axes{}; float eps = 1e-7; - auto f = make_shared( - make_shared(A, axes, eps, ngraph::op::EpsMode::ADD), - ParameterVector{A}); + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{0, 1, 0, 1}; - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - // Create some tensors for input/output - auto a = backend->create_tensor(element::f32, shape); - copy_data(a, vector{1, 2, 3, 4}); - auto result = backend->create_tensor(element::f32, shape); - - auto handle = backend->compile(f); - handle->call_with_validate({result}, {a}); - EXPECT_TRUE(test::all_close_f((vector{0.31622776, 0.4472136, 0.94868326, 0.8944272}), - read_vector(result))); + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); } -NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_one_mode_add) +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_1D_axes_0_add) { - Shape shape{2, 2}; - auto A = make_shared(element::f32, shape); - auto axes = make_shared(element::i64, Shape{}, vector{1}); + std::vector data{1, 2, 3, 4}; + Shape data_shape{4}; + std::vector axes{0}; float eps = 1e-7; - auto f = make_shared( - make_shared(A, axes, eps, ngraph::op::EpsMode::ADD), - ParameterVector{A}); + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{0.18257418, 0.36514837, 0.5477226, 0.73029673}; - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - // Create some tensors for input/output - auto a = backend->create_tensor(element::f32, shape); - copy_data(a, vector{1, 2, 3, 4}); - auto result = backend->create_tensor(element::f32, shape); - - auto handle = backend->compile(f); - handle->call_with_validate({result}, {a}); - EXPECT_TRUE(test::all_close_f((vector{0.4472136, 0.8944272, 0.6, 0.8}), - read_vector(result))); + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); } -// ----------------------- eps_mode = ngraph::op::EpsMode::MAX ----------------------- // - -NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_all_mode_max) +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_1D_axes_0_max) { - Shape shape{2, 2}; - auto A = make_shared(element::f32, shape); - auto axes = make_shared(element::i64, Shape{2}, vector{0, 1}); + std::vector data{1, 2, 3, 4}; + Shape data_shape{4}; + std::vector axes{0}; float eps = 1e-7; - auto f = make_shared( - make_shared(A, axes, eps, ngraph::op::EpsMode::ADD), - ParameterVector{A}); + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{0.18257418, 0.36514837, 0.5477226, 0.73029673}; - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - // Create some tensors for input/output - auto a = backend->create_tensor(element::f32, shape); - copy_data(a, vector{1, 2, 3, 4}); - auto result = backend->create_tensor(element::f32, shape); - - auto handle = backend->compile(f); - handle->call_with_validate({result}, {a}); - EXPECT_TRUE(test::all_close_f((vector{0.18257419, 0.36514837, 0.54772256, 0.73029674}), - read_vector(result))); + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); } -NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_none_mode_max) +// 2D +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_2D_axes_empty_add) { - Shape shape{2, 2}; - auto A = make_shared(element::f32, shape); - auto axes = make_shared(element::i64, Shape{0}, vector{}); + std::vector data{0, 3, 0, 8}; + Shape data_shape{2, 2}; + std::vector axes{}; float eps = 1e-7; - auto f = make_shared( - make_shared(A, axes, eps, ngraph::op::EpsMode::MAX), - ParameterVector{A}); + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{0, 1, 0, 1}; - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - // Create some tensors for input/output - auto a = backend->create_tensor(element::f32, shape); - copy_data(a, vector{1, 2, 3, 4}); - auto result = backend->create_tensor(element::f32, shape); - - auto handle = backend->compile(f); - handle->call_with_validate({result}, {a}); - EXPECT_TRUE(test::all_close_f((vector{0.18257419, 0.36514837, 0.54772256, 0.7302967}), - read_vector(result))); + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); } -NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_zero_mode_max) +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_2D_axes_empty_max) { - Shape shape{2, 2}; - auto A = make_shared(element::f32, shape); - auto axes = make_shared(element::i64, Shape{}, vector{0}); + std::vector data{0, 3, 0, 8}; + Shape data_shape{2, 2}; + std::vector axes{}; float eps = 1e-7; - auto f = make_shared( - make_shared(A, axes, eps, ngraph::op::EpsMode::MAX), - ParameterVector{A}); + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{0, 1, 0, 1}; - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - // Create some tensors for input/output - auto a = backend->create_tensor(element::f32, shape); - copy_data(a, vector{1, 2, 3, 4}); - auto result = backend->create_tensor(element::f32, shape); - - auto handle = backend->compile(f); - handle->call_with_validate({result}, {a}); - EXPECT_TRUE(test::all_close_f((vector{0.31622777, 0.4472136, 0.9486833, 0.89442719}), - read_vector(result))); + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); } -NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_one_mode_max) +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_2D_axes_0_add) { - Shape shape{2, 2}; - auto A = make_shared(element::f32, shape); - auto axes = make_shared(element::i64, Shape{}, vector{1}); + std::vector data{1, 2, 3, 4}; + Shape data_shape{2, 2}; + std::vector axes{0}; float eps = 1e-7; - auto f = make_shared( - make_shared(A, axes, eps, ngraph::op::EpsMode::MAX), - ParameterVector{A}); + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{0.31622776, 0.4472136, 0.94868326, 0.8944272}; - auto backend = runtime::Backend::create("${BACKEND_NAME}"); - - // Create some tensors for input/output - auto a = backend->create_tensor(element::f32, shape); - copy_data(a, vector{1, 2, 3, 4}); - auto result = backend->create_tensor(element::f32, shape); - - auto handle = backend->compile(f); - handle->call_with_validate({result}, {a}); - EXPECT_TRUE(test::all_close_f((vector{0.4472136, 0.89442719, 0.6, 0.8}), - read_vector(result))); + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_2D_axes_0_max) +{ + std::vector data{1, 2, 3, 4}; + Shape data_shape{2, 2}; + std::vector axes{0}; + float eps = 1e-7; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{0.31622777, 0.4472136, 0.9486833, 0.89442719}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_2D_axes_1_add) +{ + std::vector data{1, 2, 3, 4}; + Shape data_shape{2, 2}; + std::vector axes{1}; + float eps = 1e-7; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{0.4472136, 0.8944272, 0.6, 0.8}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_2D_axes_1_max) +{ + std::vector data{1, 2, 3, 4}; + Shape data_shape{2, 2}; + std::vector axes{1}; + float eps = 1e-7; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{0.4472136, 0.89442719, 0.6, 0.8}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_2D_axes_01_add) +{ + std::vector data{1, 2, 3, 4}; + Shape data_shape{2, 2}; + std::vector axes{0, 1}; + float eps = 1e-7; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{0.18257418, 0.36514837, 0.5477226, 0.73029673}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_2D_axes_01_max) +{ + std::vector data{1, 2, 3, 4}; + Shape data_shape{2, 2}; + std::vector axes{0, 1}; + float eps = 1e-7; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{0.18257419, 0.36514837, 0.54772256, 0.73029674}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +// 3D + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_3D_axes_1_add) +{ + std::vector data{1, 2, 3, 4}; + Shape data_shape{1, 2, 2}; + std::vector axes{1}; + float eps = 1e-7; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{0.31622776, 0.4472136, 0.94868326, 0.8944272}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_3D_axes_1_max) +{ + std::vector data{1, 2, 3, 4}; + Shape data_shape{1, 2, 2}; + std::vector axes{1}; + float eps = 1e-7; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{0.31622776, 0.4472136, 0.94868326, 0.8944272}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_3D_axes_2_add) +{ + std::vector data{1, 2, 3, 4}; + Shape data_shape{1, 2, 2}; + std::vector axes{2}; + float eps = 1e-7; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{0.4472136, 0.8944272, 0.6, 0.8}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_3D_axes_2_max) +{ + std::vector data{1, 2, 3, 4}; + Shape data_shape{1, 2, 2}; + std::vector axes{2}; + float eps = 1e-7; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{0.4472136, 0.8944272, 0.6, 0.8}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +// 4D + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_empty_max) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 1); + std::vector axes{}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output(shape_size(data_shape), 1); + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_empty_add) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 1); + std::vector axes{}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output(shape_size(data_shape), 1); + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_0_max) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{0}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.03996804, 0.07669649, 0.11043153, 0.14142135, 0.1699069, 0.19611612, + 0.22026087, 0.2425356, 0.26311737, 0.2821663, 0.2998266, 0.31622776, 0.331486, + 0.34570533, 0.35897905, 0.37139067, 0.38301498, 0.3939193, 0.40416384, 0.41380292, + 0.42288542, 0.43145543, 0.43955287, 0.99999994, 0.9992009, 0.9970544, 0.9938838, + 0.98994946, 0.98546, 0.9805806, 0.97544104, 0.9701424, 0.96476364, 0.9593654, + 0.95399374, 0.9486833, 0.9434601, 0.93834305, 0.93334556, 0.9284767, 0.923742, + 0.919145, 0.91468656, 0.9103665, 0.90618306, 0.90213406, 0.8982167}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_0_add) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{0}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0, 0.0399648, 0.0766909, 0.110424, 0.141413, 0.169897, 0.196106, 0.22025, + 0.242524, 0.263106, 0.282155, 0.299815, 0.316217, 0.331475, 0.345695, 0.358969, + 0.371381, 0.383005, 0.39391, 0.404155, 0.413794, 0.422877, 0.431447, 0.439545, + 0.999913, 0.999121, 0.996981, 0.993816, 0.989888, 0.985403, 0.980528, 0.975393, + 0.970098, 0.964723, 0.959327, 0.953958, 0.94865, 0.94343, 0.938315, 0.933319, + 0.928452, 0.923719, 0.919123, 0.914666, 0.910347, 0.906165, 0.902117, 0.8982}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_1_max) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{1}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.07669649, 0.14142135, 0.19611612, 0.2425356, 0.2821663, 0.31622776, + 0.34570533, 0.37139067, 0.3939193, 0.41380292, 0.43145543, 0.99999994, 0.9970544, + 0.98994946, 0.9805806, 0.9701424, 0.9593654, 0.9486833, 0.93834305, 0.9284767, + 0.919145, 0.9103665, 0.90213406, 0.5547002, 0.55985737, 0.56468385, 0.5692099, + 0.57346237, 0.57746464, 0.58123815, 0.5848015, 0.58817166, 0.59136367, 0.59439105, + 0.5972662, 0.83205026, 0.82858896, 0.8253072, 0.8221921, 0.8192319, 0.81641555, + 0.8137334, 0.8111763, 0.808736, 0.80640495, 0.8041761, 0.8020432}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_1_add) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{1}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0., 0.07667395, 0.14138602, 0.19607423, 0.24249104, 0.28212142, 0.31618387, + 0.3456632, 0.37135068, 0.3938816, 0.41376755, 0.43142232, 0.9996529, 0.9967614, + 0.9897021, 0.9803712, 0.96996415, 0.9592128, 0.94855154, 0.93822867, 0.9283767, + 0.9190571, 0.9102886, 0.9020648, 0.5546854, 0.55984336, 0.56467056, 0.56919736, + 0.5734503, 0.57745326, 0.58122724, 0.5847912, 0.58816177, 0.59135413, 0.594382, + 0.59725744, 0.8320281, 0.8285682, 0.82528776, 0.82217395, 0.8192147, 0.8163994, + 0.8137182, 0.81116194, 0.8087224, 0.806392, 0.8041638, 0.8020314}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_2_max) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{2}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.09667365, 0.16903085, 0.22423053, 0.4472136, 0.48336822, 0.50709254, + 0.52320457, 0.8944272, 0.8700628, 0.8451542, 0.8221786, 0.42426404, 0.4335743, + 0.4418361, 0.4492145, 0.5656854, 0.5669818, 0.56807494, 0.569005, 0.7071067, + 0.70038927, 0.6943139, 0.68879557, 0.49153918, 0.4945891, 0.49743116, 0.5000857, + 0.57346237, 0.5737234, 0.57395905, 0.5741725, 0.65538555, 0.6528576, 0.6504869, + 0.6482592, 0.51789176, 0.5193782, 0.52079225, 0.5221394, 0.5754353, 0.5755272, + 0.57561255, 0.5756921, 0.63297886, 0.6316762, 0.6304327, 0.62924486}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_2_add) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{2}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0, 0.0966285, 0.168971, 0.224168, 0.446934, 0.483143, 0.506912, 0.523058, + 0.893869, 0.869657, 0.844853, 0.821949, 0.424238, 0.43355, 0.441814, 0.449194, + 0.56565, 0.56695, 0.568047, 0.56898, 0.707063, 0.70035, 0.694279, 0.688765, + 0.491529, 0.494579, 0.497422, 0.500077, 0.57345, 0.573712, 0.573949, 0.574163, + 0.655372, 0.652845, 0.650475, 0.648248, 0.517886, 0.519373, 0.520787, 0.522135, + 0.575429, 0.575521, 0.575607, 0.575687, 0.632972, 0.63167, 0.630427, 0.629239}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_3_max) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{3}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.26726124, 0.5345225, 0.8017837, 0.3563483, 0.44543537, 0.5345225, + 0.62360954, 0.41816667, 0.4704375, 0.52270836, 0.5749792, 0.44292808, 0.47983873, + 0.5167494, 0.5536601, 0.45621273, 0.484726, 0.5132393, 0.54175264, 0.4644887, + 0.4877131, 0.5109376, 0.534162, 0.47013652, 0.48972553, 0.50931454, 0.5289036, + 0.47423577, 0.49117276, 0.50810975, 0.5250467, 0.47734618, 0.49226326, 0.50718033, + 0.5220974, 0.4797868, 0.49311423, 0.50644165, 0.5197691, 0.48175293, 0.49379677, + 0.5058406, 0.51788443, 0.48337057, 0.49435627, 0.50534195, 0.5163277}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_3_add) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{3}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0, 0.266312, 0.532624, 0.798935, 0.356207, 0.445259, 0.534311, 0.623362, + 0.41811, 0.470373, 0.522637, 0.574901, 0.442898, 0.479806, 0.516714, 0.553622, + 0.456194, 0.484706, 0.513219, 0.541731, 0.464476, 0.4877, 0.510924, 0.534148, + 0.470128, 0.489716, 0.509305, 0.528893, 0.474229, 0.491166, 0.508102, 0.525039, + 0.477341, 0.492258, 0.507175, 0.522092, 0.479783, 0.49311, 0.506437, 0.519764, + 0.481749, 0.493793, 0.505837, 0.517881, 0.483368, 0.494353, 0.505339, 0.516325}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_23_max) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{2, 3}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.04445542, 0.08891085, 0.13336627, 0.1778217, 0.22227712, 0.26673254, + 0.31118798, 0.3556434, 0.4000988, 0.44455424, 0.48900968, 0.19420628, 0.21039014, + 0.226574, 0.24275786, 0.2589417, 0.27512556, 0.29130942, 0.30749327, 0.32367712, + 0.339861, 0.35604486, 0.3722287, 0.23326269, 0.24298197, 0.25270125, 0.26242054, + 0.2721398, 0.28185907, 0.29157835, 0.30129763, 0.31101692, 0.3207362, 0.33045548, + 0.34017476, 0.24955511, 0.2564872, 0.26341927, 0.27035138, 0.27728346, 0.28421554, + 0.29114762, 0.2980797, 0.3050118, 0.3119439, 0.31887597, 0.32580805}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_23_add) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{2, 3}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0., 0.04445103, 0.08890206, 0.1333531, 0.17780413, 0.22225516, 0.2667062, + 0.31115723, 0.35560825, 0.40005928, 0.4445103, 0.48896134, 0.19420375, 0.2103874, + 0.22657104, 0.24275468, 0.2589383, 0.275122, 0.29130563, 0.30748928, 0.32367292, + 0.33985656, 0.3560402, 0.37222385, 0.2332616, 0.24298084, 0.25270006, 0.2624193, + 0.27213854, 0.2818578, 0.291577, 0.30129623, 0.3110155, 0.3207347, 0.33045393, + 0.34017318, 0.2495545, 0.25648656, 0.26341864, 0.27035072, 0.27728277, 0.28421485, + 0.29114693, 0.29807898, 0.30501106, 0.3119431, 0.3188752, 0.32580727}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_123_max) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{1, 2, 3}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.01520748, 0.03041495, 0.04562243, 0.06082991, 0.07603738, 0.09124486, + 0.10645234, 0.12165982, 0.13686728, 0.15207477, 0.16728225, 0.18248972, 0.19769719, + 0.21290468, 0.22811216, 0.24331963, 0.2585271, 0.27373457, 0.28894207, 0.30414954, + 0.319357, 0.3345645, 0.34977198, 0.13544846, 0.14109215, 0.14673583, 0.15237951, + 0.15802321, 0.16366689, 0.16931057, 0.17495427, 0.18059795, 0.18624163, 0.19188532, + 0.197529, 0.20317268, 0.20881638, 0.21446006, 0.22010374, 0.22574744, 0.23139112, + 0.2370348, 0.2426785, 0.24832217, 0.25396585, 0.25960955, 0.26525325}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_123_big_eps_max) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{1, 2, 3}; + float eps = 100; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.01520748, 0.03041495, 0.04562243, 0.06082991, 0.07603738, 0.09124486, + 0.10645234, 0.12165982, 0.13686728, 0.15207477, 0.16728225, 0.18248972, 0.19769719, + 0.21290468, 0.22811216, 0.24331963, 0.2585271, 0.27373457, 0.28894207, 0.30414954, + 0.319357, 0.3345645, 0.34977198, 0.13544846, 0.14109215, 0.14673583, 0.15237951, + 0.15802321, 0.16366689, 0.16931057, 0.17495427, 0.18059795, 0.18624163, 0.19188532, + 0.197529, 0.20317268, 0.20881638, 0.21446006, 0.22010374, 0.22574744, 0.23139112, + 0.2370348, 0.2426785, 0.24832217, 0.25396585, 0.25960955, 0.26525325}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_123_add) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{1, 2, 3}; + float eps = 1e-9; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0, 0.0152075, 0.030415, 0.0456224, 0.0608299, 0.0760374, 0.0912449, 0.106452, + 0.12166, 0.136867, 0.152075, 0.167282, 0.18249, 0.197697, 0.212905, 0.228112, + 0.24332, 0.258527, 0.273735, 0.288942, 0.30415, 0.319357, 0.334565, 0.349772, + 0.135448, 0.141092, 0.146736, 0.15238, 0.158023, 0.163667, 0.169311, 0.174954, + 0.180598, 0.186242, 0.191885, 0.197529, 0.203173, 0.208816, 0.21446, 0.220104, + 0.225747, 0.231391, 0.237035, 0.242678, 0.248322, 0.253966, 0.25961, 0.265253}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_123_big_eps_add) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{1, 2, 3}; + float eps = 0.5; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0, 0.0152066, 0.0304132, 0.0456198, 0.0608264, 0.076033, 0.0912396, 0.106446, + 0.121653, 0.136859, 0.152066, 0.167273, 0.182479, 0.197686, 0.212892, 0.228099, + 0.243306, 0.258512, 0.273719, 0.288925, 0.304132, 0.319339, 0.334545, 0.349752, + 0.135447, 0.141091, 0.146735, 0.152378, 0.158022, 0.163666, 0.169309, 0.174953, + 0.180597, 0.18624, 0.191884, 0.197527, 0.203171, 0.208815, 0.214458, 0.220102, + 0.225746, 0.231389, 0.237033, 0.242677, 0.24832, 0.253964, 0.259607, 0.265251}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_unsorted_312_max) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{3, 1, 2}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.01520748, 0.03041495, 0.04562243, 0.06082991, 0.07603738, 0.09124486, + 0.10645234, 0.12165982, 0.13686728, 0.15207477, 0.16728225, 0.18248972, 0.19769719, + 0.21290468, 0.22811216, 0.24331963, 0.2585271, 0.27373457, 0.28894207, 0.30414954, + 0.319357, 0.3345645, 0.34977198, 0.13544846, 0.14109215, 0.14673583, 0.15237951, + 0.15802321, 0.16366689, 0.16931057, 0.17495427, 0.18059795, 0.18624163, 0.19188532, + 0.197529, 0.20317268, 0.20881638, 0.21446006, 0.22010374, 0.22574744, 0.23139112, + 0.2370348, 0.2426785, 0.24832217, 0.25396585, 0.25960955, 0.26525325}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_unsorted_312_add) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{3, 1, 2}; + float eps = 1e-9; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0, 0.0152075, 0.030415, 0.0456224, 0.0608299, 0.0760374, 0.0912449, 0.106452, + 0.12166, 0.136867, 0.152075, 0.167282, 0.18249, 0.197697, 0.212905, 0.228112, + 0.24332, 0.258527, 0.273735, 0.288942, 0.30415, 0.319357, 0.334565, 0.349772, + 0.135448, 0.141092, 0.146736, 0.15238, 0.158023, 0.163667, 0.169311, 0.174954, + 0.180598, 0.186242, 0.191885, 0.197529, 0.203173, 0.208816, 0.21446, 0.220104, + 0.225747, 0.231391, 0.237035, 0.242678, 0.248322, 0.253966, 0.25961, 0.265253}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_0123_max) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{0, 1, 2, 3}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.00529108, 0.01058216, 0.01587324, 0.02116432, 0.02645539, 0.03174648, + 0.03703756, 0.04232863, 0.04761971, 0.05291079, 0.05820187, 0.06349295, 0.06878403, + 0.07407511, 0.07936618, 0.08465727, 0.08994835, 0.09523942, 0.10053051, 0.10582158, + 0.11111266, 0.11640374, 0.12169482, 0.12698591, 0.13227698, 0.13756806, 0.14285913, + 0.14815022, 0.1534413, 0.15873237, 0.16402346, 0.16931453, 0.17460561, 0.1798967, + 0.18518777, 0.19047885, 0.19576994, 0.20106101, 0.20635208, 0.21164316, 0.21693425, + 0.22222532, 0.2275164, 0.23280749, 0.23809856, 0.24338964, 0.24868073}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_4D_axes_0123_add) +{ + Shape data_shape{2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{0, 1, 2, 3}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0., 0.00529108, 0.01058216, 0.01587324, 0.02116432, 0.02645539, 0.03174648, + 0.03703756, 0.04232863, 0.04761971, 0.05291079, 0.05820187, 0.06349295, 0.06878403, + 0.07407511, 0.07936618, 0.08465727, 0.08994835, 0.09523942, 0.10053051, 0.10582158, + 0.11111266, 0.11640374, 0.12169482, 0.12698591, 0.13227698, 0.13756806, 0.14285913, + 0.14815022, 0.1534413, 0.15873237, 0.16402346, 0.16931453, 0.17460561, 0.1798967, + 0.18518777, 0.19047885, 0.19576994, 0.20106101, 0.20635208, 0.21164316, 0.21693425, + 0.22222532, 0.2275164, 0.23280749, 0.23809856, 0.24338964, 0.24868073}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_empty_max) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 1); + std::vector axes{}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output(shape_size(data_shape), 1); + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_empty_add) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 1); + std::vector axes{}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output(shape_size(data_shape), 1); + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_1_max) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{1}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.03996804, 0.07669649, 0.11043153, 0.14142135, 0.1699069, 0.19611612, + 0.22026087, 0.2425356, 0.26311737, 0.2821663, 0.2998266, 0.31622776, 0.331486, + 0.34570533, 0.35897905, 0.37139067, 0.38301498, 0.3939193, 0.40416384, 0.41380292, + 0.42288542, 0.43145543, 0.43955287, 0.99999994, 0.9992009, 0.9970544, 0.9938838, + 0.98994946, 0.98546, 0.9805806, 0.97544104, 0.9701424, 0.96476364, 0.9593654, + 0.95399374, 0.9486833, 0.9434601, 0.93834305, 0.93334556, 0.9284767, 0.923742, + 0.919145, 0.91468656, 0.9103665, 0.90618306, 0.90213406, 0.8982167}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_1_add) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{1}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0, 0.0399648, 0.0766909, 0.110424, 0.141413, 0.169897, 0.196106, 0.22025, + 0.242524, 0.263106, 0.282155, 0.299815, 0.316217, 0.331475, 0.345695, 0.358969, + 0.371381, 0.383005, 0.39391, 0.404155, 0.413794, 0.422877, 0.431447, 0.439545, + 0.999913, 0.999121, 0.996981, 0.993816, 0.989888, 0.985403, 0.980528, 0.975393, + 0.970098, 0.964723, 0.959327, 0.953958, 0.94865, 0.94343, 0.938315, 0.933319, + 0.928452, 0.923719, 0.919123, 0.914666, 0.910347, 0.906165, 0.902117, 0.8982}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_2_max) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{2}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.07669649, 0.14142135, 0.19611612, 0.2425356, 0.2821663, 0.31622776, + 0.34570533, 0.37139067, 0.3939193, 0.41380292, 0.43145543, 0.99999994, 0.9970544, + 0.98994946, 0.9805806, 0.9701424, 0.9593654, 0.9486833, 0.93834305, 0.9284767, + 0.919145, 0.9103665, 0.90213406, 0.5547002, 0.55985737, 0.56468385, 0.5692099, + 0.57346237, 0.57746464, 0.58123815, 0.5848015, 0.58817166, 0.59136367, 0.59439105, + 0.5972662, 0.83205026, 0.82858896, 0.8253072, 0.8221921, 0.8192319, 0.81641555, + 0.8137334, 0.8111763, 0.808736, 0.80640495, 0.8041761, 0.8020432}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_2_add) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{2}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0., 0.07667395, 0.14138602, 0.19607423, 0.24249104, 0.28212142, 0.31618387, + 0.3456632, 0.37135068, 0.3938816, 0.41376755, 0.43142232, 0.9996529, 0.9967614, + 0.9897021, 0.9803712, 0.96996415, 0.9592128, 0.94855154, 0.93822867, 0.9283767, + 0.9190571, 0.9102886, 0.9020648, 0.5546854, 0.55984336, 0.56467056, 0.56919736, + 0.5734503, 0.57745326, 0.58122724, 0.5847912, 0.58816177, 0.59135413, 0.594382, + 0.59725744, 0.8320281, 0.8285682, 0.82528776, 0.82217395, 0.8192147, 0.8163994, + 0.8137182, 0.81116194, 0.8087224, 0.806392, 0.8041638, 0.8020314}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_3_max) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{3}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.09667365, 0.16903085, 0.22423053, 0.4472136, 0.48336822, 0.50709254, + 0.52320457, 0.8944272, 0.8700628, 0.8451542, 0.8221786, 0.42426404, 0.4335743, + 0.4418361, 0.4492145, 0.5656854, 0.5669818, 0.56807494, 0.569005, 0.7071067, + 0.70038927, 0.6943139, 0.68879557, 0.49153918, 0.4945891, 0.49743116, 0.5000857, + 0.57346237, 0.5737234, 0.57395905, 0.5741725, 0.65538555, 0.6528576, 0.6504869, + 0.6482592, 0.51789176, 0.5193782, 0.52079225, 0.5221394, 0.5754353, 0.5755272, + 0.57561255, 0.5756921, 0.63297886, 0.6316762, 0.6304327, 0.62924486}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_3_add) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{3}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0, 0.0966285, 0.168971, 0.224168, 0.446934, 0.483143, 0.506912, 0.523058, + 0.893869, 0.869657, 0.844853, 0.821949, 0.424238, 0.43355, 0.441814, 0.449194, + 0.56565, 0.56695, 0.568047, 0.56898, 0.707063, 0.70035, 0.694279, 0.688765, + 0.491529, 0.494579, 0.497422, 0.500077, 0.57345, 0.573712, 0.573949, 0.574163, + 0.655372, 0.652845, 0.650475, 0.648248, 0.517886, 0.519373, 0.520787, 0.522135, + 0.575429, 0.575521, 0.575607, 0.575687, 0.632972, 0.63167, 0.630427, 0.629239}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_4_max) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{4}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.26726124, 0.5345225, 0.8017837, 0.3563483, 0.44543537, 0.5345225, + 0.62360954, 0.41816667, 0.4704375, 0.52270836, 0.5749792, 0.44292808, 0.47983873, + 0.5167494, 0.5536601, 0.45621273, 0.484726, 0.5132393, 0.54175264, 0.4644887, + 0.4877131, 0.5109376, 0.534162, 0.47013652, 0.48972553, 0.50931454, 0.5289036, + 0.47423577, 0.49117276, 0.50810975, 0.5250467, 0.47734618, 0.49226326, 0.50718033, + 0.5220974, 0.4797868, 0.49311423, 0.50644165, 0.5197691, 0.48175293, 0.49379677, + 0.5058406, 0.51788443, 0.48337057, 0.49435627, 0.50534195, 0.5163277}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_4_add) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{4}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0, 0.266312, 0.532624, 0.798935, 0.356207, 0.445259, 0.534311, 0.623362, + 0.41811, 0.470373, 0.522637, 0.574901, 0.442898, 0.479806, 0.516714, 0.553622, + 0.456194, 0.484706, 0.513219, 0.541731, 0.464476, 0.4877, 0.510924, 0.534148, + 0.470128, 0.489716, 0.509305, 0.528893, 0.474229, 0.491166, 0.508102, 0.525039, + 0.477341, 0.492258, 0.507175, 0.522092, 0.479783, 0.49311, 0.506437, 0.519764, + 0.481749, 0.493793, 0.505837, 0.517881, 0.483368, 0.494353, 0.505339, 0.516325}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_34_max) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{3, 4}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.04445542, 0.08891085, 0.13336627, 0.1778217, 0.22227712, 0.26673254, + 0.31118798, 0.3556434, 0.4000988, 0.44455424, 0.48900968, 0.19420628, 0.21039014, + 0.226574, 0.24275786, 0.2589417, 0.27512556, 0.29130942, 0.30749327, 0.32367712, + 0.339861, 0.35604486, 0.3722287, 0.23326269, 0.24298197, 0.25270125, 0.26242054, + 0.2721398, 0.28185907, 0.29157835, 0.30129763, 0.31101692, 0.3207362, 0.33045548, + 0.34017476, 0.24955511, 0.2564872, 0.26341927, 0.27035138, 0.27728346, 0.28421554, + 0.29114762, 0.2980797, 0.3050118, 0.3119439, 0.31887597, 0.32580805}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_34_add) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{3, 4}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0., 0.04445103, 0.08890206, 0.1333531, 0.17780413, 0.22225516, 0.2667062, + 0.31115723, 0.35560825, 0.40005928, 0.4445103, 0.48896134, 0.19420375, 0.2103874, + 0.22657104, 0.24275468, 0.2589383, 0.275122, 0.29130563, 0.30748928, 0.32367292, + 0.33985656, 0.3560402, 0.37222385, 0.2332616, 0.24298084, 0.25270006, 0.2624193, + 0.27213854, 0.2818578, 0.291577, 0.30129623, 0.3110155, 0.3207347, 0.33045393, + 0.34017318, 0.2495545, 0.25648656, 0.26341864, 0.27035072, 0.27728277, 0.28421485, + 0.29114693, 0.29807898, 0.30501106, 0.3119431, 0.3188752, 0.32580727}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_234_max) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{2, 3, 4}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::MAX; + std::vector expected_output{ + 0., 0.01520748, 0.03041495, 0.04562243, 0.06082991, 0.07603738, 0.09124486, + 0.10645234, 0.12165982, 0.13686728, 0.15207477, 0.16728225, 0.18248972, 0.19769719, + 0.21290468, 0.22811216, 0.24331963, 0.2585271, 0.27373457, 0.28894207, 0.30414954, + 0.319357, 0.3345645, 0.34977198, 0.13544846, 0.14109215, 0.14673583, 0.15237951, + 0.15802321, 0.16366689, 0.16931057, 0.17495427, 0.18059795, 0.18624163, 0.19188532, + 0.197529, 0.20317268, 0.20881638, 0.21446006, 0.22010374, 0.22574744, 0.23139112, + 0.2370348, 0.2426785, 0.24832217, 0.25396585, 0.25960955, 0.26525325}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); +} + +NGRAPH_TEST(${BACKEND_NAME}, normalize_l2_5D_axes_234_add) +{ + Shape data_shape{1, 2, 2, 3, 4}; + std::vector data(shape_size(data_shape)); + iota(begin(data), end(data), 0); + std::vector axes{2, 3, 4}; + float eps = 0.1; + auto eps_mode = ngraph::op::EpsMode::ADD; + std::vector expected_output{ + 0., 0.0152073, 0.0304146, 0.0456219, 0.0608292, 0.07603651, 0.0912438, + 0.10645111, 0.12165841, 0.1368657, 0.15207301, 0.16728032, 0.1824876, 0.19769491, + 0.21290222, 0.22810951, 0.24331681, 0.25852412, 0.2737314, 0.28893873, 0.30414602, + 0.3193533, 0.33456063, 0.34976792, 0.13544825, 0.14109191, 0.1467356, 0.15237927, + 0.15802296, 0.16366662, 0.1693103, 0.17495398, 0.18059766, 0.18624133, 0.19188501, + 0.19752869, 0.20317237, 0.20881604, 0.21445972, 0.2201034, 0.22574706, 0.23139074, + 0.23703443, 0.2426781, 0.24832177, 0.25396547, 0.25960913, 0.2652528}; + + normalize_l2_results_test(data, data_shape, axes, eps_mode, eps, expected_output); } diff --git a/ngraph/test/backend/prior_box_clustered.in.cpp b/ngraph/test/backend/prior_box_clustered.in.cpp new file mode 100644 index 00000000000..5cc2dfeb964 --- /dev/null +++ b/ngraph/test/backend/prior_box_clustered.in.cpp @@ -0,0 +1,71 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "gtest/gtest.h" + +#include "ngraph/ngraph.hpp" +#include "ngraph/op/prior_box_clustered.hpp" + +#include "util/engine/test_engines.hpp" +#include "util/test_case.hpp" +#include "util/test_control.hpp" + +using namespace std; +using namespace ngraph; + +static string s_manifest = "${MANIFEST}"; +using TestEngine = test::ENGINE_CLASS_NAME(${BACKEND_NAME}); + +NGRAPH_TEST(${BACKEND_NAME}, prior_box_clustered) +{ + op::PriorBoxClusteredAttrs attrs; + attrs.widths = {3.0f}; + attrs.heights = {3.0f}; + attrs.clip = true; + + Shape layer_shape_shape{2}; + Shape image_shape_shape{2}; + vector layer_shape{2, 2}; + vector image_shape{10, 10}; + + auto LS = op::Constant::create(element::i64, layer_shape_shape, layer_shape); + auto IS = op::Constant::create(element::i64, image_shape_shape, image_shape); + auto f = make_shared(make_shared(LS, IS, attrs), ParameterVector{}); + const auto exp_shape = Shape{2, 16}; + vector out{0, 0, 0.15f, 0.15f, 0.34999f, 0, 0.64999f, 0.15f, + 0, 0.34999f, 0.15f, 0.64999f, 0.34999f, 0.34999f, 0.64999f, 0.64999f, + 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, + 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f, 0.1f}; + + auto test_case = test::TestCase(f); + test_case.add_expected_output(exp_shape, out); + test_case.run_with_tolerance_as_fp(1.0e-5f); +} + +NGRAPH_TEST(${BACKEND_NAME}, prior_box_clustered_non_default_variances) +{ + op::PriorBoxClusteredAttrs attrs; + attrs.widths = {3.0f}; + attrs.heights = {3.0f}; + attrs.clip = true; + attrs.variances = {0.1f, 0.2f, 0.3f, 0.4f}; + + Shape layer_shape_shape{2}; + Shape image_shape_shape{2}; + vector layer_shape{2, 2}; + vector image_shape{10, 10}; + + auto LS = op::Constant::create(element::i64, layer_shape_shape, layer_shape); + auto IS = op::Constant::create(element::i64, image_shape_shape, image_shape); + auto f = make_shared(make_shared(LS, IS, attrs), ParameterVector{}); + const auto exp_shape = Shape{2, 16}; + vector out{0, 0, 0.15f, 0.15f, 0.34999f, 0, 0.64999f, 0.15f, + 0, 0.34999f, 0.15f, 0.64999f, 0.34999f, 0.34999f, 0.64999f, 0.64999f, + 0.1f, 0.2f, 0.3f, 0.4f, 0.1f, 0.2f, 0.3f, 0.4f, + 0.1f, 0.2f, 0.3f, 0.4f, 0.1f, 0.2f, 0.3f, 0.4f}; + + auto test_case = test::TestCase(f); + test_case.add_expected_output(exp_shape, out); + test_case.run_with_tolerance_as_fp(1.0e-5f); +} diff --git a/ngraph/test/files/paddlepaddle/gen_scripts/generate_argmax.py b/ngraph/test/files/paddlepaddle/gen_scripts/generate_argmax.py new file mode 100644 index 00000000000..54b24364b2d --- /dev/null +++ b/ngraph/test/files/paddlepaddle/gen_scripts/generate_argmax.py @@ -0,0 +1,60 @@ +# +# pool2d paddle model generator +# +import numpy as np +from save_model import saveModel +import sys +data_type = 'float32' + + +def pdpd_argmax(name : str, x, axis): + import paddle as pdpd + pdpd.enable_static() + + with pdpd.static.program_guard(pdpd.static.Program(), pdpd.static.Program()): + node_x = pdpd.static.data(name='x', shape=x.shape, dtype='float32') + out = pdpd.argmax(x=node_x, axis=axis) + out = pdpd.cast(out, np.float32) + cpu = pdpd.static.cpu_places(1) + exe = pdpd.static.Executor(cpu[0]) + # startup program will call initializer to initialize the parameters. + exe.run(pdpd.static.default_startup_program()) + + outs = exe.run( + feed={'x': x}, + fetch_list=[out]) + + saveModel(name, exe, feedkeys=['x'], fetchlist=[out], inputs=[x], outputs=[outs[0]], target_dir=sys.argv[1]) + + return outs[0] + +def pdpd_argmax1(name : str, x): + import paddle as pdpd + pdpd.enable_static() + + with pdpd.static.program_guard(pdpd.static.Program(), pdpd.static.Program()): + node_x = pdpd.static.data(name='x', shape=x.shape, dtype='float32') + out = pdpd.argmax(x=node_x) + out = pdpd.cast(out, np.float32) + cpu = pdpd.static.cpu_places(1) + exe = pdpd.static.Executor(cpu[0]) + # startup program will call initializer to initialize the parameters. + exe.run(pdpd.static.default_startup_program()) + + outs = exe.run( + feed={'x': x}, + fetch_list=[out]) + + saveModel(name, exe, feedkeys=['x'], fetchlist=[out], inputs=[x], outputs=[outs[0]], target_dir=sys.argv[1]) + + return outs[0] + +def main(): + data = np.random.random([3,5,7,2]).astype("float32") + axis = 0 + pdpd_argmax("argmax", data, axis) + pdpd_argmax1("argmax1", data) + + +if __name__ == "__main__": + main() diff --git a/ngraph/test/files/paddlepaddle/gen_scripts/generate_assign_value.py b/ngraph/test/files/paddlepaddle/gen_scripts/generate_assign_value.py new file mode 100644 index 00000000000..7d29574b2a9 --- /dev/null +++ b/ngraph/test/files/paddlepaddle/gen_scripts/generate_assign_value.py @@ -0,0 +1,58 @@ +import numpy as np +from save_model import saveModel +import sys + + +def pdpd_assign_value(name, test_x): + import paddle as pdpd + pdpd.enable_static() + main_program = pdpd.static.Program() + startup_program = pdpd.static.Program() + with pdpd.static.program_guard(main_program, startup_program): + node_x = pdpd.static.data(name='x', shape=test_x.shape, dtype=test_x.dtype if test_x.dtype != np.bool else np.int32) + node_x = pdpd.cast(node_x, dtype=test_x.dtype) + const_value = pdpd.assign(test_x, output=None) + result = pdpd.cast(pdpd.concat([node_x, const_value], 0), dtype=np.float32) + cpu = pdpd.static.cpu_places(1) + exe = pdpd.static.Executor(cpu[0]) + # startup program will call initializer to initialize the parameters. + exe.run(pdpd.static.default_startup_program()) + if test_x.dtype == np.bool: + test_x = test_x.astype(np.int32) + + outs = exe.run( + feed={'x': test_x}, + fetch_list=[result] + ) + + saveModel(name, exe, feedkeys=['x'], fetchlist=[result], inputs=[test_x], outputs=[outs[0]], target_dir=sys.argv[1]) + + print(outs[0]) + + +def compare(): + + test_cases = [ + { + "name": "assign_value_fp32", + "input": np.ones([1, 1, 4, 4]).astype(np.float32) + }, + { + "name": "assign_value_int32", + "input": np.ones([1, 1, 4, 4]).astype(np.int32) + }, + { + "name": "assign_value_int64", + "input": np.ones([1, 1, 4, 4]).astype(np.int64) + }, + { + "name": "assign_value_boolean", + "input": np.array([False, True, False]) + } + ] + for test in test_cases: + pdpd_assign_value(test['name'], test['input']) + + +if __name__ == "__main__": + compare() diff --git a/ngraph/test/files/paddlepaddle/gen_scripts/generate_batch_norm.py b/ngraph/test/files/paddlepaddle/gen_scripts/generate_batch_norm.py new file mode 100644 index 00000000000..fbbba99160c --- /dev/null +++ b/ngraph/test/files/paddlepaddle/gen_scripts/generate_batch_norm.py @@ -0,0 +1,89 @@ +# +# pool2d paddle model generator +# +import numpy as np +from save_model import saveModel +import sys + + +def batch_norm1(name : str, x, scale, bias, mean, var, data_layout): + import paddle as pdpd + pdpd.enable_static() + + node_x = pdpd.static.data(name='x', shape=x.shape, dtype='float32') + scale_attr = pdpd.ParamAttr(name="scale1", initializer=pdpd.nn.initializer.Assign(scale)) + bias_attr = pdpd.ParamAttr(name="bias1", initializer=pdpd.nn.initializer.Assign(bias)) + + out = pdpd.static.nn.batch_norm(node_x, epsilon=1e-5, + param_attr=scale_attr, + bias_attr=bias_attr, + moving_mean_name="bn_mean1", + moving_variance_name="bn_variance1", + use_global_stats=True, + data_layout=data_layout) + + cpu = pdpd.static.cpu_places(1) + exe = pdpd.static.Executor(cpu[0]) + # startup program will call initializer to initialize the parameters. + exe.run(pdpd.static.default_startup_program()) + pdpd.static.global_scope().var("bn_mean1").get_tensor().set(mean, pdpd.CPUPlace()) + pdpd.static.global_scope().var("bn_variance1").get_tensor().set(var, pdpd.CPUPlace()) + + outs = exe.run( + feed={'x': x}, + fetch_list=[out]) + + saveModel(name, exe, feedkeys=['x'], fetchlist=[out], inputs=[x], outputs=[outs[0]], target_dir=sys.argv[1]) + + return outs[0] + +def batch_norm2(name : str, x, scale, bias, mean, var, data_layout): + import paddle as pdpd + pdpd.enable_static() + + node_x = pdpd.static.data(name='x', shape=x.shape, dtype='float32') + scale_attr = pdpd.ParamAttr(name="scale2", initializer=pdpd.nn.initializer.Assign(scale)) + bias_attr = pdpd.ParamAttr(name="bias2", initializer=pdpd.nn.initializer.Assign(bias)) + + out = pdpd.static.nn.batch_norm(node_x, epsilon=1e-5, + param_attr=scale_attr, + bias_attr=bias_attr, + moving_mean_name="bn_mean2", + moving_variance_name="bn_variance2", + use_global_stats=True, + data_layout=data_layout) + + cpu = pdpd.static.cpu_places(1) + exe = pdpd.static.Executor(cpu[0]) + # startup program will call initializer to initialize the parameters. + exe.run(pdpd.static.default_startup_program()) + pdpd.static.global_scope().var("bn_mean2").get_tensor().set(mean, pdpd.CPUPlace()) + pdpd.static.global_scope().var("bn_variance2").get_tensor().set(var, pdpd.CPUPlace()) + + outs = exe.run( + feed={'x': x}, + fetch_list=[out]) + + saveModel(name, exe, feedkeys=['x'], fetchlist=[out], inputs=[x], outputs=[outs[0]], target_dir=sys.argv[1]) + + return outs[0] + +def main(): + import paddle as pdpd + data = np.array([[[[-1, 0, 1]], [[2, 3, 4]]]]).astype(np.float32) + # data layout is NCHW + scale = np.array([1.0, 1.5]).astype(np.float32) + bias = np.array([0, 1]).astype(np.float32) + mean = np.array([0, 3]).astype(np.float32) + var = np.array([1, 1.5]).astype(np.float32) + batch_norm1("batch_norm_nchw", data, scale, bias, mean, var, "NCHW") + + # data layout is NHWC + scale = np.array([1.0, 1.5, 2.0]).astype(np.float32) + bias = np.array([0, 1, 2]).astype(np.float32) + mean = np.array([0.5, 1.5, 1.5]).astype(np.float32) + var = np.array([1, 1.5, 2]).astype(np.float32) + batch_norm2("batch_norm_nhwc", data, scale, bias, mean, var, "NHWC") + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/ngraph/test/files/paddlepaddle/gen_scripts/generate_clip.py b/ngraph/test/files/paddlepaddle/gen_scripts/generate_clip.py new file mode 100644 index 00000000000..55edd6c62dd --- /dev/null +++ b/ngraph/test/files/paddlepaddle/gen_scripts/generate_clip.py @@ -0,0 +1,39 @@ +# +# clip paddle model generator +# +import numpy as np +from save_model import saveModel +import sys + +def clip(name: str, x, min, max): + import paddle as pdpd + pdpd.enable_static() + + with pdpd.static.program_guard(pdpd.static.Program(), pdpd.static.Program()): + node_x = pdpd.static.data(name='x', shape=x.shape, dtype='float32') + out = pdpd.fluid.layers.clip(node_x, min=min, max=max) + + cpu = pdpd.static.cpu_places(1) + exe = pdpd.static.Executor(cpu[0]) + # startup program will call initializer to initialize the parameters. + exe.run(pdpd.static.default_startup_program()) + + outs = exe.run( + feed={'x': x}, + fetch_list=[out]) + + saveModel(name, exe, feedkeys=['x'], fetchlist=[out], inputs=[x], outputs=[outs[0]], target_dir=sys.argv[1]) + + return outs[0] + + +def main(): + data = np.random.random([2, 3, 4]).astype('float32') + min = 0 + max = 0.8 + + clip("clip", data, min, max) + + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/ngraph/test/frontend/paddlepaddle/op_fuzzy.cpp b/ngraph/test/frontend/paddlepaddle/op_fuzzy.cpp new file mode 100644 index 00000000000..a2d29bfb6e6 --- /dev/null +++ b/ngraph/test/frontend/paddlepaddle/op_fuzzy.cpp @@ -0,0 +1,40 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "util/engine/test_engines.hpp" +#include "util/test_control.hpp" +#include +#include "op_fuzzy.hpp" +#include "ngraph/ngraph.hpp" + +using namespace ngraph; +using namespace InferenceEngine; +using namespace ngraph; +using namespace ngraph::frontend; +using TestEngine = test::IE_CPU_Engine; + +static const std::string PDPD = "pdpd"; +using PDPDFuzzyOpTest = FrontEndFuzzyOpTest; + +static const std::vector models{ + std::string("argmax"), + std::string("argmax1"), + std::string("assign_value_boolean"), + std::string("assign_value_fp32"), + std::string("assign_value_int32"), + std::string("assign_value_int64"), + std::string("batch_norm_nchw"), + std::string("batch_norm_nhwc"), + std::string("clip"), + std::string("relu"), +}; + +INSTANTIATE_TEST_SUITE_P(PDPDFuzzyOpTest, + FrontEndFuzzyOpTest, + ::testing::Combine(::testing::Values(PDPD), + ::testing::Values(std::string(TEST_PDPD_MODELS)), + ::testing::ValuesIn(models)), + PDPDFuzzyOpTest::getTestCaseName); diff --git a/ngraph/test/frontend/shared/include/op_fuzzy.hpp b/ngraph/test/frontend/shared/include/op_fuzzy.hpp new file mode 100644 index 00000000000..0d11df6c8b5 --- /dev/null +++ b/ngraph/test/frontend/shared/include/op_fuzzy.hpp @@ -0,0 +1,35 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#pragma once + +#include + +#include + +using FuzzyOpTestParam = std::tuple; // Model name + +class FrontEndFuzzyOpTest : public ::testing::TestWithParam +{ +public: + std::string m_feName; + std::string m_pathToModels; + std::string m_modelFile; + ngraph::frontend::FrontEndManager m_fem; + ngraph::frontend::FrontEnd::Ptr m_frontEnd; + ngraph::frontend::InputModel::Ptr m_inputModel; + + static std::string getTestCaseName(const testing::TestParamInfo& obj); + + void SetUp() override; + +protected: + void initParamTest(); + + void doLoadFromFile(); + + void runConvertedModel(const std::shared_ptr function, const std::string& model_file); +}; diff --git a/ngraph/test/frontend/shared/src/op_fuzzy.cpp b/ngraph/test/frontend/shared/src/op_fuzzy.cpp new file mode 100644 index 00000000000..526207d25a6 --- /dev/null +++ b/ngraph/test/frontend/shared/src/op_fuzzy.cpp @@ -0,0 +1,163 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include + +#include "util/engine/test_engines.hpp" +#include "util/test_case.hpp" +#include "util/test_control.hpp" +#include "op_fuzzy.hpp" +#include "utils.hpp" + +using namespace ngraph; +using namespace InferenceEngine; + +using namespace ngraph; +using namespace ngraph::frontend; +using TestEngine = test::IE_CPU_Engine; + +std::string + FrontEndFuzzyOpTest::getTestCaseName(const testing::TestParamInfo& obj) +{ + std::string fe, path, fileName; + std::tie(fe, path, fileName) = obj.param; + return fe + "_" + FrontEndTestUtils::fileToTestName(fileName); +} + +void FrontEndFuzzyOpTest::SetUp() +{ + FrontEndTestUtils::setupTestEnv(); + m_fem = FrontEndManager(); // re-initialize after setting up environment + initParamTest(); +} + +void FrontEndFuzzyOpTest::initParamTest() +{ + std::tie(m_feName, m_pathToModels, m_modelFile) = GetParam(); + m_modelFile = m_pathToModels + m_modelFile; +} + +void FrontEndFuzzyOpTest::doLoadFromFile() +{ + std::vector frontends; + ASSERT_NO_THROW(frontends = m_fem.get_available_front_ends()); + ASSERT_NO_THROW(m_frontEnd = m_fem.load_by_framework(m_feName)); + ASSERT_NE(m_frontEnd, nullptr); + ASSERT_NO_THROW(m_inputModel = m_frontEnd->load_from_file(m_modelFile)); + ASSERT_NE(m_inputModel, nullptr); +} + +template +inline void addInputOutput(cnpy::NpyArray& npy_array, + test::TestCase& test_case, + bool is_input = true) +{ + T* npy_begin = npy_array.data(); + std::vector data(npy_begin, npy_begin + npy_array.num_vals); + if (is_input) + test_case.add_input(data); + else + test_case.add_expected_output(data); +} + +static bool ends_with(std::string const& value, std::string const& ending) +{ + if (ending.size() > value.size()) + return false; + return std::equal(ending.rbegin(), ending.rend(), value.rbegin()); +} + +static std::string getModelFolder(const std::string& modelFile) +{ + if (!ends_with(modelFile, ".pdmodel")) + return modelFile; + size_t found = modelFile.find_last_of("/\\"); + return modelFile.substr(0, found); +}; + +void FrontEndFuzzyOpTest::runConvertedModel(const std::shared_ptr function, + const std::string& modelFile) +{ + auto modelFolder = getModelFolder(modelFile); + + // run test + auto testCase = test::TestCase(function); + + const auto parameters = function->get_parameters(); + for (size_t i = 0; i < parameters.size(); i++) + { + // read input npy file + std::string dataFile = + modelFolder + "/input" + std::to_string((parameters.size() - 1) - i) + ".npy"; + cnpy::NpyArray input = cnpy::npy_load(dataFile); + auto input_dtype = parameters[i]->get_element_type(); + + if (input_dtype == element::f32) + { + addInputOutput(input, testCase, true); + } + else if (input_dtype == element::i32) + { + addInputOutput(input, testCase, true); + } + else if (input_dtype == element::i64) + { + addInputOutput(input, testCase, true); + } + else + { + throw std::runtime_error("not supported dtype in" + input_dtype.get_type_name()); + } + } + + const auto results = function->get_results(); + bool useFloatTest = false; + for (size_t i = 0; i < results.size(); i++) + { + // read expected output npy file + std::string dataFile = modelFolder + "/output" + std::to_string(i) + ".npy"; + cnpy::NpyArray output = cnpy::npy_load(dataFile); + auto outputDtype = results[i]->get_element_type(); + if (outputDtype == element::f32) + { + addInputOutput(output, testCase, false); + useFloatTest = true; + } + else if (outputDtype == element::i32) + { + addInputOutput(output, testCase, false); + } + else if (outputDtype == element::i64) + { + addInputOutput(output, testCase, false); + } + else + { + throw std::runtime_error("not supported dtype out " + outputDtype.get_type_name()); + } + } + + if (useFloatTest) + { + testCase.run_with_tolerance_as_fp(); + } + else + { + testCase.run(); + } +} + +TEST_P(FrontEndFuzzyOpTest, testOpFuzzy) +{ + // load + ASSERT_NO_THROW(doLoadFromFile()); + + // convert + std::shared_ptr function; + function = m_frontEnd->convert(m_inputModel); + ASSERT_NE(function, nullptr); + + // run + runConvertedModel(function, m_modelFile); +} diff --git a/ngraph/test/models/onnx/constant_fill_shape_attribute.prototxt b/ngraph/test/models/onnx/constant_fill_shape_attribute.prototxt index 806f01ffd89..cdbbf99419a 100644 --- a/ngraph/test/models/onnx/constant_fill_shape_attribute.prototxt +++ b/ngraph/test/models/onnx/constant_fill_shape_attribute.prototxt @@ -2,7 +2,6 @@ ir_version: 7 producer_name: "backend-test" graph { node { - input: "target_shape" output: "output" op_type: "ConstantFill" attribute { diff --git a/ngraph/test/runtime/ie/unit_test.manifest b/ngraph/test/runtime/ie/unit_test.manifest index 3483b054310..fd6a5df50ce 100644 --- a/ngraph/test/runtime/ie/unit_test.manifest +++ b/ngraph/test/runtime/ie/unit_test.manifest @@ -339,13 +339,7 @@ max_matrix_to_scalar_zero_by_zero max_3d_eliminate_zero_dim lrn_across_empty lrn_2d_across_empty -normalize_across_empty_axes_input -normalize_l2_all_mode_add -normalize_l2_none_mode_add -normalize_l2_zero_mode_add -normalize_l2_all_mode_max -normalize_l2_none_mode_max -normalize_l2_zero_mode_max + squeeze_default_axes dynamic_abc broadcast_v1 @@ -426,7 +420,6 @@ lrn_across_all_dims elu elu_negative_alpha max_pool_2d_1channel_1image_overpadded -normalize_across_chw_4d_max_bias grn_2d_with_bias erf divide_adjoint_stability @@ -676,10 +669,6 @@ conv_bias_bprop_2d # Cannot cast ngraph node ConvolutionBiasAdd to CNNLayer! conv_bias_add_2d -# [Validation] Argument must have rank >= 2 and <= 4 (argument shape: {1,2,2,2,3}) -normalize_across_1axis_5d -normalize_across_123axes_5d - # Unsupported operator detected in the graph. gemm gemm_C @@ -917,6 +906,56 @@ non_zero non_zero_all_1s non_zero_all_0s +# NormalizeL2 - output mismatch, +# mkldnn_normalize_nchw applies eps after sqrt for across_spatial +# Issue: 59586 +IE_CPU.normalize_l2_4D_axes_123_big_eps_max +IE_CPU.normalize_l2_4D_axes_123_big_eps_add + +# NomalizeL2 - unsorted axes are not supported, +# message: "Doesn't support reduction axes: (3.1.2)" +# Issue: 59794 +IE_CPU.normalize_l2_4D_axes_unsorted_312_max +IE_CPU.normalize_l2_4D_axes_unsorted_312_add + +# NormalizeL2 - Plugins support normalize over "channel" dimension +# or "channel + all spatial" dimensions for 2D, 3D or 4D cases +# Issue: 35627, 59791 +normalize_l2_1D_axes_empty_add +normalize_l2_1D_axes_empty_max +normalize_l2_1D_axes_0_add +normalize_l2_1D_axes_0_max +normalize_l2_2D_axes_0_add +normalize_l2_2D_axes_0_max +normalize_l2_2D_axes_01_add +normalize_l2_2D_axes_01_max +normalize_l2_3D_axes_2_add +normalize_l2_3D_axes_2_max +normalize_l2_4D_axes_0_max +normalize_l2_4D_axes_0_add +normalize_l2_4D_axes_2_max +normalize_l2_4D_axes_2_add +normalize_l2_4D_axes_3_max +normalize_l2_4D_axes_3_add +normalize_l2_4D_axes_23_max +normalize_l2_4D_axes_23_add +normalize_l2_4D_axes_0123_max +normalize_l2_4D_axes_0123_add +normalize_l2_5D_axes_empty_max +normalize_l2_5D_axes_empty_add +normalize_l2_5D_axes_1_max +normalize_l2_5D_axes_1_add +normalize_l2_5D_axes_2_max +normalize_l2_5D_axes_2_add +normalize_l2_5D_axes_3_max +normalize_l2_5D_axes_3_add +normalize_l2_5D_axes_4_max +normalize_l2_5D_axes_4_add +normalize_l2_5D_axes_34_max +normalize_l2_5D_axes_34_add +normalize_l2_5D_axes_234_max +normalize_l2_5D_axes_234_add + # (Constant W, R inputs are required) Ticket: 49207 # W, R inputs as Parameter, default clip value # Operation has a form that is not supported. @@ -938,90 +977,6 @@ roll_3d_input roll_3d_input_negative_shift roll_negative_axes -# convert operation -IE_CPU.convert_u8_to_boolean -IE_CPU.convert_i32_to_boolean -IE_CPU.convert_f32_to_boolean -IE_CPU.convert_u8_to_f16 -IE_CPU.convert_u8_to_i16 -IE_CPU.convert_u8_to_i64 -IE_CPU.convert_u8_to_u16 -IE_CPU.convert_u8_to_u32 -IE_CPU.convert_u8_to_u64 -IE_CPU.convert_f16_to_f32 -IE_CPU.convert_u32_to_f32 -IE_CPU.convert_i4_to_f32 -IE_CPU.convert_u1_to_f32 -IE_CPU.convert_u4_to_f32 - -IE_CPU.convert_u1_to_u1 -IE_CPU.convert_u4_to_u1 -IE_CPU.convert_u8_to_u1 -IE_CPU.convert_u16_to_u1 -IE_CPU.convert_u32_to_u1 -IE_CPU.convert_u64_to_u1 -IE_CPU.convert_i4_to_u1 -IE_CPU.convert_i8_to_u1 -IE_CPU.convert_i16_to_u1 -IE_CPU.convert_i32_to_u1 -IE_CPU.convert_i64_to_u1 -IE_CPU.convert_f16_to_u1 -IE_CPU.convert_bf16_to_u1 -IE_CPU.convert_f32_to_u1 - -IE_CPU.convert_u1_to_i4 -IE_CPU.convert_u4_to_i4 -IE_CPU.convert_u8_to_i4 -IE_CPU.convert_u16_to_i4 -IE_CPU.convert_u32_to_i4 -IE_CPU.convert_u64_to_i4 -IE_CPU.convert_i8_to_i4 -IE_CPU.convert_i16_to_i4 -IE_CPU.convert_i32_to_i4 -IE_CPU.convert_i64_to_i4 -IE_CPU.convert_f16_to_i4 -IE_CPU.convert_bf16_to_i4 -IE_CPU.convert_f32_to_i4 - -IE_CPU.convert_u1_to_u4 -IE_CPU.convert_u4_to_u4 -IE_CPU.convert_u8_to_u4 -IE_CPU.convert_u16_to_u4 -IE_CPU.convert_u32_to_u4 -IE_CPU.convert_u64_to_u4 -IE_CPU.convert_i4_to_u4 -IE_CPU.convert_i8_to_u4 -IE_CPU.convert_i16_to_u4 -IE_CPU.convert_i32_to_u4 -IE_CPU.convert_i64_to_u4 -IE_CPU.convert_f16_to_u4 -IE_CPU.convert_bf16_to_u4 -IE_CPU.convert_f32_to_u4 - -IE_CPU.convert_u1_to_i8 -IE_CPU.convert_u4_to_i8 -IE_CPU.convert_i4_to_i8 -IE_CPU.convert_u1_to_i16 -IE_CPU.convert_u4_to_i16 -IE_CPU.convert_i4_to_i16 -IE_CPU.convert_u1_to_i32 -IE_CPU.convert_u4_to_i32 -IE_CPU.convert_i4_to_i32 -IE_CPU.convert_u1_to_i64 -IE_CPU.convert_u4_to_i64 -IE_CPU.convert_i4_to_i64 -IE_CPU.convert_u1_to_u8 -IE_CPU.convert_u4_to_u8 -IE_CPU.convert_i4_to_u8 -IE_CPU.convert_u1_to_u16 -IE_CPU.convert_u4_to_u16 -IE_CPU.convert_i4_to_u16 -IE_CPU.convert_u1_to_u32 -IE_CPU.convert_u4_to_u32 -IE_CPU.convert_i4_to_u32 -IE_CPU.convert_u1_to_u64 -IE_CPU.convert_u4_to_u64 -IE_CPU.convert_i4_to_u64 #------------------------------------------------------------------------------- # # Inference Engine CPU plugin excludes diff --git a/ngraph/test/type_prop/prior_box_clustered.cpp b/ngraph/test/type_prop/prior_box_clustered.cpp new file mode 100644 index 00000000000..1c4cb0e3599 --- /dev/null +++ b/ngraph/test/type_prop/prior_box_clustered.cpp @@ -0,0 +1,133 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "gtest/gtest.h" + +#include "util/type_prop.hpp" +#include "ngraph/ngraph.hpp" +#include "ngraph/op/prior_box_clustered.hpp" + +using namespace ngraph; + + +TEST(type_prop, prior_box_clustered) +{ + op::PriorBoxClusteredAttrs attrs; + attrs.widths = {4.0f, 2.0f, 3.2f}; + attrs.heights = {1.0f, 2.0f, 1.1f}; + + auto layer_shape = op::Constant::create(element::i64, Shape{2}, {19, 19}); + auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); + auto pbc = std::make_shared(layer_shape, image_shape, attrs); + // Output shape - 4 * 19 * 19 * 3 (attrs.widths.size()) + ASSERT_EQ(pbc->get_shape(), (Shape{2, 4332})); +} + +TEST(type_prop, prior_box_clustered_float_layer_shape) +{ + op::PriorBoxClusteredAttrs attrs; + attrs.widths = {4.0f, 2.0f, 3.2f}; + attrs.heights = {1.0f, 2.0f, 1.1f}; + + auto layer_shape = op::Constant::create(element::f32, Shape{2}, {19, 19}); + auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); + + try + { + auto pbc = std::make_shared(layer_shape, image_shape, attrs); + // Should have thrown, so fail if it didn't + FAIL() << "Incorrect prior_box_clustered value type exception not handled"; + } + catch (const NodeValidationFailure& error) + { + EXPECT_HAS_SUBSTRING( + error.what(), + std::string("layer shape input must be an integral number")); + } + catch (...) + { + FAIL() << "Deduced type check failed for unexpected reason"; + } +} + +TEST(type_prop, prior_box_clustered_float_image_shape) +{ + op::PriorBoxClusteredAttrs attrs; + attrs.widths = {4.0f, 2.0f, 3.2f}; + attrs.heights = {1.0f, 2.0f, 1.1f}; + + auto layer_shape = op::Constant::create(element::i64, Shape{2}, {19, 19}); + auto image_shape = op::Constant::create(element::f32, Shape{2}, {300, 300}); + + try + { + auto pbc = std::make_shared(layer_shape, image_shape, attrs); + // Should have thrown, so fail if it didn't + FAIL() << "Incorrect prior_box_clustered value type exception not handled"; + } + catch (const NodeValidationFailure& error) + { + EXPECT_HAS_SUBSTRING( + error.what(), + std::string("image shape input must be an integral number")); + } + catch (...) + { + FAIL() << "Deduced type check failed for unexpected reason"; + } +} + +TEST(type_prop, prior_box_clustered_widths_heights_different) +{ + op::PriorBoxClusteredAttrs attrs; + attrs.widths = {4.0f, 2.0f, 3.2f}; + attrs.heights = {1.0f, 2.0f}; + + auto layer_shape = op::Constant::create(element::i64, Shape{2}, {19, 19}); + auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); + + try + { + auto pbc = std::make_shared(layer_shape, image_shape, attrs); + // Should have thrown, so fail if it didn't + FAIL() << "Incorrect prior_box_clustered value type exception not handled"; + } + catch (const NodeValidationFailure& error) + { + EXPECT_HAS_SUBSTRING( + error.what(), + std::string("Size of heights vector:")); + } + catch (...) + { + FAIL() << "Deduced type check failed for unexpected reason"; + } +} + +TEST(type_prop, prior_box_clustered_not_rank_2) +{ + op::PriorBoxClusteredAttrs attrs; + attrs.widths = {4.0f, 2.0f, 3.2f}; + attrs.heights = {1.0f, 2.0f, 1.1f}; + + auto layer_shape = op::Constant::create(element::i64, Shape{3}, {19, 19, 19}); + auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); + + try + { + auto pbc = std::make_shared(layer_shape, image_shape, attrs); + // Should have thrown, so fail if it didn't + FAIL() << "Incorrect prior_box_clustered value type exception not handled"; + } + catch (const NodeValidationFailure& error) + { + EXPECT_HAS_SUBSTRING( + error.what(), + std::string("Layer shape must have rank 2")); + } + catch (...) + { + FAIL() << "Deduced type check failed for unexpected reason"; + } +} diff --git a/ngraph/test/type_prop_layers.cpp b/ngraph/test/type_prop_layers.cpp index efb6a49ee14..8ef1cd28efb 100644 --- a/ngraph/test/type_prop_layers.cpp +++ b/ngraph/test/type_prop_layers.cpp @@ -7,7 +7,6 @@ #include "ngraph/ngraph.hpp" #include "ngraph/op/ctc_greedy_decoder.hpp" #include "ngraph/op/interpolate.hpp" -#include "ngraph/op/prior_box_clustered.hpp" #include "ngraph/op/region_yolo.hpp" #include "ngraph/op/reorg_yolo.hpp" #include "ngraph/op/roi_pooling.hpp" @@ -45,19 +44,6 @@ TEST(type_prop_layers, interpolate) .same_scheme(PartialShape{2, 2, Dimension::dynamic(), Dimension::dynamic()})); } -TEST(type_prop_layers, prior_box_clustered) -{ - op::PriorBoxClusteredAttrs attrs; - attrs.widths = {4.0f, 2.0f, 3.2f}; - attrs.heights = {1.0f, 2.0f, 1.1f}; - - auto layer_shape = op::Constant::create(element::i64, Shape{2}, {19, 19}); - auto image_shape = op::Constant::create(element::i64, Shape{2}, {300, 300}); - auto pbc = make_shared(layer_shape, image_shape, attrs); - // Output shape - 4 * 19 * 19 * 3 (attrs.widths.size()) - ASSERT_EQ(pbc->get_shape(), (Shape{2, 4332})); -} - TEST(type_prop_layers, region_yolo1) { auto inputs = make_shared(element::f32, Shape{1, 125, 13, 13}); diff --git a/ngraph/test/util/engine/ie_engines.cpp b/ngraph/test/util/engine/ie_engines.cpp index ce5e4247b8f..321e1132076 100644 --- a/ngraph/test/util/engine/ie_engines.cpp +++ b/ngraph/test/util/engine/ie_engines.cpp @@ -307,6 +307,8 @@ std::set test::IE_Engine::get_ie_ops() const ie_ops.insert(opset6.begin(), opset6.end()); const auto& opset7 = get_opset7().get_type_info_set(); ie_ops.insert(opset7.begin(), opset7.end()); + const auto& opset8 = get_opset8().get_type_info_set(); + ie_ops.insert(opset8.begin(), opset8.end()); return ie_ops; } diff --git a/ngraph/test/visitors/op/prior_box_clustered.cpp b/ngraph/test/visitors/op/prior_box_clustered.cpp new file mode 100644 index 00000000000..1e85dcdb27d --- /dev/null +++ b/ngraph/test/visitors/op/prior_box_clustered.cpp @@ -0,0 +1,47 @@ +// Copyright (C) 2018-2021 Intel Corporation +// SPDX-License-Identifier: Apache-2.0 +// + +#include "gtest/gtest.h" + +#include "ngraph/ngraph.hpp" +#include "util/visitor.hpp" +#include "ngraph/opsets/opset1.hpp" + +using namespace std; +using namespace ngraph; +using ngraph::test::NodeBuilder; +using ngraph::test::ValueMap; + +TEST(attributes, prior_box_clustered_op) +{ + NodeBuilder::get_ops().register_factory(); + const auto layer_shape = make_shared(element::i64, Shape{32, 32}); + const auto image_shape = make_shared(element::i64, Shape{300, 300}); + + op::PriorBoxClusteredAttrs attrs; + attrs.heights = {2.0f, 3.0f}; + attrs.widths = {2.0f, 3.0f}; + attrs.clip = true; + attrs.step_widths = 0.0f; + attrs.step_heights = 0.0f; + attrs.step = 0.0f; + attrs.offset = 0.0f; + attrs.variances = {0.1f}; + + auto pbc = make_shared(layer_shape, image_shape, attrs); + NodeBuilder builder(pbc); + auto g_pbc = as_type_ptr(builder.create()); + const auto pbc_attrs = pbc->get_attrs(); + const auto g_pbc_attrs = g_pbc->get_attrs(); + const auto expected_attr_count = 8; + + EXPECT_EQ(builder.get_value_map_size(), expected_attr_count); + EXPECT_EQ(g_pbc_attrs.heights, pbc_attrs.heights); + EXPECT_EQ(g_pbc_attrs.widths, pbc_attrs.widths); + EXPECT_EQ(g_pbc_attrs.clip, pbc_attrs.clip); + EXPECT_EQ(g_pbc_attrs.step_widths, pbc_attrs.step_widths); + EXPECT_EQ(g_pbc_attrs.step_heights, pbc_attrs.step_heights); + EXPECT_EQ(g_pbc_attrs.offset, pbc_attrs.offset); + EXPECT_EQ(g_pbc_attrs.variances, pbc_attrs.variances); +}