That dispatching logic ca certainly be simplified as a one-liner, which will reduce the memo logic addition to be about 10 loc.
```c++ Result VisitExpr(const& expr) final { auto it = memo_.find(expr); if (it != memo_.end()) { return it->second; } res = ParentClass::VisitExpr(expr); memo_[expr] = res; return res; } ``` I get your point. I think it is ok to add such a base class , and document its restrictions. To be careful in the beginning, let us only put it as an internal header of relay(inside src). --- [Visit Topic](https://discuss.tvm.ai/t/missing-memoization-in-exprfunctor/6334/6) to respond. You are receiving this because you enabled mailing list mode. To unsubscribe from these emails, [click here](https://discuss.tvm.ai/email/unsubscribe/f811e0addf639abb6bb4ca71a8341136852888f9524c3425db36a5fcf2561b69).