tvm
|
Dynamic dispatch functor based on ObjectPath. More...
#include <ir_docsifier_functor.h>
Public Member Functions | |
template<class TObjectRef > | |
R | operator() (const String &token, TObjectRef obj, Args... args) const |
Call the dispatch function. More... | |
TSelf & | set_dispatch (String token, uint32_t type_index, runtime::PackedFunc f) |
Set the dispatch function. More... | |
TSelf & | set_fallback (runtime::PackedFunc f) |
void | remove_fallback () |
template<typename TObjectRef , typename TCallable , typename = std::enable_if_t<IsDispatchFunction<TObjectRef, TCallable>::value>> | |
TSelf & | set_dispatch (String token, TCallable f) |
Set the dispatch function. More... | |
template<typename TCallable , typename = std::enable_if_t<IsDispatchFunction<ObjectRef, TCallable>::value>> | |
TSelf & | set_fallback (TCallable f) |
void | remove_dispatch (String token, uint32_t type_index) |
Remove dispatch function. More... | |
Dynamic dispatch functor based on ObjectPath.
This functor dispatches based on the type of object and the input dispatch token.
|
inline |
Call the dispatch function.
token | The dispatch token. |
obj | The object. |
args | Other args. |
If the TObjectRef isn't registered with the token, it will try to find dispatch function for TObjectRef with the default dispatch token (empty string).
|
inline |
Remove dispatch function.
token | The dispatch token. |
type_index | The TVM object type index for the dispatch function to be removed. |
This is useful when dispatch function comes from other language's runtime, and those function should be removed before that language runtime shuts down.
|
inline |
|
inline |
Set the dispatch function.
token | The dispatch token. |
f | The dispatch function. |
|
inline |
Set the dispatch function.
token | The dispatch token. |
type_index | The TVM object type index for this dispatch function. |
f | The dispatch function. |
This takes a type-erased packed function as input. It should be used through FFI boundary, for example, registering dispatch function from Python.
|
inline |
|
inline |