24 #ifndef TVM_RELAY_ADT_H_ 25 #define TVM_RELAY_ADT_H_ 49 static constexpr
const char*
_type_key =
"relay.Pattern";
82 static constexpr
const char*
_type_key =
"relay.PatternWildcard";
96 PatternWildcard&
operator=(
const PatternWildcard& other) {
102 (*this).
data_ = std::move(other.data_);
122 v->Visit(
"var", &var);
123 v->Visit(
"span", &
span);
132 static constexpr
const char*
_type_key =
"relay.PatternVar";
158 v->Visit(
"constructor", &constructor);
159 v->Visit(
"patterns", &patterns);
160 v->Visit(
"span", &
span);
168 hash_reduce(constructor);
169 hash_reduce(patterns);
172 static constexpr
const char*
_type_key =
"relay.PatternConstructor";
198 v->Visit(
"patterns", &patterns);
199 v->Visit(
"span", &
span);
208 static constexpr
const char*
_type_key =
"relay.PatternTuple";
234 v->Visit(
"lhs", &lhs);
235 v->Visit(
"rhs", &rhs);
247 static constexpr
const char*
_type_key =
"relay.Clause";
291 v->Visit(
"data", &data);
292 v->Visit(
"clauses", &clauses);
293 v->Visit(
"complete", &complete);
294 v->Visit(
"virtual_device_", &virtual_device_);
295 v->Visit(
"span", &
span);
296 v->Visit(
"_checked_type_", &checked_type_);
308 hash_reduce(clauses);
309 hash_reduce(complete);
344 #endif // TVM_RELAY_ADT_H_ bool SEqualReduce(const MatchNode *other, SEqualReducer equal) const
Definition: adt.h:299
tvm::Span Span
Definition: base.h:65
bool SEqualReduce(const PatternNode *other, SEqualReducer equal) const
Definition: adt.h:78
bool DefEqual(const ObjectRef &lhs, const ObjectRef &rhs)
Reduce condition to comparison of two definitions, where free vars can be mapped. ...
Match container node.
Definition: adt.h:277
A custom smart pointer for Object.
Definition: object.h:358
Constructor constructor
Definition: adt.h:153
bool SEqualReduce(const PatternVarNode *other, SEqualReducer equal) const
Definition: adt.h:126
PatternWildcard(const PatternWildcard &pat)
Definition: adt.h:92
Pattern(ObjectPtr< tvm::Object > p)
Definition: adt.h:66
PatternVar container node.
Definition: adt.h:150
bool SEqualReduce(const PatternTupleNode *other, SEqualReducer equal) const
Definition: adt.h:202
A Reducer class to reduce the structural equality result of two objects.
Definition: structural_equal.h:124
bool SEqualReduce(const ClauseNode *other, SEqualReducer equal) const
Definition: adt.h:238
Expr data
The input being deconstructed.
Definition: adt.h:280
ADT constructor. Constructors compare by pointer equality.
Definition: adt.h:47
Relay expression language.
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
const PatternWildcardNode * operator->() const
Definition: adt.h:106
A Reducer class to reduce the structural hash value.
Definition: structural_hash.h:110
tvm::relay::Var var
Variable that stores the matched value.
Definition: adt.h:119
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
tvm::TypeDataNode TypeDataNode
Definition: adt.h:44
void SHashReduce(SHashReducer hash_reduce) const
Definition: adt.h:305
Definition: loop_state.h:456
Span span
The location of the program in a SourceFragment can be null, check with span.defined() ...
Definition: base.h:75
void VisitAttrs(tvm::AttrVisitor *v)
Definition: adt.h:76
static constexpr const bool _type_has_method_sequal_reduce
Definition: adt.h:50
Clause WithFields(Clause clause, Optional< Pattern > opt_lhs=Optional< Pattern >(), Optional< Expr > opt_rhs=Optional< Expr >())
Returns clause with the given properties. A null property denotes 'no change'. Returns clause if all ...
base class of all object containers.
Definition: object.h:167
PatternWildcard & operator=(PatternWildcard &&other)
Definition: adt.h:101
Pattern()
Definition: adt.h:65
Managed reference to ConstructorNode.
Definition: adt.h:88
Helpers for attribute objects.
virtual void MarkGraphNode()=0
Mark current comparison as graph node equal comparison.
PatternVar container node.
Definition: adt.h:116
void SHashReduce(SHashReducer hash_reduce) const
Definition: adt.h:167
Expr rhs
The resulting value.
Definition: adt.h:231
This is the base node container of all relay structures.
Definition: base.h:71
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
bool SEqualReduce(const PatternConstructorNode *other, SEqualReducer equal) const
Definition: adt.h:163
Pattern lhs
The pattern the clause matches.
Definition: adt.h:229
void VisitAttrs(tvm::AttrVisitor *v)
Definition: adt.h:157
Definition: source_map.h:120
void SHashReduce(SHashReducer hash_reduce) const
Definition: adt.h:206
virtual void MarkGraphNode()=0
Mark current comparison as graph node in hashing. Graph node hash will depends on the graph structure...
tvm::Array< Pattern > patterns
Definition: adt.h:195
Array, container representing a contiguous sequence of ObjectRefs.
Definition: array.h:289
static constexpr const char * _type_key
Definition: adt.h:49
TypeData container node.
Definition: adt.h:102
ObjectPtr< Object > data_
Internal pointer that backs the reference.
Definition: object.h:574
void SHashReduce(SHashReducer hash_reduce) const
Definition: adt.h:242
Managed reference to RelayExprNode.
Definition: expr.h:433
void VisitAttrs(tvm::AttrVisitor *v)
Definition: adt.h:121
#define TVM_DEFINE_OBJECT_REF_METHODS(TypeName, ParentType, ObjectName)
Definition: object.h:713
Pattern is the base type for an ADT match pattern in Relay.
Definition: adt.h:63
Base type for declaring relay pattern.
Definition: adt.h:47
tvm::Array< Clause > clauses
The match node clauses.
Definition: adt.h:283
Algebraic data type definitions.
Var var(std::string name_hint, DataType t=DataType::Int(32))
Construct a new Var expression.
Base class of all object reference.
Definition: object.h:511
TVM_DECLARE_BASE_OBJECT_INFO(PatternNode, Object)
#define TVM_DEFINE_OBJECT_REF_COW_METHOD(ObjectName)
Define CopyOnWrite function in an ObjectRef.
Definition: object.h:785
tvm::Constructor Constructor
Definition: adt.h:40
tvm::ConstructorNode ConstructorNode
Definition: adt.h:41
#define TVM_DECLARE_FINAL_OBJECT_INFO(TypeName, ParentType)
helper macro to declare type information in a final class.
Definition: object.h:671
bool complete
Should this match be complete (cover all cases)? If yes, the type checker will generate an error if t...
Definition: adt.h:288
void SHashReduce(SHashReducer hash_reduce) const
Definition: adt.h:130
PatternWildcard(ObjectPtr< Object > n)
Definition: adt.h:90
void VisitAttrs(tvm::AttrVisitor *v)
Definition: adt.h:197
static constexpr const bool _type_has_method_shash_reduce
Definition: adt.h:51
Stores all data for an Algebraic Data Type (ADT).
Definition: adt.h:149
Clause container node.
Definition: adt.h:226
Base classes for the Relay IR.
Optional container that to represent to a Nullable variant of T.
Definition: optional.h:51
PatternWildcard(PatternWildcard &&pat)
Definition: adt.h:94
void VisitAttrs(tvm::AttrVisitor *v)
Definition: adt.h:290
tvm::Array< Pattern > patterns
Definition: adt.h:155
void VisitAttrs(tvm::AttrVisitor *v)
Definition: adt.h:233
tvm::TypeData TypeData
Definition: adt.h:43
Base node of all non-primitive expressions.
Definition: expr.h:361
PatternWildcard & operator=(const PatternWildcard &other)
Definition: adt.h:96
void SHashReduce(SHashReducer hash_reduce) const
Definition: adt.h:80
PatternVar container node.
Definition: adt.h:191
PatternWildcard container node.
Definition: adt.h:74
void DefHash(const ObjectRef &key) const
Push hash of key to the current sequence of hash values.
Definition: structural_hash.h:187