19 #ifndef TVM_RELAX_EXPR_H_
20 #define TVM_RELAX_EXPR_H_
59 return equal.FreeVarEqualImpl(
this, other);
64 static constexpr
const char*
_type_key =
"relax.Id";
164 v->Visit(
"args", &
args);
165 v->Visit(
"attrs", &
attrs);
169 v->Visit(
"span", &
span);
186 static constexpr
const char*
_type_key =
"relax.expr.Call";
225 v->Visit(
"fields", &
fields);
228 v->Visit(
"span", &
span);
238 static constexpr
const char*
_type_key =
"relax.expr.Tuple";
265 template <
typename RelaxExpr,
typename = std::enable_if_t<std::is_base_of_v<Expr, RelaxExpr>>>
267 :
Tuple(fields.
Map([](const RelaxExpr& expr) ->
Expr { return expr; }), span) {}
290 v->Visit(
"tuple_value", &tuple);
291 v->Visit(
"index", &index);
292 v->Visit(
"struct_info_", &struct_info_);
293 v->Visit(
"_checked_type_", &checked_type_);
294 v->Visit(
"span", &span);
307 static constexpr
const char* _type_key =
"relax.expr.TupleGetItem";
340 static constexpr
const char* _type_key =
"relax.expr.LeafExpr";
341 static constexpr
const uint32_t _type_child_slots = 7;
362 v->Visit(
"values", &values);
363 v->Visit(
"struct_info_", &struct_info_);
364 v->Visit(
"_checked_type_", &checked_type_);
365 v->Visit(
"span", &span);
375 static constexpr
const char* _type_key =
"relax.expr.ShapeExpr";
376 static constexpr
const bool _type_has_method_sequal_reduce =
true;
377 static constexpr
const bool _type_has_method_shash_reduce =
true;
399 v->Visit(
"vid", &vid);
400 v->Visit(
"struct_info_", &struct_info_);
401 v->Visit(
"_checked_type_", &checked_type_);
402 v->Visit(
"span", &span);
406 equal->MarkGraphNode();
412 hash_reduce(struct_info_);
415 static constexpr
const char* _type_key =
"relax.expr.Var";
416 static constexpr
const bool _type_has_method_sequal_reduce =
true;
417 static constexpr
const bool _type_has_method_shash_reduce =
true;
418 static constexpr
const uint32_t _type_child_slots = 2;
426 :
Var(
Id(name_hint), struct_info_annotation, span) {}
440 v->Visit(
"vid", &vid);
441 v->Visit(
"struct_info_", &struct_info_);
442 v->Visit(
"_checked_type_", &checked_type_);
443 v->Visit(
"span", &span);
447 equal->MarkGraphNode();
453 hash_reduce(struct_info_);
456 static constexpr
const char* _type_key =
"relax.expr.DataflowVar";
457 static constexpr
const bool _type_has_method_sequal_reduce =
true;
458 static constexpr
const bool _type_has_method_shash_reduce =
true;
466 :
DataflowVar(
Id(name_hint), struct_info_annotation, span) {}
492 v->Visit(
"data", &data);
493 v->Visit(
"struct_info_", &struct_info_);
494 v->Visit(
"_checked_type_", &checked_type_);
495 v->Visit(
"span", &span);
505 hash_reduce(struct_info_);
508 static constexpr
const char* _type_key =
"relax.expr.Constant";
540 v->Visit(
"value", &value);
541 v->Visit(
"struct_info_", &struct_info_);
542 v->Visit(
"_checked_type_", &checked_type_);
543 v->Visit(
"span", &span);
553 static constexpr
const char* _type_key =
"relax.expr.PrimValue";
591 v->Visit(
"value", &value);
592 v->Visit(
"struct_info_", &struct_info_);
593 v->Visit(
"_checked_type_", &checked_type_);
594 v->Visit(
"span", &span);
604 static constexpr
const char* _type_key =
"relax.expr.StringImm";
634 v->Visit(
"value", &value);
635 v->Visit(
"struct_info_", &struct_info_);
636 v->Visit(
"_checked_type_", &checked_type_);
637 v->Visit(
"span", &span);
647 static constexpr
const char* _type_key =
"relax.expr.DataTypeImm";
675 static constexpr
const char* _type_key =
"relax.expr.Binding";
676 static constexpr
const bool _type_has_method_sequal_reduce =
true;
677 static constexpr
const bool _type_has_method_shash_reduce =
true;
708 v->Visit(
"var", &
var);
709 v->Visit(
"value", &value);
710 v->Visit(
"struct_info", &struct_info);
711 v->Visit(
"span", &span);
717 static constexpr
const char* _type_key =
"relax.expr.MatchCast";
718 static constexpr
const bool _type_has_method_sequal_reduce =
true;
719 static constexpr
const bool _type_has_method_shash_reduce =
true;
741 v->Visit(
"var", &
var);
742 v->Visit(
"value", &value);
743 v->Visit(
"span", &span);
749 static constexpr
const char* _type_key =
"relax.expr.VarBinding";
750 static constexpr
const bool _type_has_method_sequal_reduce =
true;
751 static constexpr
const bool _type_has_method_shash_reduce =
true;
768 v->Visit(
"span", &span);
769 v->Visit(
"bindings", &bindings);
778 static constexpr
const char* _type_key =
"relax.expr.BindingBlock";
779 static constexpr
const bool _type_has_method_sequal_reduce =
true;
780 static constexpr
const bool _type_has_method_shash_reduce =
true;
800 static constexpr
const char* _type_key =
"relax.expr.DataflowBlock";
801 static constexpr
const bool _type_has_method_sequal_reduce =
true;
802 static constexpr
const bool _type_has_method_shash_reduce =
true;
823 v->Visit(
"blocks", &blocks);
824 v->Visit(
"body", &body);
825 v->Visit(
"struct_info_", &struct_info_);
826 v->Visit(
"_checked_type_", &checked_type_);
827 v->Visit(
"span", &span);
838 hash_reduce(struct_info_);
841 static constexpr
const char* _type_key =
"relax.expr.SeqExpr";
842 static constexpr
const bool _type_has_method_sequal_reduce =
true;
843 static constexpr
const bool _type_has_method_shash_reduce =
true;
888 v->Visit(
"cond", &cond);
889 v->Visit(
"true_branch", &true_branch);
890 v->Visit(
"false_branch", &false_branch);
891 v->Visit(
"_checked_type_", &checked_type_);
892 v->Visit(
"struct_info_", &struct_info_);
893 v->Visit(
"span", &span);
897 equal->MarkGraphNode();
905 hash_reduce(true_branch);
906 hash_reduce(false_branch);
907 hash_reduce(struct_info_);
910 static constexpr
const char* _type_key =
"relax.expr.If";
962 v->Visit(
"params", ¶ms);
963 v->Visit(
"body", &body);
964 v->Visit(
"is_pure", &is_pure);
965 v->Visit(
"ret_struct_info", &ret_struct_info);
966 v->Visit(
"attrs", &attrs);
967 v->Visit(
"struct_info_", &struct_info_);
968 v->Visit(
"_checked_type_", &checked_type_);
969 v->Visit(
"span", &span);
973 equal->MarkGraphNode();
983 hash_reduce(ret_struct_info);
984 hash_reduce(is_pure);
986 hash_reduce(struct_info_);
989 static constexpr
const char* _type_key =
"relax.expr.Function";
990 static constexpr
const bool _type_has_method_sequal_reduce =
true;
991 static constexpr
const bool _type_has_method_shash_reduce =
true;
1071 v->Visit(
"global_symbol", &global_symbol);
1072 v->Visit(
"struct_info_", &struct_info_);
1073 v->Visit(
"_checked_type_", &checked_type_);
1074 v->Visit(
"span", &span);
1082 hash_reduce(global_symbol);
1083 hash_reduce(struct_info_);
1086 static constexpr
const char* _type_key =
"relax.expr.ExternFunc";
1087 static constexpr
const bool _type_has_method_sequal_reduce =
true;
1088 static constexpr
const bool _type_has_method_shash_reduce =
true;
1132 struct std::hash<
tvm::relax::Var> {
1139 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
Optional< ObjectRef > struct_info_
Stores the result of structure information of the expression that encapsulate both static shape and r...
Definition: expr.h:377
Type checked_type_
Stores the result of type inference(type checking).
Definition: expr.h:370
Managed reference to RelayExprNode.
Definition: expr.h:442
A Reducer class to reduce the structural equality result of two objects.
Definition: structural_equal.h:137
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
Managed reference to TensorTypeNode.
Definition: tensor_type.h:99
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:776
bool SEqualReduce(const BindingBlockNode *other, SEqualReducer equal) const
Definition: expr.h:772
Array< Binding > bindings
Definition: expr.h:765
Span span
Definition: expr.h:764
TVM_DECLARE_BASE_OBJECT_INFO(BindingBlockNode, Object)
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:767
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:669
TVM_DECLARE_BASE_OBJECT_INFO(BindingNode, Object)
Var var
The return variable to bound to.
Definition: expr.h:672
Span span
Definition: expr.h:673
const BindingNode * operator->() const
Definition: expr.h:688
TVM_DEFINE_DEFAULT_COPY_MOVE_AND_ASSIGN(Binding)
Binding(ObjectPtr< Object > n)
Definition: expr.h:686
const BindingNode * get() const
Definition: expr.h:689
Call corresponds to callable invocation. Corresponds to operation in computational graph terminology.
Definition: expr.h:138
TVM_DECLARE_FINAL_OBJECT_INFO(CallNode, ExprNode)
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:162
bool SEqualReduce(const CallNode *other, SEqualReducer equal) const
Definition: expr.h:172
tvm::Array< Expr > args
The arguments(inputs) of the call.
Definition: expr.h:149
static constexpr const char * _type_key
Definition: expr.h:186
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:178
Expr op
The operator(function) being invoked.
Definition: expr.h:146
Attrs attrs
The additional attributes.
Definition: expr.h:152
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:160
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:480
runtime::NDArray data
The data of the tensor.
Definition: expr.h:483
TVM_DECLARE_FINAL_OBJECT_INFO(ConstantNode, LeafExprNode)
bool SEqualReduce(const ConstantNode *other, SEqualReducer equal) const
Definition: expr.h:498
bool is_scalar() const
Definition: expr.h:489
TensorType tensor_type() const
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:503
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:491
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:628
DataType value
The data value.
Definition: expr.h:631
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:645
bool SEqualReduce(const DataTypeImmNode *other, SEqualReducer equal) const
Definition: expr.h:640
TVM_DECLARE_FINAL_OBJECT_INFO(DataTypeImmNode, LeafExprNode)
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:633
Managed reference to DataTypeImm.
Definition: expr.h:655
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:794
TVM_DECLARE_FINAL_OBJECT_INFO(DataflowBlockNode, BindingBlockNode)
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:798
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:437
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:439
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:451
bool SEqualReduce(const DataflowVarNode *other, SEqualReducer equal) const
Definition: expr.h:446
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:464
The extern function, which can represent packed function.
Definition: expr.h:1065
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:1081
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:1070
String global_symbol
The name of global symbol.
Definition: expr.h:1068
TVM_DECLARE_FINAL_OBJECT_INFO(ExternFuncNode, BaseFuncNode)
bool SEqualReduce(const ExternFuncNode *other, SEqualReducer equal) const
Definition: expr.h:1077
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:950
Array< Var > params
The parameters to the function.
Definition: expr.h:953
TVM_DECLARE_FINAL_OBJECT_INFO(FunctionNode, BaseFuncNode)
SeqExpr body
The body of the function.
Definition: expr.h:955
bool SEqualReduce(const FunctionNode *other, SEqualReducer equal) const
Definition: expr.h:972
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:961
StructInfo ret_struct_info
The return type of the function.
Definition: expr.h:957
bool is_pure
Whether the function is annotated as pure or not.
Definition: expr.h:959
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:979
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:47
bool SEqualReduce(const IdNode *other, SEqualReducer equal) const
Definition: expr.h:58
TVM_DECLARE_FINAL_OBJECT_INFO(IdNode, Object)
static constexpr const bool _type_has_method_shash_reduce
Definition: expr.h:66
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:56
static constexpr const char * _type_key
Definition: expr.h:64
static constexpr const bool _type_has_method_sequal_reduce
Definition: expr.h:65
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:54
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:62
Id(String name_hint)
The constructor.
TVM_DEFINE_OBJECT_REF_METHODS(Id, ObjectRef, IdNode)
Condition expression.
Definition: expr.h:878
SeqExpr true_branch
The expression evaluated when condition is true.
Definition: expr.h:883
bool SEqualReduce(const IfNode *other, SEqualReducer equal) const
Definition: expr.h:896
Expr cond
The condition.
Definition: expr.h:881
TVM_DECLARE_FINAL_OBJECT_INFO(IfNode, ExprNode)
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:902
SeqExpr false_branch
The expression evaluated when condition is false.
Definition: expr.h:885
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:887
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:338
TVM_DECLARE_BASE_OBJECT_INFO(LeafExprNode, ExprNode)
Managed reference to BaseExprNode.
Definition: expr.h:349
TVM_DEFINE_OBJECT_REF_METHODS(LeafExpr, Expr, LeafExprNode)
Runtime-match the value to the struct info.
Definition: expr.h:700
Expr value
The input value to match cast.
Definition: expr.h:703
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:707
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:705
TVM_DECLARE_FINAL_OBJECT_INFO(MatchCastNode, BindingNode)
Managed reference to MatchCastNode.
Definition: expr.h:727
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:534
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:539
PrimExpr value
The prim expr representing the value.
Definition: expr.h:537
TVM_DECLARE_FINAL_OBJECT_INFO(PrimValueNode, LeafExprNode)
bool SEqualReduce(const PrimValueNode *other, SEqualReducer equal) const
Definition: expr.h:546
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:551
Managed reference to PrimValueNode.
Definition: expr.h:561
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:817
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:822
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:835
bool SEqualReduce(const SeqExprNode *other, SEqualReducer equal) const
Definition: expr.h:830
Expr body
Definition: expr.h:820
TVM_DECLARE_FINAL_OBJECT_INFO(SeqExprNode, ExprNode)
Array< BindingBlock > blocks
Definition: expr.h:819
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:356
TVM_DECLARE_FINAL_OBJECT_INFO(ShapeExprNode, LeafExprNode)
Array< PrimExpr > values
Definition: expr.h:359
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:373
bool SEqualReduce(const ShapeExprNode *other, SEqualReducer equal) const
Definition: expr.h:368
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:361
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:585
bool SEqualReduce(const StringImmNode *other, SEqualReducer equal) const
Definition: expr.h:597
TVM_DECLARE_FINAL_OBJECT_INFO(StringImmNode, LeafExprNode)
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:590
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:602
String value
The data value.
Definition: expr.h:588
Managed reference to StringImm.
Definition: expr.h:612
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:110
Span span
Span that points to the original source code. Reserved debug information.
Definition: expr.h:116
static constexpr const uint32_t _type_child_slots
Definition: expr.h:121
static constexpr const bool _type_has_method_shash_reduce
Definition: expr.h:120
static constexpr const char * _type_key
Definition: expr.h:118
TVM_DECLARE_BASE_OBJECT_INFO(StructInfoNode, Object)
static constexpr const bool _type_has_method_sequal_reduce
Definition: expr.h:119
Managed reference to StructInfoNode.
Definition: expr.h:129
TVM_DEFINE_OBJECT_REF_METHODS(StructInfo, ObjectRef, StructInfoNode)
Get index-th field out of a tuple.
Definition: expr.h:282
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:289
bool SEqualReduce(const TupleGetItemNode *other, SEqualReducer equal) const
Definition: expr.h:297
TVM_DECLARE_FINAL_OBJECT_INFO(TupleGetItemNode, ExprNode)
int index
which value to get
Definition: expr.h:287
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:302
Expr tuple
The tuple Expression.
Definition: expr.h:285
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:219
tvm::Array< Expr > fields
the fields of the tuple
Definition: expr.h:222
TVM_DECLARE_FINAL_OBJECT_INFO(TupleNode, ExprNode)
bool SEqualReduce(const TupleNode *other, SEqualReducer equal) const
Definition: expr.h:231
static constexpr const char * _type_key
Definition: expr.h:238
void VisitAttrs(tvm::AttrVisitor *v)
Definition: expr.h:224
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:236
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:266
TVM_DEFINE_OBJECT_REF_METHODS(Tuple, Expr, TupleNode)
TVM_DEFINE_OBJECT_REF_COW_METHOD(TupleNode)
Expr value
The binding value.
Definition: expr.h:738
TVM_DECLARE_FINAL_OBJECT_INFO(VarBindingNode, BindingNode)
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:740
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:389
void SHashReduce(SHashReducer hash_reduce) const
Definition: expr.h:410
void VisitAttrs(AttrVisitor *v)
Definition: expr.h:398
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:393
const String & name_hint() const
Definition: expr.h:396
bool SEqualReduce(const VarNode *other, SEqualReducer equal) const
Definition: expr.h:405
TVM_DEFINE_OBJECT_REF_METHODS(Var, LeafExpr, VarNode)
Var(String name_hint, Optional< StructInfo > struct_info_annotation, Span span=Span())
Definition: expr.h:424
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:362
Base class of all object reference.
Definition: object.h:519
base class of all object containers.
Definition: object.h:171
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
Reference to string objects.
Definition: string.h:98
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:1054
constexpr const char * kWorkspaceSize
The required workspace for an external function.
Definition: expr.h:1048
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:1061
constexpr const char * kComposite
Treat the function as a composite operator.
Definition: expr.h:1044
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:1042
constexpr const char * kPrimitive
Mark the function as a primitive function.
Definition: expr.h:1037
constexpr const char * kPartitionedFromPattern
Indicate the function was created by the Pattern Partitioning Pass.
Definition: expr.h:1046
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.
tvm::Span Span
Definition: base.h:65
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
GlobalVar WithFields(GlobalVar global_var, Optional< String > opt_name_hint={}, Optional< Type > opt_type={}, Optional< VirtualDevice > opt_virtual_device={}, Optional< Span > opt_span={})
Returns global_var with the given properties. A null property denotes 'no change'....
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:665
ObjectRef hash functor.
Definition: object.h:655
Common operators defined for Expr.