The current implementation of destroy_all does not work for a partial Op
tree.
Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
// Insert child op nodes
for (uint32_t n = 0; n < cur->arity(); ++n)
{
- q.emplace(cur->arg(n));
+ if (auto child = cur->arg(n))
+ {
+ q.emplace(child);
+ }
}
// Destroy the current op node
ASSERT_EQ(mgr.size(), 0);
}
+
+TEST_F(OpManagerTest, destroy_all_partial_tree)
+{
+ // Create a (partial) Op tree
+ auto conv_op = mgr.create<coco::Conv2D>();
+
+ mgr.destroy_all(conv_op);
+
+ ASSERT_EQ(mgr.size(), 0);
+}