Skip to content

Commit 7dd54af

Browse files
committed
fix program desc unit test error
1 parent b681537 commit 7dd54af

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

paddle/fluid/framework/program_desc_test.cc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,17 @@ TEST(ProgramDesc, copy_ctor) {
8787
ASSERT_EQ(op_origin->Inputs(), op_copy->Inputs());
8888
ASSERT_EQ(op_origin->Outputs(), op_copy->Outputs());
8989

90-
ASSERT_EQ(op_copy->Proto()->SerializeAsString(),
91-
op_origin->Proto()->SerializeAsString());
90+
ASSERT_EQ(op_origin->Proto()->attrs().size(),
91+
op_copy->Proto()->attrs().size());
92+
for (auto it = op_origin->Proto()->attrs().begin();
93+
it != op_origin->Proto()->attrs().end(); ++it) {
94+
for (auto it_2 = op_copy->Proto()->attrs().begin();
95+
it_2 != op_copy->Proto()->attrs().end(); ++it_2) {
96+
if (it->name() == it_2->name()) {
97+
ASSERT_TRUE(it_2->SerializeAsString() == it->SerializeAsString());
98+
}
99+
}
100+
}
92101

93102
if (op->Type() == "op_with_subblock") {
94103
ASSERT_EQ(1, op->GetBlockAttrId("sub_block"));

0 commit comments

Comments
 (0)