@comaniac OK I see. I think FunctionPattern would solve it all for me here. Glad to see the team has a plan on this!
I have tried using this to match
pattern = is_op('nn.conv2d')(wildcard(), wildcard())
pattern = is_op('multiply')(pattern, wildcard())
pattern = is_op('add')(pattern, wildcard())
tuple_get_item_node = TupleGetItemPattern(pattern, 0)
pattern = is_op('nn.relu')(tuple_get_item_node)
but it returns false. Looks like it doesn’t go inside the function. I also tried disabling FuseOps and insert
MergeComposite after Optimize() has finished, but it throws an error saying something like “add
is detected and will be removed by future passes.”
Just to see if there’s any luck here. Is there a way to get it work with the current code base?