Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Relay]Port eliminate_common_subexpr to non-recursive form #6134

Merged
merged 1 commit into from
Jul 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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