Deprecate version inside DiscreteTypeInfo (#10781)

* Deprecate version inside DiscreteTypeInfo

* Fixed code style

* Fixed openvino for macOS

* Fixed build for macOS

* Fixed errors for Windows build
This commit is contained in:
Ilya Churaev 2022-03-14 21:18:00 +03:00 committed by GitHub
parent 575b2fad73
commit ad1c4a24c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
28 changed files with 150 additions and 136 deletions

View File

@ -28,7 +28,9 @@ public:
explicit OneHotIE(const Output<ngraph::Node>& input, int axis, int depth, float on_value, float off_value, element::Type type); explicit OneHotIE(const Output<ngraph::Node>& input, int axis, int depth, float on_value, float off_value, element::Type type);
OPENVINO_SUPPRESS_DEPRECATED_START
size_t get_version() const override { return 1; } size_t get_version() const override { return 1; }
OPENVINO_SUPPRESS_DEPRECATED_END
void validate_and_infer_types() override; void validate_and_infer_types() override;
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override; std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;

View File

@ -25,7 +25,9 @@ public:
PadIE(const Output<ngraph::Node>& input, PadMode pad_mode, CoordinateDiff pads_begin, CoordinateDiff pads_end, Shape output_shape, float pad_value); PadIE(const Output<ngraph::Node>& input, PadMode pad_mode, CoordinateDiff pads_begin, CoordinateDiff pads_end, Shape output_shape, float pad_value);
OPENVINO_SUPPRESS_DEPRECATED_START
size_t get_version() const override { return 1; } size_t get_version() const override { return 1; }
OPENVINO_SUPPRESS_DEPRECATED_END
void validate_and_infer_types() override; void validate_and_infer_types() override;
bool visit_attributes(AttributeVisitor& visitor) override; bool visit_attributes(AttributeVisitor& visitor) override;

View File

@ -16,6 +16,7 @@ ngraph::pass::low_precision::MarkupPerTensorQuantization::MarkupPerTensorQuantiz
const std::vector<OperationPerTensorQuantizationRestriction>& restrictions) { const std::vector<OperationPerTensorQuantizationRestriction>& restrictions) {
for (const OperationPerTensorQuantizationRestriction& restriction : restrictions) { for (const OperationPerTensorQuantizationRestriction& restriction : restrictions) {
const auto it = restrictionsByOperation.find(restriction.operationType.name); const auto it = restrictionsByOperation.find(restriction.operationType.name);
OPENVINO_SUPPRESS_DEPRECATED_START
if (it == restrictionsByOperation.end()) { if (it == restrictionsByOperation.end()) {
PerTensorQuantization r(restriction.specifyVersion); PerTensorQuantization r(restriction.specifyVersion);
r.portsByVersion.emplace(restriction.operationType.version, restriction.restrictedPorts); r.portsByVersion.emplace(restriction.operationType.version, restriction.restrictedPorts);
@ -23,6 +24,7 @@ ngraph::pass::low_precision::MarkupPerTensorQuantization::MarkupPerTensorQuantiz
} else { } else {
it->second.add(restriction.operationType.version, restriction.restrictedPorts); it->second.add(restriction.operationType.version, restriction.restrictedPorts);
} }
OPENVINO_SUPPRESS_DEPRECATED_END
} }
} }
@ -66,7 +68,9 @@ bool ngraph::pass::low_precision::MarkupPerTensorQuantization::run_on_model(cons
} }
if (restriction.versionIsRequired) { if (restriction.versionIsRequired) {
OPENVINO_SUPPRESS_DEPRECATED_START
const auto it2 = restriction.portsByVersion.find(node->get_type_info().version); const auto it2 = restriction.portsByVersion.find(node->get_type_info().version);
OPENVINO_SUPPRESS_DEPRECATED_END
if (it2 == restriction.portsByVersion.end()) { if (it2 == restriction.portsByVersion.end()) {
continue; continue;
} }

View File

@ -23,6 +23,7 @@ ngraph::pass::low_precision::MarkupPrecisions::MarkupPrecisions(const std::vecto
const std::vector<ngraph::element::Type>& defaultPrecisions) : defaultPrecisions(defaultPrecisions) { const std::vector<ngraph::element::Type>& defaultPrecisions) : defaultPrecisions(defaultPrecisions) {
for (const auto& restriction : restrictions) { for (const auto& restriction : restrictions) {
const auto it = restrictionsByOperation.find(restriction.operationType.name); const auto it = restrictionsByOperation.find(restriction.operationType.name);
OPENVINO_SUPPRESS_DEPRECATED_START
if (it == restrictionsByOperation.end()) { if (it == restrictionsByOperation.end()) {
Restriction r(restriction.specifyVersion); Restriction r(restriction.specifyVersion);
r.precisionsByVersion.emplace(restriction.operationType.version, restriction.precisionsByPort); r.precisionsByVersion.emplace(restriction.operationType.version, restriction.precisionsByPort);
@ -30,6 +31,7 @@ ngraph::pass::low_precision::MarkupPrecisions::MarkupPrecisions(const std::vecto
} else { } else {
it->second.add(restriction.operationType.version, restriction.precisionsByPort); it->second.add(restriction.operationType.version, restriction.precisionsByPort);
} }
OPENVINO_SUPPRESS_DEPRECATED_END
} }
} }
@ -92,7 +94,9 @@ bool ngraph::pass::low_precision::MarkupPrecisions::run_on_model(const std::shar
if (it != restrictionsByOperation.end()) { if (it != restrictionsByOperation.end()) {
const Restriction& r = it->second; const Restriction& r = it->second;
if (r.versionIsRequired) { if (r.versionIsRequired) {
OPENVINO_SUPPRESS_DEPRECATED_START
const auto it2 = r.precisionsByVersion.find(typeInfo.version); const auto it2 = r.precisionsByVersion.find(typeInfo.version);
OPENVINO_SUPPRESS_DEPRECATED_END
if (it2 == r.precisionsByVersion.end()) { if (it2 == r.precisionsByVersion.end()) {
continue; continue;
} }

View File

@ -120,10 +120,12 @@ const ::ngraph::Node::type_info_t& NmsStaticShapeIE<BaseNmsOp>::get_type_info_st
// but currently it will not pass conversion ot Legacy Opset correctly // but currently it will not pass conversion ot Legacy Opset correctly
static const std::string name = BaseNmsOpTypeInfoPtr->name; static const std::string name = BaseNmsOpTypeInfoPtr->name;
OPENVINO_SUPPRESS_DEPRECATED_START
static const ::ngraph::Node::type_info_t type_info_static{name.c_str(), static const ::ngraph::Node::type_info_t type_info_static{name.c_str(),
BaseNmsOpTypeInfoPtr->version, BaseNmsOpTypeInfoPtr->version,
"ie_internal_opset", "ie_internal_opset",
BaseNmsOpTypeInfoPtr}; BaseNmsOpTypeInfoPtr};
OPENVINO_SUPPRESS_DEPRECATED_END
return type_info_static; return type_info_static;
} }

View File

@ -157,17 +157,17 @@ using ov::check_new_args_count;
#define _NGRAPH_RTTI_DEFINITION_WITH_PARENT(CLASS, TYPE_NAME, _VERSION_INDEX, PARENT_CLASS) \ #define _NGRAPH_RTTI_DEFINITION_WITH_PARENT(CLASS, TYPE_NAME, _VERSION_INDEX, PARENT_CLASS) \
const ::ngraph::Node::type_info_t& CLASS::get_type_info_static() { \ const ::ngraph::Node::type_info_t& CLASS::get_type_info_static() { \
static const ::ngraph::Node::type_info_t type_info_static{TYPE_NAME, \ static const ::ngraph::Node::type_info_t type_info_static{TYPE_NAME, \
_VERSION_INDEX, \ static_cast<uint64_t>(_VERSION_INDEX), \
&PARENT_CLASS::get_type_info_static()}; \ &PARENT_CLASS::get_type_info_static()}; \
return type_info_static; \ return type_info_static; \
} \ } \
_NGRAPH_RTTI_DEFINITION_COMMON(CLASS) _NGRAPH_RTTI_DEFINITION_COMMON(CLASS)
#define _NGRAPH_RTTI_DEFINITION_NO_PARENT(CLASS, TYPE_NAME, _VERSION_INDEX) \ #define _NGRAPH_RTTI_DEFINITION_NO_PARENT(CLASS, TYPE_NAME, _VERSION_INDEX) \
const ::ngraph::Node::type_info_t& CLASS::get_type_info_static() { \ const ::ngraph::Node::type_info_t& CLASS::get_type_info_static() { \
static const ::ngraph::Node::type_info_t type_info_static{TYPE_NAME, _VERSION_INDEX}; \ static const ::ngraph::Node::type_info_t type_info_static{TYPE_NAME, static_cast<uint64_t>(_VERSION_INDEX)}; \
return type_info_static; \ return type_info_static; \
} \ } \
_NGRAPH_RTTI_DEFINITION_COMMON(CLASS) _NGRAPH_RTTI_DEFINITION_COMMON(CLASS)
#define NGRAPH_RTTI_DEFINITION(...) \ #define NGRAPH_RTTI_DEFINITION(...) \
_OPENVINO_RTTI_EXPAND(_OPENVINO_RTTI_DEFINITION_SELECTOR(__VA_ARGS__, \ _OPENVINO_RTTI_EXPAND(_OPENVINO_RTTI_DEFINITION_SELECTOR(__VA_ARGS__, \

View File

@ -43,7 +43,7 @@ class OPENVINO_API Model : public std::enable_shared_from_this<Model> {
public: public:
static const ::ov::DiscreteTypeInfo& get_type_info_static() { static const ::ov::DiscreteTypeInfo& get_type_info_static() {
static const ::ov::DiscreteTypeInfo type_info_static{"Model", 0}; static const ::ov::DiscreteTypeInfo type_info_static{"Model", static_cast<uint64_t>(0)};
return type_info_static; return type_info_static;
} }
const ::ov::DiscreteTypeInfo& get_type_info() const { const ::ov::DiscreteTypeInfo& get_type_info() const {

View File

@ -424,8 +424,11 @@ public:
NodeVector get_users(bool check_is_used = false) const; NodeVector get_users(bool check_is_used = false) const;
/// \return Version of this node /// \return Version of this node
OPENVINO_DEPRECATED("This method is deprecated and will be removed soon.")
virtual size_t get_version() const { virtual size_t get_version() const {
OPENVINO_SUPPRESS_DEPRECATED_START
return get_type_info().version; return get_type_info().version;
OPENVINO_SUPPRESS_DEPRECATED_END
} }
OPENVINO_DEPRECATED("This method is deprecated and will be removed soon.") OPENVINO_DEPRECATED("This method is deprecated and will be removed soon.")

View File

@ -20,7 +20,7 @@ class Any;
class OPENVINO_API RuntimeAttribute { class OPENVINO_API RuntimeAttribute {
public: public:
static const DiscreteTypeInfo& get_type_info_static() { static const DiscreteTypeInfo& get_type_info_static() {
static const ::ov::DiscreteTypeInfo type_info_static{"RuntimeAttribute", 0}; static const ::ov::DiscreteTypeInfo type_info_static{"RuntimeAttribute", static_cast<uint64_t>(0)};
return type_info_static; return type_info_static;
} }
virtual const DiscreteTypeInfo& get_type_info() const { virtual const DiscreteTypeInfo& get_type_info() const {

View File

@ -27,6 +27,7 @@ namespace ov {
/// related to any other type. /// related to any other type.
struct OPENVINO_API DiscreteTypeInfo { struct OPENVINO_API DiscreteTypeInfo {
const char* name; const char* name;
OPENVINO_DEPRECATED("This member was deprecated. Please use version_id instead.")
uint64_t version; uint64_t version;
const char* version_id; const char* version_id;
// A pointer to a parent type info; used for casting and inheritance traversal, not for // A pointer to a parent type info; used for casting and inheritance traversal, not for
@ -34,6 +35,19 @@ struct OPENVINO_API DiscreteTypeInfo {
const DiscreteTypeInfo* parent; const DiscreteTypeInfo* parent;
DiscreteTypeInfo() = default; DiscreteTypeInfo() = default;
OPENVINO_SUPPRESS_DEPRECATED_START
DiscreteTypeInfo(const DiscreteTypeInfo&) = default;
DiscreteTypeInfo(DiscreteTypeInfo&&) = default;
DiscreteTypeInfo& operator=(const DiscreteTypeInfo&) = default;
explicit constexpr DiscreteTypeInfo(const char* _name,
const char* _version_id,
const DiscreteTypeInfo* _parent = nullptr)
: name(_name),
version(0),
version_id(_version_id),
parent(_parent),
hash_value(0) {}
constexpr DiscreteTypeInfo(const char* _name, uint64_t _version, const DiscreteTypeInfo* _parent = nullptr) constexpr DiscreteTypeInfo(const char* _name, uint64_t _version, const DiscreteTypeInfo* _parent = nullptr)
: name(_name), : name(_name),
@ -51,6 +65,7 @@ struct OPENVINO_API DiscreteTypeInfo {
version_id(_version_id), version_id(_version_id),
parent(_parent), parent(_parent),
hash_value(0) {} hash_value(0) {}
OPENVINO_SUPPRESS_DEPRECATED_END
bool is_castable(const DiscreteTypeInfo& target_type) const; bool is_castable(const DiscreteTypeInfo& target_type) const;

View File

@ -381,7 +381,9 @@ std::ostream& ov::Node::write_description(std::ostream& out, uint32_t depth) con
if (depth == 0) { if (depth == 0) {
out << get_friendly_name(); out << get_friendly_name();
} else { } else {
OPENVINO_SUPPRESS_DEPRECATED_START
out << "v" << get_type_info().version << "::" << get_type_info().name << " " << get_friendly_name() << " ("; out << "v" << get_type_info().version << "::" << get_type_info().name << " " << get_friendly_name() << " (";
OPENVINO_SUPPRESS_DEPRECATED_END
string sep = ""; string sep = "";
for (const auto& arg : input_values()) { for (const auto& arg : input_values()) {
out << sep << arg; out << sep << arg;

View File

@ -942,9 +942,11 @@ void ngfunction_2_ir(pugi::xml_node& netXml,
// WA for LSTMCellv0, peephole input shall not be serialized // WA for LSTMCellv0, peephole input shall not be serialized
if (e.to_port == 6) { if (e.to_port == 6) {
auto type_info = f.get_ordered_ops()[e.to_layer]->get_type_info(); auto type_info = f.get_ordered_ops()[e.to_layer]->get_type_info();
OPENVINO_SUPPRESS_DEPRECATED_START
if (!strcmp(type_info.name, "LSTMCell") && type_info.version == 0) { if (!strcmp(type_info.name, "LSTMCell") && type_info.version == 0) {
continue; continue;
} }
OPENVINO_SUPPRESS_DEPRECATED_END
} }
pugi::xml_node edge = edges.append_child("edge"); pugi::xml_node edge = edges.append_child("edge");
edge.append_attribute("from-layer").set_value(e.from_layer); edge.append_attribute("from-layer").set_value(e.from_layer);

View File

@ -18,7 +18,9 @@ size_t DiscreteTypeInfo::hash() const {
if (hash_value != 0) if (hash_value != 0)
return hash_value; return hash_value;
size_t name_hash = name ? std::hash<std::string>()(std::string(name)) : 0; size_t name_hash = name ? std::hash<std::string>()(std::string(name)) : 0;
OPENVINO_SUPPRESS_DEPRECATED_START
size_t version_hash = std::hash<decltype(version)>()(version); size_t version_hash = std::hash<decltype(version)>()(version);
OPENVINO_SUPPRESS_DEPRECATED_END
size_t version_id_hash = version_id ? std::hash<std::string>()(std::string(version_id)) : 0; size_t version_id_hash = version_id ? std::hash<std::string>()(std::string(version_id)) : 0;
return ov::util::hash_combine(std::vector<size_t>{name_hash, version_hash, version_id_hash}); return ov::util::hash_combine(std::vector<size_t>{name_hash, version_hash, version_id_hash});
@ -38,7 +40,9 @@ std::string DiscreteTypeInfo::get_version() const {
if (version_id) { if (version_id) {
return std::string(version_id); return std::string(version_id);
} }
OPENVINO_SUPPRESS_DEPRECATED_START
return std::to_string(version); return std::to_string(version);
OPENVINO_SUPPRESS_DEPRECATED_END
} }
DiscreteTypeInfo::operator std::string() const { DiscreteTypeInfo::operator std::string() const {
@ -47,8 +51,10 @@ DiscreteTypeInfo::operator std::string() const {
std::ostream& operator<<(std::ostream& s, const DiscreteTypeInfo& info) { std::ostream& operator<<(std::ostream& s, const DiscreteTypeInfo& info) {
std::string version_id = info.version_id ? info.version_id : "(empty)"; std::string version_id = info.version_id ? info.version_id : "(empty)";
OPENVINO_SUPPRESS_DEPRECATED_START
s << "DiscreteTypeInfo{name: " << info.name << ", version_id: " << version_id << ", old_version: " << info.version s << "DiscreteTypeInfo{name: " << info.name << ", version_id: " << version_id << ", old_version: " << info.version
<< ", parent: "; << ", parent: ";
OPENVINO_SUPPRESS_DEPRECATED_END
if (!info.parent) if (!info.parent)
s << info.parent; s << info.parent;
else else
@ -60,6 +66,7 @@ std::ostream& operator<<(std::ostream& s, const DiscreteTypeInfo& info) {
// parent is commented to fix type relaxed operations // parent is commented to fix type relaxed operations
bool DiscreteTypeInfo::operator<(const DiscreteTypeInfo& b) const { bool DiscreteTypeInfo::operator<(const DiscreteTypeInfo& b) const {
OPENVINO_SUPPRESS_DEPRECATED_START
if (version < b.version) if (version < b.version)
return true; return true;
if (version == b.version && name != nullptr && b.name != nullptr) { if (version == b.version && name != nullptr && b.name != nullptr) {
@ -74,12 +81,15 @@ bool DiscreteTypeInfo::operator<(const DiscreteTypeInfo& b) const {
} }
} }
OPENVINO_SUPPRESS_DEPRECATED_END
return false; return false;
} }
bool DiscreteTypeInfo::operator==(const DiscreteTypeInfo& b) const { bool DiscreteTypeInfo::operator==(const DiscreteTypeInfo& b) const {
if (hash_value != 0 && b.hash_value != 0) if (hash_value != 0 && b.hash_value != 0)
return hash() == b.hash(); return hash() == b.hash();
OPENVINO_SUPPRESS_DEPRECATED_START
return version == b.version && strcmp(name, b.name) == 0; return version == b.version && strcmp(name, b.name) == 0;
OPENVINO_SUPPRESS_DEPRECATED_END
} }
bool DiscreteTypeInfo::operator<=(const DiscreteTypeInfo& b) const { bool DiscreteTypeInfo::operator<=(const DiscreteTypeInfo& b) const {
return *this == b || *this < b; return *this == b || *this < b;

View File

@ -29,7 +29,7 @@ using namespace std;
class ControlDependencyOp : public ngraph::op::Op { class ControlDependencyOp : public ngraph::op::Op {
public: public:
static constexpr NodeTypeInfo type_info{"ControlDependencyOp", 0}; static constexpr NodeTypeInfo type_info{"ControlDependencyOp", static_cast<uint64_t>(0)};
const NodeTypeInfo& get_type_info() const override { const NodeTypeInfo& get_type_info() const override {
return type_info; return type_info;
} }

View File

@ -27,7 +27,7 @@
namespace ngraph { namespace ngraph {
class TestOpMultiOut : public op::Op { class TestOpMultiOut : public op::Op {
public: public:
static constexpr NodeTypeInfo type_info{"TestOpMultiOut", 0}; static constexpr NodeTypeInfo type_info{"TestOpMultiOut", static_cast<uint64_t>(0)};
const NodeTypeInfo& get_type_info() const override { const NodeTypeInfo& get_type_info() const override {
return type_info; return type_info;
} }

View File

@ -146,7 +146,7 @@ TEST(opset, opset8_dump) {
class MyOpOld : public ov::op::Op { class MyOpOld : public ov::op::Op {
public: public:
static constexpr ov::DiscreteTypeInfo type_info{"MyOpOld", 0}; static constexpr ov::DiscreteTypeInfo type_info{"MyOpOld", static_cast<uint64_t>(0)};
const ov::DiscreteTypeInfo& get_type_info() const override { const ov::DiscreteTypeInfo& get_type_info() const override {
return type_info; return type_info;
} }

View File

@ -50,6 +50,7 @@ public:
} }
}; };
OPENVINO_SUPPRESS_DEPRECATED_START
TEST(rtti, op_with_type) { TEST(rtti, op_with_type) {
auto op = OpType(); auto op = OpType();
auto type_info = op.get_type_info(); auto type_info = op.get_type_info();

View File

@ -8,12 +8,13 @@
#include "openvino/opsets/opset.hpp" #include "openvino/opsets/opset.hpp"
#include "openvino/util/common_util.hpp" #include "openvino/util/common_util.hpp"
OPENVINO_SUPPRESS_DEPRECATED_START
TEST(type_info, compare_old_type) { TEST(type_info, compare_old_type) {
ov::DiscreteTypeInfo type1("type1", 0); ov::DiscreteTypeInfo type1("type1", static_cast<uint64_t>(0));
ov::DiscreteTypeInfo type2("type2", 0); ov::DiscreteTypeInfo type2("type2", static_cast<uint64_t>(0));
ov::DiscreteTypeInfo type3("type1", 1); ov::DiscreteTypeInfo type3("type1", 1ul);
ov::DiscreteTypeInfo type4("type3", 0, &type1); ov::DiscreteTypeInfo type4("type3", static_cast<uint64_t>(0), &type1);
ov::DiscreteTypeInfo type5("type3", 0, &type2); ov::DiscreteTypeInfo type5("type3", static_cast<uint64_t>(0), &type2);
ASSERT_TRUE(type1 != type2); ASSERT_TRUE(type1 != type2);
ASSERT_TRUE(type1 == type1); ASSERT_TRUE(type1 == type1);
ASSERT_TRUE(type1 < type2); ASSERT_TRUE(type1 < type2);
@ -27,11 +28,11 @@ TEST(type_info, compare_old_type) {
} }
TEST(type_info, compare_new_type) { TEST(type_info, compare_new_type) {
ov::DiscreteTypeInfo type1("type1", 0, "version1"); ov::DiscreteTypeInfo type1("type1", "version1");
ov::DiscreteTypeInfo type2("type2", 0, "version1"); ov::DiscreteTypeInfo type2("type2", "version1");
ov::DiscreteTypeInfo type3("type1", 1, "version2"); ov::DiscreteTypeInfo type3("type1", "version2");
ov::DiscreteTypeInfo type4("type3", 0, "version3", &type1); ov::DiscreteTypeInfo type4("type3", "version3", &type1);
ov::DiscreteTypeInfo type5("type3", 0, "version3", &type2); ov::DiscreteTypeInfo type5("type3", "version3", &type2);
ASSERT_TRUE(type1 != type2); ASSERT_TRUE(type1 != type2);
ASSERT_TRUE(type1 == type1); ASSERT_TRUE(type1 == type1);
ASSERT_TRUE(type1 < type2); ASSERT_TRUE(type1 < type2);
@ -45,8 +46,8 @@ TEST(type_info, compare_new_type) {
} }
TEST(type_info, compare_new_with_old_type) { TEST(type_info, compare_new_with_old_type) {
ov::DiscreteTypeInfo type1("type1", 0, "version1"); ov::DiscreteTypeInfo type1("type1", static_cast<uint64_t>(0), "version1");
ov::DiscreteTypeInfo type1_o("type1", 0); ov::DiscreteTypeInfo type1_o("type1", static_cast<uint64_t>(0));
ASSERT_TRUE(type1 == type1_o); ASSERT_TRUE(type1 == type1_o);
} }
@ -61,8 +62,8 @@ TEST(type_info, check_hash_value) {
ov::DiscreteTypeInfo type("type1", 0, "version1"); ov::DiscreteTypeInfo type("type1", 0, "version1");
ov::DiscreteTypeInfo type_old("type1", 1); ov::DiscreteTypeInfo type_old("type1", 1);
ov::DiscreteTypeInfo type_with_version("type1", 1, "version1"); ov::DiscreteTypeInfo type_with_version("type1", 1, "version1");
ov::DiscreteTypeInfo type_empty_name("", 0); ov::DiscreteTypeInfo type_empty_name("", static_cast<uint64_t>(0));
ov::DiscreteTypeInfo type_empty_ver("type", 0, ""); ov::DiscreteTypeInfo type_empty_ver("type", static_cast<uint64_t>(0), "");
EXPECT_EQ(hash_val(type.name, type.version_id, type.version), type.hash()); EXPECT_EQ(hash_val(type.name, type.version_id, type.version), type.hash());
EXPECT_EQ(hash_val(type_old.name, type_old.version_id, type_old.version), type_old.hash()); EXPECT_EQ(hash_val(type_old.name, type_old.version_id, type_old.version), type_old.hash());
EXPECT_EQ(hash_val(type_with_version.name, type_with_version.version_id, type_with_version.version), EXPECT_EQ(hash_val(type_with_version.name, type_with_version.version_id, type_with_version.version),
@ -74,11 +75,11 @@ TEST(type_info, check_hash_value) {
TEST(type_info, find_in_map) { TEST(type_info, find_in_map) {
std::vector<std::string> vector_names; std::vector<std::string> vector_names;
ov::DiscreteTypeInfo a("Mod", 1, "opset1"); ov::DiscreteTypeInfo a("Mod", 1ul, "opset1");
ov::DiscreteTypeInfo b("Prelu", 0, "opset1"); ov::DiscreteTypeInfo b("Prelu", static_cast<uint64_t>(0), "opset1");
ov::DiscreteTypeInfo c("Vector", 0); ov::DiscreteTypeInfo c("Vector", static_cast<uint64_t>(0));
ov::DiscreteTypeInfo d("Mod", 1, "opset3"); ov::DiscreteTypeInfo d("Mod", 1ul, "opset3");
ov::DiscreteTypeInfo f("Mod", 2); ov::DiscreteTypeInfo f("Mod", 2ul);
std::map<ov::DiscreteTypeInfo, int> test_map; std::map<ov::DiscreteTypeInfo, int> test_map;
test_map[a] = 1; test_map[a] = 1;
@ -94,19 +95,19 @@ TEST(type_info, find_in_map) {
std::string name = type.name; std::string name = type.name;
vector_names.emplace_back(name); vector_names.emplace_back(name);
ov::DiscreteTypeInfo t(vector_names.rbegin()->c_str(), 1000); ov::DiscreteTypeInfo t(vector_names.rbegin()->c_str(), 1000);
ov::DiscreteTypeInfo t2(vector_names.rbegin()->c_str(), 0); ov::DiscreteTypeInfo t2(vector_names.rbegin()->c_str(), static_cast<uint64_t>(0));
test_map[t] = 3; test_map[t] = 3;
test_map[t2] = 4; test_map[t2] = 4;
std::string name1 = "a" + name; std::string name1 = "a" + name;
vector_names.emplace_back(name1); vector_names.emplace_back(name1);
ov::DiscreteTypeInfo t3(vector_names.rbegin()->c_str(), 1000); ov::DiscreteTypeInfo t3(vector_names.rbegin()->c_str(), 1000);
ov::DiscreteTypeInfo t4(vector_names.rbegin()->c_str(), 0); ov::DiscreteTypeInfo t4(vector_names.rbegin()->c_str(), static_cast<uint64_t>(0));
test_map[t3] = 5; test_map[t3] = 5;
test_map[t4] = 6; test_map[t4] = 6;
std::string name2 = name + "z"; std::string name2 = name + "z";
vector_names.emplace_back(name2); vector_names.emplace_back(name2);
ov::DiscreteTypeInfo t5(vector_names.rbegin()->c_str(), 1000); ov::DiscreteTypeInfo t5(vector_names.rbegin()->c_str(), 1000);
ov::DiscreteTypeInfo t6(vector_names.rbegin()->c_str(), 0); ov::DiscreteTypeInfo t6(vector_names.rbegin()->c_str(), static_cast<uint64_t>(0));
test_map[t5] = 7; test_map[t5] = 7;
test_map[t6] = 8; test_map[t6] = 8;
} }

View File

@ -27,9 +27,11 @@ bool is_type_relaxed(const std::string& type) {
} }
bool compare_type_info(const ngraph::DiscreteTypeInfo& info1, const ngraph::DiscreteTypeInfo& info2) { bool compare_type_info(const ngraph::DiscreteTypeInfo& info1, const ngraph::DiscreteTypeInfo& info2) {
OPENVINO_SUPPRESS_DEPRECATED_START
if (!is_type_relaxed(info1.name) && !is_type_relaxed(info2.name) && (info1.version != info2.version)) { if (!is_type_relaxed(info1.name) && !is_type_relaxed(info2.name) && (info1.version != info2.version)) {
return false; return false;
} }
OPENVINO_SUPPRESS_DEPRECATED_END
const std::string info1Name = const std::string info1Name =
is_type_relaxed(info1.name) && (info1.parent != nullptr) ? info1.parent->name : info1.name; is_type_relaxed(info1.name) && (info1.parent != nullptr) ? info1.parent->name : info1.name;
@ -76,7 +78,9 @@ bool less_by_parent_name(const std::shared_ptr<ngraph::op::v0::Result>& l,
} }
std::string typeInfoToStr(const ngraph::Node::type_info_t& typeInfo) { std::string typeInfoToStr(const ngraph::Node::type_info_t& typeInfo) {
OPENVINO_SUPPRESS_DEPRECATED_START
return std::string(typeInfo.name) + "/" + to_str(typeInfo.version); return std::string(typeInfo.name) + "/" + to_str(typeInfo.version);
OPENVINO_SUPPRESS_DEPRECATED_END
} }
std::string tensor_names(const ngraph::descriptor::Tensor& t) { std::string tensor_names(const ngraph::descriptor::Tensor& t) {

View File

@ -31,7 +31,7 @@ class AttributeAdapter<TuringModel> : public EnumAttributeAdapterBase<TuringMode
public: public:
AttributeAdapter(TuringModel& value) : EnumAttributeAdapterBase<TuringModel>(value) {} AttributeAdapter(TuringModel& value) : EnumAttributeAdapterBase<TuringModel>(value) {}
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<TuringModel>", 0}; static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<TuringModel>", static_cast<uint64_t>(0)};
const DiscreteTypeInfo& get_type_info() const override { const DiscreteTypeInfo& get_type_info() const override {
return type_info; return type_info;
} }
@ -64,7 +64,7 @@ public:
visitor.on_attribute("z", m_ref.z); visitor.on_attribute("z", m_ref.z);
return true; return true;
} }
static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<Position>", 0}; static constexpr DiscreteTypeInfo type_info{"AttributeAdapter<Position>", static_cast<uint64_t>(0)};
const DiscreteTypeInfo& get_type_info() const override { const DiscreteTypeInfo& get_type_info() const override {
return type_info; return type_info;
} }

View File

@ -30,7 +30,7 @@ namespace onnx_import {
/// https://github.com/onnx/onnx/blob/master/docs/IR.md#optional-inputs-and-outputs /// https://github.com/onnx/onnx/blob/master/docs/IR.md#optional-inputs-and-outputs
class ONNX_IMPORTER_API NullNode : public ngraph::Node { class ONNX_IMPORTER_API NullNode : public ngraph::Node {
public: public:
static constexpr NodeTypeInfo type_info{"NullNode", 0}; static constexpr NodeTypeInfo type_info{"NullNode", static_cast<uint64_t>(0)};
const NodeTypeInfo& get_type_info() const override { const NodeTypeInfo& get_type_info() const override {
return type_info; return type_info;
} }

View File

@ -91,7 +91,7 @@ static const char RUNTIME_PRECISION[] = "runtimePrecision";
*/ */
class INFERENCE_ENGINE_API_CLASS(ExecutionNode) : public ngraph::Node { class INFERENCE_ENGINE_API_CLASS(ExecutionNode) : public ngraph::Node {
public: public:
static constexpr ngraph::NodeTypeInfo type_info{"ExecutionNode", 0}; static constexpr ngraph::NodeTypeInfo type_info{"ExecutionNode", static_cast<uint64_t>(0)};
const ngraph::NodeTypeInfo& get_type_info() const override; const ngraph::NodeTypeInfo& get_type_info() const override;
/** /**

View File

@ -41,7 +41,9 @@ std::shared_ptr<ngraph::Node> gatherShapeElements(const ngraph::Output<ngraph::N
template<> template<>
inline void printTo(std::ostream& stream, const ngraph::NodeTypeInfo& object) { inline void printTo(std::ostream& stream, const ngraph::NodeTypeInfo& object) {
OPENVINO_SUPPRESS_DEPRECATED_START
stream << object.name << " ver. " << object.version; stream << object.name << " ver. " << object.version;
OPENVINO_SUPPRESS_DEPRECATED_END
} }
using Nodes = std::unordered_set<ngraph::Node*>; using Nodes = std::unordered_set<ngraph::Node*>;

View File

@ -181,7 +181,7 @@ std::string getOVExtensionPath() {
class CustomOldIdentity : public ngraph::op::Op { class CustomOldIdentity : public ngraph::op::Op {
public: public:
static constexpr ngraph::NodeTypeInfo type_info{"Identity", 0}; static constexpr ngraph::NodeTypeInfo type_info{"Identity", static_cast<uint64_t>(0)};
const ngraph::NodeTypeInfo& get_type_info() const override { const ngraph::NodeTypeInfo& get_type_info() const override {
return type_info; return type_info;
} }

View File

@ -2,23 +2,21 @@
// SPDX-License-Identifier: Apache-2.0 // SPDX-License-Identifier: Apache-2.0
// //
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <gmock/gmock-matchers.h>
#include <memory> #include <memory>
#include <queue>
#include <string>
#include "common_test_utils/test_common.hpp"
#include <ngraph/function.hpp> #include <ngraph/function.hpp>
#include <ngraph/opsets/opset5.hpp> #include <ngraph/opsets/opset5.hpp>
#include <ngraph/opsets/opset6.hpp> #include <ngraph/opsets/opset6.hpp>
#include <ngraph/pass/manager.hpp> #include <ngraph/pass/manager.hpp>
#include <queue>
#include <string>
#include <transformations/init_node_info.hpp> #include <transformations/init_node_info.hpp>
#include <transformations/utils/utils.hpp> #include <transformations/utils/utils.hpp>
#include "common_test_utils/ngraph_test_utils.hpp" #include "common_test_utils/ngraph_test_utils.hpp"
#include "common_test_utils/test_common.hpp"
using namespace testing; using namespace testing;
using namespace ngraph; using namespace ngraph;
@ -50,8 +48,7 @@ TEST(TransformationTests, CompareFunctoinsTIPositive) {
auto reshape_pattern_2 = ngraph::opset5::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {1, 1, 128}); auto reshape_pattern_2 = ngraph::opset5::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {1, 1, 128});
auto unsqueeze = std::make_shared<opset5::Reshape>(lstm_cell, reshape_pattern_2, false); auto unsqueeze = std::make_shared<opset5::Reshape>(lstm_cell, reshape_pattern_2, false);
auto res_2 = std::make_shared<opset5::Result>(unsqueeze); auto res_2 = std::make_shared<opset5::Result>(unsqueeze);
auto body = std::make_shared<Function>(OutputVector{res_1, res_2}, auto body = std::make_shared<Function>(OutputVector{res_1, res_2}, ParameterVector{Xi, Yi, Zi});
ParameterVector{Xi, Yi, Zi});
auto tensor_iterator = std::make_shared<opset5::TensorIterator>(); auto tensor_iterator = std::make_shared<opset5::TensorIterator>();
tensor_iterator->set_body(body); tensor_iterator->set_body(body);
@ -64,8 +61,7 @@ TEST(TransformationTests, CompareFunctoinsTIPositive) {
auto out1 = tensor_iterator->get_concatenated_slices(res_2, 0, 1, 1, -1, 1); auto out1 = tensor_iterator->get_concatenated_slices(res_2, 0, 1, 1, -1, 1);
auto res_ti_1 = std::make_shared<opset5::Result>(tensor_iterator->output(1)); auto res_ti_1 = std::make_shared<opset5::Result>(tensor_iterator->output(1));
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{res_ti_1}, f = std::make_shared<ngraph::Function>(ngraph::NodeVector{res_ti_1}, ngraph::ParameterVector{X, Y, Z});
ngraph::ParameterVector{X, Y, Z});
} }
{ {
@ -95,8 +91,7 @@ TEST(TransformationTests, CompareFunctoinsTIPositive) {
auto unsqueeze = std::make_shared<opset5::Reshape>(lstm_cell, reshape_pattern_2, false); auto unsqueeze = std::make_shared<opset5::Reshape>(lstm_cell, reshape_pattern_2, false);
auto res_2 = std::make_shared<opset5::Result>(unsqueeze); auto res_2 = std::make_shared<opset5::Result>(unsqueeze);
res_2->set_friendly_name("res_2"); res_2->set_friendly_name("res_2");
auto body = std::make_shared<Function>(OutputVector{res_1, res_2}, auto body = std::make_shared<Function>(OutputVector{res_1, res_2}, ParameterVector{Xi, Yi, Zi});
ParameterVector{Xi, Yi, Zi});
auto tensor_iterator = std::make_shared<opset5::TensorIterator>(); auto tensor_iterator = std::make_shared<opset5::TensorIterator>();
tensor_iterator->set_body(body); tensor_iterator->set_body(body);
@ -109,8 +104,7 @@ TEST(TransformationTests, CompareFunctoinsTIPositive) {
auto out1 = tensor_iterator->get_concatenated_slices(res_2, 0, 1, 1, -1, 1); auto out1 = tensor_iterator->get_concatenated_slices(res_2, 0, 1, 1, -1, 1);
auto res_ti_1 = std::make_shared<opset5::Result>(tensor_iterator->output(1)); auto res_ti_1 = std::make_shared<opset5::Result>(tensor_iterator->output(1));
f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{res_ti_1}, f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{res_ti_1}, ngraph::ParameterVector{X, Y, Z});
ngraph::ParameterVector{X, Y, Z});
} }
auto res = compare_functions(f, f_ref); auto res = compare_functions(f, f_ref);
@ -144,8 +138,7 @@ TEST(TransformationTests, CompareFunctoinsTINegative) {
auto reshape_pattern_2 = ngraph::opset5::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {1, 1, 128}); auto reshape_pattern_2 = ngraph::opset5::Constant::create(ngraph::element::i64, ngraph::Shape{3}, {1, 1, 128});
auto unsqueeze = std::make_shared<opset5::Reshape>(lstm_cell, reshape_pattern_2, false); auto unsqueeze = std::make_shared<opset5::Reshape>(lstm_cell, reshape_pattern_2, false);
auto res_2 = std::make_shared<opset5::Result>(unsqueeze); auto res_2 = std::make_shared<opset5::Result>(unsqueeze);
auto body = std::make_shared<Function>(OutputVector{res_1, res_2}, auto body = std::make_shared<Function>(OutputVector{res_1, res_2}, ParameterVector{Xi, Yi, Zi});
ParameterVector{Xi, Yi, Zi});
auto tensor_iterator = std::make_shared<opset5::TensorIterator>(); auto tensor_iterator = std::make_shared<opset5::TensorIterator>();
tensor_iterator->set_body(body); tensor_iterator->set_body(body);
@ -158,8 +151,7 @@ TEST(TransformationTests, CompareFunctoinsTINegative) {
auto out1 = tensor_iterator->get_concatenated_slices(res_2, 0, 1, 1, -1, 1); auto out1 = tensor_iterator->get_concatenated_slices(res_2, 0, 1, 1, -1, 1);
auto res_ti_1 = std::make_shared<opset5::Result>(tensor_iterator->output(1)); auto res_ti_1 = std::make_shared<opset5::Result>(tensor_iterator->output(1));
f = std::make_shared<ngraph::Function>(ngraph::NodeVector{res_ti_1}, f = std::make_shared<ngraph::Function>(ngraph::NodeVector{res_ti_1}, ngraph::ParameterVector{X, Y, Z});
ngraph::ParameterVector{X, Y, Z});
} }
{ {
@ -190,8 +182,7 @@ TEST(TransformationTests, CompareFunctoinsTINegative) {
auto unsqueeze = std::make_shared<opset5::Reshape>(lstm_cell, reshape_pattern_2, false); auto unsqueeze = std::make_shared<opset5::Reshape>(lstm_cell, reshape_pattern_2, false);
auto res_2 = std::make_shared<opset5::Result>(unsqueeze); auto res_2 = std::make_shared<opset5::Result>(unsqueeze);
res_2->set_friendly_name("res_2"); res_2->set_friendly_name("res_2");
auto body = std::make_shared<Function>(OutputVector{res_1, res_2}, auto body = std::make_shared<Function>(OutputVector{res_1, res_2}, ParameterVector{Xi, Yi, Zi});
ParameterVector{Xi, Yi, Zi});
auto tensor_iterator = std::make_shared<opset5::TensorIterator>(); auto tensor_iterator = std::make_shared<opset5::TensorIterator>();
tensor_iterator->set_body(body); tensor_iterator->set_body(body);
@ -204,8 +195,7 @@ TEST(TransformationTests, CompareFunctoinsTINegative) {
auto out1 = tensor_iterator->get_concatenated_slices(res_2, 0, 1, 1, -1, 1); auto out1 = tensor_iterator->get_concatenated_slices(res_2, 0, 1, 1, -1, 1);
auto res_ti_1 = std::make_shared<opset5::Result>(tensor_iterator->output(1)); auto res_ti_1 = std::make_shared<opset5::Result>(tensor_iterator->output(1));
f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{res_ti_1}, f_ref = std::make_shared<ngraph::Function>(ngraph::NodeVector{res_ti_1}, ngraph::ParameterVector{X, Y, Z});
ngraph::ParameterVector{X, Y, Z});
} }
const auto fc = FunctionsComparator::with_default().enable(FunctionsComparator::ATTRIBUTES); const auto fc = FunctionsComparator::with_default().enable(FunctionsComparator::ATTRIBUTES);
@ -237,8 +227,7 @@ TEST(TransformationTests, CompareFunctoinsTINegativeDifferentElementTypeBetweenS
auto out = ti->get_concatenated_slices(result, 0, 1, 1, -1, 1); auto out = ti->get_concatenated_slices(result, 0, 1, 1, -1, 1);
return std::make_shared<Function>( return std::make_shared<Function>(NodeVector{out.get_node_shared_ptr()}, ParameterVector{X, Y});
NodeVector{out.get_node_shared_ptr()}, ParameterVector{X, Y});
}; };
const auto f1 = createFunc(element::f32); const auto f1 = createFunc(element::f32);
const auto f2 = createFunc(element::f16); const auto f2 = createFunc(element::f16);
@ -274,8 +263,7 @@ TEST(TransformationTests, CompareFunctoinsTINegativeDifferentElementTypeBetweenI
auto out = ti->get_concatenated_slices(result, 0, 1, 1, -1, 1); auto out = ti->get_concatenated_slices(result, 0, 1, 1, -1, 1);
return std::make_shared<Function>( return std::make_shared<Function>(NodeVector{out.get_node_shared_ptr()}, ParameterVector{X, Y});
NodeVector{out.get_node_shared_ptr()}, ParameterVector{X, Y});
}; };
const auto f1 = createFunc(element::f32); const auto f1 = createFunc(element::f32);
@ -310,8 +298,7 @@ TEST(TransformationTests, CompareFunctoinsTINegativeDifferentElementTypeBetweent
auto out = ti->get_concatenated_slices(result, 0, 1, 1, -1, 1); auto out = ti->get_concatenated_slices(result, 0, 1, 1, -1, 1);
auto fn = std::make_shared<Function>( auto fn = std::make_shared<Function>(NodeVector{out.get_node_shared_ptr()}, ParameterVector{X, Y});
NodeVector{out.get_node_shared_ptr()}, ParameterVector{X, Y});
/// << /// <<
auto&& result_out = result->output(0); auto&& result_out = result->output(0);
@ -321,7 +308,7 @@ TEST(TransformationTests, CompareFunctoinsTINegativeDifferentElementTypeBetweent
return fn; return fn;
}; };
{ // check element type difference { // check element type difference
const auto f1 = createFunc(element::u16, Shape{10, 20}); const auto f1 = createFunc(element::u16, Shape{10, 20});
const auto f2 = createFunc(element::u64, Shape{10, 20}); const auto f2 = createFunc(element::u64, Shape{10, 20});
@ -332,7 +319,7 @@ TEST(TransformationTests, CompareFunctoinsTINegativeDifferentElementTypeBetweent
EXPECT_FALSE(result.valid); EXPECT_FALSE(result.valid);
EXPECT_THAT(result.message, HasSubstr("outputs and results mismatch")); EXPECT_THAT(result.message, HasSubstr("outputs and results mismatch"));
} }
{ // check Shape difference { // check Shape difference
const auto f1 = createFunc(element::u16, Shape{11, 20}); const auto f1 = createFunc(element::u16, Shape{11, 20});
const auto f2 = createFunc(element::u16, Shape{12, 20}); const auto f2 = createFunc(element::u16, Shape{12, 20});
@ -350,8 +337,7 @@ TEST(TransformationTests, ConstantNegativeDifferentElementType) {
using namespace ngraph::opset5; using namespace ngraph::opset5;
auto constant = Constant::create(t, ngraph::Shape{1}, {1.1}); auto constant = Constant::create(t, ngraph::Shape{1}, {1.1});
return std::make_shared<ngraph::Function>( return std::make_shared<ngraph::Function>(ngraph::NodeVector{constant}, ngraph::ParameterVector{});
ngraph::NodeVector{constant}, ngraph::ParameterVector{});
}; };
const auto& f1 = createConstantFunc(ngraph::element::f64); const auto& f1 = createConstantFunc(ngraph::element::f64);
@ -368,8 +354,7 @@ TEST(TransformationTests, ConstantNegativeDifferentValues) {
using namespace ngraph::opset5; using namespace ngraph::opset5;
auto constant = Constant::create(ngraph::element::f32, ngraph::Shape{1}, {value}); auto constant = Constant::create(ngraph::element::f32, ngraph::Shape{1}, {value});
return std::make_shared<ngraph::Function>( return std::make_shared<ngraph::Function>(ngraph::NodeVector{constant}, ngraph::ParameterVector{});
ngraph::NodeVector{constant}, ngraph::ParameterVector{});
}; };
const auto& f1 = createConstantFunc(1.0); const auto& f1 = createConstantFunc(1.0);
@ -386,8 +371,7 @@ TEST(TransformationTests, ConstantNegativeDifferentShapes) {
using namespace ngraph::opset5; using namespace ngraph::opset5;
auto constant = Constant::create(ngraph::element::f32, s, {1.1}); auto constant = Constant::create(ngraph::element::f32, s, {1.1});
return std::make_shared<ngraph::Function>( return std::make_shared<ngraph::Function>(ngraph::NodeVector{constant}, ngraph::ParameterVector{});
ngraph::NodeVector{constant}, ngraph::ParameterVector{});
}; };
const auto& f1 = createConstantFunc(ngraph::Shape{2}); const auto& f1 = createConstantFunc(ngraph::Shape{2});
@ -405,8 +389,7 @@ TEST(TransformationTests, ClampNegativeDifferentMin) {
auto constant = Constant::create(ngraph::element::f32, ngraph::Shape{1}, {1.0}); auto constant = Constant::create(ngraph::element::f32, ngraph::Shape{1}, {1.0});
auto clamp = std::make_shared<Clamp>(constant, min, 20.); auto clamp = std::make_shared<Clamp>(constant, min, 20.);
return std::make_shared<ngraph::Function>( return std::make_shared<ngraph::Function>(ngraph::NodeVector{clamp}, ngraph::ParameterVector{});
ngraph::NodeVector{clamp}, ngraph::ParameterVector{});
}; };
const auto& f1 = createClampFunc(1.0); const auto& f1 = createClampFunc(1.0);
@ -424,8 +407,7 @@ TEST(TransformationTests, ClampNegativeDifferentMax) {
auto constant = Constant::create(ngraph::element::f32, ngraph::Shape{1}, {1.0}); auto constant = Constant::create(ngraph::element::f32, ngraph::Shape{1}, {1.0});
auto clamp = std::make_shared<Clamp>(constant, 1., max); auto clamp = std::make_shared<Clamp>(constant, 1., max);
return std::make_shared<ngraph::Function>( return std::make_shared<ngraph::Function>(ngraph::NodeVector{clamp}, ngraph::ParameterVector{});
ngraph::NodeVector{clamp}, ngraph::ParameterVector{});
}; };
const auto& f1 = createClampFunc(10.1); const auto& f1 = createClampFunc(10.1);
@ -440,12 +422,10 @@ TEST(TransformationTests, ClampNegativeDifferentMax) {
TEST(TransformationTests, ConcatNegativeDifferentMax) { TEST(TransformationTests, ConcatNegativeDifferentMax) {
const auto createConcatFunc = [](int64_t axis) { const auto createConcatFunc = [](int64_t axis) {
using namespace ngraph::opset5; using namespace ngraph::opset5;
auto constant = auto constant = Constant::create(ngraph::element::f32, ngraph::Shape{10, 10, 2, 2, 3}, {1.0});
Constant::create(ngraph::element::f32, ngraph::Shape{10, 10, 2, 2, 3}, {1.0});
auto clamp = std::make_shared<Concat>(ngraph::OutputVector{constant}, axis); auto clamp = std::make_shared<Concat>(ngraph::OutputVector{constant}, axis);
return std::make_shared<ngraph::Function>( return std::make_shared<ngraph::Function>(ngraph::NodeVector{clamp}, ngraph::ParameterVector{});
ngraph::NodeVector{clamp}, ngraph::ParameterVector{});
}; };
const auto& f1 = createConcatFunc(1); const auto& f1 = createConcatFunc(1);
@ -500,12 +480,11 @@ TEST(TransformationTests, ReorgYoloNegativeDifferentMax) {
const auto createReorgYoloFunc = [](const Strides& stride) { const auto createReorgYoloFunc = [](const Strides& stride) {
using namespace ngraph::opset5; using namespace ngraph::opset5;
auto param = auto param = std::make_shared<Parameter>(ngraph::element::f32, ngraph::Shape{10, 10, 10, 10});
std::make_shared<Parameter>(ngraph::element::f32, ngraph::Shape{10, 10, 10, 10});
auto reorg_yolo = std::make_shared<ReorgYolo>(param, stride); auto reorg_yolo = std::make_shared<ReorgYolo>(param, stride);
return std::make_shared<ngraph::Function>( return std::make_shared<ngraph::Function>(std::make_shared<ngraph::opset1::Result>(reorg_yolo),
std::make_shared<ngraph::opset1::Result>(reorg_yolo), ngraph::ParameterVector{param}); ngraph::ParameterVector{param});
}; };
const auto& f1 = createReorgYoloFunc({1, 2}); const auto& f1 = createReorgYoloFunc({1, 2});
@ -524,20 +503,18 @@ class DummyConstant : public ngraph::op::Op {
public: public:
DummyConstant() = default; DummyConstant() = default;
DummyConstant(const Member& member) DummyConstant(const Member& member) : m_element_type(element::Type_t::u8), m_shape({1, 1}), m_member(member) {
: m_element_type(element::Type_t::u8), m_shape({1, 1}), m_member(member) {
constructor_validate_and_infer_types(); constructor_validate_and_infer_types();
} }
DummyConstant(const DummyConstant& o) DummyConstant(const DummyConstant& o) : m_element_type(o.m_element_type), m_shape(o.m_shape), m_member(o.m_member) {
: m_element_type(o.m_element_type), m_shape(o.m_shape), m_member(o.m_member) {
constructor_validate_and_infer_types(); constructor_validate_and_infer_types();
} }
DummyConstant& operator=(const DummyConstant&) = delete; DummyConstant& operator=(const DummyConstant&) = delete;
const NodeTypeInfo& get_type_info() const override { const NodeTypeInfo& get_type_info() const override {
static const NodeTypeInfo type_info{typeid(this).name(), 0}; static const NodeTypeInfo type_info{typeid(this).name(), static_cast<uint64_t>(0)};
return type_info; return type_info;
} }
@ -576,8 +553,7 @@ template <typename Member>
std::shared_ptr<ngraph::Function> createDummyFunc(const Member& m) { std::shared_ptr<ngraph::Function> createDummyFunc(const Member& m) {
auto constant = std::make_shared<DummyConstant<Member>>(m); auto constant = std::make_shared<DummyConstant<Member>>(m);
return std::make_shared<ngraph::Function>( return std::make_shared<ngraph::Function>(ngraph::NodeVector{constant}, ngraph::ParameterVector{});
ngraph::NodeVector{constant}, ngraph::ParameterVector{});
} }
} // namespace } // namespace
@ -631,19 +607,16 @@ class AttributeAdapter<TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLIS
: public DirectValueAccessor<TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION> { : public DirectValueAccessor<TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION> {
public: public:
AttributeAdapter(TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION& value) AttributeAdapter(TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION& value)
: DirectValueAccessor<TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION>(value) { : DirectValueAccessor<TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION>(value) {}
}
static constexpr DiscreteTypeInfo type_info{ static constexpr DiscreteTypeInfo type_info{"TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION", static_cast<uint64_t>(0)};
"TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION", 0};
const DiscreteTypeInfo& get_type_info() const override { const DiscreteTypeInfo& get_type_info() const override {
return type_info; return type_info;
} }
}; };
constexpr DiscreteTypeInfo constexpr DiscreteTypeInfo AttributeAdapter<TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION>::type_info;
AttributeAdapter<TestDummyDataTypeTransformationTests_NO_NGRAPH_NAME_COLISION>::type_info;
} // namespace ov } // namespace ov
@ -702,8 +675,7 @@ const auto createU1ConstantFunc = [](const Shape& s, const uint8_t* data) {
using namespace ngraph::opset5; using namespace ngraph::opset5;
auto c = std::make_shared<Constant>(element::u1, s, data); auto c = std::make_shared<Constant>(element::u1, s, data);
return std::make_shared<ngraph::Function>(ngraph::NodeVector{c}, return std::make_shared<ngraph::Function>(ngraph::NodeVector{c}, ngraph::ParameterVector{});
ngraph::ParameterVector{});
}; };
} }
@ -711,13 +683,10 @@ TEST(TransformationTests, ConstantComparison_ElementTypeU1_Positive_1stbit) {
const Shape shape{1}; const Shape shape{1};
const uint8_t data[1] = {0x80}; // 1000'0000 const uint8_t data[1] = {0x80}; // 1000'0000
const auto& f1 = const auto& f1 = createU1ConstantFunc(shape, static_cast<const uint8_t*>(data));
createU1ConstantFunc(shape, static_cast<const uint8_t*>(data)); const auto& f2 = createU1ConstantFunc(shape, static_cast<const uint8_t*>(data));
const auto& f2 =
createU1ConstantFunc(shape, static_cast<const uint8_t*>(data));
const auto fc = FunctionsComparator::with_default().enable( const auto fc = FunctionsComparator::with_default().enable(FunctionsComparator::CONST_VALUES);
FunctionsComparator::CONST_VALUES);
const auto res = fc.compare(f1, f2); const auto res = fc.compare(f1, f2);
EXPECT_TRUE(res.valid) << res.message; EXPECT_TRUE(res.valid) << res.message;
} }
@ -726,13 +695,10 @@ TEST(TransformationTests, ConstantComparison_ElementTypeU1_Positive_9thbit) {
const Shape shape{9}; const Shape shape{9};
const uint8_t data[2] = {0x00, 0x80}; // 0000'0000 1000'0000 const uint8_t data[2] = {0x00, 0x80}; // 0000'0000 1000'0000
const auto& f1 = const auto& f1 = createU1ConstantFunc(shape, static_cast<const uint8_t*>(data));
createU1ConstantFunc(shape, static_cast<const uint8_t*>(data)); const auto& f2 = createU1ConstantFunc(shape, static_cast<const uint8_t*>(data));
const auto& f2 =
createU1ConstantFunc(shape, static_cast<const uint8_t*>(data));
const auto fc = FunctionsComparator::with_default().enable( const auto fc = FunctionsComparator::with_default().enable(FunctionsComparator::CONST_VALUES);
FunctionsComparator::CONST_VALUES);
const auto res = fc.compare(f1, f2); const auto res = fc.compare(f1, f2);
EXPECT_TRUE(res.valid) << res.message; EXPECT_TRUE(res.valid) << res.message;
} }
@ -743,13 +709,10 @@ TEST(TransformationTests, ConstantComparison_ElementTypeU1_Positive_garbage) {
const uint8_t data1[2] = {0xAA, 0x8F}; // 1010'1010 1000'1111 const uint8_t data1[2] = {0xAA, 0x8F}; // 1010'1010 1000'1111
const uint8_t data2[2] = {0xAA, 0xF0}; // 1010'1010 1111'0000 const uint8_t data2[2] = {0xAA, 0xF0}; // 1010'1010 1111'0000
const auto& f1 = const auto& f1 = createU1ConstantFunc(shape, static_cast<const uint8_t*>(data1));
createU1ConstantFunc(shape, static_cast<const uint8_t*>(data1)); const auto& f2 = createU1ConstantFunc(shape, static_cast<const uint8_t*>(data2));
const auto& f2 =
createU1ConstantFunc(shape, static_cast<const uint8_t*>(data2));
const auto fc = FunctionsComparator::with_default().enable( const auto fc = FunctionsComparator::with_default().enable(FunctionsComparator::CONST_VALUES);
FunctionsComparator::CONST_VALUES);
const auto res = fc.compare(f1, f2); const auto res = fc.compare(f1, f2);
EXPECT_TRUE(res.valid) << res.message; EXPECT_TRUE(res.valid) << res.message;
} }
@ -759,13 +722,10 @@ TEST(TransformationTests, ConstantComparison_ElementTypeU1_Negative) {
const uint8_t data1[1] = {0x80}; // 1000 0000 const uint8_t data1[1] = {0x80}; // 1000 0000
const uint8_t data2[1] = {0x01}; // 0000 0001 const uint8_t data2[1] = {0x01}; // 0000 0001
const auto& f1 = const auto& f1 = createU1ConstantFunc(shape, static_cast<const uint8_t*>(data1));
createU1ConstantFunc(shape, static_cast<const uint8_t*>(data1)); const auto& f2 = createU1ConstantFunc(shape, static_cast<const uint8_t*>(data2));
const auto& f2 =
createU1ConstantFunc(shape, static_cast<const uint8_t*>(data2));
const auto fc = FunctionsComparator::with_default().enable( const auto fc = FunctionsComparator::with_default().enable(FunctionsComparator::CONST_VALUES);
FunctionsComparator::CONST_VALUES);
const auto res = fc.compare(f1, f2); const auto res = fc.compare(f1, f2);
EXPECT_FALSE(res.valid); EXPECT_FALSE(res.valid);
EXPECT_THAT(res.message, HasSubstr("Different Constant values detected")); EXPECT_THAT(res.message, HasSubstr("Different Constant values detected"));
@ -776,13 +736,10 @@ TEST(TransformationTests, ConstantComparison_ElementTypeU1_Negative_9thbit) {
const uint8_t data1[2] = {0x00, 0x80}; // 0000 0000 1000 0000 const uint8_t data1[2] = {0x00, 0x80}; // 0000 0000 1000 0000
const uint8_t data2[2] = {0x00, 0x00}; // 0000 0000 0000 0000 const uint8_t data2[2] = {0x00, 0x00}; // 0000 0000 0000 0000
const auto& f1 = const auto& f1 = createU1ConstantFunc(shape, static_cast<const uint8_t*>(data1));
createU1ConstantFunc(shape, static_cast<const uint8_t*>(data1)); const auto& f2 = createU1ConstantFunc(shape, static_cast<const uint8_t*>(data2));
const auto& f2 =
createU1ConstantFunc(shape, static_cast<const uint8_t*>(data2));
const auto fc = FunctionsComparator::with_default().enable( const auto fc = FunctionsComparator::with_default().enable(FunctionsComparator::CONST_VALUES);
FunctionsComparator::CONST_VALUES);
const auto res = fc.compare(f1, f2); const auto res = fc.compare(f1, f2);
EXPECT_FALSE(res.valid); EXPECT_FALSE(res.valid);
EXPECT_THAT(res.message, HasSubstr("Different Constant values detected")); EXPECT_THAT(res.message, HasSubstr("Different Constant values detected"));

View File

@ -70,8 +70,7 @@ bool compare_constants_data(const std::shared_ptr<ov::op::v0::Constant> &op,
bool SingleOpMatcher::same_op_type(const std::shared_ptr<ov::Node> &node, bool SingleOpMatcher::same_op_type(const std::shared_ptr<ov::Node> &node,
const std::shared_ptr<ov::Node> &ref, const std::shared_ptr<ov::Node> &ref,
const LayerTestsUtils::OPInfo &op_info) const { const LayerTestsUtils::OPInfo &op_info) const {
return node->get_type_info().name == ref->get_type_info().name && return node->get_type_info() == ref->get_type_info();
node->get_type_info().version == ref->get_type_info().version;
} }
bool SingleOpMatcher::match_inputs(const std::shared_ptr<ov::Node> &node, bool SingleOpMatcher::match_inputs(const std::shared_ptr<ov::Node> &node,

View File

@ -23,9 +23,9 @@ public:
void SetUp() override { void SetUp() override {
const auto tensorType = ngraph::element::f16; const auto tensorType = ngraph::element::f16;
const auto shapeType = ngraph::element::i64; const auto shapeType = ngraph::element::i64;
const auto tensorShape = std::initializer_list<std::size_t>{1, 800}; const ov::Shape tensorShape{1, 800};
const auto tensor = std::make_shared<ngraph::opset3::Parameter>(tensorType, ngraph::Shape{tensorShape}); const auto tensor = std::make_shared<ngraph::opset3::Parameter>(tensorType, tensorShape);
const auto shape = std::make_shared<ngraph::opset3::Parameter>(shapeType, ngraph::Shape{tensorShape.size()}); const auto shape = std::make_shared<ngraph::opset3::Parameter>(shapeType, ngraph::Shape{tensorShape.size()});
auto dynamicShapeResolver = std::make_shared<ngraph::vpu::op::DynamicShapeResolver>(tensor, shape); auto dynamicShapeResolver = std::make_shared<ngraph::vpu::op::DynamicShapeResolver>(tensor, shape);
dynamicShapeResolver->set_friendly_name(s_FriendlyName); dynamicShapeResolver->set_friendly_name(s_FriendlyName);

View File

@ -278,7 +278,9 @@ std::vector<std::pair<ngraph::element::Type, std::vector<std::uint8_t>>> getCons
namespace { namespace {
std::string toString(const NodeTypeInfo& typeInfo) { std::string toString(const NodeTypeInfo& typeInfo) {
OPENVINO_SUPPRESS_DEPRECATED_START
return std::string(typeInfo.name) + " ver. " + std::to_string(typeInfo.version); return std::string(typeInfo.name) + " ver. " + std::to_string(typeInfo.version);
OPENVINO_SUPPRESS_DEPRECATED_END
} }
void CompareShapes(const PartialShape& actual, const PartialShape& expected) { void CompareShapes(const PartialShape& actual, const PartialShape& expected) {
@ -339,7 +341,9 @@ std::shared_ptr<ngraph::Node> getNodeSharedPtr(const ngraph::NodeTypeInfo &type_
ngraphNode->validate_and_infer_types(); ngraphNode->validate_and_infer_types();
return ngraphNode; return ngraphNode;
} }
OPENVINO_SUPPRESS_DEPRECATED_START
NGRAPH_UNREACHABLE("supported opsets does not contain op with name: ", type_info.name, " version: ", type_info.version); NGRAPH_UNREACHABLE("supported opsets does not contain op with name: ", type_info.name, " version: ", type_info.version);
OPENVINO_SUPPRESS_DEPRECATED_END
} }
bool is_tensor_iterator_exist(const std::shared_ptr<ngraph::Function> & func) { bool is_tensor_iterator_exist(const std::shared_ptr<ngraph::Function> & func) {