Difference between MixedModeMutator and ExprRewriter

Hi,

I’ve been looking at types of Relay pass recently and got a bit confused when it comes to MixedModeMutator and when it should be used over ExprRewriter. The RFC (Performing Relay Passes Non-Recursively) seems to me to suggest that ExprRewriter should be used when wanting to mutate a graph non-recursively, yet I can see many uses of MixedModeMutator in the codebase for seemingly a similar reason. Therefore, I’m wondering if/what the difference is between MixedModeMutator and ExprRewriter, and when one should be used over the other?

cc @mbrookhart @tqchen @manupa-arm

Hi @lhutton1. That was the intention (it’s somewhat safer to do a dataflow transformation without access to recursion at all), but MixedMode* was introduced well after TVM became a mature project, and it seems like most people prefer using the MixedModMutator directly, since the API is closer to ExprMutator.

Thanks @mbrookhart, this is what I suspected :slight_smile: