tvm
Public Member Functions | List of all members
tvm::script::printer::IRDocsifierFunctor< R, Args > Class Template Reference

Dynamic dispatch functor based on ObjectPath. More...

#include <ir_docsifier_functor.h>

Collaboration diagram for tvm::script::printer::IRDocsifierFunctor< R, Args >:

Public Member Functions

template<class TObjectRef >
operator() (const String &token, TObjectRef obj, Args... args) const
 Call the dispatch function. More...
 
TSelfset_dispatch (String token, uint32_t type_index, runtime::PackedFunc f)
 Set the dispatch function. More...
 
TSelfset_fallback (runtime::PackedFunc f)
 
void remove_fallback ()
 
template<typename TObjectRef , typename TCallable , typename = std::enable_if_t<IsDispatchFunction<TObjectRef, TCallable>::value>>
TSelfset_dispatch (String token, TCallable f)
 Set the dispatch function. More...
 
template<typename TCallable , typename = std::enable_if_t<IsDispatchFunction<ObjectRef, TCallable>::value>>
TSelfset_fallback (TCallable f)
 
void remove_dispatch (String token, uint32_t type_index)
 Remove dispatch function. More...
 

Detailed Description

template<typename R, typename... Args>
class tvm::script::printer::IRDocsifierFunctor< R, Args >

Dynamic dispatch functor based on ObjectPath.

This functor dispatches based on the type of object and the input dispatch token.

Member Function Documentation

◆ operator()()

template<typename R , typename... Args>
template<class TObjectRef >
R tvm::script::printer::IRDocsifierFunctor< R, Args >::operator() ( const String token,
TObjectRef  obj,
Args...  args 
) const
inline

Call the dispatch function.

Parameters
tokenThe dispatch token.
objThe object.
argsOther args.
Returns
The return value of the dispatch function

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).

◆ remove_dispatch()

template<typename R , typename... Args>
void tvm::script::printer::IRDocsifierFunctor< R, Args >::remove_dispatch ( String  token,
uint32_t  type_index 
)
inline

Remove dispatch function.

Parameters
tokenThe dispatch token.
type_indexThe 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.

◆ remove_fallback()

template<typename R , typename... Args>
void tvm::script::printer::IRDocsifierFunctor< R, Args >::remove_fallback ( )
inline

◆ set_dispatch() [1/2]

template<typename R , typename... Args>
template<typename TObjectRef , typename TCallable , typename = std::enable_if_t<IsDispatchFunction<TObjectRef, TCallable>::value>>
TSelf& tvm::script::printer::IRDocsifierFunctor< R, Args >::set_dispatch ( String  token,
TCallable  f 
)
inline

Set the dispatch function.

Parameters
tokenThe dispatch token.
fThe dispatch function.

◆ set_dispatch() [2/2]

template<typename R , typename... Args>
TSelf& tvm::script::printer::IRDocsifierFunctor< R, Args >::set_dispatch ( String  token,
uint32_t  type_index,
runtime::PackedFunc  f 
)
inline

Set the dispatch function.

Parameters
tokenThe dispatch token.
type_indexThe TVM object type index for this dispatch function.
fThe 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.

◆ set_fallback() [1/2]

template<typename R , typename... Args>
TSelf& tvm::script::printer::IRDocsifierFunctor< R, Args >::set_fallback ( runtime::PackedFunc  f)
inline

◆ set_fallback() [2/2]

template<typename R , typename... Args>
template<typename TCallable , typename = std::enable_if_t<IsDispatchFunction<ObjectRef, TCallable>::value>>
TSelf& tvm::script::printer::IRDocsifierFunctor< R, Args >::set_fallback ( TCallable  f)
inline

The documentation for this class was generated from the following file: