tvm
|
Packed function is a type-erased function. The arguments are passed by packed format. More...
#include <packed_func.h>
Public Member Functions | |
PackedFunc (std::nullptr_t null) | |
Constructor from null. More... | |
template<typename TCallable , typename = std::enable_if_t< std::is_convertible<TCallable, std::function<void(TVMArgs, TVMRetValue*)>>::value && !std::is_base_of<TCallable, PackedFunc>::value>> | |
PackedFunc (TCallable data) | |
Constructing a packed function from a callable type whose signature is consistent with PackedFunc More... | |
template<typename... Args> | |
TVMRetValue | operator() (Args &&... args) const |
Call packed function by directly passing in unpacked format. More... | |
TVM_ALWAYS_INLINE void | CallPacked (TVMArgs args, TVMRetValue *rv) const |
Call the function in packed format. More... | |
bool | operator== (std::nullptr_t null) const |
bool | operator!= (std::nullptr_t null) const |
TVM_DEFINE_OBJECT_REF_METHODS (PackedFunc, ObjectRef, PackedFuncObj) | |
![]() | |
ObjectRef ()=default | |
default constructor More... | |
ObjectRef (ObjectPtr< Object > data) | |
Constructor from existing object ptr. More... | |
bool | same_as (const ObjectRef &other) const |
Comparator. More... | |
bool | operator== (const ObjectRef &other) const |
Comparator. More... | |
bool | operator!= (const ObjectRef &other) const |
Comparator. More... | |
bool | operator< (const ObjectRef &other) const |
Comparator. More... | |
bool | defined () const |
const Object * | get () const |
const Object * | operator-> () const |
bool | unique () const |
int | use_count () const |
template<typename ObjectType , typename = std::enable_if_t<std::is_base_of_v<Object, ObjectType>>> | |
const ObjectType * | as () const |
Try to downcast the internal Object to a raw pointer of a corresponding type. More... | |
template<typename ObjectRefType , typename = std::enable_if_t<std::is_base_of_v<ObjectRef, ObjectRefType>>> | |
Optional< ObjectRefType > | as () const |
Try to downcast the ObjectRef to a Optional<T> of the requested type. More... | |
Additional Inherited Members | |
![]() | |
using | ContainerType = Object |
type indicate the container type. More... | |
![]() | |
static constexpr bool | _type_is_nullable = true |
![]() | |
Object * | get_mutable () const |
![]() | |
template<typename T > | |
static T | DowncastNoCheck (ObjectRef ref) |
Internal helper function downcast a ref without check. More... | |
static void | FFIClearAfterMove (ObjectRef *ref) |
Clear the object ref data field without DecRef after we successfully moved the field. More... | |
template<typename ObjectType > | |
static ObjectPtr< ObjectType > | GetDataPtr (const ObjectRef &ref) |
Internal helper function get data_ as ObjectPtr of ObjectType. More... | |
![]() | |
ObjectPtr< Object > | data_ |
Internal pointer that backs the reference. More... | |
Packed function is a type-erased function. The arguments are passed by packed format.
This is an useful unified interface to call generated functions, It is the unified function type of TVM. It corresponds to TVMFunctionHandle in C runtime API.
|
inline |
Constructor from null.
|
inlineexplicit |
Constructing a packed function from a callable type whose signature is consistent with PackedFunc
data | the internal container of packed function. |
TVM_ALWAYS_INLINE void tvm::runtime::PackedFunc::CallPacked | ( | TVMArgs | args, |
TVMRetValue * | rv | ||
) | const |
Call the function in packed format.
args | The arguments |
rv | The return value. |
|
inline |
|
inline |
Call packed function by directly passing in unpacked format.
args | Arguments to be passed. |
Args | arguments to be passed. |
|
inline |
tvm::runtime::PackedFunc::TVM_DEFINE_OBJECT_REF_METHODS | ( | PackedFunc | , |
ObjectRef | , | ||
PackedFuncObj | |||
) |