template<typename FType>
class tvm::NodeFunctor< FType >
A dynamically dispatched functor on the type of the first argument.
This is a class that is useful to construct polymorphic dispatching base on the AST/IR node's type.
NodeFunctor<std::string (const ObjectRef& n, std::string prefix)> tostr;
tostr.set_dispatch<Add>([](const ObjectRef& op, std::string prefix) {
return prefix + "Add";
});
tostr.set_dispatch<IntImm>([](const ObjectRef& op, std::string prefix) {
return prefix + "IntImm"
});
LOG(INFO) << tostr(x, "My");
LOG(INFO) << tostr(y, "My");
RelayExpr Expr
Definition: expr.h:37
PrimExpr make_const(DataType t, ValueType value, Span span=Span())
Make a const value with certain data type.
Definition: op.h:962
- Template Parameters
-
FType | function signiture This type if only defined for FType with function signature |