diff --git a/relay/include/relay/evaluator.h b/relay/include/relay/evaluator.h index 734bfadc36f6f..3a7a2f340337e 100644 --- a/relay/include/relay/evaluator.h +++ b/relay/include/relay/evaluator.h @@ -24,22 +24,22 @@ class Evaluator : public ExprFunctor { Evaluator(); Evaluator(Environment env) : env(env) {} Value Eval(const Expr& expr); - Value VisitExpr_(const LocalIdNode* op); - Value VisitExpr_(const GlobalIdNode* op); - Value VisitExpr_(const IntrinsicIdNode* op); - Value VisitExpr_(const FloatLitNode* op); - Value VisitExpr_(const BoolLitNode* op); - Value VisitExpr_(const IntLitNode* op); - Value VisitExpr_(const TensorLitNode* op); - Value VisitExpr_(const ProductLitNode* op); - Value VisitExpr_(const CastNode* op); - Value VisitExpr_(const ParamNode* op); - Value VisitExpr_(const FunctionNode* op); - Value VisitExpr_(const CallNode* op); - Value VisitExpr_(const DebugNode* op); - Value VisitExpr_(const UnaryOpNode* op); - Value VisitExpr_(const BinaryOpNode* op); - Value VisitExpr_(const AssignmentNode* op); + Value VisitExpr_(const LocalIdNode* op) override; + Value VisitExpr_(const GlobalIdNode* op) override; + Value VisitExpr_(const IntrinsicIdNode* op) override; + Value VisitExpr_(const FloatLitNode* op) override; + Value VisitExpr_(const BoolLitNode* op) override; + Value VisitExpr_(const IntLitNode* op) override; + Value VisitExpr_(const TensorLitNode* op) override; + Value VisitExpr_(const ProductLitNode* op) override; + Value VisitExpr_(const CastNode* op) override; + Value VisitExpr_(const ParamNode* op) override; + Value VisitExpr_(const FunctionNode* op) override; + Value VisitExpr_(const CallNode* op) override; + Value VisitExpr_(const DebugNode* op) override; + Value VisitExpr_(const UnaryOpNode* op) override; + Value VisitExpr_(const BinaryOpNode* op) override; + Value VisitExpr_(const AssignmentNode* op) override; }; } // namespace relay diff --git a/relay/include/relay/typechecker.h b/relay/include/relay/typechecker.h index e422e40b4d1eb..66354a7c50f90 100644 --- a/relay/include/relay/typechecker.h +++ b/relay/include/relay/typechecker.h @@ -20,22 +20,22 @@ class Typechecker : public ExprFunctor { Typechecker(); Typechecker(Environment env) : env(env) {} Type Check(const Expr & expr); - Type VisitExpr_(const LocalIdNode* op); - Type VisitExpr_(const GlobalIdNode* op); - Type VisitExpr_(const IntrinsicIdNode* op); - Type VisitExpr_(const FloatLitNode* op); - Type VisitExpr_(const BoolLitNode* op); - Type VisitExpr_(const IntLitNode* op); - Type VisitExpr_(const TensorLitNode* op); - Type VisitExpr_(const ProductLitNode* op); - Type VisitExpr_(const CastNode* op); - Type VisitExpr_(const ParamNode* op); - Type VisitExpr_(const FunctionNode* op); - Type VisitExpr_(const CallNode* op); - Type VisitExpr_(const DebugNode* op); - Type VisitExpr_(const UnaryOpNode* op); - Type VisitExpr_(const BinaryOpNode* op); - Type VisitExpr_(const AssignmentNode* op); + Type VisitExpr_(const LocalIdNode* op) override; + Type VisitExpr_(const GlobalIdNode* op) override; + Type VisitExpr_(const IntrinsicIdNode* op) override; + Type VisitExpr_(const FloatLitNode* op) override; + Type VisitExpr_(const BoolLitNode* op) override; + Type VisitExpr_(const IntLitNode* op) override; + Type VisitExpr_(const TensorLitNode* op) override; + Type VisitExpr_(const ProductLitNode* op) override; + Type VisitExpr_(const CastNode* op) override; + Type VisitExpr_(const ParamNode* op) override; + Type VisitExpr_(const FunctionNode* op) override; + Type VisitExpr_(const CallNode* op) override; + Type VisitExpr_(const DebugNode* op) override; + Type VisitExpr_(const UnaryOpNode* op) override; + Type VisitExpr_(const BinaryOpNode* op) override; + Type VisitExpr_(const AssignmentNode* op) override; }; } // namespace relay diff --git a/relay/include/relay/visitor.h b/relay/include/relay/visitor.h index 034db9b0ce416..c05f433ae881c 100644 --- a/relay/include/relay/visitor.h +++ b/relay/include/relay/visitor.h @@ -45,7 +45,7 @@ class FunctorNode void VisitAttrs(tvm::AttrVisitor* v) final {} - NodeRef VisitExpr_(const LocalIdNode* local, tvm::Array args) { + NodeRef VisitExpr_(const LocalIdNode* local, tvm::Array args) override { if (visit_local_id != nullptr) { return visit_local_id(local->name, args); } else { @@ -53,7 +53,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const GlobalIdNode* global, tvm::Array args) { + NodeRef VisitExpr_(const GlobalIdNode* global, tvm::Array args) override { if (visit_global_id != nullptr) { return visit_global_id(global->name, args); } else { @@ -62,7 +62,7 @@ class FunctorNode } NodeRef VisitExpr_(const IntrinsicIdNode* intrinsic, - tvm::Array args) { + tvm::Array args) override { if (visit_intrinsic_id != nullptr) { return visit_intrinsic_id(intrinsic->name, args); } else { @@ -70,7 +70,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const FloatLitNode* float_lit, tvm::Array args) { + NodeRef VisitExpr_(const FloatLitNode* float_lit, tvm::Array args) override { if (visit_float_lit != nullptr) { return visit_float_lit(float_lit->value, args); } else { @@ -78,7 +78,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const BoolLitNode* bool_lit, tvm::Array args) { + NodeRef VisitExpr_(const BoolLitNode* bool_lit, tvm::Array args) override { if (visit_bool_lit != nullptr) { return visit_bool_lit(bool_lit->value, args); } else { @@ -86,7 +86,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const IntLitNode* int_lit, tvm::Array args) { + NodeRef VisitExpr_(const IntLitNode* int_lit, tvm::Array args) override { if (visit_int_lit != nullptr) { return visit_int_lit(int_lit->value, args); } else { @@ -95,7 +95,7 @@ class FunctorNode } NodeRef VisitExpr_(const TensorLitNode* tensor_lit, - tvm::Array args) { + tvm::Array args) override { if (visit_tensor_lit != nullptr) { return visit_tensor_lit(tensor_lit->data, args); } else { @@ -104,7 +104,7 @@ class FunctorNode } NodeRef VisitExpr_(const ProductLitNode* product_lit, - tvm::Array args) { + tvm::Array args) override { if (visit_product_lit != nullptr) { return visit_product_lit(product_lit->fields, args); } else { @@ -112,7 +112,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const CastNode* cast, tvm::Array args) { + NodeRef VisitExpr_(const CastNode* cast, tvm::Array args) override { if (visit_cast != nullptr) { return visit_cast(cast->target, cast->node, args); } else { @@ -120,7 +120,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const ParamNode* param, tvm::Array args) { + NodeRef VisitExpr_(const ParamNode* param, tvm::Array args) override { if (visit_param != nullptr) { return visit_param(param->id, param->type, args); } else { @@ -128,7 +128,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const FunctionNode* fn, tvm::Array args) { + NodeRef VisitExpr_(const FunctionNode* fn, tvm::Array args) override { if (visit_function != nullptr) { return visit_function(fn->params, fn->body, args); } else { @@ -136,7 +136,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const CallNode* call, tvm::Array args) { + NodeRef VisitExpr_(const CallNode* call, tvm::Array args) override { if (visit_call != nullptr) { return visit_call(call->fn, call->args, args); } else { @@ -144,7 +144,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const DebugNode* debug, tvm::Array args) { + NodeRef VisitExpr_(const DebugNode* debug, tvm::Array args) override { if (visit_debug != nullptr) { return visit_debug(debug->node, args); } else { @@ -152,7 +152,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const UnaryOpNode* uop, tvm::Array args) { + NodeRef VisitExpr_(const UnaryOpNode* uop, tvm::Array args) override { if (visit_unary_op != nullptr) { return visit_unary_op(static_cast(uop->op), uop->node, args); } else { @@ -160,7 +160,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const BinaryOpNode* bop, tvm::Array args) { + NodeRef VisitExpr_(const BinaryOpNode* bop, tvm::Array args) override { if (visit_binary_op != nullptr) { return visit_binary_op(static_cast(bop->op), bop->left, bop->right, args); @@ -169,7 +169,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const AssignmentNode* bop, tvm::Array args) { + NodeRef VisitExpr_(const AssignmentNode* bop, tvm::Array args) override { throw "foo"; // if (visit_assignment != nullptr) { // return visit_assignment(intrinsic->name, args); @@ -178,7 +178,7 @@ class FunctorNode // } } - NodeRef VisitExpr_(const ReverseNode* rev, tvm::Array args) { + NodeRef VisitExpr_(const ReverseNode* rev, tvm::Array args) override { if (visit_reverse != nullptr) { return visit_reverse(rev->node, args); } else { @@ -186,7 +186,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const AccumulateNode* acc, tvm::Array args) { + NodeRef VisitExpr_(const AccumulateNode* acc, tvm::Array args) override { if (visit_accumulate != nullptr) { return visit_accumulate(acc->update_binders, acc->value, args); } else { @@ -194,7 +194,7 @@ class FunctorNode } } - NodeRef VisitExpr_(const ZeroNode* zero, tvm::Array args) { + NodeRef VisitExpr_(const ZeroNode* zero, tvm::Array args) override { if (visit_zero != nullptr) { return visit_zero(zero->type, args); } else {