19 #ifndef TVM_RELAX_EXPR_H_
20 #define TVM_RELAX_EXPR_H_
60 return equal.FreeVarEqualImpl(
this, other);
65 static constexpr
const char*
_type_key =
"relax.Id";
165 v->Visit(
"args", &
args);
166 v->Visit(
"attrs", &
attrs);
170 v->Visit(
"span", &
span);
187 static constexpr
const char*
_type_key =
"relax.expr.Call";
226 v->Visit(
"fields", &
fields);
229 v->Visit(
"span", &
span);
239 static constexpr
const char*
_type_key =
"relax.expr.Tuple";
266 template <
typename RelaxExpr,
typename = std::enable_if_t<std::is_base_of_v<Expr, RelaxExpr>>>
291 v->Visit(
"tuple_value", &tuple);
292 v->Visit(
"index", &index);
293 v->Visit(
"struct_info_", &struct_info_);
294 v->Visit(
"_checked_type_", &checked_type_);
295 v->Visit(
"span", &span);
308 static constexpr
const char* _type_key =
"relax.expr.TupleGetItem";
341 static constexpr
const char* _type_key =
"relax.expr.LeafExpr";
342 static constexpr
const uint32_t _type_child_slots = 7;
363 v->Visit(
"values", &values);
364 v->Visit(
"struct_info_", &struct_info_);
365 v->Visit(
"_checked_type_", &checked_type_);
366 v->Visit(
"span", &span);
376 static constexpr
const char* _type_key =
"relax.expr.ShapeExpr";
377 static constexpr
const bool _type_has_method_sequal_reduce =
true;
378 static constexpr
const bool _type_has_method_shash_reduce =
true;
400 v->Visit(
"vid", &vid);
401 v->Visit(
"struct_info_", &struct_info_);
402 v->Visit(
"_checked_type_", &checked_type_);
403 v->Visit(
"span", &span);
407 equal->MarkGraphNode();
413 hash_reduce(struct_info_);
416 static constexpr
const char* _type_key =
"relax.expr.Var";
417 static constexpr
const bool _type_has_method_sequal_reduce =
true;
418 static constexpr
const bool _type_has_method_shash_reduce =
true;
419 static constexpr
const uint32_t _type_child_slots = 1;
427 :
Var(
Id(name_hint), struct_info_annotation, span) {}
441 v->Visit(
"vid", &vid);
442 v->Visit(
"struct_info_", &struct_info_);
443 v->Visit(
"_checked_type_", &checked_type_);
444 v->Visit(
"span", &span);
448 equal->MarkGraphNode();
454 hash_reduce(struct_info_);
457 static constexpr
const char* _type_key =
"relax.expr.DataflowVar";
458 static constexpr
const bool _type_has_method_sequal_reduce =
true;
459 static constexpr
const bool _type_has_method_shash_reduce =
true;
467 :
DataflowVar(
Id(name_hint), struct_info_annotation, span) {}
493 v->Visit(
"data", &data);
494 v->Visit(
"struct_info_", &struct_info_);
495 v->Visit(
"_checked_type_", &checked_type_);
496 v->Visit(
"span", &span);
506 hash_reduce(struct_info_);
509 static constexpr
const char* _type_key =
"relax.expr.Constant";
541 v->Visit(
"value", &value);
542 v->Visit(
"struct_info_", &struct_info_);
543 v->Visit(
"_checked_type_", &checked_type_);
544 v->Visit(
"span", &span);
554 static constexpr
const char* _type_key =
"relax.expr.PrimValue";
592 v->Visit(
"value", &value);
593 v->Visit(
"struct_info_", &struct_info_);
594 v->Visit(
"_checked_type_", &checked_type_);
595 v->Visit(
"span", &span);
605 static constexpr
const char* _type_key =
"relax.expr.StringImm";
635 v->Visit(
"value", &value);
636 v->Visit(
"struct_info_", &struct_info_);
637 v->Visit(
"_checked_type_", &checked_type_);
638 v->Visit(
"span", &span);
648 static constexpr
const char* _type_key =
"relax.expr.DataTypeImm";
676 static constexpr
const char* _type_key =
"relax.expr.Binding";
677 static constexpr
const bool _type_has_method_sequal_reduce =
true;
678 static constexpr
const bool _type_has_method_shash_reduce =
true;
709 v->Visit(
"var", &
var);
710 v->Visit(
"value", &value);
711 v->Visit(
"struct_info", &struct_info);
712 v->Visit(
"span", &span);
718 static constexpr
const char* _type_key =
"relax.expr.MatchCast";
719 static constexpr
const bool _type_has_method_sequal_reduce =
true;
720 static constexpr
const bool _type_has_method_shash_reduce =
true;
742 v->Visit(
"var", &
var);
743 v->Visit(
"value", &value);
744 v->Visit(
"span", &span);
750 static constexpr
const char* _type_key =
"relax.expr.VarBinding";
751 static constexpr
const bool _type_has_method_sequal_reduce =
true;
752 static constexpr
const bool _type_has_method_shash_reduce =
true;
769 v->Visit(
"span", &span);
770 v->Visit(
"bindings", &bindings);
779 static constexpr
const char* _type_key =
"relax.expr.BindingBlock";
780 static constexpr
const bool _type_has_method_sequal_reduce =
true;
781 static constexpr
const bool _type_has_method_shash_reduce =
true;
801 static constexpr
const char* _type_key =
"relax.expr.DataflowBlock";
802 static constexpr
const bool _type_has_method_sequal_reduce =
true;
803 static constexpr
const bool _type_has_method_shash_reduce =
true;
824 v->Visit(
"blocks", &blocks);
825 v->Visit(
"body", &body);
826 v->Visit(
"struct_info_", &struct_info_);
827 v->Visit(
"_checked_type_", &checked_type_);
828 v->Visit(
"span", &span);
839 hash_reduce(struct_info_);
842 static constexpr
const char* _type_key =
"relax.expr.SeqExpr";
843 static constexpr
const bool _type_has_method_sequal_reduce =
true;
844 static constexpr
const bool _type_has_method_shash_reduce =
true;
889 v->Visit(
"cond", &cond);
890 v->Visit(
"true_branch", &true_branch);
891 v->Visit(
"false_branch", &false_branch);
892 v->Visit(
"_checked_type_", &checked_type_);
893 v->Visit(
"struct_info_", &struct_info_);
894 v->Visit(
"span", &span);
898 equal->MarkGraphNode();
906 hash_reduce(true_branch);
907 hash_reduce(false_branch);
908 hash_reduce(struct_info_);
911 static constexpr
const char* _type_key =
"relax.expr.If";
963 v->Visit(
"params", ¶ms);
964 v->Visit(
"body", &body);
965 v->Visit(
"is_pure", &is_pure);
966 v->Visit(
"ret_struct_info", &ret_struct_info);
967 v->Visit(
"attrs", &attrs);
968 v->Visit(
"struct_info_", &struct_info_);
969 v->Visit(
"_checked_type_", &checked_type_);
970 v->Visit(
"span", &span);
974 equal->MarkGraphNode();
984 hash_reduce(ret_struct_info);
985 hash_reduce(is_pure);
987 hash_reduce(struct_info_);
990 static constexpr
const char* _type_key =
"relax.expr.Function";
991 static constexpr
const bool _type_has_method_sequal_reduce =
true;
992 static constexpr
const bool _type_has_method_shash_reduce =
true;
1072 v->Visit(
"global_symbol", &global_symbol);
1073 v->Visit(
"struct_info_", &struct_info_);
1074 v->Visit(
"_checked_type_", &checked_type_);
1075 v->Visit(
"span", &span);
1083 hash_reduce(global_symbol);
1084 hash_reduce(struct_info_);
1087 static constexpr
const char* _type_key =
"relax.expr.ExternFunc";
1088 static constexpr
const bool _type_has_method_sequal_reduce =
true;
1089 static constexpr
const bool _type_has_method_shash_reduce =
true;
1133 struct std::hash<
tvm::relax::Var> {
1140 struct std::equal_to<
tvm::relax::Var> {
Runtime Array container types.
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 to BaseAttrsNode.
Definition: attrs.h:190
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:56
Base node of all functions.
Definition: function.h:139
DictAttrs attrs
Additional attributes storing the meta-data.
Definition: function.h:142
Managed reference to BaseFuncNode.
Definition: function.h:230
Managed reference to DictAttrsNode.
Definition: attrs.h:227
Reference to PrimExprNode.
Definition: expr.h:115
Base node of all non-primitive expressions.
Definition: expr.h:362
Type checked_type_
Stores the result of type inference(type checking).
Definition: expr.h:370
Optional< ObjectRef > struct_info_
Stores the result of structure information of the expression that encapsulate both static shape and r...
Definition: expr.h:377
Managed reference to RelaxExprNode.
Definition: expr.h:405
A Reducer class to reduce the structural equality result of two objects.
Definition: structural_equal.h:135
virtual void MarkGraphNode()=0
Mark current comparison as graph node in hashing. Graph node hash will depends on the graph structure...
A Reducer class to reduce the structural hash value.
Definition: structural_hash.h:121
void FreeVarHashImpl(const runtime::Object *var) const
Implementation for hash for a free var.
Definition: structural_hash.h:203
void DefHash(const ObjectRef &key) const
Push hash of key to the current sequence of hash values.
Definition: structural_hash.h:198
Definition: source_map.h:120
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:777
bool SEqualReduce(const BindingBlockNode *other, SEqualReducer equal) const
Definition: expr.h:773
Array< Binding > bindings
Definition: expr.h:766
Span span
Definition: expr.h:765
TVM_DECLARE_BASE_OBJECT_INFO(BindingBlockNode, Object)
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:768
BindingBlock(Array< Binding > bindings, Span span=Span())
BindingBlockNode * CopyOnWrite()
TVM_DEFINE_OBJECT_REF_METHODS(BindingBlock, ObjectRef, BindingBlockNode)
The base class of a variable binding in Relax.
Definition: expr.h:670
TVM_DECLARE_BASE_OBJECT_INFO(BindingNode, Object)
Var var
The return variable to bound to.
Definition: expr.h:673
Span span
Definition: expr.h:674
const BindingNode * operator->() const
Definition: expr.h:689
TVM_DEFINE_DEFAULT_COPY_MOVE_AND_ASSIGN(Binding)
Binding(ObjectPtr< Object > n)
Definition: expr.h:687
const BindingNode * get() const
Definition: expr.h:690
Call corresponds to callable invocation. Corresponds to operation in computational graph terminology.
Definition: expr.h:139
TVM_DECLARE_FINAL_OBJECT_INFO(CallNode, ExprNode)
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:163
bool SEqualReduce(const CallNode *other, SEqualReducer equal) const
Definition: expr.h:173
tvm::Array< Expr > args
The arguments(inputs) of the call.
Definition: expr.h:150
static constexpr const char * _type_key
Definition: expr.h:187
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:179
Expr op
The operator(function) being invoked.
Definition: expr.h:147
Attrs attrs
The additional attributes.
Definition: expr.h:153
Array< StructInfo > sinfo_args
The structure info arguments of a CallNode. sinfo_args is designed to be non-empty only for intrinsic...
Definition: expr.h:161
TVM_DEFINE_OBJECT_REF_COW_METHOD(CallNode)
Call(Expr op, Array< Expr > args, Attrs attrs=Attrs(), Array< StructInfo > sinfo_args=Array< StructInfo >(), Span span=Span())
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(Call, Expr, CallNode)
Constant tensor.
Definition: expr.h:481
runtime::NDArray data
The data of the tensor.
Definition: expr.h:484
TVM_DECLARE_FINAL_OBJECT_INFO(ConstantNode, LeafExprNode)
bool SEqualReduce(const ConstantNode *other, SEqualReducer equal) const
Definition: expr.h:499
bool is_scalar() const
Definition: expr.h:490
TensorType tensor_type() const
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:504
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:492
TVM_DEFINE_OBJECT_REF_METHODS(Constant, LeafExpr, ConstantNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(ConstantNode)
Constant(runtime::NDArray data, Optional< StructInfo > struct_info_annotation=NullOpt, Span span=Span())
The constructor.
Represent a data type constant.
Definition: expr.h:629
DataType value
The data value.
Definition: expr.h:632
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:646
bool SEqualReduce(const DataTypeImmNode *other, SEqualReducer equal) const
Definition: expr.h:641
TVM_DECLARE_FINAL_OBJECT_INFO(DataTypeImmNode, LeafExprNode)
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:634
Managed reference to DataTypeImm.
Definition: expr.h:656
TVM_DEFINE_OBJECT_REF_METHODS(DataTypeImm, LeafExpr, DataTypeImmNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(DataTypeImmNode)
DataTypeImm(DataType value, Span span=Span())
The constructor.
bool SEqualReduce(const DataflowBlockNode *other, SEqualReducer equal) const
Definition: expr.h:795
TVM_DECLARE_FINAL_OBJECT_INFO(DataflowBlockNode, BindingBlockNode)
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:799
TVM_DEFINE_OBJECT_REF_METHODS(DataflowBlock, BindingBlock, DataflowBlockNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(DataflowBlockNode)
DataflowBlock(Array< Binding > bindings, Span span=Span())
A sub-type of the variable node used to mark dataflow variables from normal visible "function local" ...
Definition: expr.h:438
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:440
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:452
bool SEqualReduce(const DataflowVarNode *other, SEqualReducer equal) const
Definition: expr.h:447
TVM_DECLARE_FINAL_OBJECT_INFO(DataflowVarNode, VarNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(DataflowVarNode)
DataflowVar(Id vid, Optional< StructInfo > struct_info_annotation, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(DataflowVar, Var, DataflowVarNode)
DataflowVar(String name_hint, Optional< StructInfo > struct_info_annotation, Span span=Span())
Definition: expr.h:465
The extern function, which can represent packed function.
Definition: expr.h:1066
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:1082
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:1071
String global_symbol
The name of global symbol.
Definition: expr.h:1069
TVM_DECLARE_FINAL_OBJECT_INFO(ExternFuncNode, BaseFuncNode)
bool SEqualReduce(const ExternFuncNode *other, SEqualReducer equal) const
Definition: expr.h:1078
TVM_DEFINE_OBJECT_REF_METHODS(ExternFunc, BaseFunc, ExternFuncNode)
ExternFunc(String global_symbol, StructInfo struct_info, Span span=Span())
ExternFunc(String global_symbol, Span span=Span())
TVM_DEFINE_OBJECT_REF_COW_METHOD(ExternFuncNode)
A Relax function.
Definition: expr.h:951
Array< Var > params
The parameters to the function.
Definition: expr.h:954
TVM_DECLARE_FINAL_OBJECT_INFO(FunctionNode, BaseFuncNode)
SeqExpr body
The body of the function.
Definition: expr.h:956
bool SEqualReduce(const FunctionNode *other, SEqualReducer equal) const
Definition: expr.h:973
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:962
StructInfo ret_struct_info
The return type of the function.
Definition: expr.h:958
bool is_pure
Whether the function is annotated as pure or not.
Definition: expr.h:960
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:980
TVM_DEFINE_OBJECT_REF_METHODS(Function, BaseFunc, FunctionNode)
static Function CreateEmpty(Array< Var > params, StructInfo ret_struct_info, bool is_pure=true, DictAttrs attrs=DictAttrs(), Span span=Span())
Mimics the constructor but without body Expr.
TVM_DEFINE_OBJECT_REF_COW_METHOD(FunctionNode)
Function(Array< Var > params, Expr body, Optional< StructInfo > ret_struct_info, bool is_pure=true, DictAttrs attrs=DictAttrs(), Span span=Span())
Construct a Relax Function.
The unique identifier of variables.
Definition: expr.h:48
bool SEqualReduce(const IdNode *other, SEqualReducer equal) const
Definition: expr.h:59
TVM_DECLARE_FINAL_OBJECT_INFO(IdNode, Object)
static constexpr const bool _type_has_method_shash_reduce
Definition: expr.h:67
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:57
static constexpr const char * _type_key
Definition: expr.h:65
static constexpr const bool _type_has_method_sequal_reduce
Definition: expr.h:66
String name_hint
The name of the variable, this only acts as a hint to the user, and is not used for equality.
Definition: expr.h:55
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:63
Id(String name_hint)
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(Id, ObjectRef, IdNode)
Condition expression.
Definition: expr.h:879
SeqExpr true_branch
The expression evaluated when condition is true.
Definition: expr.h:884
bool SEqualReduce(const IfNode *other, SEqualReducer equal) const
Definition: expr.h:897
Expr cond
The condition.
Definition: expr.h:882
TVM_DECLARE_FINAL_OBJECT_INFO(IfNode, ExprNode)
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:903
SeqExpr false_branch
The expression evaluated when condition is false.
Definition: expr.h:886
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:888
TVM_DEFINE_OBJECT_REF_COW_METHOD(IfNode)
If(Expr cond, Expr true_branch, Expr false_branch, Span span=Span())
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(If, Expr, IfNode)
Base type of all (non-function) leaf Exprs.
Definition: expr.h:339
TVM_DECLARE_BASE_OBJECT_INFO(LeafExprNode, ExprNode)
Managed reference to BaseExprNode.
Definition: expr.h:350
TVM_DEFINE_OBJECT_REF_METHODS(LeafExpr, Expr, LeafExprNode)
Runtime-match the value to the struct info.
Definition: expr.h:701
Expr value
The input value to match cast.
Definition: expr.h:704
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:708
bool SEqualReduce(const MatchCastNode *other, SEqualReducer equal) const
void SHashReduce(SHashReducer hash_reduce) const
StructInfo struct_info
The struct info pattern to match to.
Definition: expr.h:706
TVM_DECLARE_FINAL_OBJECT_INFO(MatchCastNode, BindingNode)
Managed reference to MatchCastNode.
Definition: expr.h:728
TVM_DEFINE_OBJECT_REF_METHODS(MatchCast, Binding, MatchCastNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(MatchCastNode)
MatchCast(Var var, Expr value, StructInfo struct_info, Span span=Span())
PrimValue.
Definition: expr.h:535
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:540
PrimExpr value
The prim expr representing the value.
Definition: expr.h:538
TVM_DECLARE_FINAL_OBJECT_INFO(PrimValueNode, LeafExprNode)
bool SEqualReduce(const PrimValueNode *other, SEqualReducer equal) const
Definition: expr.h:547
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:552
Managed reference to PrimValueNode.
Definition: expr.h:562
TVM_DEFINE_OBJECT_REF_COW_METHOD(PrimValueNode)
static PrimValue Int64(int64_t value, Span span=Span())
Create a int64 prim value.
PrimValue(PrimExpr value, Span span=Span())
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(PrimValue, LeafExpr, PrimValueNode)
A sequence of blocks followed by an expression.
Definition: expr.h:818
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:823
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:836
bool SEqualReduce(const SeqExprNode *other, SEqualReducer equal) const
Definition: expr.h:831
Expr body
Definition: expr.h:821
TVM_DECLARE_FINAL_OBJECT_INFO(SeqExprNode, ExprNode)
Array< BindingBlock > blocks
Definition: expr.h:820
SeqExpr(Array< BindingBlock > blocks, Expr body, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(SeqExpr, Expr, SeqExprNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(SeqExprNode)
A shape expression which allows users to construct a shape containing PrimExpr.
Definition: expr.h:357
TVM_DECLARE_FINAL_OBJECT_INFO(ShapeExprNode, LeafExprNode)
Array< PrimExpr > values
Definition: expr.h:360
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:374
bool SEqualReduce(const ShapeExprNode *other, SEqualReducer equal) const
Definition: expr.h:369
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:362
TVM_DEFINE_OBJECT_REF_METHODS(ShapeExpr, LeafExpr, ShapeExprNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(ShapeExprNode)
ShapeExpr(Array< PrimExpr > values, Span span=Span())
Represent a string literal constant.
Definition: expr.h:586
bool SEqualReduce(const StringImmNode *other, SEqualReducer equal) const
Definition: expr.h:598
TVM_DECLARE_FINAL_OBJECT_INFO(StringImmNode, LeafExprNode)
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:591
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:603
String value
The data value.
Definition: expr.h:589
Managed reference to StringImm.
Definition: expr.h:613
StringImm(String value, Span span=Span())
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(StringImm, LeafExpr, StringImmNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(StringImmNode)
Base type of all structure information.
Definition: expr.h:111
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:117
static constexpr const uint32_t _type_child_slots
Definition: expr.h:122
static constexpr const bool _type_has_method_shash_reduce
Definition: expr.h:121
static constexpr const char * _type_key
Definition: expr.h:119
TVM_DECLARE_BASE_OBJECT_INFO(StructInfoNode, Object)
static constexpr const bool _type_has_method_sequal_reduce
Definition: expr.h:120
Managed reference to StructInfoNode.
Definition: expr.h:130
TVM_DEFINE_OBJECT_REF_METHODS(StructInfo, ObjectRef, StructInfoNode)
Managed reference to TensorTypeNode.
Definition: type.h:111
Get index-th field out of a tuple.
Definition: expr.h:283
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:290
bool SEqualReduce(const TupleGetItemNode *other, SEqualReducer equal) const
Definition: expr.h:298
TVM_DECLARE_FINAL_OBJECT_INFO(TupleGetItemNode, ExprNode)
int index
which value to get
Definition: expr.h:288
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:303
Expr tuple
The tuple Expression.
Definition: expr.h:286
TVM_DEFINE_OBJECT_REF_COW_METHOD(TupleGetItemNode)
TupleGetItem(Expr tuple, int index, Span span=Span())
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(TupleGetItem, Expr, TupleGetItemNode)
Tuple container.
Definition: expr.h:220
tvm::Array< Expr > fields
the fields of the tuple
Definition: expr.h:223
TVM_DECLARE_FINAL_OBJECT_INFO(TupleNode, ExprNode)
bool SEqualReduce(const TupleNode *other, SEqualReducer equal) const
Definition: expr.h:232
static constexpr const char * _type_key
Definition: expr.h:239
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:225
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:237
Tuple(tvm::Array< Expr > fields, Span span=Span())
The constructor.
Tuple(tvm::Array< RelaxExpr > fields, Span span=Span())
Utility constructor to handle conversion to relax::Expr.
Definition: expr.h:267
TVM_DEFINE_OBJECT_REF_METHODS(Tuple, Expr, TupleNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(TupleNode)
Expr value
The binding value.
Definition: expr.h:739
TVM_DECLARE_FINAL_OBJECT_INFO(VarBindingNode, BindingNode)
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:741
void SHashReduce(SHashReducer hash_reduce) const
bool SEqualReduce(const VarBindingNode *other, SEqualReducer equal) const
TVM_DEFINE_OBJECT_REF_COW_METHOD(VarBindingNode)
VarBinding(Var var, Expr value, Span span=Span())
TVM_DEFINE_OBJECT_REF_METHODS(VarBinding, Binding, VarBindingNode)
The variable class for all Relax bindings.
Definition: expr.h:390
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:411
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:399
TVM_DECLARE_BASE_OBJECT_INFO(VarNode, LeafExprNode)
Id vid
The identifier of the variable, which is used for comparing stable equality across transformations.
Definition: expr.h:394
const String & name_hint() const
Definition: expr.h:397
bool SEqualReduce(const VarNode *other, SEqualReducer equal) const
Definition: expr.h:406
TVM_DEFINE_OBJECT_REF_METHODS(Var, LeafExpr, VarNode)
Var(String name_hint, Optional< StructInfo > struct_info_annotation, Span span=Span())
Definition: expr.h:425
Var(Id vid, Optional< StructInfo > struct_info_annotation, Span span=Span())
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
Runtime primitive data type.
Definition: data_type.h:43
Map container of NodeRef->NodeRef in DSL graph. Map implements copy on write semantics,...
Definition: map.h:1271
Managed NDArray. The array is backed by reference counted blocks.
Definition: ndarray.h:51
A custom smart pointer for Object.
Definition: object.h:363
Base class of all object reference.
Definition: object.h:520
base class of all object containers.
Definition: object.h:172
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
Reference to string objects.
Definition: string.h:97
Runtime Map container types.
constexpr const char * kForcePure
Override checking purity for this function and treat as pure (is_pure must be set to true)
Definition: expr.h:1055
constexpr const char * kWorkspaceSize
The required workspace for an external function.
Definition: expr.h:1049
constexpr const char * kNumInput
The number of inputs of a function. If a function has the num_input attribute, the last func->params....
Definition: expr.h:1062
constexpr const char * kComposite
Treat the function as a composite operator.
Definition: expr.h:1045
constexpr const char * kCodegen
Indicate the codegen that should be used for building this function. When this is unset or set to "de...
Definition: expr.h:1043
constexpr const char * kPrimitive
Mark the function as a primitive function.
Definition: expr.h:1038
constexpr const char * kPartitionedFromPattern
Indicate the function was created by the Pattern Partitioning Pass.
Definition: expr.h:1047
If WithFields(If if_expr, Optional< Expr > opt_cond=Optional< Expr >(), Optional< Expr > opt_true_branch=Optional< Expr >(), Optional< Expr > opt_false_branch=Optional< Expr >(), Optional< Span > opt_span=Optional< Span >())
Returns if_expr with the given properties. A null property denotes 'no change'. Returns if_expr if al...
Call WithFields(Call call, Optional< Expr > opt_op=Optional< Expr >(), Optional< Array< Expr >> opt_args=Optional< Array< Expr >>(), Optional< Attrs > opt_attrs=Optional< Attrs >(), Optional< Array< StructInfo >> opt_sinfo_args=Optional< Array< StructInfo >>(), Optional< Span > opt_span=Optional< Span >())
Returns call with the given properties. A null property denotes 'no change'. Returns call if all prop...
Expr GetShapeOf(const Expr &expr)
Get the shape of Expr.
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.
Performance counters for profiling via the PAPI library.
Definition: analyzer.h:36
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
constexpr runtime::NullOptType NullOpt
Definition: optional.h:169
Definitions and helper macros for IR/AST nodes.
A managed object in the TVM runtime.
A map from source names to source code.
ObjectRef equal functor.
Definition: object.h:666
ObjectRef hash functor.
Definition: object.h:656
Common operators defined for Expr.