24 #ifndef TVM_RELAY_DATAFLOW_MATCHER_H_
25 #define TVM_RELAY_DATAFLOW_MATCHER_H_
31 #include <unordered_map>
37 class DFPatternCallback;
59 static constexpr
const char*
_type_key =
"DFPatternCallbackNode";
70 bool rewrite_once =
false);
Visitor class to get the attributes of an AST/IR node. The content is going to be called for each fie...
Definition: reflection.h:52
Managed reference class to IRModuleNode.
Definition: module.h:366
Managed reference to RelayExprNode.
Definition: expr.h:442
Base type of all dataflow pattern callbacks.
Definition: dataflow_matcher.h:42
TVM_DECLARE_BASE_OBJECT_INFO(DFPatternCallbackNode, Object)
void VisitAttrs(tvm::AttrVisitor *v)
Definition: dataflow_matcher.h:53
bool rewrite_once
Run the callback only once.
Definition: dataflow_matcher.h:51
static constexpr const char * _type_key
Definition: dataflow_matcher.h:59
bool require_type
Require InferType to be run before the callback.
Definition: dataflow_matcher.h:49
DFPattern pattern
Pattern this callback matches.
Definition: dataflow_matcher.h:45
Managed reference to dataflow pattern callbacks.
Definition: dataflow_matcher.h:67
TVM_DEFINE_OBJECT_REF_METHODS(DFPatternCallback, ObjectRef, DFPatternCallbackNode)
DFPatternCallback(DFPattern pattern, PackedFunc callback, bool require_type, bool rewrite_once=false)
Managed reference to dataflow patterns.
Definition: dataflow_pattern.h:52
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics,...
Definition: map.h:1271
Base class of all object reference.
Definition: object.h:519
base class of all object containers.
Definition: object.h:171
Packed function is a type-erased function. The arguments are passed by packed format.
Definition: packed_func.h:141
Expr PartitionPattern(DFPattern pattern, Expr expr, Map< String, ObjectRef > attrs, PackedFunc check)
Partition all matches of a DFPattern inside an Expr into separate Function calls.
Expr InferType(const Expr &expr)
Infer the type of an expression.
bool MatchPattern(DFPattern pattern, Expr expr)
Determine if a pattern matches an expression.
Expr RewritePatterns(Array< DFPatternCallback > callbacks, Expr expr, IRModule mod=IRModule())
Rewrite an expression based on some number of DFPatternCallbacks.
IRModuleFrame IRModule()
The IRModule declaration statement.
Definition: module.h:359
tvm::PrimExpr mod(const tvm::PrimExpr &a, const tvm::PrimExpr &b)
Definition: broadcast.h:290
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
A pattern language for matching dataflow properties.
A set of passes for operating on pattern graphs.