24 #ifndef TVM_RELAX_STRUCT_INFO_FUNCTOR_H_
25 #define TVM_RELAX_STRUCT_INFO_FUNCTOR_H_
36 template <
typename FStructInfo>
40 #define STRUCT_INFO_FUNCTOR_DEFAULT \
41 { return VisitStructInfoDefault_(op, std::forward<Args>(args)...); }
43 #define TVM_STRUCT_INFO_FUNCTOR_DISPATCH(OP) \
44 vtable.template set_dispatch<OP>([](const ObjectRef& n, TSelf* self, Args... args) { \
45 return self->VisitStructInfo_(static_cast<const OP*>(n.get()), std::forward<Args>(args)...); \
48 template <
typename R,
typename... Args>
66 return VisitStructInfo(n, std::forward<Args>(args)...);
77 return vtable(n,
this, std::forward<Args>(args)...);
95 LOG(FATAL) <<
"Do not have a default for " << op->
GetTypeKey();
101 static FStructInfo InitVTable() {
115 #undef TVM_STRUCT_INFO_FUNCTOR_DISPATCH
A dynamically dispatched functor on the type of the first argument.
Definition: functor.h:64
Reference to PrimExprNode.
Definition: expr.h:115
Managed reference to RelayExprNode.
Definition: expr.h:442
Structure information about function.
Definition: struct_info.h:303
Opaque object.
Definition: struct_info.h:35
Primitive value.
Definition: struct_info.h:61
StructInfo of shape value.
Definition: struct_info.h:106
Definition: struct_info_functor.h:49
virtual R VisitStructInfo_(const FuncStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:92
virtual R VisitStructInfo_(const TensorStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:86
virtual R VisitStructInfo_(const PrimStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:82
virtual R VisitStructInfoDefault_(const Object *op, Args...)
Definition: struct_info_functor.h:94
virtual R VisitStructInfo_(const ShapeStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:84
virtual R VisitStructInfo(const StructInfo &n, Args... args)
The functor call.
Definition: struct_info_functor.h:74
virtual R VisitStructInfo_(const TupleStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:90
virtual R VisitStructInfo_(const ObjectStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:80
virtual ~StructInfoFunctor()
virtual destructor
Definition: struct_info_functor.h:58
virtual R VisitStructInfo_(const distributed::DTensorStructInfoNode *op, Args... args)
Definition: struct_info_functor.h:88
R result_type
the result type of this functor
Definition: struct_info_functor.h:56
R operator()(const StructInfo &n, Args... args)
Same as call.
Definition: struct_info_functor.h:65
Definition: struct_info_functor.h:37
StructInfoMutator that mutates struct info.
Definition: struct_info_functor.h:139
StructInfo VisitStructInfo_(const TupleStructInfoNode *op) override
StructInfo VisitStructInfo_(const FuncStructInfoNode *op) override
StructInfo VisitStructInfo_(const ObjectStructInfoNode *op) override
StructInfo VisitStructInfo_(const ShapeStructInfoNode *op) override
StructInfo VisitStructInfo_(const PrimStructInfoNode *op) override
virtual Expr VisitStructInfoExprField(const Expr &expr)
Definition: struct_info_functor.h:151
StructInfo VisitStructInfo_(const distributed::DTensorStructInfoNode *op) override
virtual PrimExpr VisitStructInfoExprField(const PrimExpr &expr)
Definition: struct_info_functor.h:152
StructInfo VisitStructInfo_(const TensorStructInfoNode *op) override
A struct info visitor.
Definition: struct_info_functor.h:120
void VisitStructInfo_(const FuncStructInfoNode *op) override
virtual void VisitStructInfoExprField(const PrimExpr &expr)
Definition: struct_info_functor.h:133
void VisitStructInfo_(const TupleStructInfoNode *op) override
void VisitStructInfo_(const ObjectStructInfoNode *op) override
virtual void VisitStructInfoExprField(const Expr &expr)
Definition: struct_info_functor.h:132
void VisitStructInfo_(const PrimStructInfoNode *op) override
void VisitStructInfo_(const distributed::DTensorStructInfoNode *op) override
void VisitStructInfo_(const ShapeStructInfoNode *op) override
void VisitStructInfo_(const TensorStructInfoNode *op) override
Managed reference to StructInfoNode.
Definition: expr.h:129
StructInfo of Tensor.
Definition: struct_info.h:163
StructInfo of Tuple.
Definition: struct_info.h:253
StructInfo of DTensor (Distributed Tensor).
Definition: struct_info.h:132
Base class of all object reference.
Definition: object.h:519
bool defined() const
Definition: object.h:552
base class of all object containers.
Definition: object.h:171
std::string GetTypeKey() const
Definition: object.h:184
Struct info for DTensor (Distributed Tensor)
Defines the Functor data structures.
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
#define STRUCT_INFO_FUNCTOR_DEFAULT
Definition: struct_info_functor.h:40
#define TVM_STRUCT_INFO_FUNCTOR_DISPATCH(OP)
Definition: struct_info_functor.h:43