[XXX-67099] Remove legacy from primitives priotity (#8005)

This commit is contained in:
Anastasiia Urlapova 2021-10-27 19:08:26 +03:00 committed by GitHub
parent a0a70ab53e
commit 1fa0d525d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,12 +17,13 @@
#include <ngraph/variant.hpp>
#include <transformations/utils/utils.hpp>
#include <cpp/ie_cnn_network.h>
#include <legacy/cnn_network_impl.hpp> // deprecated API
#include <legacy/ie_layers.h> // deprecated API
#include <ie_ngraph_utils.hpp>
#include "transformations/rt_info/primitives_priority_attribute.hpp"
#include "common_test_utils/ngraph_test_utils.hpp"
using namespace testing;
using namespace InferenceEngine;
using namespace InferenceEngine::details;
TEST(TransformationTests, ConvBiasFusion) {
std::shared_ptr<ngraph::Function> f(nullptr);
@ -39,6 +40,7 @@ TEST(TransformationTests, ConvBiasFusion) {
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{add}, ngraph::ParameterVector{input1});
}
std::unordered_map<std::string, std::string> pp;
InferenceEngine::CNNNetwork network(f);
@ -48,16 +50,18 @@ TEST(TransformationTests, ConvBiasFusion) {
for (auto & op : nGraph->get_ops()) {
if (auto conv = std::dynamic_pointer_cast<ngraph::opset1::Convolution>(op)) {
auto & rtInfo = conv->get_rt_info();
rtInfo["PrimitivesPriority"] = std::make_shared<ngraph::VariantWrapper<std::string> > ("test");
rtInfo["PrimitivesPriority"] = std::make_shared<ngraph::VariantWrapper<std::string>>("test");
pp[op->get_friendly_name()] = "test";
}
}
auto clonedNetwork = std::make_shared<InferenceEngine::details::CNNNetworkImpl>(network);
auto clonedNetwork = InferenceEngine::details::cloneNetwork(network);
auto funcs = clonedNetwork.getFunction();
IE_SUPPRESS_DEPRECATED_START
InferenceEngine::CNNLayerPtr conv;
clonedNetwork->getLayerByName("add", conv, nullptr);
ASSERT_TRUE(conv->params.count("PrimitivesPriority"));
ASSERT_EQ(conv->params.at("PrimitivesPriority"), "test");
IE_SUPPRESS_DEPRECATED_END
for (auto & op : funcs->get_ops()) {
if (auto conv = std::dynamic_pointer_cast<ngraph::opset1::Convolution>(op)) {
ASSERT_TRUE(pp.find(op->get_friendly_name()) != pp.end());
ASSERT_EQ(pp[op->get_friendly_name()], "test");
}
}
}