-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix FrameworkNodeAttr Deserialization (#7854)
- Loading branch information
Gleb Kazantaev
authored
Oct 6, 2021
1 parent
faeeedf
commit 5ef3472
Showing
3 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright (C) 2021 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#include "ngraph/op/util/framework_node.hpp" | ||
|
||
#include <vector> | ||
|
||
#include "gtest/gtest.h" | ||
|
||
TEST(framework_node, attrs) { | ||
ov::op::util::FrameworkNodeAttrs attrs; | ||
|
||
attrs.set_opset_name("opset_name"); | ||
ASSERT_EQ(attrs.get_opset_name(), "opset_name"); | ||
|
||
attrs.set_type_name("type_name"); | ||
ASSERT_EQ(attrs.get_type_name(), "type_name"); | ||
|
||
attrs["attr1"] = "value1"; | ||
ASSERT_EQ(attrs.at("attr1"), "value1"); | ||
ASSERT_EQ(attrs.begin()->first, "attr1"); | ||
ASSERT_EQ(attrs.begin()->first, "attr1"); | ||
ASSERT_EQ(attrs.begin()->second, "value1"); | ||
|
||
ov::op::util::FrameworkNodeAttrs a1, a2; | ||
a1.set_type_name("type_name"); | ||
a2.set_type_name("type_name_"); | ||
ASSERT_FALSE(a1 == a2); | ||
a2.set_type_name("type_name"); | ||
ASSERT_TRUE(a1 == a2); | ||
a1.set_opset_name("opset_name"); | ||
a2.set_opset_name("opset_name_"); | ||
ASSERT_FALSE(a1 == a2); | ||
a2.set_opset_name("opset_name"); | ||
ASSERT_TRUE(a1 == a2); | ||
a1["attr"] = "value"; | ||
ASSERT_FALSE(a1 == a2); | ||
a2["attr"] = "value_"; | ||
ASSERT_FALSE(a1 == a2); | ||
a2["attr"] = "value"; | ||
ASSERT_TRUE(a1 == a2); | ||
} |