tvm
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Namespaces | Macros | Functions
expr_functor.h File Reference

A more powerful visitor which enables defining arbitrary function signatures with type based dispatch on first argument. More...

#include <tvm/node/functor.h>
#include <tvm/relay/adt.h>
#include <tvm/relay/error.h>
#include <tvm/relay/expr.h>
#include <tvm/relay/function.h>
#include <tvm/relay/op.h>
#include <deque>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
Include dependency graph for expr_functor.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  tvm::relay::ExprFunctor< R(const Expr &n, Args...)>
 
class  tvm::relay::ExprVisitor
 A simple visitor wrapper around ExprFunctor. Recursively visit the content. More...
 
class  tvm::relay::ExprMutator
 A wrapper around ExprFunctor which functionally updates the AST. More...
 
class  tvm::relay::MixedModeVisitor
 A wrapper around ExprVisitor which traverses the Dataflow Normal AST. More...
 
class  tvm::relay::MixedModeMutator
 Non-recursive DFS Graph Traversal for Custom Rewriting Passes. More...
 
class  tvm::relay::ExprRewriter
 A non-iterating Expression Rewriter. More...
 
struct  tvm::relay::v_info
 A struct to keep info of traversed expr in ExpandDataflow function. More...
 

Namespaces

 tvm
 runtime implementation for LibTorch/TorchScript.
 
 tvm::relay
 Relay: a high level functional IR for TVM.
 

Macros

#define EXPR_FUNCTOR_DEFAULT    { return VisitExprDefault_(op, std::forward<Args>(args)...); }
 
#define RELAY_EXPR_FUNCTOR_DISPATCH(OP)
 
#define RELAY_EXPR_REWRITER_DISPATCH(OP)
 
#define EXPR_REWRITER_REWRITE_DEFAULT    { return post; }
 

Functions

Expr tvm::relay::PostOrderRewrite (const Expr &expr, ExprRewriter *rewriter)
 Non-recursive DFS Graph Traversal for Custom Rewriting Passes. More...
 
void tvm::relay::PostOrderVisit (const Expr &node, std::function< void(const Expr &)> fvisit)
 recursively visit the ir in post DFS order node, apply fvisit Each node is guaranteed to be visited only once. More...
 
template<typename FCheckVisited , typename FVisitLeaf , typename FExpandExpr >
void tvm::relay::ExpandDataflow (Expr expr, FCheckVisited fcheck_visited, FVisitLeaf fvisit_leaf, FExpandExpr fexpand_expr)
 A function to iteratively traverse dataflow regions of a graph. More...
 
template<typename FCheckVisited , typename FVisitLeaf >
void tvm::relay::ExpandDataflow (Expr expr, FCheckVisited fcheck_visited, FVisitLeaf fvisit_leaf)
 
void tvm::relay::ExpandANormalForm (const LetNode *op, std::function< void(const LetNode *)> pre_visit, std::function< void(const LetNode *)> post_visit)
 

Detailed Description

A more powerful visitor which enables defining arbitrary function signatures with type based dispatch on first argument.

Macro Definition Documentation

◆ EXPR_FUNCTOR_DEFAULT

#define EXPR_FUNCTOR_DEFAULT    { return VisitExprDefault_(op, std::forward<Args>(args)...); }

◆ EXPR_REWRITER_REWRITE_DEFAULT

#define EXPR_REWRITER_REWRITE_DEFAULT    { return post; }

◆ RELAY_EXPR_FUNCTOR_DISPATCH

#define RELAY_EXPR_FUNCTOR_DISPATCH (   OP)
Value:
vtable.template set_dispatch<OP>([](const ObjectRef& n, TSelf* self, Args... args) { \
return self->VisitExpr_(static_cast<const OP*>(n.get()), std::forward<Args>(args)...); \
});

◆ RELAY_EXPR_REWRITER_DISPATCH

#define RELAY_EXPR_REWRITER_DISPATCH (   OP)
Value:
vtable.template set_dispatch<OP>([](const ObjectRef& n, TSelf* self, const Expr& post) { \
return self->Rewrite_(static_cast<const OP*>(n.get()), post); \
});
tvm::RelayExpr Expr
Definition: expr.h:54