Skip to content

Commit

Permalink
Updates on deprecated stuff (#5838)
Browse files Browse the repository at this point in the history
* Removed cloneFunction from ngraph CNNNetwork impl

* Removed custom clone

* Localize deprecation suppressions

* Removed Jira tickets

* Fixed MYRIAD tests compilation on Windows
  • Loading branch information
ilya-lavrenov authored May 27, 2021
1 parent d2f7812 commit 12f2bb7
Show file tree
Hide file tree
Showing 19 changed files with 36 additions and 53 deletions.
20 changes: 2 additions & 18 deletions inference-engine/src/inference_engine/cnn_network_ngraph_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,6 @@ using details::CNNNetworkNGraphImpl;
using InferenceEngine::details::CNNNetworkNGraphImpl;
using ngraph::Function;

static std::shared_ptr<ngraph::Function> copyFunction(const std::shared_ptr<const ngraph::Function>& func,
bool constFolding) {
OV_ITT_SCOPED_TASK(itt::domains::IE, "copyFunction");

auto specialized_function = ngraph::clone_function(*func);

if (constFolding) {
ngraph::pass::ConstantFolding().run_on_function(specialized_function);
}
return specialized_function;
}

void CNNNetworkNGraphImpl::createDataForResult(const ::ngraph::Output<::ngraph::Node>& output, const std::string& outName,
DataPtr& ptr) {
const auto isCompatible = [](size_t size, const Layout& l) -> bool {
Expand Down Expand Up @@ -172,7 +160,7 @@ CNNNetworkNGraphImpl::CNNNetworkNGraphImpl(const CNNNetwork& network) {
IE_THROW() << "Cannot create CNNNetwork with nGraph from legacy network format!";
}

_ngraph_function = copyFunction(network.getFunction(), false);
_ngraph_function = ngraph::clone_function(*network.getFunction());
validateFunctionNames();
InputsDataMap inputs = network.getInputsInfo();
OutputsDataMap outputs = network.getOutputsInfo();
Expand Down Expand Up @@ -314,10 +302,6 @@ size_t CNNNetworkNGraphImpl::getBatchSize() const noexcept {
return 1;
}

std::shared_ptr<ngraph::Function> CNNNetworkNGraphImpl::cloneFunction(bool constFolding) const {
return copyFunction(_ngraph_function, constFolding);
}

void CNNNetworkNGraphImpl::reshape() {
reshape({});
}
Expand Down Expand Up @@ -398,7 +382,7 @@ CNNNetworkNGraphImpl::reshape(const std::map<std::string, ngraph::PartialShape>&
if (outputs_are_static) {
specialized_ngraph_function = _ngraph_function;
} else {
specialized_ngraph_function = cloneFunction(false);
specialized_ngraph_function = ngraph::clone_function(*_ngraph_function);
{
OV_ITT_SCOPED_TASK(itt::domains::IE, "CNNNetworkNGraphImpl::ConvertToLegacy");
::ngraph::pass::Manager manager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//

/**
* @brief A file containing ngraph implementation of public ICNNNetwork interface
* @brief A file containing ngraph implementation of public CNNNetwork wrapper
* @file cnn_network_ngraph_impl.hpp
*/

Expand Down Expand Up @@ -36,7 +36,7 @@ namespace details {
IE_SUPPRESS_DEPRECATED_START

/**
* @brief Ngraph-based implementation of the ICNNNetwork interface.
* @brief Ngraph-based implementation of the CNNNetwork.
*/
class INFERENCE_ENGINE_API_CLASS(CNNNetworkNGraphImpl) final : public ICNNNetwork {
public:
Expand Down Expand Up @@ -84,7 +84,6 @@ class INFERENCE_ENGINE_API_CLASS(CNNNetworkNGraphImpl) final : public ICNNNetwor
// used by convertFunctionToICNNNetwork from legacy library
std::map<std::string, DataPtr> _data;
protected:
virtual std::shared_ptr<::ngraph::Function> cloneFunction(bool constFolding = false) const;
std::shared_ptr<::ngraph::Function> _ngraph_function;

private:
Expand Down
19 changes: 6 additions & 13 deletions inference-engine/src/legacy_api/src/ie_util_internal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "caseless.hpp"
#include "precision_utils.h"
#include "cnn_network_ngraph_impl.hpp"
#include "ie_ngraph_utils.hpp"

#include "legacy/ie_util_internal.hpp"
#include "legacy/cnn_network_impl.hpp"
Expand Down Expand Up @@ -150,26 +151,18 @@ CNNLayerPtr clonelayer(const CNNLayer& source) {
CNNNetwork cloneNetwork(const CNNNetwork& network) {
OV_ITT_SCOPE(FIRST_INFERENCE, itt::domains::IELegacy_LT, "cloneNetwork");

IE_SUPPRESS_DEPRECATED_START
if (network.getFunction()) {
return CNNNetwork(std::make_shared<details::CNNNetworkNGraphImpl>(network));
return InferenceEngine::details::cloneNetwork(network);
}

return CNNNetwork(cloneNet(network));
IE_SUPPRESS_DEPRECATED_START
return CNNNetwork(InferenceEngine::cloneNet(network));
IE_SUPPRESS_DEPRECATED_END
}

details::CNNNetworkImplPtr cloneNet(const CNNNetwork& origin_network) {
details::CNNNetworkImplPtr cloneNet(const CNNNetwork& network) {
OV_ITT_SCOPED_TASK(itt::domains::IELegacy, "cloneNet(CNNNetwork)");
IE_SUPPRESS_DEPRECATED_START
std::shared_ptr<ICNNNetwork> clonedNetwork;
// Call conversion only on the copy of nGraph function
if (origin_network.getFunction()) {
// Copy and call conversion
clonedNetwork = std::make_shared<InferenceEngine::details::CNNNetworkImpl>(cloneNetwork(origin_network));
}
const CNNNetwork network = clonedNetwork ? CNNNetwork(clonedNetwork) : origin_network;
IE_SUPPRESS_DEPRECATED_END
IE_ASSERT(network.getFunction() == nullptr);

std::vector<CNNLayerPtr> layers;
details::CNNNetworkIterator i(network);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,9 @@ class StageNode :
// Bindings with IE
//

IE_SUPPRESS_DEPRECATED_START
VPU_MODEL_ATTRIBUTE(ie::CNNLayerPtr, origLayer, nullptr)
IE_SUPPRESS_DEPRECATED_END

//
// Edges
Expand Down Expand Up @@ -573,7 +575,9 @@ class StageNode :
//

inline std::string origLayerName() const {
IE_SUPPRESS_DEPRECATED_START
return _origLayer != nullptr ? _origLayer->name : std::string();
IE_SUPPRESS_DEPRECATED_END
}

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

namespace vpu {

IE_SUPPRESS_DEPRECATED_START

class StageBuilder final {
public:
using Ptr = std::shared_ptr<StageBuilder>;
Expand Down Expand Up @@ -359,4 +361,6 @@ class StageBuilder final {
int32_t blankIndex);
};

IE_SUPPRESS_DEPRECATED_END

} // namespace vpu
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

set(TARGET_NAME myriadFuncTests)

disable_deprecated_warnings()

addIeTargetTest(
NAME ${TARGET_NAME}
ROOT ${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,19 @@ class DynamicShapeResolverTests : public CommonTestUtils::TestsCommon {
}

protected:
IE_SUPPRESS_DEPRECATED_START
InferenceEngine::CNNLayerPtr getDynamicShapeResolverLayer() const {
return CommonTestUtils::getLayerByName(cnnNetwork, s_FriendlyName);
}
IE_SUPPRESS_DEPRECATED_END
InferenceEngine::CNNNetwork cnnNetwork;

private:
void triggerConversionToCNNNetwork() {
IE_SUPPRESS_DEPRECATED_START
cnnNetwork = InferenceEngine::CNNNetwork(
std::make_shared<InferenceEngine::details::CNNNetworkImpl>(cnnNetwork));
IE_SUPPRESS_DEPRECATED_END
}

static const char s_FriendlyName[];
Expand All @@ -57,10 +61,12 @@ TEST_F(DynamicShapeResolverTests, smoke_NGraphFunctionCanBeConvertedToCNNNetwork
ASSERT_EQ(cnnNetwork.layerCount(), cnnNetwork.getInputsInfo().size() + 1);
ASSERT_EQ(cnnNetwork.getOutputsInfo().size(), 1);

IE_SUPPRESS_DEPRECATED_START
const auto dynamicShapeResolver = getDynamicShapeResolverLayer();
ASSERT_EQ(dynamicShapeResolver->type, "DynamicShapeResolver");
ASSERT_EQ(dynamicShapeResolver->insData.size(), 2);
ASSERT_EQ(dynamicShapeResolver->outData.size(), 1);
IE_SUPPRESS_DEPRECATED_END
}

} // namespace
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include "vpu/private_plugin_config.hpp"
#include "behavior/config.hpp"

IE_SUPPRESS_DEPRECATED_START

using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "vpu/private_plugin_config.hpp"
#include "vpu/myriad_config.hpp"

IE_SUPPRESS_DEPRECATED_START

using namespace BehaviorTestsDefinitions;
namespace {
const std::vector<InferenceEngine::Precision> netPrecisions = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ class LayerTransformationParamsNGraphFactory {
class LayerTransformationParamsFactory : public LayerTransformationParamsNGraphFactory {
};

IE_SUPPRESS_DEPRECATED_START

class LayerTransformation : virtual public LayerTestsUtils::LayerTestsCommon {
protected:
LayerTransformation();
Expand Down Expand Up @@ -64,8 +62,6 @@ class LayerTransformation : virtual public LayerTestsUtils::LayerTestsCommon {
const ngraph::pass::low_precision::LayerTransformation::Params& params);
};

IE_SUPPRESS_DEPRECATED_END

typedef std::tuple<
InferenceEngine::Precision,
InferenceEngine::SizeVector,
Expand Down
2 changes: 0 additions & 2 deletions inference-engine/tests/unit/vpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

set(TARGET_NAME vpuUnitTests)

disable_deprecated_warnings()

include(${XLINK_DIR}/XLink.cmake)

addIeTargetTest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include "ngraph/ngraph.hpp"
#include "ngraph/opsets/opset3.hpp"

IE_SUPPRESS_DEPRECATED_START

namespace vpu {

namespace ie = InferenceEngine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

using namespace vpu;

IE_SUPPRESS_DEPRECATED_START

class VPU_SplitLargeKernelConvTest : public GraphTransformerTest {
protected:
PassSet pipeline;
Expand Down
2 changes: 0 additions & 2 deletions inference-engine/tests_deprecated/behavior/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

add_subdirectory(shared_tests)

disable_deprecated_warnings()

if (ENABLE_HDDL OR ENABLE_MYRIAD)
add_subdirectory(vpu)
endif()
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

set(TARGET_NAME IEBehaviorSharedTests)

disable_deprecated_warnings()

file(GLOB_RECURSE SHARED_TESTS_SRC ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/*.hpp)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# SPDX-License-Identifier: Apache-2.0
#

function(enable_vpu TARGET_NAME FLAG_NAME PLUGIN_NAME)
disable_deprecated_warnings()

function(enable_vpu TARGET_NAME FLAG_NAME PLUGIN_NAME)
# Common tests for HDDL MYRIAD KMB
file(GLOB_RECURSE TEST_INCLUDE
${CMAKE_CURRENT_SOURCE_DIR}/shared_tests_instances/*.hpp)
Expand Down
4 changes: 2 additions & 2 deletions inference-engine/tests_deprecated/functional/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# SPDX-License-Identifier: Apache-2.0
#

add_subdirectory(shared_tests)

disable_deprecated_warnings()

add_subdirectory(shared_tests)

if (ENABLE_MYRIAD)
add_subdirectory(vpu)
endif()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

set(TARGET_NAME IESharedTests)

disable_deprecated_warnings()

list(APPEND SHARED_LIBRARIES
${NGRAPH_LIBRARIES}
commonTestUtils
Expand Down
2 changes: 0 additions & 2 deletions inference-engine/tools/vpu/vpu_perfcheck/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# SPDX-License-Identifier: Apache-2.0
#

disable_deprecated_warnings()

function(add_perfcheck_target TARGET_NAME PLUGIN_NAME)
file(GLOB SOURCES *.cpp)

Expand Down

0 comments on commit 12f2bb7

Please sign in to comment.