Registry for global function.
More...
#include <registry.h>
|
Registry & | set_body (PackedFunc f) |
| set the body of the function to be f More...
|
|
template<typename TCallable , typename = typename std::enable_if_t< std::is_convertible<TCallable, std::function<void(TVMArgs, TVMRetValue*)>>::value && !std::is_base_of<PackedFunc, TCallable>::value>> |
Registry & | set_body (TCallable f) |
| set the body of the function to be f More...
|
|
template<typename FLambda > |
Registry & | set_body_typed (FLambda f) |
| set the body of the function to the given function. Note that this will ignore default arg values and always require all arguments to be provided. More...
|
|
template<typename T , typename R , typename... Args> |
Registry & | set_body_method (R(T::*f)(Args...)) |
| set the body of the function to be the passed method pointer. Note that this will ignore default arg values and always require all arguments to be provided. More...
|
|
template<typename T , typename R , typename... Args> |
Registry & | set_body_method (R(T::*f)(Args...) const) |
| set the body of the function to be the passed method pointer. Note that this will ignore default arg values and always require all arguments to be provided. More...
|
|
template<typename TObjectRef , typename TNode , typename R , typename... Args, typename = typename std::enable_if<std::is_base_of<ObjectRef, TObjectRef>::value>::type> |
Registry & | set_body_method (R(TNode::*f)(Args...)) |
| set the body of the function to be the passed method pointer. Used when calling a method on a Node subclass through a ObjectRef subclass. Note that this will ignore default arg values and always require all arguments to be provided. More...
|
|
template<typename TObjectRef , typename TNode , typename R , typename... Args, typename = typename std::enable_if<std::is_base_of<ObjectRef, TObjectRef>::value>::type> |
Registry & | set_body_method (R(TNode::*f)(Args...) const) |
| set the body of the function to be the passed method pointer. Used when calling a method on a Node subclass through a ObjectRef subclass. Note that this will ignore default arg values and always require all arguments to be provided. More...
|
|
Registry for global function.
◆ Get()
Get the global function by name.
- Parameters
-
name | The name of the function. |
- Returns
- pointer to the registered function, nullptr if it does not exist.
◆ ListNames()
static std::vector<String> tvm::runtime::Registry::ListNames |
( |
| ) |
|
|
static |
Get the names of currently registered global function.
- Returns
- The names
◆ Register()
static Registry& tvm::runtime::Registry::Register |
( |
const String & |
name, |
|
|
bool |
override = false |
|
) |
| |
|
static |
Register a function with given name.
- Parameters
-
name | The name of the function. |
override | Whether allow override existing function. |
- Returns
- Reference to the registry.
◆ Remove()
static bool tvm::runtime::Registry::Remove |
( |
const String & |
name | ) |
|
|
static |
Erase global function from registry, if exist.
- Parameters
-
name | The name of the function. |
- Returns
- Whether function exist.
◆ set_body() [1/2]
set the body of the function to be f
- Parameters
-
f | The body of the function. |
◆ set_body() [2/2]
template<typename TCallable , typename = typename std::enable_if_t< std::is_convertible<TCallable, std::function<void(TVMArgs, TVMRetValue*)>>::value && !std::is_base_of<PackedFunc, TCallable>::value>>
Registry& tvm::runtime::Registry::set_body |
( |
TCallable |
f | ) |
|
|
inline |
set the body of the function to be f
- Parameters
-
f | The body of the function. |
◆ set_body_method() [1/4]
template<typename T , typename R , typename... Args>
Registry& tvm::runtime::Registry::set_body_method |
( |
R(T::*)(Args...) const |
f | ) |
|
|
inline |
set the body of the function to be the passed method pointer. Note that this will ignore default arg values and always require all arguments to be provided.
struct Example {
int doThing(int x);
}
.set_body_method(&Example::doThing);
#define TVM_REGISTER_GLOBAL(OpName)
Register a function globally.
Definition: registry.h:384
- Parameters
-
f | the method pointer to forward to. |
- Template Parameters
-
T | the type containing the method (inferred). |
R | the return type of the function (inferred). |
Args | the argument types of the function (inferred). |
◆ set_body_method() [2/4]
template<typename T , typename R , typename... Args>
Registry& tvm::runtime::Registry::set_body_method |
( |
R(T::*)(Args...) |
f | ) |
|
|
inline |
set the body of the function to be the passed method pointer. Note that this will ignore default arg values and always require all arguments to be provided.
struct Example {
int doThing(int x);
}
.set_body_method(&Example::doThing);
- Parameters
-
f | the method pointer to forward to. |
- Template Parameters
-
T | the type containing the method (inferred). |
R | the return type of the function (inferred). |
Args | the argument types of the function (inferred). |
◆ set_body_method() [3/4]
template<typename TObjectRef , typename TNode , typename R , typename... Args, typename = typename std::enable_if<std::is_base_of<ObjectRef, TObjectRef>::value>::type>
Registry& tvm::runtime::Registry::set_body_method |
( |
R(TNode::*)(Args...) const |
f | ) |
|
|
inline |
set the body of the function to be the passed method pointer. Used when calling a method on a Node subclass through a ObjectRef subclass. Note that this will ignore default arg values and always require all arguments to be provided.
struct ExampleNode: BaseNode {
int doThing(int x);
}
struct Example;
.set_body_method<Example>(&ExampleNode::doThing);
- Parameters
-
f | the method pointer to forward to. |
- Template Parameters
-
TObjectRef | the node reference type to call the method on |
TNode | the node type containing the method (inferred). |
R | the return type of the function (inferred). |
Args | the argument types of the function (inferred). |
◆ set_body_method() [4/4]
template<typename TObjectRef , typename TNode , typename R , typename... Args, typename = typename std::enable_if<std::is_base_of<ObjectRef, TObjectRef>::value>::type>
Registry& tvm::runtime::Registry::set_body_method |
( |
R(TNode::*)(Args...) |
f | ) |
|
|
inline |
set the body of the function to be the passed method pointer. Used when calling a method on a Node subclass through a ObjectRef subclass. Note that this will ignore default arg values and always require all arguments to be provided.
struct ExampleNode: BaseNode {
int doThing(int x);
}
struct Example;
.set_body_method<Example>(&ExampleNode::doThing);
- Parameters
-
f | the method pointer to forward to. |
- Template Parameters
-
TObjectRef | the node reference type to call the method on |
TNode | the node type containing the method (inferred). |
R | the return type of the function (inferred). |
Args | the argument types of the function (inferred). |
◆ set_body_typed()
template<typename FLambda >
Registry& tvm::runtime::Registry::set_body_typed |
( |
FLambda |
f | ) |
|
|
inline |
set the body of the function to the given function. Note that this will ignore default arg values and always require all arguments to be provided.
return x * y;
}
.set_body_typed([](int a, int b) -> int { return a - b; });
tvm::PrimExpr multiply(const tvm::PrimExpr &a, const tvm::PrimExpr &b)
Definition: broadcast.h:225
- Parameters
-
f | The function to forward to. |
- Template Parameters
-
FLambda | The signature of the function. |
◆ Manager
◆ func_
◆ name_
String tvm::runtime::Registry::name_ |
|
protected |
The documentation for this class was generated from the following file: