24 #ifndef TVM_RELAX_TYPE_H_
25 #define TVM_RELAX_TYPE_H_
41 static constexpr
int kUnknownNDim = -1;
49 v->Visit(
"ndim", &
ndim);
50 v->Visit(
"span", &
span);
59 static constexpr
const char*
_type_key =
"relax.ShapeType";
79 static constexpr
const char*
_type_key =
"relax.ObjectType";
101 v->Visit(
"ndim", &
ndim);
102 v->Visit(
"dtype", &
dtype);
103 v->Visit(
"span", &
span);
119 static constexpr
const char*
_type_key =
"relax.DynTensorType";
153 static constexpr
const char*
_type_key =
"relax.PackedFuncType";
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
Base of all Tensor types This container can hold TensorType or GenericTensorType.
Definition: tensor_type.h:36
A Reducer class to reduce the structural equality result of two objects.
Definition: structural_equal.h:137
A Reducer class to reduce the structural hash value.
Definition: structural_hash.h:121
Definition: source_map.h:120
Type is the base type of all types.
Definition: type.h:74
Span span
Span that points to the original source code. Reserved debug information.
Definition: type.h:80
Managed reference to TypeNode.
Definition: type.h:93
int ndim
The number of dimensions of the tensor, use -1 to denote tensor with unknwon number of dimensions.
Definition: type.h:96
bool SEqualReduce(const DynTensorTypeNode *other, SEqualReducer equal) const
Definition: type.h:106
DataType dtype
The content data type, use void to denote the dtype is unknown.
Definition: type.h:98
bool IsUnknownDtype() const
Definition: type.h:117
void SHashReduce(SHashReducer hash_reduce) const
Definition: type.h:110
void VisitAttrs(tvm::AttrVisitor *v)
Definition: type.h:100
bool IsUnknownNdim() const
Definition: type.h:115
TVM_DECLARE_FINAL_OBJECT_INFO(DynTensorTypeNode, BaseTensorTypeNode)
static constexpr const char * _type_key
Definition: type.h:119
Managed reference to DynTensorTypeNode.
Definition: type.h:127
static DynTensorType CreateUnknownNDim(DataType dtype, Span span=Span())
Create a DynTensorType with unknown ndim.
DynTensorType(int ndim, DataType dtype, Span span=Span())
Constructor.
TVM_DEFINE_OBJECT_REF_METHODS(DynTensorType, Type, DynTensorTypeNode)
bool SEqualReduce(const ObjectTypeNode *other, SEqualReducer equal) const
Definition: type.h:75
void SHashReduce(SHashReducer hash_reduce) const
Definition: type.h:77
TVM_DECLARE_FINAL_OBJECT_INFO(ObjectTypeNode, TypeNode)
void VisitAttrs(tvm::AttrVisitor *v)
Definition: type.h:73
static constexpr const char * _type_key
Definition: type.h:79
ObjectType(Span span=Span())
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(ObjectType, Type, ObjectTypeNode)
void SHashReduce(SHashReducer hash_reduce) const
Definition: type.h:151
bool SEqualReduce(const PackedFuncTypeNode *other, SEqualReducer equal) const
Definition: type.h:149
static constexpr const char * _type_key
Definition: type.h:153
TVM_DECLARE_FINAL_OBJECT_INFO(PackedFuncTypeNode, TypeNode)
void VisitAttrs(tvm::AttrVisitor *v)
Definition: type.h:147
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(PackedFuncType, Type, PackedFuncTypeNode)
PackedFuncType(Span span=Span())
int ndim
size of the shape.
Definition: type.h:46
void SHashReduce(SHashReducer hash_reduce) const
Definition: type.h:57
TVM_DECLARE_FINAL_OBJECT_INFO(ShapeTypeNode, TypeNode)
static constexpr const char * _type_key
Definition: type.h:59
void VisitAttrs(tvm::AttrVisitor *v)
Definition: type.h:48
bool SEqualReduce(const ShapeTypeNode *other, SEqualReducer equal) const
Definition: type.h:53
ShapeType(int ndim=kUnknownNDim, Span span=Span())
TVM_DEFINE_NOTNULLABLE_OBJECT_REF_METHODS(ShapeType, Type, ShapeTypeNode)
Runtime primitive data type.
Definition: data_type.h:43
bool is_void() const
Definition: data_type.h:156
Serializable global function used in IR.
Helpers for attribute objects.
IR/AST nodes for the unified type system in TVM.
tvm::Span Span
Definition: base.h:65
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
This file defines the TVM global function registry.
Polymorphic tensor types.
Type relation and function for type inference(checking).