24 #ifndef TVM_IR_ENV_FUNC_H_
25 #define TVM_IR_ENV_FUNC_H_
83 template <
typename... Args>
87 return n->
func(std::forward<Args>(args)...);
103 template <
typename FType>
115 template <
typename R,
typename... Args>
128 ObjectRef::operator=(other);
140 ICHECK(n !=
nullptr);
141 return runtime::detail::typed_packed_call_dispatcher<R>::run(n->
func,
142 std::forward<Args>(args)...);
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
A serializable function backed by TVM's global environment.
Definition: env_func.h:41
String name
Unique name of the global function.
Definition: env_func.h:44
static constexpr const char * _type_key
Definition: env_func.h:62
TVM_DECLARE_FINAL_OBJECT_INFO(EnvFuncNode, Object)
EnvFuncNode()
constructor
Definition: env_func.h:48
runtime::PackedFunc func
The internal packed function.
Definition: env_func.h:46
static constexpr bool _type_has_method_sequal_reduce
Definition: env_func.h:63
bool SEqualReduce(const EnvFuncNode *other, SEqualReducer equal) const
Definition: env_func.h:52
void SHashReduce(SHashReducer hash_reduce) const
Definition: env_func.h:57
void VisitAttrs(AttrVisitor *v)
Definition: env_func.h:50
static constexpr bool _type_has_method_shash_reduce
Definition: env_func.h:64
Managed reference to EnvFuncNode.
Definition: env_func.h:72
EnvFunc(ObjectPtr< Object > n)
Definition: env_func.h:75
const EnvFuncNode * operator->() const
Definition: env_func.h:77
runtime::TVMRetValue operator()(Args &&... args) const
Invoke the function.
Definition: env_func.h:84
EnvFunc()
Definition: env_func.h:74
static EnvFunc Get(const String &name)
Get a global function based on the name.
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
A typed version of EnvFunc. It is backed by a GlobalFuncNode internally.
Definition: env_func.h:116
TypedEnvFunc(ObjectPtr< Object > n)
Definition: env_func.h:121
TypedEnvFunc()
Definition: env_func.h:120
TSelf & operator=(const EnvFunc &other)
Assign global function to a TypedEnvFunc.
Definition: env_func.h:127
const EnvFuncNode * operator->() const
Definition: env_func.h:132
R operator()(Args... args) const
Invoke the function.
Definition: env_func.h:138
Please refer to TypedEnvFunc<R(Args..)>.
Definition: env_func.h:104
A custom smart pointer for Object.
Definition: object.h:362
Base class of all object reference.
Definition: object.h:519
const Object * get() const
Definition: object.h:554
base class of all object containers.
Definition: object.h:171
Packed function is a type-erased function. The arguments are passed by packed format.
Definition: packed_func.h:141
Reference to string objects.
Definition: string.h:98
Return Value container, Unlike TVMArgValue, which only holds reference and do not delete the underlyi...
Definition: packed_func.h:946
runtime implementation for LibTorch/TorchScript.
Definition: analyzer.h:36
PrimExpr equal(PrimExpr a, PrimExpr b, Span span=Span())
equal
Reflection and serialization of compiler IR/AST nodes.