Proper way to compare relay call node (for deleting duplicated)

Hi,

I made a custom Pass and the Pass can return duplicated nodes

So I need to post-processing to remove duplicated.

I first tried by

node_list = list(set(node_list))

but this method identify each node by some kind of memory address something.

What I’m trying is that transforming node object to string and compare the string.

But this taste like some kind of hacky/dirty trick , so I wonder there is a recommended way to compare one node to another.

Thank you.

Is tvm.ir.structural_equal not adequate for your purposes?

Wow. This would be more properway to comparing node.

Thanks so much!!