mxnet
Classes | Typedefs | Enumerations | Functions
c_runtime_api.h File Reference
#include <dlpack/dlpack.h>
#include <mxnet/c_api.h>
#include <stdint.h>
#include <stddef.h>
Include dependency graph for c_runtime_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

union  MXNetValue
 Union type of values being passed through API and function calls. More...
 
struct  MXNetByteArray
 Byte array type used to pass in byte array When kBytes is used as data type. More...
 

Typedefs

typedef void * MXNetFunctionHandle
 Handle to packed function handle. More...
 
typedef void * MXNetObjectHandle
 Handle to Object. More...
 

Enumerations

enum  MXNetTypeCode {
  kHandle = 3U, kNull = 4U, kMXNetType = 5U, kMXNetContext = 6U,
  kArrayHandle = 7U, kObjectHandle = 8U, kModuleHandle = 9U, kFuncHandle = 10U,
  kStr = 11U, kBytes = 12U, kNDArrayContainer = 13U, kNDArrayHandle = 14U,
  kExtBegin = 15U, kNNVMFirst = 16U, kNNVMLast = 20U, kExtReserveEnd = 64U,
  kExtEnd = 128U, kCustomBegin = 129U
}
 The type code in MXNetType. More...
 

Functions

MXNET_DLL int MXNetFuncFree (MXNetFunctionHandle func)
 Free the function when it is no longer needed. More...
 
MXNET_DLL int MXNetFuncCall (MXNetFunctionHandle func, MXNetValue *arg_values, int *type_codes, int num_args, MXNetValue *ret_val, int *ret_type_code)
 Call a Packed MXNet Function. More...
 
MXNET_DLL int MXNetFuncGetGlobal (const char *name, MXNetFunctionHandle *out)
 Get a global function. More...
 
MXNET_DLL int MXNetFuncListGlobalNames (int *out_size, const char ***out_array)
 List all the globally registered function name. More...
 
MXNET_DLL int MXNetObjectFree (MXNetObjectHandle obj)
 Free the object. More...
 

Typedef Documentation

typedef void* MXNetFunctionHandle

Handle to packed function handle.

typedef void* MXNetObjectHandle

Handle to Object.

Enumeration Type Documentation

The type code in MXNetType.

Note
MXNetType is used in two places.
Enumerator
kHandle 
kNull 
kMXNetType 
kMXNetContext 
kArrayHandle 
kObjectHandle 
kModuleHandle 
kFuncHandle 
kStr 
kBytes 
kNDArrayContainer 
kNDArrayHandle 
kExtBegin 
kNNVMFirst 
kNNVMLast 
kExtReserveEnd 
kExtEnd 
kCustomBegin 

Function Documentation

MXNET_DLL int MXNetFuncCall ( MXNetFunctionHandle  func,
MXNetValue arg_values,
int *  type_codes,
int  num_args,
MXNetValue ret_val,
int *  ret_type_code 
)

Call a Packed MXNet Function.

Parameters
funcnode handle of the function.
arg_valuesThe arguments
type_codesThe type codes of the arguments
num_argsNumber of arguments.
ret_valThe return value.
ret_type_codethe type code of return value.
Returns
0 when success, -1 when failure happens
Note
MXNet calls always exchanges with type bits=64, lanes=1
API calls always exchanges with type bits=64, lanes=1 If API call returns container handles (e.g. FunctionHandle) these handles should be managed by the front-end. The front-end need to call free function (e.g. MXNetFuncFree) to free these handles.
MXNET_DLL int MXNetFuncFree ( MXNetFunctionHandle  func)

Free the function when it is no longer needed.

Parameters
funcThe function handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNetFuncGetGlobal ( const char *  name,
MXNetFunctionHandle out 
)

Get a global function.

Parameters
nameThe name of the function.
outthe result function pointer, NULL if it does not exist.
Note
The function handle of global function is managed by MXNet runtime, So MXNetFuncFree is should not be called when it get deleted.
MXNET_DLL int MXNetFuncListGlobalNames ( int *  out_size,
const char ***  out_array 
)

List all the globally registered function name.

Parameters
out_sizeThe number of functions
out_arrayThe array of function names.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNetObjectFree ( MXNetObjectHandle  obj)

Free the object.

Parameters
objThe object handle.
Note
Internally we decrease the reference counter of the object. The object will be freed when every reference to the object are removed.
Returns
0 when success, -1 when failure happens