Skip to content

Commit

Permalink
[Relay]Port eliminate_common_subexpr to non-recursive form (apache#6134)
Browse files Browse the repository at this point in the history
Co-authored-by: Zheng Jiang <[email protected]>
  • Loading branch information
2 people authored and Trevor Morris committed Aug 26, 2020
1 parent 7218319 commit 2f7d582
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/relay/transforms/eliminate_common_subexpr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@
namespace tvm {
namespace relay {

class CommonSubexprEliminator : public ExprMutator {
class CommonSubexprEliminator : public MixedModeMutator {
public:
explicit CommonSubexprEliminator(runtime::TypedPackedFunc<bool(Expr)> fskip) : fskip_(fskip) {}

Expr VisitExpr_(const CallNode* call) final {
Expr Rewrite_(const CallNode* call, const Expr& post) final {
static auto op_stateful = Op::GetAttrMap<TOpIsStateful>("TOpIsStateful");
Expr new_expr = ExprMutator::VisitExpr_(call);
Expr new_expr = post;
const CallNode* new_call = new_expr.as<CallNode>();
CHECK(new_call);
const OpNode* op = new_call->op.as<OpNode>();
Expand Down Expand Up @@ -80,8 +80,8 @@ class CommonSubexprEliminator : public ExprMutator {
return new_expr;
}

Expr VisitExpr_(const TupleGetItemNode* op) final {
Expr new_expr = ExprMutator::VisitExpr_(op);
Expr Rewrite_(const TupleGetItemNode* op, const Expr& post) final {
Expr new_expr = post;
const TupleGetItemNode* new_tuple_item = new_expr.as<TupleGetItemNode>();
CHECK(new_tuple_item);

Expand Down

0 comments on commit 2f7d582

Please sign in to comment.