tvm
Classes | Public Member Functions | Protected Member Functions | List of all members
tvm::relax::ExprMutatorBase Class Reference

A mutator works in unnormalized form. More...

#include <expr_functor.h>

Inheritance diagram for tvm::relax::ExprMutatorBase:
Collaboration diagram for tvm::relax::ExprMutatorBase:

Public Member Functions

Expr VisitExpr (const Expr &expr) override
 
Expr VisitExpr_ (const ConstantNode *op) override
 
Expr VisitExpr_ (const TupleNode *op) override
 
Expr VisitExpr_ (const VarNode *op) override
 
Expr VisitExpr_ (const DataflowVarNode *op) override
 
Expr VisitExpr_ (const ShapeExprNode *op) override
 
Expr VisitExpr_ (const ExternFuncNode *op) override
 
Expr VisitExpr_ (const GlobalVarNode *op) override
 
Expr VisitExpr_ (const FunctionNode *op) override
 
Expr VisitExpr_ (const CallNode *op) override
 
Expr VisitExpr_ (const SeqExprNode *op) override
 
Expr VisitExpr_ (const IfNode *op) override
 
Expr VisitExpr_ (const OpNode *op) override
 
Expr VisitExpr_ (const TupleGetItemNode *op) override
 
Expr VisitExpr_ (const PrimValueNode *op) override
 
Expr VisitExpr_ (const StringImmNode *op) override
 
Expr VisitExpr_ (const DataTypeImmNode *op) override
 
virtual BindingBlock VisitBindingBlock (const BindingBlock &block)
 Mutate BindingBlock. More...
 
virtual PrimExpr VisitPrimExpr (const PrimExpr &expr)
 Used to visit the PrimExpr inside of expressions. More...
 
virtual StructInfo VisitExprDepStructInfoField (const StructInfo &struct_info)
 Visit struct_info that may recursively contain Expr/PrimExpr. More...
 

Protected Member Functions

bool VisitAndCheckStructInfoFieldUnchanged (const ObjectRef &struct_info)
 Check whether VisitExprDepStructInfoField change struct_info. More...
 

Detailed Description

A mutator works in unnormalized form.

ExprMutatorBase expects input AST to be in the unnormalized form, i.e., checked_type_ and shape_ of expressions can be nullptr, and the expressions may nest(and as a result the AST is not in ANF).

Member Function Documentation

◆ VisitAndCheckStructInfoFieldUnchanged()

bool tvm::relax::ExprMutatorBase::VisitAndCheckStructInfoFieldUnchanged ( const ObjectRef struct_info)
inlineprotected

Check whether VisitExprDepStructInfoField change struct_info.

Returns
Whether struct info changed.
Note
This function is used by mutator implementations to check if previous Expr update will trigger a change in struct_info. If change is detected, the implementation can generate a fresh node without struct_info, and trigger normalizer to re-derive.

◆ VisitBindingBlock()

virtual BindingBlock tvm::relax::ExprMutatorBase::VisitBindingBlock ( const BindingBlock block)
virtual

Mutate BindingBlock.

Parameters
blockThe binding block to be visited.
Returns
The binding block after transformation.

Reimplemented in tvm::relax::ExprMutator.

◆ VisitExpr()

Expr tvm::relax::ExprMutatorBase::VisitExpr ( const Expr expr)
override

◆ VisitExpr_() [1/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const CallNode op)
override

◆ VisitExpr_() [2/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const ConstantNode op)
override

◆ VisitExpr_() [3/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const DataflowVarNode op)
override

◆ VisitExpr_() [4/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const DataTypeImmNode op)
override

◆ VisitExpr_() [5/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const ExternFuncNode op)
override

◆ VisitExpr_() [6/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const FunctionNode op)
override

◆ VisitExpr_() [7/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const GlobalVarNode op)
override

◆ VisitExpr_() [8/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const IfNode op)
override

◆ VisitExpr_() [9/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const OpNode op)
override

◆ VisitExpr_() [10/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const PrimValueNode op)
override

◆ VisitExpr_() [11/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const SeqExprNode op)
override

◆ VisitExpr_() [12/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const ShapeExprNode op)
override

◆ VisitExpr_() [13/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const StringImmNode op)
override

◆ VisitExpr_() [14/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const TupleGetItemNode op)
override

◆ VisitExpr_() [15/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const TupleNode op)
override

◆ VisitExpr_() [16/16]

Expr tvm::relax::ExprMutatorBase::VisitExpr_ ( const VarNode op)
override

◆ VisitExprDepStructInfoField()

virtual StructInfo tvm::relax::ExprMutatorBase::VisitExprDepStructInfoField ( const StructInfo struct_info)
virtual

Visit struct_info that may recursively contain Expr/PrimExpr.

By default, this function recurse into struct info such as TensorStructInfo and ShapeStructInfo and call VisitExpr/VisitPrimExpr accordingly. It does not recurse into FunctionStructInfo as it does not contain Expr defined in the current scope.

Pass writers can overload this function to change to other behaviors. For example, if in Expr in StructInfo won't change, we can override this function by an identity function.

Parameters
struct_infoInput struct info field.
Returns
The updated struct info.

◆ VisitPrimExpr()

virtual PrimExpr tvm::relax::ExprMutatorBase::VisitPrimExpr ( const PrimExpr expr)
virtual

Used to visit the PrimExpr inside of expressions.

Can be overloaded to transform the shape expressions.


The documentation for this class was generated from the following file: