Minimized legacy usage in tests (#5591)

* Minimized legacy usage in tests

* Use legacy only for specific files

* Fixed code style

* Fixed linkage

* Removed old CPU / GPU tests binaries

* Test

* Disabled IB console

* Disabled test for AUTO QueryNetwork from parallel threads
This commit is contained in:
Ilya Lavrenov authored and GitHub committed 2021-05-14 18:47:54 +03:00
1 parent 500b922457
commit a3448032ca
72 files changed
+439 -620

No files matched your search

+1 -1
View File
@@ -163,7 +163,7 @@ jobs:
- 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* --gtest_output=xml:TEST-cpuFuncTests-IB.xml /testlevel=24
$(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* --gtest_output=xml:TEST-cpuFuncTests-IB.xml
displayName: 'CPU FuncTests - IB'
continueOnError: false
@@ -3,5 +3,5 @@
#
add_subdirectory(shared_test_classes)
add_subdirectory(inference_engine)
add_subdirectory(plugin)
add_subdirectory(inference_engine)
@@ -58,6 +58,21 @@ ie_faster_build(${TARGET_NAME}
PCH PRIVATE "precomp.hpp"
)
# CVS-55343
file(GLOB_RECURSE legacy_tests
"${CMAKE_CURRENT_SOURCE_DIR}/transformations/*.cpp" # CVS-55385
"${CMAKE_CURRENT_SOURCE_DIR}/lp_transformations/*.cpp" # CVS-55376
"${CMAKE_CURRENT_SOURCE_DIR}/ngraph_reader/*.cpp" # CVS-55365
"${CMAKE_CURRENT_SOURCE_DIR}/cnn_network/cnn_ngraph_impl_tests.cpp" # CVS-55375
"${CMAKE_CURRENT_SOURCE_DIR}/core_threading_tests.cpp" # CVS-55257
"${CMAKE_CURRENT_SOURCE_DIR}/caching_test.cpp" # CVS-55257
"${CMAKE_CURRENT_SOURCE_DIR}/local_test.cpp" # CVS-55386
)
set_source_files_properties(${legacy_tests} PROPERTIES INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>)
include(CMakeParseArguments)
#
@@ -7,9 +7,11 @@
#include <vector>
#include <thread>
#include <chrono>
#include <functional>
#include <gtest/gtest.h>
#include <gmock/gmock.h>
#include "ie_core.hpp"
#include "ie_plugin_ptr.hpp"
#include "ngraph/function.hpp"
#include "details/ie_so_loader.h"
@@ -23,7 +25,6 @@
#include "common_test_utils/test_constants.hpp"
#include "functional_test_utils/test_model/test_model.hpp"
#include "functional_test_utils/network_utils.hpp"
#include "unit_test_utils/mocks/mock_iexecutable_network.hpp"
#include "unit_test_utils/mocks/mock_iinfer_request.hpp"
@@ -20,8 +20,16 @@
#include <fstream>
class CoreThreadingTests : public ::testing::Test {
protected:
std::string modelName = "CoreThreadingTests.xml", weightsName = "CoreThreadingTests.bin";
public:
void SetUp() override {
FuncTestUtils::TestModel::generateTestModel(modelName, weightsName);
}
void TearDown() override {
CommonTestUtils::removeIRFiles(modelName, weightsName);
}
void runParallel(std::function<void(void)> func,
@@ -138,11 +146,10 @@ TEST_F(CoreThreadingTests, DISABLED_GetAvailableDevices) {
// tested function: ReadNetwork, AddExtension
TEST_F(CoreThreadingTests, ReadNetwork) {
InferenceEngine::Core ie;
auto model = FuncTestUtils::TestModel::convReluNormPoolFcModelFP32;
auto network = ie.ReadNetwork(model.model_xml_str, model.weights_blob);
auto network = ie.ReadNetwork(modelName, weightsName);
runParallel([&] () {
safeAddExtension(ie);
(void)ie.ReadNetwork(model.model_xml_str, model.weights_blob);
(void)ie.ReadNetwork(modelName, weightsName);
}, 100, 12);
}
@@ -3,7 +3,6 @@
//
#include <string>
#include <legacy/ie_util_internal.hpp>
#include "ngraph_reader_tests.hpp"
using namespace InferenceEngine;
@@ -40,18 +39,13 @@ TEST_F(NGraphReaderTests, ReadConstantNetwork) {
</net>
)V0G0N";
IE_SUPPRESS_DEPRECATED_START
Core ie;
Blob::Ptr weights;
Core ie;
Blob::Ptr weights;
weights = make_shared_blob<uint8_t>(TensorDesc(Precision::U8, {5808}, Layout::C));
weights->allocate();
weights = make_shared_blob<uint8_t>(TensorDesc(Precision::U8, {5808}, Layout::C));
weights->allocate();
auto network = ie.ReadNetwork(model, weights);
auto clonedNetwork = cloneNetwork(network);
auto clonedNet = cloneNet(network);
IE_SUPPRESS_DEPRECATED_END
auto network = ie.ReadNetwork(model, weights);
}
TEST_F(NGraphReaderTests, ReadConstantNetworkWithNegativeDimension) {
@@ -4,7 +4,6 @@
#include <string>
#include <ngraph/ngraph.hpp>
#include <legacy/ie_util_internal.hpp>
#include <common_test_utils/xml_net_builder/xml_filler.hpp>
#include "ngraph_reader_tests.hpp"
@@ -19,7 +18,7 @@ public:
m_element_type(element_type),
m_shape(shape),
m_data(data) {
constructor_validate_and_infer_types();
constructor_validate_and_infer_types();
}
void validate_and_infer_types() override {
set_output_type(0, m_element_type, m_shape);
@@ -40,30 +39,27 @@ public:
ngraph::Shape getShapeAttr() const { return m_shape; }
void* getDataPtr() { return (m_data ? m_data->get_ptr() : nullptr); }
private:
ngraph::element::Type m_element_type;
ngraph::Shape m_shape{};
std::shared_ptr<ngraph::runtime::AlignedBuffer> m_data;
private:
ngraph::element::Type m_element_type;
ngraph::Shape m_shape{};
std::shared_ptr<ngraph::runtime::AlignedBuffer> m_data;
};
constexpr ngraph::NodeTypeInfo CustomAddConst::type_info;
class CustomAddConstExtension : public InferenceEngine::IExtension {
public:
CustomAddConstExtension() {
}
public:
void GetVersion(const InferenceEngine::Version*& versionInfo) const noexcept override {}
void GetVersion(const InferenceEngine::Version*& versionInfo) const noexcept override {}
void Unload() noexcept override {}
void Unload() noexcept override {}
std::map<std::string, ngraph::OpSet> getOpSets() override {
std::map<std::string, ngraph::OpSet> opsets;
ngraph::OpSet opset;
opset.insert<CustomAddConst>();
opsets["custom_opset"] = opset;
return opsets;
}
std::map<std::string, ngraph::OpSet> getOpSets() override {
std::map<std::string, ngraph::OpSet> opsets;
ngraph::OpSet opset;
opset.insert<CustomAddConst>();
opsets["custom_opset"] = opset;
return opsets;
}
};
TEST_F(NGraphReaderTests, ReadCustomAddConstNetwork) {
@@ -106,26 +102,22 @@ TEST_F(NGraphReaderTests, ReadCustomAddConstNetwork) {
</net>
)V0G0N";
std::string expectedValue = std::string("0?|%.g6/,-{5~P1>");
const std::string expectedValue = std::string("0?|%.g6/,-{5~P1>");
REPLACE_WITH_STR(model, "_VALUE_", expectedValue);
InferenceEngine::Blob::CPtr weights;
InferenceEngine::Core ie;
ie.AddExtension(std::make_shared<CustomAddConstExtension>());
auto network = ie.ReadNetwork(model, weights);
IE_SUPPRESS_DEPRECATED_START
auto convertedNetwork = std::make_shared<InferenceEngine::details::CNNNetworkImpl>(network);
for (auto it = details::CNNNetworkIterator(convertedNetwork.get()); it != details::CNNNetworkIterator(); it++) {
InferenceEngine::CNNLayerPtr layer = *it;
ASSERT_NE(nullptr, layer->getNode());
bool found = false;
for (const auto & op : network.getFunction()->get_ops()) {
if (auto casted = std::dynamic_pointer_cast<CustomAddConst>(op)) {
std::string actualValue(reinterpret_cast<char *>(casted->getDataPtr()),
expectedValue.length());
ASSERT_EQ(expectedValue, actualValue);
found = true;
}
}
InferenceEngine::CNNLayerPtr customAdd;
convertedNetwork->getLayerByName("activation", customAdd, nullptr);
ASSERT_EQ(expectedValue, customAdd->GetParamAsString("value"));
IE_SUPPRESS_DEPRECATED_END
ASSERT_TRUE(found);
}
@@ -4,7 +4,6 @@
#include <string>
#include "ngraph_reader_tests.hpp"
#include "common_test_utils/xml_net_builder/ir_net.hpp"
TEST_F(NGraphReaderTests, ReadEinsumNetwork) {
std::string model = R"V0G0N(
@@ -255,10 +255,4 @@ TEST_F(NGraphReaderTests, ReadFQNetwork) {
Core reader;
auto cnn = reader.ReadNetwork(model, weights);
IE_SUPPRESS_DEPRECATED_START
// convert to old representation
auto convertedNetwork = std::make_shared<details::CNNNetworkImpl>(cnn);
(void)convertedNetwork;
IE_SUPPRESS_DEPRECATED_END
}
@@ -14,7 +14,7 @@
#include "common_test_utils/unicode_utils.hpp"
#include "common_test_utils/file_utils.hpp"
#include "functional_test_utils/test_model/test_model.hpp"
#include "functional_test_utils/network_utils.hpp"
#include "network_utils.hpp"
#ifdef ENABLE_UNICODE_PATH_SUPPORT
@@ -9,10 +9,11 @@
#include <map>
#include <algorithm>
#include "functional_test_utils/network_utils.hpp"
#include "network_utils.hpp"
#include "cpp/ie_cnn_network.h"
#include "functional_test_utils/blob_utils.hpp"
#include <legacy/net_pass.h>
#include <legacy/details/ie_cnn_network_iterator.hpp>
namespace FuncTestUtils {
@@ -6,7 +6,6 @@
#include "cpp/ie_cnn_network.h"
#include <legacy/cnn_network_impl.hpp>
#include <legacy/details/ie_cnn_network_iterator.hpp>
namespace FuncTestUtils {
@@ -18,7 +18,7 @@
#include "common_test_utils/test_common.hpp"
#include "common_test_utils/file_utils.hpp"
#include "common_test_utils/data_utils.hpp"
#include "functional_test_utils/network_utils.hpp"
#include "network_utils.hpp"
using namespace testing;
using namespace InferenceEngine;
@@ -18,8 +18,6 @@
#include "common_test_utils/ngraph_test_utils.hpp"
#include "legacy/convert_function_to_cnn_network.hpp"
using namespace ngraph;
TEST_F(NGraphReaderTests, ReadNonMaxSuppression5) {
@@ -220,10 +220,4 @@ TEST_F(NGraphReaderTests, ReadReLUScalarNetwork) {
Blob::CPtr blob;
Core reader;
auto cnn = reader.ReadNetwork(model, blob);
IE_SUPPRESS_DEPRECATED_START
// convert to old representation
auto convertedNetwork = std::make_shared<details::CNNNetworkImpl>(cnn);
(void)convertedNetwork;
IE_SUPPRESS_DEPRECATED_END
}
@@ -3,6 +3,8 @@
//
#include <string>
#include <ngraph/function.hpp>
#include "ngraph_reader_tests.hpp"
TEST_F(NGraphReaderTests, ReadNetworkWithTensorNames) {
@@ -23,7 +23,6 @@
#include <ngraph/opsets/opset.hpp>
#include <ngraph/graph_util.hpp>
#include <legacy/ie_util_internal.hpp>
#include <ie_core.hpp>
#include "common_test_utils/test_common.hpp"
@@ -337,10 +336,6 @@ TEST_F(NGraphReshapeTests, ReshapeNewIRWithNewExtension1) {
auto output = network.getOutputsInfo();
SizeVector outDims = output["activation"]->getTensorDesc().getDims();
ASSERT_EQ(outDims, refAfterReshape);
// Convert to CNNNetwork
auto convertedNetwork = std::make_shared<InferenceEngine::details::CNNNetworkImpl>(network);
auto layer = CommonTestUtils::getLayerByName(InferenceEngine::CNNNetwork(convertedNetwork), "activation");
ASSERT_EQ("CustomTestLayer", layer->type);
}
TEST_F(NGraphReshapeTests, ReshapeNewIRWithNewExtension2) {
@@ -408,12 +403,6 @@ TEST_F(NGraphReshapeTests, ReshapeNewIRWithNewExtension2) {
auto output = network.getOutputsInfo();
SizeVector outDims = output["activation"]->getTensorDesc().getDims();
ASSERT_EQ(outDims, refAfterReshape);
// Convert to CNNNetwork
auto convertedNetwork = std::make_shared<InferenceEngine::details::CNNNetworkImpl>(network);
auto layer = CommonTestUtils::getLayerByName(InferenceEngine::CNNNetwork(convertedNetwork), "activation");
ASSERT_EQ("CustomTestLayer", layer->type);
ASSERT_EQ("false", layer->params["test1"]);
ASSERT_EQ("3", layer->params["test2"]);
}
class BadExtension : public InferenceEngine::IExtension {
@@ -12,7 +12,6 @@
#include <ngraph/pass/manager.hpp>
#include <ngraph/function.hpp>
#include <ngraph/opsets/opset5.hpp>
#include <legacy/ngraph_ops/fully_connected.hpp>
#include <transformations/op_conversions/convert_ti_to_sequences.hpp>
#include <transformations/utils/utils.hpp>
#include <transformations/init_node_info.hpp>
@@ -15,7 +15,6 @@
#include <ngraph/function.hpp>
#include <ngraph/opsets/opset3.hpp>
#include <ngraph/pass/constant_folding.hpp>
#include <legacy/ngraph_ops/fully_connected.hpp>
#include <transformations/common_optimizations/depth_to_space_fusion.hpp>
#include <transformations/utils/utils.hpp>
#include <transformations/init_node_info.hpp>
@@ -5,6 +5,7 @@
#include <gtest/gtest.h>
#include <cpp/ie_cnn_network.h>
#include <legacy/cnn_network_impl.hpp> // deprecated API
#include <legacy/details/ie_cnn_network_iterator.hpp> // deprecated API
#include <ngraph/function.hpp>
#include <ngraph/opsets/opset1.hpp>
@@ -16,8 +16,6 @@
#include <ngraph/opsets/opset1.hpp>
#include <ngraph/opsets/opset3.hpp>
#include <ngraph/pass/constant_folding.hpp>
#include <legacy/ngraph_ops/fully_connected.hpp>
#include <legacy/transformations/convert_opset1_to_legacy/fc_bias_fusion.hpp>
#include <transformations/common_optimizations/optimize_strided_slice.hpp>
#include <transformations/utils/utils.hpp>
@@ -12,7 +12,6 @@
#include <ngraph/function.hpp>
#include <ngraph/opsets/opset6.hpp>
#include <ngraph/pass/manager.hpp>
#include <legacy/ngraph_ops/fully_connected.hpp>
#include <transformations/control_flow/unroll_tensor_iterator.hpp>
#include <transformations/utils/utils.hpp>
#include <transformations/init_node_info.hpp>
@@ -12,7 +12,6 @@
#include <ngraph/function.hpp>
#include <ngraph/opsets/opset4.hpp>
#include <ngraph/pass/manager.hpp>
#include <legacy/ngraph_ops/fully_connected.hpp>
#include <transformations/control_flow/unroll_tensor_iterator.hpp>
#include <transformations/utils/utils.hpp>
#include <transformations/init_node_info.hpp>
@@ -21,4 +21,3 @@ if (ENABLE_MYRIAD)
endif()
add_subdirectory(conformance)
@@ -30,3 +30,8 @@ addIeTargetTest(
LABELS
CPU
)
# CVS-55352
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/bfloat16/memory_conv.cpp"
PROPERTIES INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>)
@@ -8,74 +8,71 @@
#include <onnx_import/onnx_utils.hpp>
#include <file_utils.h>
#include <common_test_utils/test_assertions.hpp>
#include <functional_test_utils/test_model/test_model.hpp>
#include <onnx_custom_op.hpp>
class CustomAbsKernel : public InferenceEngine::ILayerExecImpl {
public:
explicit CustomAbsKernel(const std::shared_ptr<ngraph::Node>& node): node(node) {}
public:
explicit CustomAbsKernel(const std::shared_ptr<ngraph::Node>& node): node(node) {}
InferenceEngine::StatusCode
init(InferenceEngine::LayerConfig& /*config*/, InferenceEngine::ResponseDesc* /*resp*/) noexcept override {
return InferenceEngine::StatusCode::OK;
InferenceEngine::StatusCode
init(InferenceEngine::LayerConfig& /*config*/, InferenceEngine::ResponseDesc* /*resp*/) noexcept override {
return InferenceEngine::StatusCode::OK;
}
InferenceEngine::StatusCode getSupportedConfigurations(std::vector<InferenceEngine::LayerConfig>& conf,
InferenceEngine::ResponseDesc* /*resp*/) noexcept override {
InferenceEngine::LayerConfig layerConfig;
layerConfig.dynBatchSupport = true;
if (node->outputs().size() != 1 && node->inputs().size() != 1)
return InferenceEngine::GENERAL_ERROR;
InferenceEngine::DataConfig cfg;
cfg.constant = false;
cfg.inPlace = 0;
InferenceEngine::SizeVector order;
auto partialShape = node->get_output_partial_shape(0);
if (partialShape.is_dynamic())
return InferenceEngine::GENERAL_ERROR;
auto shape = node->get_output_shape(0);
for (size_t i = 0; i < shape.size(); i++) {
order.push_back(i);
}
cfg.desc = InferenceEngine::TensorDesc(InferenceEngine::Precision::FP32,
shape, {shape, order});
layerConfig.outConfs.push_back(cfg);
layerConfig.inConfs.push_back(cfg);
conf.push_back(layerConfig);
return InferenceEngine::OK;
}
InferenceEngine::StatusCode getSupportedConfigurations(std::vector<InferenceEngine::LayerConfig>& conf,
InferenceEngine::ResponseDesc* /*resp*/) noexcept override {
InferenceEngine::LayerConfig layerConfig;
layerConfig.dynBatchSupport = true;
if (node->outputs().size() != 1 && node->inputs().size() != 1)
return InferenceEngine::GENERAL_ERROR;
InferenceEngine::DataConfig cfg;
cfg.constant = false;
cfg.inPlace = 0;
InferenceEngine::SizeVector order;
auto partialShape = node->get_output_partial_shape(0);
if (partialShape.is_dynamic())
return InferenceEngine::GENERAL_ERROR;
auto shape = node->get_output_shape(0);
for (size_t i = 0; i < shape.size(); i++) {
order.push_back(i);
InferenceEngine::StatusCode
execute(std::vector<InferenceEngine::Blob::Ptr>& inputs, std::vector<InferenceEngine::Blob::Ptr>& outputs,
InferenceEngine::ResponseDesc* /*resp*/) noexcept override {
for (size_t i = 0; i < inputs.size(); i++) {
InferenceEngine::MemoryBlob::CPtr minput = InferenceEngine::as<InferenceEngine::MemoryBlob>(inputs[i]);
InferenceEngine::MemoryBlob::Ptr moutput = InferenceEngine::as<InferenceEngine::MemoryBlob>(outputs[i]);
if (!moutput || !minput) {
return InferenceEngine::StatusCode::PARAMETER_MISMATCH;
}
cfg.desc = InferenceEngine::TensorDesc(InferenceEngine::Precision::FP32,
shape, {shape, order});
layerConfig.outConfs.push_back(cfg);
layerConfig.inConfs.push_back(cfg);
conf.push_back(layerConfig);
return InferenceEngine::OK;
}
// locked memory holder should be alive all time while access to its buffer happens
auto minputHolder = minput->rmap();
auto moutputHolder = moutput->wmap();
InferenceEngine::StatusCode
execute(std::vector<InferenceEngine::Blob::Ptr>& inputs, std::vector<InferenceEngine::Blob::Ptr>& outputs,
InferenceEngine::ResponseDesc* /*resp*/) noexcept override {
for (size_t i = 0; i < inputs.size(); i++) {
InferenceEngine::MemoryBlob::CPtr minput = InferenceEngine::as<InferenceEngine::MemoryBlob>(inputs[i]);
InferenceEngine::MemoryBlob::Ptr moutput = InferenceEngine::as<InferenceEngine::MemoryBlob>(outputs[i]);
if (!moutput || !minput) {
return InferenceEngine::StatusCode::PARAMETER_MISMATCH;
}
// locked memory holder should be alive all time while access to its buffer happens
auto minputHolder = minput->rmap();
auto moutputHolder = moutput->wmap();
auto inputData = minputHolder.as<const float *>();
auto outputData = moutputHolder.as<float *>();
for (size_t j = 0; j < minput->size(); j++) {
outputData[j] = inputData[j] < 0 ? (-inputData[j] * 2) : inputData[j];
}
auto inputData = minputHolder.as<const float *>();
auto outputData = moutputHolder.as<float *>();
for (size_t j = 0; j < minput->size(); j++) {
outputData[j] = inputData[j] < 0 ? (-inputData[j] * 2) : inputData[j];
}
return InferenceEngine::StatusCode::OK;
}
return InferenceEngine::StatusCode::OK;
}
private:
const std::shared_ptr<ngraph::Node> node;
private:
const std::shared_ptr<ngraph::Node> node;
};
class CustomAbs : public ngraph::op::Op {
@@ -100,31 +97,28 @@ public:
constexpr ngraph::NodeTypeInfo CustomAbs::type_info;
class CustomAbsExtension : public InferenceEngine::IExtension {
public:
CustomAbsExtension() {
}
public:
void GetVersion(const InferenceEngine::Version*& versionInfo) const noexcept override {}
void GetVersion(const InferenceEngine::Version*& versionInfo) const noexcept override {}
void Unload() noexcept override {}
void Unload() noexcept override {}
std::map<std::string, ngraph::OpSet> getOpSets() override {
std::map<std::string, ngraph::OpSet> opsets;
ngraph::OpSet opset;
opset.insert<CustomAbs>();
opsets["custom_opset"] = opset;
return opsets;
}
std::map<std::string, ngraph::OpSet> getOpSets() override {
std::map<std::string, ngraph::OpSet> opsets;
ngraph::OpSet opset;
opset.insert<CustomAbs>();
opsets["custom_opset"] = opset;
return opsets;
}
std::vector<std::string> getImplTypes(const std::shared_ptr<ngraph::Node>& node) override {
if (node->description() != CustomAbs::type_info.name)
return {};
return {"CPU"};
}
std::vector<std::string> getImplTypes(const std::shared_ptr<ngraph::Node>& node) override {
if (node->description() != CustomAbs::type_info.name)
return {};
return {"CPU"};
}
InferenceEngine::ILayerImpl::Ptr getImplementation(const std::shared_ptr<ngraph::Node>& node, const std::string& implType) override {
return std::make_shared<CustomAbsKernel>(node);
}
InferenceEngine::ILayerImpl::Ptr getImplementation(const std::shared_ptr<ngraph::Node>& node, const std::string& implType) override {
return std::make_shared<CustomAbsKernel>(node);
}
};
void infer_model(InferenceEngine::Core& ie, const std::string& model,
@@ -65,6 +65,9 @@ std::vector<std::string> disabledTestPatterns() {
// Unsupported operation of type: NormalizeL2 name : Doesn't support reduction axes: (2.2)
R"(.*BF16NetworkRestore1.*)",
R"(.*MobileNet_ssd_with_branching.*)",
// AUTO plugin and QueryNetwork
R"(.*CoreThreading.*smoke_QueryNetwork.*targetDevice=AUTO_config.*)",
};
if (!InferenceEngine::with_cpu_x86_avx512_core()) {
@@ -166,7 +166,7 @@ const auto fusingReluAdd = fusingSpecificParams{std::make_shared<postNodesMgr>(s
{[](std::shared_ptr<ngraph::Node> inpNode, const ngraph::element::Type& ngPrc, ngraph::ParameterVector& params){
auto shape = inpNode->get_shape();
if (shape.size() == 1)
THROW_IE_EXCEPTION << "If shape.size() == 1 then Granularity can be PerTensor only";
IE_THROW() << "If shape.size() == 1 then Granularity can be PerTensor only";
ngraph::Shape newShape(shape.size(), 1);
newShape[1] = shape[1];
auto constNode = ngraph::builder::makeConstant(ngPrc, newShape, std::vector<float>{}, true);
@@ -221,7 +221,7 @@ const auto fusingFakeQuantizePerChannel = fusingSpecificParams{std::make_shared<
auto localPrc = inpNode->get_element_type();
auto shape = inpNode->get_shape();
if (shape.size() == 1)
THROW_IE_EXCEPTION << "If shape.size() == 1 then Granularity can be PerTensor only";
IE_THROW() << "If shape.size() == 1 then Granularity can be PerTensor only";
ngraph::Shape newShape(shape.size(), 1);
newShape[1] = shape[1];
return ngraph::builder::makeFakeQuantize(inpNode, localPrc, 256, newShape);
@@ -14,4 +14,12 @@ addIeTargetTest(
ADD_CPPLINT
LABELS
GNA
)
)
# CVS-55347
set_source_files_properties(
"${CMAKE_CURRENT_SOURCE_DIR}/shared_tests_instances/behavior/add_output.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/shared_tests_instances/behavior/memory_states.cpp"
PROPERTIES INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>)
@@ -65,6 +65,7 @@ public:
}
auto importedNetwork = core->ImportNetwork(inputStream, targetDevice, configuration);
std::vector<std::string> queryToState;
IE_SUPPRESS_DEPRECATED_START
for (const auto &query_state : executableNetwork.QueryState()) {
queryToState.push_back(query_state.GetName());
}
@@ -72,6 +73,7 @@ public:
ASSERT_TRUE(std::find(queryToState.begin(), queryToState.end(), next_memory.GetName()) != queryToState.end())
<< "State " << next_memory.GetName() << " expected to be in memory states but it is not!";
}
IE_SUPPRESS_DEPRECATED_END
InferenceEngine::InferRequest importInfer = importedNetwork.CreateInferRequest();
importInfer.Infer();
}
@@ -22,6 +22,22 @@ addIeTargetTest(
GPU
)
# CVS-55376
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/shared_tests_instances/low_precision_transformations/layer_transformation.cpp"
PROPERTIES INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>)
# try to find VA libraries
find_package(PkgConfig QUIET)
if(PkgConfig_FOUND)
pkg_search_module(LIBVA QUIET libva)
endif()
# TODO: pkg_search_module finds libva not in sysroot
if(ANDROID)
set(LIBVA_FOUND OFF CACHE BOOL "" FORCE)
endif()
if(LIBVA_FOUND)
target_compile_definitions(${TARGET_NAME} PRIVATE ENABLE_LIBVA)
target_include_directories(${TARGET_NAME} PRIVATE ${LIBVA_INCLUDE_DIRS})
@@ -11,13 +11,12 @@
#include <ie_core.hpp>
#include <legacy/net_pass.h>
#include <legacy/graph_transformer.h>
#include <legacy/convert_function_to_cnn_network.hpp>
#include <transformations/common_optimizations/common_optimizations.hpp>
#include <legacy/transformations/convert_opset1_to_legacy/convert_opset1_to_legacy.hpp>
#include <legacy/transformations/convert_opset1_to_legacy/convert_prior_to_ie_prior.hpp>
#include <legacy/ngraph_ops/fully_connected.hpp>
#include <legacy/net_pass.h>
#include <transformations/opset_conversions/convert_opset2_to_opset1.hpp>
#include <transformations/opset_conversions/convert_opset3_to_opset2.hpp>
#include <transformations/init_node_info.hpp>
@@ -13,7 +13,6 @@
#include "common_test_utils/test_common.hpp"
#include "common_test_utils/common_utils.hpp"
#include <legacy/details/ie_cnn_network_iterator.hpp>
#include <gtest/gtest.h>
@@ -39,10 +39,15 @@ addIeTarget(
${EXPORT_DEPENDENCIES}
)
# CVS-55376
set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/src/low_precision_transformations/layer_transformation.cpp"
PROPERTIES INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>)
ie_faster_build(${TARGET_NAME}
PCH PRIVATE "src/precomp.hpp"
)
if (TARGET MKLDNNPlugin)
add_dependencies(${TARGET_NAME} MKLDNNPlugin)
endif()
endif()
@@ -13,11 +13,9 @@
#include <file_utils.h>
#include <ngraph_functions/subgraph_builders.hpp>
#include <functional_test_utils/blob_utils.hpp>
#include <functional_test_utils/test_model/test_model.hpp>
#include <common_test_utils/file_utils.hpp>
#include <common_test_utils/test_assertions.hpp>
#include <common_test_utils/test_constants.hpp>
#include <common_test_utils/common_layers_params.hpp>
#include <gtest/gtest.h>
#include <thread>
@@ -177,7 +175,7 @@ TEST_P(CoreThreadingTests, smoke_QueryNetwork) {
}
//
// Parametrized tests with numfer of parallel threads, iterations
// Parameterized tests with number of parallel threads, iterations
//
using Threads = unsigned int;
@@ -13,7 +13,6 @@
#include <vector>
#include <string>
#include <ie_core.hpp>
#include <legacy/details/ie_cnn_network_tools.h>
#include <base/behavior_test_utils.hpp>
#include <exec_graph_info.hpp>
#include "common_test_utils/common_utils.hpp"
@@ -79,54 +78,35 @@ TEST_P(ExecGraphTests, CheckExecGraphInfoBeforeExecution) {
originalLayersMap[layer->get_friendly_name()] = 0;
}
int IteratorForLayersConstant = 0;
if (auto function = execGraph.getFunction()) {
for (const auto & op : function->get_ops()) {
const auto & rtInfo = op->get_rt_info();
auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string {
auto it = rtInfo.find(paramName);
IE_ASSERT(rtInfo.end() != it);
auto value = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(it->second);
IE_ASSERT(nullptr != value);
auto function = execGraph.getFunction();
ASSERT_NE(function, nullptr);
return value->get();
};
for (const auto & op : function->get_ops()) {
const auto & rtInfo = op->get_rt_info();
// Each layer from the execGraphInfo network must have PM data option set
ASSERT_EQ("not_executed", getExecValue(ExecGraphInfoSerialization::PERF_COUNTER));
// Parse origin layer names (fused/merged layers) from the executable graph
// and compare with layers from the original model
auto origFromExecLayer = getExecValue(ExecGraphInfoSerialization::ORIGINAL_NAMES);
if (origFromExecLayer == "")
IteratorForLayersConstant++;
std::vector<std::string> origFromExecLayerSep = separateStrToVec(origFromExecLayer, ',');
std::for_each(origFromExecLayerSep.begin(), origFromExecLayerSep.end(), [&](const std::string &layer) {
auto origLayer = originalLayersMap.find(layer);
ASSERT_NE(originalLayersMap.end(), origLayer) << layer;
origLayer->second++;
});
}
} else {
IE_SUPPRESS_DEPRECATED_START
// Store all the layers from the executable graph information represented as CNNNetwork
const std::vector<InferenceEngine::CNNLayerPtr> execGraphLayers =
InferenceEngine::details::CNNNetSortTopologically(execGraph);
for (const auto &execLayer : execGraphLayers) {
// Each layer from the execGraphInfo network must have PM data option set
ASSERT_EQ("not_executed", execLayer->params[ExecGraphInfoSerialization::PERF_COUNTER]);
// Parse origin layer names (fused/merged layers) from the executable graph
// and compare with layers from the original model
auto origFromExecLayer = execLayer->params[ExecGraphInfoSerialization::ORIGINAL_NAMES];
if (origFromExecLayer == "")
IteratorForLayersConstant++;
std::vector<std::string> origFromExecLayerSep = separateStrToVec(origFromExecLayer, ',');
std::for_each(origFromExecLayerSep.begin(), origFromExecLayerSep.end(), [&](const std::string &layer) {
auto origLayer = originalLayersMap.find(layer);
ASSERT_NE(originalLayersMap.end(), origLayer) << layer;
origLayer->second++;
});
}
IE_SUPPRESS_DEPRECATED_END
auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string {
auto it = rtInfo.find(paramName);
IE_ASSERT(rtInfo.end() != it);
auto value = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(it->second);
IE_ASSERT(nullptr != value);
return value->get();
};
// Each layer from the execGraphInfo network must have PM data option set
ASSERT_EQ("not_executed", getExecValue(ExecGraphInfoSerialization::PERF_COUNTER));
// Parse origin layer names (fused/merged layers) from the executable graph
// and compare with layers from the original model
auto origFromExecLayer = getExecValue(ExecGraphInfoSerialization::ORIGINAL_NAMES);
if (origFromExecLayer == "")
IteratorForLayersConstant++;
std::vector<std::string> origFromExecLayerSep = separateStrToVec(origFromExecLayer, ',');
std::for_each(origFromExecLayerSep.begin(), origFromExecLayerSep.end(), [&](const std::string &layer) {
auto origLayer = originalLayersMap.find(layer);
ASSERT_NE(originalLayersMap.end(), origLayer) << layer;
origLayer->second++;
});
}
// All layers from the original IR must be present with in ExecGraphInfo
@@ -168,66 +148,40 @@ TEST_P(ExecGraphTests, CheckExecGraphInfoAfterExecution) {
int IteratorForLayersConstant = 0;
// Store all the layers from the executable graph information represented as CNNNetwork
bool has_layer_with_valid_time = false;
auto function = execGraph.getFunction();
ASSERT_NE(nullptr, function);
if (auto function = execGraph.getFunction()) {
for (const auto & op : function->get_ops()) {
const auto & rtInfo = op->get_rt_info();
for (const auto & op : function->get_ops()) {
const auto & rtInfo = op->get_rt_info();
auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string {
auto it = rtInfo.find(paramName);
IE_ASSERT(rtInfo.end() != it);
auto value = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(it->second);
IE_ASSERT(nullptr != value);
auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string {
auto it = rtInfo.find(paramName);
IE_ASSERT(rtInfo.end() != it);
auto value = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(it->second);
IE_ASSERT(nullptr != value);
return value->get();
};
return value->get();
};
// At least one layer in the topology should be executed and have valid perf counter value
try {
float x = static_cast<float>(std::atof(
getExecValue(ExecGraphInfoSerialization::PERF_COUNTER).c_str()));
ASSERT_GE(x, 0.0f);
has_layer_with_valid_time = true;
} catch (std::exception &) {}
// At least one layer in the topology should be executed and have valid perf counter value
try {
float x = static_cast<float>(std::atof(
getExecValue(ExecGraphInfoSerialization::PERF_COUNTER).c_str()));
ASSERT_GE(x, 0.0f);
has_layer_with_valid_time = true;
} catch (std::exception &) {}
// Parse origin layer names (fused/merged layers) from the executable graph
// and compare with layers from the original model
auto origFromExecLayer = getExecValue(ExecGraphInfoSerialization::ORIGINAL_NAMES);
std::vector<std::string> origFromExecLayerSep = separateStrToVec(origFromExecLayer, ',');
if (origFromExecLayer == "")
IteratorForLayersConstant++;
std::for_each(origFromExecLayerSep.begin(), origFromExecLayerSep.end(), [&](const std::string &layer) {
auto origLayer = originalLayersMap.find(layer);
ASSERT_NE(originalLayersMap.end(), origLayer) << layer;
origLayer->second++;
});
}
} else {
IE_SUPPRESS_DEPRECATED_START
const std::vector<InferenceEngine::CNNLayerPtr> execGraphLayers =
InferenceEngine::details::CNNNetSortTopologically(execGraph);
for (const auto &execLayer : execGraphLayers) {
// At least one layer in the topology should be executed and have valid perf counter value
try {
float x = static_cast<float>(std::atof(
execLayer->params[ExecGraphInfoSerialization::PERF_COUNTER].c_str()));
ASSERT_GE(x, 0.0f);
has_layer_with_valid_time = true;
} catch (std::exception &) {}
// Parse origin layer names (fused/merged layers) from the executable graph
// and compare with layers from the original model
auto origFromExecLayer = execLayer->params[ExecGraphInfoSerialization::ORIGINAL_NAMES];
std::vector<std::string> origFromExecLayerSep = separateStrToVec(origFromExecLayer, ',');
if (origFromExecLayer == "")
IteratorForLayersConstant++;
std::for_each(origFromExecLayerSep.begin(), origFromExecLayerSep.end(), [&](const std::string &layer) {
auto origLayer = originalLayersMap.find(layer);
ASSERT_NE(originalLayersMap.end(), origLayer) << layer;
origLayer->second++;
});
}
IE_SUPPRESS_DEPRECATED_END
// Parse origin layer names (fused/merged layers) from the executable graph
// and compare with layers from the original model
auto origFromExecLayer = getExecValue(ExecGraphInfoSerialization::ORIGINAL_NAMES);
std::vector<std::string> origFromExecLayerSep = separateStrToVec(origFromExecLayer, ',');
if (origFromExecLayer == "")
IteratorForLayersConstant++;
std::for_each(origFromExecLayerSep.begin(), origFromExecLayerSep.end(), [&](const std::string &layer) {
auto origLayer = originalLayersMap.find(layer);
ASSERT_NE(originalLayersMap.end(), origLayer) << layer;
origLayer->second++;
});
}
ASSERT_TRUE(has_layer_with_valid_time);
@@ -10,10 +10,8 @@
#include <memory>
#include "ie_extension.h"
#include <condition_variable>
#include <legacy/ie_util_internal.hpp>
#include <common_test_utils/ngraph_test_utils.hpp>
#include <ngraph_functions/subgraph_builders.hpp>
#include <functional_test_utils/test_model/test_model.hpp>
#include <fstream>
#include <base/behavior_test_utils.hpp>
#include <common_test_utils/test_assertions.hpp>
@@ -47,15 +45,6 @@ TEST_P(BehaviorTests, allocateNullBlob) {
ASSERT_NO_THROW(blob.allocate());
}
TEST_P(BehaviorTests, canNotLoadNetworkWithoutWeights) {
// Skip test according to plugin specific disabledTestPatterns() (if any)
SKIP_IF_CURRENT_TEST_IS_DISABLED()
InferenceEngine::Core core;
auto model = FuncTestUtils::TestModel::convReluNormPoolFcModelFP32;
ASSERT_THROW(core.ReadNetwork(model.model_xml_str, InferenceEngine::Blob::CPtr()),
InferenceEngine::Exception);
}
TEST_P(BehaviorTests, pluginDoesNotChangeOriginalNetwork) {
// Skip test according to plugin specific disabledTestPatterns() (if any)
SKIP_IF_CURRENT_TEST_IS_DISABLED()
@@ -180,7 +180,7 @@ void LoadNetworkCacheTestBase::Run() {
executableNetwork = core->LoadNetwork(cnnNetwork, targetDevice, configuration);
GenerateInputs();
Infer();
} catch (InferenceEngineException &ex) {
} catch (const Exception &ex) {
GTEST_COUT << "Can't loadNetwork without cache for " << m_functionName << " with precision " << m_precision.get_type_name() << std::endl;
GTEST_COUT << "Exception [" << ex.what() << "]" << std::endl;
SKIP();
@@ -1,92 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include <vector>
#include <deque>
#include <unordered_set>
#include <legacy/ie_layers.h>
#include <cpp/ie_cnn_network.h>
using namespace InferenceEngine;
IE_SUPPRESS_DEPRECATED_START
std::vector<InferenceEngine::CNNLayerPtr> TopologicalSort(const InferenceEngine::CNNNetwork& network) {
std::vector<CNNLayerPtr> ordered;
std::unordered_set<std::string> used;
OutputsDataMap outputs = network.getOutputsInfo();
InputsDataMap inputs = network.getInputsInfo();
auto get_consumers = [](const CNNLayerPtr& node) -> std::vector<CNNLayerPtr> {
std::vector<CNNLayerPtr> consumers;
for (const auto & output : node->outData) {
for (const auto &consumer : getInputTo(output)) {
consumers.push_back(consumer.second);
}
}
return consumers;
};
auto bfs = [&used, &ordered, &get_consumers](const CNNLayerPtr& start_node, bool traverse_via_outputs = false) {
if (!start_node) return;
std::deque<CNNLayerPtr> q;
q.push_front(start_node);
while (!q.empty()) {
auto node = q.front();
q.pop_front();
if (used.insert(node->name).second) {
ordered.push_back(node);
}
// Traverse via inputs
for (const auto & input : node->insData) {
auto locked_input = input.lock();
if (!locked_input) {
IE_THROW() << "insData for " << node->name << " is not valid.";
}
if (auto next_node = getCreatorLayer(locked_input).lock()) {
if (!used.count(next_node->name)) {
// Check that all consumers were used
bool all_consumers_used(true);
for (const auto & consumer : get_consumers(next_node)) {
if (!used.count(consumer->name)) all_consumers_used = false;
}
if (all_consumers_used) {
q.push_front(next_node);
}
}
}
}
// Traverse via outputs
if (traverse_via_outputs) {
for (const auto &consumer : get_consumers(node)) {
if (!used.count(consumer->name)) {
q.push_front(consumer);
}
}
}
}
};
// First we run bfs starting from outputs that provides deterministic graph traverse
for (const auto & output : outputs) {
if (!used.count(output.first)) {
bfs(getCreatorLayer(output.second).lock());
}
}
// For cases when graph has no outputs we start bfs from inputs to ensure topological sort
for (const auto & input : inputs) {
const auto data_ptr = input.second->getInputData();
for (const auto & consumer : getInputTo(data_ptr))
if (!used.count(consumer.first)) {
bfs(consumer.second, true);
}
}
std::reverse(ordered.begin(), ordered.end());
return ordered;
}
@@ -17,8 +17,6 @@
#include "execution_graph_tests/num_inputs_fusing_bin_conv.hpp"
std::vector<InferenceEngine::CNNLayerPtr> TopologicalSort(const InferenceEngine::CNNNetwork& network);
namespace ExecutionGraphTests {
std::string ExecGraphInputsFusingBinConv::getTestCaseName(testing::TestParamInfo<std::string> obj) {
@@ -58,60 +56,26 @@ TEST_P(ExecGraphInputsFusingBinConv, CheckNumInputsInBinConvFusingWithConv) {
auto execNet = ie->LoadNetwork(cnnNet, targetDevice);
InferenceEngine::CNNNetwork execGraphInfo = execNet.GetExecGraphInfo();
auto function = execGraphInfo.getFunction();
ASSERT_NE(function, nullptr);
if (auto function = execGraphInfo.getFunction()) {
// try to convert to old representation and check that conversion passed well
std::shared_ptr<InferenceEngine::details::CNNNetworkImpl> convertedExecGraph;
ASSERT_NO_THROW(convertedExecGraph = std::make_shared<InferenceEngine::details::CNNNetworkImpl>(execGraphInfo));
for (const auto & op : function->get_ops()) {
const auto & rtInfo = op->get_rt_info();
auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string {
auto it = rtInfo.find(paramName);
IE_ASSERT(rtInfo.end() != it);
auto value = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(it->second);
IE_ASSERT(nullptr != value);
for (const auto & op : function->get_ops()) {
const auto & rtInfo = op->get_rt_info();
auto getExecValue = [&rtInfo](const std::string & paramName) -> std::string {
auto it = rtInfo.find(paramName);
IE_ASSERT(rtInfo.end() != it);
auto value = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(it->second);
IE_ASSERT(nullptr != value);
return value->get();
};
return value->get();
};
auto layerType = getExecValue("layerType");
if (layerType == "BinaryConvolution") {
auto originalLayersNames = getExecValue("originalLayersNames");
ASSERT_TRUE(originalLayersNames.find("BinaryConvolution") != std::string::npos);
ASSERT_EQ(op->get_input_size(), 2);
}
// IR v7 does not have output nodes
if (ngraph::op::is_output(op))
continue;
IE_SUPPRESS_DEPRECATED_START
InferenceEngine::CNNLayerPtr cnnLayer;
ASSERT_NO_THROW(cnnLayer = CommonTestUtils::getLayerByName(InferenceEngine::CNNNetwork(convertedExecGraph), op->get_friendly_name()));
ASSERT_EQ(cnnLayer->name, op->get_friendly_name());
auto variantType = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(
op->get_rt_info()[ExecGraphInfoSerialization::LAYER_TYPE]);;
ASSERT_EQ(cnnLayer->type, variantType->get());
for (const auto & kvp : cnnLayer->params) {
auto variant = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(op->get_rt_info()[kvp.first]);
ASSERT_EQ(variant->get(), kvp.second);
}
IE_SUPPRESS_DEPRECATED_END
auto layerType = getExecValue("layerType");
if (layerType == "BinaryConvolution") {
auto originalLayersNames = getExecValue("originalLayersNames");
ASSERT_TRUE(originalLayersNames.find("BinaryConvolution") != std::string::npos);
ASSERT_EQ(op->get_input_size(), 2);
}
} else {
IE_SUPPRESS_DEPRECATED_START
std::vector<InferenceEngine::CNNLayerPtr> nodes;
ASSERT_NO_THROW(nodes = TopologicalSort(execGraphInfo));
for (auto &node : nodes) {
if (node->type == "BinaryConvolution") {
std::string originalLayersNames = node->params["originalLayersNames"];
ASSERT_TRUE(originalLayersNames.find("BinaryConvolution") != std::string::npos);
ASSERT_EQ(node->insData.size(), 2);
}
}
IE_SUPPRESS_DEPRECATED_END
}
fnPtr.reset();
@@ -22,8 +22,6 @@
#include "execution_graph_tests/unique_node_names.hpp"
std::vector<InferenceEngine::CNNLayerPtr> TopologicalSort(const InferenceEngine::CNNNetwork& network);
namespace ExecutionGraphTests {
std::string ExecGraphUniqueNodeNames::getTestCaseName(testing::TestParamInfo<LayerTestsUtils::basicParams> obj) {
@@ -46,11 +44,8 @@ void ExecGraphUniqueNodeNames::SetUp() {
std::tie(netPrecision, inputShape, targetDevice) = this->GetParam();
auto ngPrc = FuncTestUtils::PrecisionUtils::convertIE2nGraphPrc(netPrecision);
auto params = ngraph::builder::makeParams(ngPrc, {inputShape});
auto split = ngraph::builder::makeSplit(params[0], ngPrc, 2, 1);
auto concat = std::make_shared<ngraph::opset1::Concat>(split->outputs(), 1);
ngraph::ResultVector results{std::make_shared<ngraph::opset1::Result>(concat)};
@@ -74,33 +69,22 @@ TEST_P(ExecGraphUniqueNodeNames, CheckUniqueNodeNames) {
int expectedReorders = 2;
std::unordered_set<std::string> names;
if (auto function = execGraphInfo.getFunction()) {
for (const auto & op : function->get_ops()) {
ASSERT_TRUE(names.find(op->get_friendly_name()) == names.end()) <<
"Node with name " << op->get_friendly_name() << "already exists";
names.insert(op->get_friendly_name());
auto function = execGraphInfo.getFunction();
ASSERT_NE(function, nullptr);
const auto & rtInfo = op->get_rt_info();
auto it = rtInfo.find(ExecGraphInfoSerialization::LAYER_TYPE);
ASSERT_NE(rtInfo.end(), it);
auto opType = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(it->second);
ASSERT_NE(nullptr, opType);
for (const auto & op : function->get_ops()) {
ASSERT_TRUE(names.find(op->get_friendly_name()) == names.end()) <<
"Node with name " << op->get_friendly_name() << "already exists";
names.insert(op->get_friendly_name());
if (opType->get() == "Reorder") {
numReorders++;
}
}
} else {
auto nodes = TopologicalSort(execGraphInfo);
for (auto &node : nodes) {
IE_SUPPRESS_DEPRECATED_START
ASSERT_TRUE(names.find(node->name) == names.end()) <<
"Node with name " << node->name << "already exists";
names.insert(node->name);
if (node->type == "Reorder") {
numReorders++;
}
IE_SUPPRESS_DEPRECATED_END
const auto & rtInfo = op->get_rt_info();
auto it = rtInfo.find(ExecGraphInfoSerialization::LAYER_TYPE);
ASSERT_NE(rtInfo.end(), it);
auto opType = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(it->second);
ASSERT_NE(nullptr, opType);
if (opType->get() == "Reorder") {
numReorders++;
}
}
@@ -21,7 +21,6 @@
#include <ngraph/function.hpp>
#include <ngraph/opsets/opset1.hpp>
#include <ngraph/pass/constant_folding.hpp>
#include <legacy/ngraph_ops/fully_connected.hpp>
#include <transformations/utils/utils.hpp>
#include <transformations/init_node_info.hpp>
#include <transformations/common_optimizations/depth_to_space_fusion.hpp>
@@ -43,6 +43,7 @@
namespace LayerTestsUtils {
ngraph::pass::low_precision::LowPrecisionTransformations LayerTransformation::getLowPrecisionTransformationsNGraph(
const ngraph::pass::low_precision::LayerTransformation::Params& params) const {
return ngraph::pass::low_precision::LowPrecisionTransformer::getAllTransformations(params).
@@ -43,24 +43,19 @@ TEST_P(ConvBiasFusion, ConvBiasFusion) {
InferenceEngine::Core ie;
InferenceEngine::ExecutableNetwork exeNetwork = ie.LoadNetwork(network, device);
auto net = exeNetwork.GetExecGraphInfo();
auto function = net.getFunction();
ASSERT_NE(nullptr, function);
if (auto function = net.getFunction()) {
for (const auto & op : function->get_ops()) {
if (op->get_friendly_name() == getOutputName()) {
auto rtInfo = op->get_rt_info();
auto it = rtInfo.find("originalLayersNames");
ASSERT_NE(rtInfo.end(), it);
auto variant = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(it->second);
ASSERT_NE(nullptr, variant);
ASSERT_EQ(variant->get(), "add,conv");
break;
}
for (const auto & op : function->get_ops()) {
if (op->get_friendly_name() == getOutputName()) {
auto rtInfo = op->get_rt_info();
auto it = rtInfo.find("originalLayersNames");
ASSERT_NE(rtInfo.end(), it);
auto variant = std::dynamic_pointer_cast<ngraph::VariantImpl<std::string>>(it->second);
ASSERT_NE(nullptr, variant);
ASSERT_EQ(variant->get(), "add,conv");
break;
}
} else {
IE_SUPPRESS_DEPRECATED_START
auto add_layer = CommonTestUtils::getLayerByName(net, getOutputName());
ASSERT_EQ(add_layer->params["originalLayersNames"], "add,conv");
IE_SUPPRESS_DEPRECATED_END
}
}
@@ -28,7 +28,12 @@ addIeTarget(
${EXPORT_DEPENDENCIES}
)
# CVS-55373
set_source_files_properties(
"${CMAKE_CURRENT_SOURCE_DIR}/src/subgraph/softsign.cpp"
PROPERTIES INCLUDE_DIRECTORIES
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>)
ie_faster_build(${TARGET_NAME}
PCH PRIVATE "src/precomp.hpp"
)
@@ -8,8 +8,6 @@
#include <tuple>
#include <memory>
#include <legacy/ie_util_internal.hpp>
#include "shared_test_classes/base/layer_test_utils.hpp"
#include <low_precision/transformer.hpp>
@@ -11,7 +11,6 @@
#include "common_test_utils/common_utils.hpp"
#include "common_test_utils/test_common.hpp"
#include "common_test_utils/test_constants.hpp"
#include "common_test_utils/common_layers_params.hpp"
#include "ie_core.hpp"
namespace LayerTestsDefinitions {
@@ -11,7 +11,6 @@
#include "shared_test_classes/base/layer_test_utils.hpp"
#include "ngraph_functions/builders.hpp"
#include "common_test_utils/common_layers_params.hpp"
namespace LayerTestsDefinitions {
@@ -13,8 +13,6 @@
#include "ngraph_functions/pass/convert_prc.hpp"
#include <legacy/ie_util_internal.hpp>
using namespace InferenceEngine;
using namespace ngraph;
@@ -99,6 +99,7 @@ namespace LayerTestsDefinitions {
}
void GRUSequenceTest::GenerateInputs() {
inputs.clear();
for (const auto &input : executableNetwork.GetInputsInfo()) {
const auto &info = input.second;
auto blob = GenerateInput(*info);
@@ -2,7 +2,6 @@
// SPDX-License-Identifier: Apache-2.0
//
#include "legacy/ngraph_ops/prior_box_clustered_ie.hpp"
#include "shared_test_classes/single_layer/prior_box_clustered.hpp"
namespace LayerTestsDefinitions {
@@ -4,7 +4,6 @@
#include "ngraph/opsets/opset5.hpp"
#include "shared_test_classes/subgraph/split_concat_memory.hpp"
#include "common_test_utils/xml_net_builder/ir_net.hpp"
namespace SubgraphTestsDefinitions {
@@ -75,8 +75,16 @@ function(add_common_utils ADD_TARGET_NAME)
PUBLIC
${PUGI}
${NGRAPH_LIBRARIES}
${EXPORT_DEPENDENCIES}
)
# USE_STATIC_IE is passed
if(ARGN)
target_link_libraries(${ADD_TARGET_NAME} PRIVATE inference_engine_s)
else()
target_link_libraries(${ADD_TARGET_NAME} PRIVATE inference_engine_legacy)
endif()
ie_faster_build(${ADD_TARGET_NAME}
UNITY
PCH PRIVATE "precomp.hpp"
@@ -102,18 +110,13 @@ function(add_common_utils ADD_TARGET_NAME)
PUBLIC
${IE_TESTS_ROOT}/ie_test_utils
$<TARGET_PROPERTY:inference_engine,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:pugixml,INTERFACE_INCLUDE_DIRECTORIES>
PRIVATE
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>
$<TARGET_PROPERTY:inference_engine_plugin_api,INTERFACE_INCLUDE_DIRECTORIES>
)
target_compile_definitions(${ADD_TARGET_NAME} PUBLIC ${ARGN})
target_link_libraries(${ADD_TARGET_NAME}
PUBLIC
${EXPORT_DEPENDENCIES}
)
endfunction()
add_common_utils(${TARGET_NAME})
@@ -209,18 +209,4 @@ void get_common_dims(const InferenceEngine::Blob &blob,
}
}
std::ostream& operator<<(std::ostream & os, OpType type) {
switch (type) {
case OpType::SCALAR:
os << "SCALAR";
break;
case OpType::VECTOR:
os << "VECTOR";
break;
default:
IE_THROW() << "NOT_SUPPORTED_OP_TYPE";
}
return os;
}
} // namespace CommonTestUtils
@@ -97,10 +97,5 @@ void get_common_dims(const InferenceEngine::Blob &blob,
int32_t &dimz,
int32_t &dimn);
enum class OpType {
SCALAR,
VECTOR
};
std::ostream& operator<<(std::ostream & os, OpType type);
} // namespace CommonTestUtils
@@ -0,0 +1,40 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "common_test_utils/common_utils.hpp"
#include <legacy/details/ie_cnn_network_iterator.hpp>
namespace CommonTestUtils {
IE_SUPPRESS_DEPRECATED_START
std::shared_ptr<InferenceEngine::CNNLayer>
getLayerByName(const InferenceEngine::CNNNetwork & network, const std::string & layerName) {
InferenceEngine::details::CNNNetworkIterator i(network), end;
while (i != end) {
auto layer = *i;
if (layer->name == layerName)
return layer;
++i;
}
IE_THROW(NotFound) << "Layer " << layerName << " not found in network";
}
IE_SUPPRESS_DEPRECATED_END
std::ostream& operator<<(std::ostream & os, OpType type) {
switch (type) {
case OpType::SCALAR:
os << "SCALAR";
break;
case OpType::VECTOR:
os << "VECTOR";
break;
default:
IE_THROW() << "NOT_SUPPORTED_OP_TYPE";
}
return os;
}
} // namespace CommonTestUtils
@@ -11,11 +11,29 @@
#include <vector>
#include <set>
#include <chrono>
#include <ostream>
#include <memory>
#include <cpp/ie_cnn_network.h>
#include <legacy/details/ie_cnn_network_iterator.hpp>
namespace InferenceEngine {
class CNNLayer;
}
namespace CommonTestUtils {
enum class OpType {
SCALAR,
VECTOR
};
std::ostream& operator<<(std::ostream & os, OpType type);
IE_SUPPRESS_DEPRECATED_START
std::shared_ptr<InferenceEngine::CNNLayer>
getLayerByName(const InferenceEngine::CNNNetwork & network, const std::string & layerName);
IE_SUPPRESS_DEPRECATED_END
template<typename vecElementType>
inline std::string vec2str(const std::vector<vecElementType> &vec) {
if (!vec.empty()) {
@@ -49,19 +67,6 @@ inline std::string set2str(const std::set<vecElementType> &set) {
return std::string("()");
}
inline InferenceEngine::CNNLayerPtr getLayerByName(const InferenceEngine::CNNNetwork & network,
const std::string & layerName) {
IE_SUPPRESS_DEPRECATED_START
InferenceEngine::details::CNNNetworkIterator i(network), end;
while (i != end) {
auto layer = *i;
if (layer->name == layerName)
return layer;
++i;
}
IE_THROW(NotFound) << "Layer " << layerName << " not found in network";
}
template <typename master, typename slave>
std::vector<std::pair<master, slave>> combineParams(
const std::map<master, std::vector<slave>>& keyValueSets) {
@@ -26,6 +26,9 @@ addIeTarget(
inference_engine_transformations
inference_engine_lp_transformations
inference_engine
PRIVATE
# use this dependency as private in order to minimize
# its usage in 3rd party applications
inference_engine_legacy
INCLUDES
PUBLIC
@@ -7,6 +7,9 @@
using namespace LayerTestsUtils;
#ifdef _WIN32
# define getpid _getpid
#endif
Summary *Summary::p_instance = nullptr;
bool Summary::extendReport = false;
@@ -18,6 +18,9 @@ addIeTarget(
ADD_CPPLINT
DEVELOPER_PACKAGE
inference_engine_tests
INCLUDES
PRIVATE
$<TARGET_PROPERTY:inference_engine_legacy,INTERFACE_INCLUDE_DIRECTORIES>
EXPORT_DEPENDENCIES
${EXPORT_DEPENDENCIES}
)
@@ -1,22 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "unit_test_utils/mocks/mock_allocator.hpp"
#include "unit_test_utils/mocks/mock_icnn_network.hpp"
#include "unit_test_utils/mocks/mock_ie_ivariable_state.hpp"
#include "unit_test_utils/mocks/mock_iexecutable_network.hpp"
#include "unit_test_utils/mocks/mock_iinfer_request.hpp"
#include "unit_test_utils/mocks/mock_not_empty_icnn_network.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/mock_task_executor.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/impl/mock_async_infer_request_default.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/impl/mock_executable_network_internal.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/impl/mock_executable_thread_safe_default.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/impl/mock_inference_plugin_internal.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iexecutable_network_internal.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iinfer_request_internal.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/interface/mock_ivariable_state_internal.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iinference_plugin.hpp"
@@ -0,0 +1,65 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#include "unit_test_utils/mocks/mock_allocator.hpp"
#include "unit_test_utils/mocks/mock_icnn_network.hpp"
#include "unit_test_utils/mocks/mock_ie_ivariable_state.hpp"
#include "unit_test_utils/mocks/mock_iexecutable_network.hpp"
#include "unit_test_utils/mocks/mock_iinfer_request.hpp"
#include "unit_test_utils/mocks/mock_not_empty_icnn_network.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/mock_task_executor.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/impl/mock_async_infer_request_default.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/impl/mock_executable_network_internal.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/impl/mock_executable_thread_safe_default.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/impl/mock_inference_plugin_internal.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iexecutable_network_internal.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iinfer_request_internal.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/interface/mock_ivariable_state_internal.hpp"
#include "unit_test_utils/mocks/cpp_interfaces/interface/mock_iinference_plugin.hpp"
#include <legacy/ie_layers.h>
using namespace InferenceEngine;
void MockNotEmptyICNNNetwork::getOutputsInfo(OutputsDataMap& out) const noexcept {
IE_SUPPRESS_DEPRECATED_START
auto data = std::make_shared<Data>(MockNotEmptyICNNNetwork::OUTPUT_BLOB_NAME, Precision::UNSPECIFIED);
getInputTo(data)[""] = std::make_shared<CNNLayer>(LayerParams{
MockNotEmptyICNNNetwork::OUTPUT_BLOB_NAME,
"FullyConnected",
Precision::FP32 });
out[MockNotEmptyICNNNetwork::OUTPUT_BLOB_NAME] = data;
IE_SUPPRESS_DEPRECATED_END
}
void MockNotEmptyICNNNetwork::getInputsInfo(InputsDataMap &inputs) const noexcept {
IE_SUPPRESS_DEPRECATED_START
auto inputInfo = std::make_shared<InputInfo>();
auto inData = std::make_shared<Data>(MockNotEmptyICNNNetwork::INPUT_BLOB_NAME, Precision::UNSPECIFIED);
auto inputLayer = std::make_shared<CNNLayer>(LayerParams{
MockNotEmptyICNNNetwork::INPUT_BLOB_NAME,
"Input",
Precision::FP32 });
getInputTo(inData)[MockNotEmptyICNNNetwork::OUTPUT_BLOB_NAME] = inputLayer;
inData->setDims(MockNotEmptyICNNNetwork::INPUT_DIMENTIONS);
inData->setLayout(Layout::NCHW);
inputInfo->setInputData(inData);
auto outData = std::make_shared<Data>(MockNotEmptyICNNNetwork::OUTPUT_BLOB_NAME, Precision::UNSPECIFIED);
outData->setDims(MockNotEmptyICNNNetwork::OUTPUT_DIMENTIONS);
outData->setLayout(Layout::NCHW);
getInputTo(outData)[""] = std::make_shared<CNNLayer>(LayerParams{
MockNotEmptyICNNNetwork::OUTPUT_BLOB_NAME,
"FullyConnected",
Precision::FP32 });
inputLayer->outData.push_back(outData);
inputs[MockNotEmptyICNNNetwork::INPUT_BLOB_NAME] = inputInfo;
IE_SUPPRESS_DEPRECATED_END
}
@@ -14,10 +14,13 @@
#include <string>
#include "ie_icnn_network.hpp"
#include <legacy/cnn_network_impl.hpp>
IE_SUPPRESS_DEPRECATED_START
namespace InferenceEngine {
class CNNLayer;
} // namespace InferenceEngine
/**
* @class MockICNNNetwork
* @brief Main interface to describe the NN topology
@@ -33,7 +36,7 @@ class MockICNNNetwork final : public InferenceEngine::ICNNNetwork {
MOCK_QUALIFIED_METHOD0(getName, const noexcept, const std::string&());
MOCK_QUALIFIED_METHOD3(addOutput, noexcept, InferenceEngine::StatusCode(const std::string &, size_t, InferenceEngine::ResponseDesc*));
MOCK_QUALIFIED_METHOD3(getLayerByName, const noexcept, InferenceEngine::StatusCode(const char* ,
InferenceEngine::CNNLayerPtr&,
std::shared_ptr<InferenceEngine::CNNLayer>&,
InferenceEngine::ResponseDesc*));
MOCK_QUALIFIED_METHOD2(setBatchSize, noexcept, InferenceEngine::StatusCode(const size_t size, InferenceEngine::ResponseDesc*));
MOCK_QUALIFIED_METHOD0(getBatchSize, const noexcept, size_t());
@@ -10,7 +10,6 @@
#include <memory>
#include <vector>
#include <legacy/ie_layers.h>
#include "ie_icnn_network.hpp"
namespace InferenceEngine {
@@ -25,43 +24,8 @@ public:
const std::string& getName() const noexcept override {
return name;
}
void getOutputsInfo(OutputsDataMap& out) const noexcept override {
IE_SUPPRESS_DEPRECATED_START
auto data = std::make_shared<Data>(MockNotEmptyICNNNetwork::OUTPUT_BLOB_NAME, Precision::UNSPECIFIED);
getInputTo(data)[""] = std::make_shared<CNNLayer>(LayerParams{
MockNotEmptyICNNNetwork::OUTPUT_BLOB_NAME,
"FullyConnected",
Precision::FP32 });
out[MockNotEmptyICNNNetwork::OUTPUT_BLOB_NAME] = data;
IE_SUPPRESS_DEPRECATED_END
};
void getInputsInfo(InputsDataMap &inputs) const noexcept override {
IE_SUPPRESS_DEPRECATED_START
auto inputInfo = std::make_shared<InputInfo>();
auto inData = std::make_shared<Data>(MockNotEmptyICNNNetwork::INPUT_BLOB_NAME, Precision::UNSPECIFIED);
auto inputLayer = std::make_shared<CNNLayer>(LayerParams{
MockNotEmptyICNNNetwork::INPUT_BLOB_NAME,
"Input",
Precision::FP32 });
getInputTo(inData)[MockNotEmptyICNNNetwork::OUTPUT_BLOB_NAME] = inputLayer;
inData->setDims(MockNotEmptyICNNNetwork::INPUT_DIMENTIONS);
inData->setLayout(Layout::NCHW);
inputInfo->setInputData(inData);
auto outData = std::make_shared<Data>(MockNotEmptyICNNNetwork::OUTPUT_BLOB_NAME, Precision::UNSPECIFIED);
outData->setDims(MockNotEmptyICNNNetwork::OUTPUT_DIMENTIONS);
outData->setLayout(Layout::NCHW);
getInputTo(outData)[""] = std::make_shared<CNNLayer>(LayerParams{
MockNotEmptyICNNNetwork::OUTPUT_BLOB_NAME,
"FullyConnected",
Precision::FP32 });
inputLayer->outData.push_back(outData);
inputs[MockNotEmptyICNNNetwork::INPUT_BLOB_NAME] = inputInfo;
IE_SUPPRESS_DEPRECATED_END
};
void getOutputsInfo(OutputsDataMap& out) const noexcept override;
void getInputsInfo(InputsDataMap &inputs) const noexcept override;
std::shared_ptr<ngraph::Function> getFunction() noexcept override {
return nullptr;
}
@@ -11,7 +11,6 @@
#include <ngraph/opsets/opset1.hpp>
#include <legacy/ngraph_ops/fully_connected.hpp>
#include <legacy/ngraph_ops/scaleshift.hpp>
#include "ngraph_functions/subgraph_builders.hpp"
#include "lpt_ngraph_functions/common/builders.hpp"
#include "low_precision/network_helper.hpp"
@@ -10,14 +10,6 @@ if (ENABLE_MYRIAD)
add_subdirectory(vpu)
endif()
if (ENABLE_CLDNN)
add_subdirectory(cldnn)
endif()
if (ENABLE_GNA)
add_subdirectory(gna)
endif()
if (ENABLE_MKL_DNN)
add_subdirectory(mkldnn)
endif()
@@ -1,7 +0,0 @@
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
add_executable(ClDnnFunctionalTests dummy.cpp)
target_link_libraries(ClDnnFunctionalTests PRIVATE gtest_main)
@@ -1,4 +0,0 @@
// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
@@ -1,7 +0,0 @@
# Copyright (C) 2018-2021 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
#
add_executable(MklDnnFunctionalTests dummy.cpp)
target_link_libraries(MklDnnFunctionalTests PRIVATE gtest_main)
@@ -1,3 +0,0 @@
// Copyright (C) 2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
@@ -10,6 +10,7 @@
#include <legacy/ie_layers_internal.hpp>
#include <legacy/details/ie_cnn_network_iterator.hpp>
#include <functional_test_utils/plugin_cache.hpp>
#include "single_layer_common.hpp"
#include "conv_ref.hpp"
#include "deconv_ref.hpp"