What is the difference between ExprRewriter and ExprMutator

see in visitor/include/tvm/relay/expr_functor.h what is the difference between ExprRewriter and ExprMutator? which should I choose in practice.

Hi @ShawnZhuang, you may find this answer helpful: Difference between MixedModeMutator and ExprRewriter. To fill in the gap from the answer in the link, MixedModeMutator was introduced to avoid the recursive nature of ExprMutator helping to prevent stack overflow. I would recommend using either ExprRewriter or MixedModeMutator when writing a pass now. Hope this helps!

1 Like