mxnet
|
A PackedFunc wrapper to provide typed function signature. It is backed by a PackedFunc internally. More...
#include <packed_func.h>
Public Types | |
using | TSelf = TypedPackedFunc< R(Args...)> |
short hand for this function type More... | |
Public Member Functions | |
TypedPackedFunc () | |
default constructor More... | |
TypedPackedFunc (std::nullptr_t null) | |
constructor from null More... | |
TypedPackedFunc (PackedFunc packed) | |
construct by wrap a PackedFunc More... | |
TypedPackedFunc (const MXNetRetValue &value) | |
constructor from MXNetRetValue More... | |
TypedPackedFunc (const MXNetArgValue &value) | |
constructor from MXNetArgValue More... | |
template<typename FLambda , typename = typename std::enable_if< std::is_convertible<FLambda, std::function<R(Args...)> >::value>::type> | |
TypedPackedFunc (const FLambda &typed_lambda) | |
construct from a lambda function with the same signature. More... | |
template<typename FLambda , typename = typename std::enable_if< std::is_convertible<FLambda, std::function<R(Args...)> >::value>::type> | |
TSelf & | operator= (FLambda typed_lambda) |
copy assignment operator from typed lambda More... | |
TSelf & | operator= (PackedFunc packed) |
copy assignment operator from PackedFunc. More... | |
R | operator() (Args ...args) const |
Invoke the operator. More... | |
operator PackedFunc () const | |
convert to PackedFunc More... | |
const PackedFunc & | packed () const |
bool | operator== (std::nullptr_t null) const |
bool | operator!= (std::nullptr_t null) const |
template<typename FType > | |
void | AssignTypedLambda (FType flambda) |
Friends | |
class | MXNetRetValue |
A PackedFunc wrapper to provide typed function signature. It is backed by a PackedFunc internally.
TypedPackedFunc enables compile time type checking. TypedPackedFunc works with the runtime system:
Developers should prefer TypedPackedFunc over PackedFunc in C++ code as it enables compile time checking. We can construct a TypedPackedFunc from a lambda function with the same signature.
R | The return value of the function. |
Args | The argument signature of the function. |
using mxnet::runtime::TypedPackedFunc< R(Args...)>::TSelf = TypedPackedFunc<R(Args...)> |
short hand for this function type
|
inline |
default constructor
|
inline |
constructor from null
|
inline |
construct by wrap a PackedFunc
Example usage:
packed | The packed function |
|
inline |
constructor from MXNetRetValue
value | The MXNetRetValue |
|
inline |
constructor from MXNetArgValue
value | The MXNetArgValue |
|
inline |
construct from a lambda function with the same signature.
Example usage:
typed_lambda | typed lambda function. |
FLambda | the type of the lambda function. |
|
inline |
|
inline |
convert to PackedFunc
|
inline |
|
inline |
Invoke the operator.
args | The arguments |
|
inline |
copy assignment operator from typed lambda
Example usage:
typed_lambda | typed lambda function. |
FLambda | the type of the lambda function. |
|
inline |
copy assignment operator from PackedFunc.
packed | The packed function. |
|
inline |
|
inline |
|
friend |