tvm
Namespaces | Functions
utils.h File Reference

Utility classes and functions for working with the Relax IR. More...

#include <tvm/arith/analyzer.h>
#include <tvm/ir/module.h>
#include <tvm/relax/expr.h>
#include <tvm/runtime/logging.h>
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 tvm
 runtime implementation for LibTorch/TorchScript.
 
 tvm::relax
 

Functions

Expr tvm::relax::Bind (const Expr &expr, const tvm::Map< Var, Expr > &binds, const tvm::Map< tir::Var, PrimExpr > &symbolic_var_map={})
 Bind the variables to a Relax expression. This is a helper function usually called by other pass functions to help optimizations. If any free variables are introduced into a function, those are added to the function parameters. Additionally this may change the order of parameters if you map a variable to a variable. More...
 
StructInfo tvm::relax::Bind (const StructInfo &sinfo, const tvm::Map< tir::Var, PrimExpr > &symbolic_var_map)
 Bind the symbolic variables to a StructInfo. This is a helper function usually called by other pass functions to help optimizations. More...
 
tvm::Map< tir::Var, PrimExpr > tvm::relax::InferSymbolicVarMap (const tvm::Map< relax::Var, relax::Expr > &binds, arith::Analyzer *analyzer)
 Infer a binding map for symbolic variables. More...
 
bool tvm::relax::IsBoolStructInfo (const StructInfo &sinfo, bool permit_unknown_rank=true, bool permit_unknown_dtype=true)
 Check if the given StructInfo is for a boolean scalar (tensor of rank 0 with a boolean dtype). More...
 
bool tvm::relax::IsLeafOrTuple (const Expr &expr)
 Check if the given expression is a "leaf" node or tuple node for normalization purposes. More...
 
bool tvm::relax::IsImpureCall (const Call &call)
 Check if the given Call node is an impure operation. If the callee is a general expression, this simply requires checking the purity field of the FuncStructInfo. If it is an Op, then this checks the fPurity field. More...
 
Function tvm::relax::CopyWithNewVars (Function func)
 Copy the given function. All variables that are bound inside the original function would be copied to satisfy the restriction in the well-formed check: Variables in Relax must be bound exactly once. This also ensures that both the function and its copy can be inserted into the same IRModule, and be asserted on the structural equality agaisnt IRModule created by TVMScript. More...
 
Expr tvm::relax::ToNonDataflow (const Expr &e)
 Transform all dataflow structure to non-dataflow version. More...
 
Expr tvm::relax::GetBoundValue (const Binding &b)
 Get the value bound in the binding. More...
 

Detailed Description

Utility classes and functions for working with the Relax IR.