I was trying to do something like this, basically have my own visitor that will do some work on its own and use the superclass’s visitor to do the rest:
@relax.expr_functor.mutator
class MyMutator(relax.PyExprMutator):
...
def visit_dataflow_block_(self, block):
# visit bindings...
# Do the equivalent of C++'s PyExprMutator::visit_dataflow_block(block):
super(relax.PyExprMutator, self).visit_dataflow_block(block) # Did not work
def visit_call_(self, call):
# Not called if I have my own block visitor.
This didn’t work because the superclass didn’t have any visitor methods in it (I guess the decorator did something here). Without calling the superclass’s visitor, I don’t know how to get it to call visitors of the elements of the block.
Does PyExprMutator
even support this?