mxnet
|
C API of mxnet. More...
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
Go to the source code of this file.
Classes | |
struct | NativeOpInfo |
struct | NDArrayOpInfo |
struct | MXCallbackList |
Macros | |
#define | DEFAULT(x) |
Inhibit C++ name-mangling for MXNet functions. More... | |
#define | MXNET_DLL |
MXNET_DLL prefix for windows. More... | |
Typedefs | |
typedef unsigned int | mx_uint |
manually define unsigned int More... | |
typedef float | mx_float |
manually define float More... | |
typedef void * | NDArrayHandle |
handle to NDArray More... | |
typedef const void * | FunctionHandle |
handle to a mxnet narray function that changes NDArray More... | |
typedef void * | AtomicSymbolCreator |
handle to a function that takes param and creates symbol More... | |
typedef void * | CachedOpHandle |
handle to cached operator More... | |
typedef void * | SymbolHandle |
handle to a symbol that can be bind as operator More... | |
typedef void * | AtomicSymbolHandle |
handle to a AtomicSymbol More... | |
typedef void * | ExecutorHandle |
handle to an Executor More... | |
typedef void * | DataIterCreator |
handle a dataiter creator More... | |
typedef void * | DataIterHandle |
handle to a DataIterator More... | |
typedef void * | KVStoreHandle |
handle to KVStore More... | |
typedef void * | RecordIOHandle |
handle to RecordIO More... | |
typedef void * | RtcHandle |
handle to MXRtc More... | |
typedef void(* | ExecutorMonitorCallback) (const char *, NDArrayHandle, void *) |
typedef int(* | MXGenericCallback) (void) |
typedef int(* | CustomOpFBFunc) (int, void **, int *, const int *, const int, void *) |
typedef int(* | CustomOpDelFunc) (void *) |
typedef int(* | CustomOpListFunc) (char ***, void *) |
typedef int(* | CustomOpInferShapeFunc) (int, int *, unsigned **, void *) |
typedef int(* | CustomOpInferTypeFunc) (int, int *, void *) |
typedef int(* | CustomOpBwdDepFunc) (const int *, const int *, const int *, int *, int **, void *) |
typedef int(* | CustomOpCreateFunc) (const char *, int, unsigned **, const int *, const int *, struct MXCallbackList *, void *) |
typedef int(* | CustomOpPropCreator) (const char *, const int, const char **, const char **, struct MXCallbackList *) |
typedef int(* | CustomFunctionBwdFunc) (int, int, void **, const int *, const int, void *) |
typedef int(* | CustomFunctionDelFunc) (void *) |
typedef void( | MXKVStoreUpdater) (int key, NDArrayHandle recv, NDArrayHandle local, void *handle) |
user-defined updater for the kvstore It's this updater's responsibility to delete recv and local More... | |
typedef void( | MXKVStoreServerController) (int head, const char *body, void *controller_handle) |
the prototype of a server controller More... | |
Functions | |
MXNET_DLL const char * | MXGetLastError () |
return str message of the last error all function in this file will return 0 when success and -1 when an error occured, MXGetLastError can be called to retrieve the error More... | |
MXNET_DLL int | MXRandomSeed (int seed) |
Seed the global random number generators in mxnet. More... | |
MXNET_DLL int | MXNotifyShutdown () |
Notify the engine about a shutdown, This can help engine to print less messages into display. More... | |
MXNET_DLL int | MXSetProfilerConfig (int mode, const char *filename) |
Set up configuration of profiler. More... | |
MXNET_DLL int | MXSetProfilerState (int state) |
Set up state of profiler. More... | |
MXNET_DLL int | MXDumpProfile () |
Save profile and stop profiler. More... | |
MXNET_DLL int | MXSetNumOMPThreads (int thread_num) |
Set the number of OMP threads to use. More... | |
MXNET_DLL int | MXNDArrayCreateNone (NDArrayHandle *out) |
create a NDArray handle that is not initialized can be used to pass in as mutate variables to hold the result of NDArray More... | |
MXNET_DLL int | MXNDArrayCreate (const mx_uint *shape, mx_uint ndim, int dev_type, int dev_id, int delay_alloc, NDArrayHandle *out) |
create a NDArray with specified shape More... | |
MXNET_DLL int | MXNDArrayCreateEx (const mx_uint *shape, mx_uint ndim, int dev_type, int dev_id, int delay_alloc, int dtype, NDArrayHandle *out) |
create a NDArray with specified shape and data type More... | |
MXNET_DLL int | MXNDArrayLoadFromRawBytes (const void *buf, size_t size, NDArrayHandle *out) |
create a NDArray handle that is loaded from raw bytes. More... | |
MXNET_DLL int | MXNDArraySaveRawBytes (NDArrayHandle handle, size_t *out_size, const char **out_buf) |
save the NDArray into raw bytes. More... | |
MXNET_DLL int | MXNDArraySave (const char *fname, mx_uint num_args, NDArrayHandle *args, const char **keys) |
Save list of narray into the file. More... | |
MXNET_DLL int | MXNDArrayLoad (const char *fname, mx_uint *out_size, NDArrayHandle **out_arr, mx_uint *out_name_size, const char ***out_names) |
Load list of narray from the file. More... | |
MXNET_DLL int | MXNDArraySyncCopyFromCPU (NDArrayHandle handle, const void *data, size_t size) |
Perform a synchronize copy from a continugous CPU memory region. More... | |
MXNET_DLL int | MXNDArraySyncCopyToCPU (NDArrayHandle handle, void *data, size_t size) |
Perform a synchronize copyto a continugous CPU memory region. More... | |
MXNET_DLL int | MXNDArrayWaitToRead (NDArrayHandle handle) |
Wait until all the pending writes with respect NDArray are finished. Always call this before read data out synchronizely. More... | |
MXNET_DLL int | MXNDArrayWaitToWrite (NDArrayHandle handle) |
Wait until all the pending read/write with respect NDArray are finished. Always call this before write data into NDArray synchronizely. More... | |
MXNET_DLL int | MXNDArrayWaitAll () |
wait until all delayed operations in the system is completed More... | |
MXNET_DLL int | MXNDArrayFree (NDArrayHandle handle) |
free the narray handle More... | |
MXNET_DLL int | MXNDArraySlice (NDArrayHandle handle, mx_uint slice_begin, mx_uint slice_end, NDArrayHandle *out) |
Slice the NDArray along axis 0. More... | |
MXNET_DLL int | MXNDArrayAt (NDArrayHandle handle, mx_uint idx, NDArrayHandle *out) |
Index the NDArray along axis 0. More... | |
MXNET_DLL int | MXNDArrayReshape (NDArrayHandle handle, int ndim, int *dims, NDArrayHandle *out) |
Reshape the NDArray. More... | |
MXNET_DLL int | MXNDArrayGetShape (NDArrayHandle handle, mx_uint *out_dim, const mx_uint **out_pdata) |
get the shape of the array More... | |
MXNET_DLL int | MXNDArrayGetData (NDArrayHandle handle, void **out_pdata) |
get the content of the data in NDArray More... | |
MXNET_DLL int | MXNDArrayGetDType (NDArrayHandle handle, int *out_dtype) |
get the type of the data in NDArray More... | |
MXNET_DLL int | MXNDArrayGetContext (NDArrayHandle handle, int *out_dev_type, int *out_dev_id) |
get the context of the NDArray More... | |
MXNET_DLL int | MXNDArrayGetGrad (NDArrayHandle handle, NDArrayHandle *out) |
return gradient buffer attached to this NDArray More... | |
MXNET_DLL int | MXNDArrayDetach (NDArrayHandle handle, NDArrayHandle *out) |
detach and ndarray from computation graph by clearing entry_ More... | |
MXNET_DLL int | MXNDArraySetGradState (NDArrayHandle handle, int state) |
set the flag for gradient array state. More... | |
MXNET_DLL int | MXNDArrayGetGradState (NDArrayHandle handle, int *out) |
set the flag for gradient array state. More... | |
MXNET_DLL int | MXListFunctions (mx_uint *out_size, FunctionHandle **out_array) |
list all the available functions handles most user can use it to list all the needed functions More... | |
MXNET_DLL int | MXGetFunction (const char *name, FunctionHandle *out) |
get the function handle by name More... | |
MXNET_DLL int | MXFuncGetInfo (FunctionHandle fun, const char **name, const char **description, mx_uint *num_args, const char ***arg_names, const char ***arg_type_infos, const char ***arg_descriptions, const char **return_type DEFAULT(NULL)) |
Get the information of the function handle. More... | |
MXNET_DLL int | MXFuncDescribe (FunctionHandle fun, mx_uint *num_use_vars, mx_uint *num_scalars, mx_uint *num_mutate_vars, int *type_mask) |
get the argument requirements of the function More... | |
MXNET_DLL int | MXFuncInvoke (FunctionHandle fun, NDArrayHandle *use_vars, mx_float *scalar_args, NDArrayHandle *mutate_vars) |
invoke a function, the array size of passed in arguments must match the values in the More... | |
MXNET_DLL int | MXFuncInvokeEx (FunctionHandle fun, NDArrayHandle *use_vars, mx_float *scalar_args, NDArrayHandle *mutate_vars, int num_params, char **param_keys, char **param_vals) |
invoke a function, the array size of passed in arguments must match the values in the More... | |
MXNET_DLL int | MXImperativeInvoke (AtomicSymbolCreator creator, int num_inputs, NDArrayHandle *inputs, int *num_outputs, NDArrayHandle **outputs, int num_params, const char **param_keys, const char **param_vals) |
invoke a nnvm op and imperative function More... | |
MXNET_DLL int | MXAutogradSetIsRecording (int is_recording, int *prev) |
set whether to record operator for autograd More... | |
MXNET_DLL int | MXAutogradSetIsTraining (int is_training, int *prev) |
set whether to record operator for autograd More... | |
MXNET_DLL int | MXAutogradIsRecording (bool *curr) |
get whether autograd recording is on More... | |
MXNET_DLL int | MXAutogradIsTraining (bool *curr) |
get whether training mode is on More... | |
MXNET_DLL int | MXAutogradMarkVariables (mx_uint num_var, NDArrayHandle *var_handles, mx_uint *reqs_array, NDArrayHandle *grad_handles) |
mark NDArrays as variables to compute gradient for autograd More... | |
MXNET_DLL int | MXAutogradComputeGradient (mx_uint num_output, NDArrayHandle *output_handles) |
compute the gradient of outputs w.r.t variabels More... | |
MXNET_DLL int | MXAutogradBackward (mx_uint num_output, NDArrayHandle *output_handles, NDArrayHandle *ograd_handles, int retain_graph) |
compute the gradient of outputs w.r.t variabels More... | |
MXNET_DLL int | MXAutogradBackwardEx (mx_uint num_output, NDArrayHandle *output_handles, NDArrayHandle *ograd_handles, int retain_graph, int is_train) |
compute the gradient of outputs w.r.t variabels More... | |
MXNET_DLL int | MXAutogradGetSymbol (NDArrayHandle handle, SymbolHandle *out) |
MXNET_DLL int | MXCreateCachedOp (SymbolHandle handle, CachedOpHandle *out) |
create cached operator More... | |
MXNET_DLL int | MXFreeCachedOp (CachedOpHandle handle) |
free cached operator More... | |
MXNET_DLL int | MXInvokeCachedOp (CachedOpHandle handle, int num_inputs, NDArrayHandle *inputs, int *num_outputs, NDArrayHandle **outputs) |
invoke cached operator More... | |
MXNET_DLL int | MXListAllOpNames (mx_uint *out_size, const char ***out_array) |
list all the available operator names, include entries. More... | |
MXNET_DLL int | MXSymbolListAtomicSymbolCreators (mx_uint *out_size, AtomicSymbolCreator **out_array) |
list all the available AtomicSymbolEntry More... | |
MXNET_DLL int | MXSymbolGetAtomicSymbolName (AtomicSymbolCreator creator, const char **name) |
Get the name of an atomic symbol. More... | |
MXNET_DLL int | MXSymbolGetAtomicSymbolInfo (AtomicSymbolCreator creator, const char **name, const char **description, mx_uint *num_args, const char ***arg_names, const char ***arg_type_infos, const char ***arg_descriptions, const char **key_var_num_args, const char **return_type DEFAULT(NULL)) |
Get the detailed information about atomic symbol. More... | |
MXNET_DLL int | MXSymbolCreateAtomicSymbol (AtomicSymbolCreator creator, mx_uint num_param, const char **keys, const char **vals, SymbolHandle *out) |
Create an AtomicSymbol. More... | |
MXNET_DLL int | MXSymbolCreateVariable (const char *name, SymbolHandle *out) |
Create a Variable Symbol. More... | |
MXNET_DLL int | MXSymbolCreateGroup (mx_uint num_symbols, SymbolHandle *symbols, SymbolHandle *out) |
Create a Symbol by grouping list of symbols together. More... | |
MXNET_DLL int | MXSymbolCreateFromFile (const char *fname, SymbolHandle *out) |
Load a symbol from a json file. More... | |
MXNET_DLL int | MXSymbolCreateFromJSON (const char *json, SymbolHandle *out) |
Load a symbol from a json string. More... | |
MXNET_DLL int | MXSymbolSaveToFile (SymbolHandle symbol, const char *fname) |
Save a symbol into a json file. More... | |
MXNET_DLL int | MXSymbolSaveToJSON (SymbolHandle symbol, const char **out_json) |
Save a symbol into a json string. More... | |
MXNET_DLL int | MXSymbolFree (SymbolHandle symbol) |
Free the symbol handle. More... | |
MXNET_DLL int | MXSymbolCopy (SymbolHandle symbol, SymbolHandle *out) |
Copy the symbol to another handle. More... | |
MXNET_DLL int | MXSymbolPrint (SymbolHandle symbol, const char **out_str) |
Print the content of symbol, used for debug. More... | |
MXNET_DLL int | MXSymbolGetName (SymbolHandle symbol, const char **out, int *success) |
Get string name from symbol. More... | |
MXNET_DLL int | MXSymbolGetAttr (SymbolHandle symbol, const char *key, const char **out, int *success) |
Get string attribute from symbol. More... | |
MXNET_DLL int | MXSymbolSetAttr (SymbolHandle symbol, const char *key, const char *value) |
Set string attribute from symbol. NOTE: Setting attribute to a symbol can affect the semantics(mutable/immutable) of symbolic graph. More... | |
MXNET_DLL int | MXSymbolListAttr (SymbolHandle symbol, mx_uint *out_size, const char ***out) |
Get all attributes from symbol, including all descendents. More... | |
MXNET_DLL int | MXSymbolListAttrShallow (SymbolHandle symbol, mx_uint *out_size, const char ***out) |
Get all attributes from symbol, excluding descendents. More... | |
MXNET_DLL int | MXSymbolListArguments (SymbolHandle symbol, mx_uint *out_size, const char ***out_str_array) |
List arguments in the symbol. More... | |
MXNET_DLL int | MXSymbolListOutputs (SymbolHandle symbol, mx_uint *out_size, const char ***out_str_array) |
List returns in the symbol. More... | |
MXNET_DLL int | MXSymbolGetInternals (SymbolHandle symbol, SymbolHandle *out) |
Get a symbol that contains all the internals. More... | |
MXNET_DLL int | MXSymbolGetChildren (SymbolHandle symbol, SymbolHandle *out) |
Get a symbol that contains only direct children. More... | |
MXNET_DLL int | MXSymbolGetOutput (SymbolHandle symbol, mx_uint index, SymbolHandle *out) |
Get index-th outputs of the symbol. More... | |
MXNET_DLL int | MXSymbolListAuxiliaryStates (SymbolHandle symbol, mx_uint *out_size, const char ***out_str_array) |
List auxiliary states in the symbol. More... | |
MXNET_DLL int | MXSymbolCompose (SymbolHandle sym, const char *name, mx_uint num_args, const char **keys, SymbolHandle *args) |
Compose the symbol on other symbols. More... | |
MXNET_DLL int | MXSymbolGrad (SymbolHandle sym, mx_uint num_wrt, const char **wrt, SymbolHandle *out) |
Get the gradient graph of the symbol. More... | |
MXNET_DLL int | MXSymbolInferShape (SymbolHandle sym, mx_uint num_args, const char **keys, const mx_uint *arg_ind_ptr, const mx_uint *arg_shape_data, mx_uint *in_shape_size, const mx_uint **in_shape_ndim, const mx_uint ***in_shape_data, mx_uint *out_shape_size, const mx_uint **out_shape_ndim, const mx_uint ***out_shape_data, mx_uint *aux_shape_size, const mx_uint **aux_shape_ndim, const mx_uint ***aux_shape_data, int *complete) |
infer shape of unknown input shapes given the known one. The shapes are packed into a CSR matrix represented by arg_ind_ptr and arg_shape_data The call will be treated as a kwargs call if key != nullptr or num_args==0, otherwise it is positional. More... | |
MXNET_DLL int | MXSymbolInferShapePartial (SymbolHandle sym, mx_uint num_args, const char **keys, const mx_uint *arg_ind_ptr, const mx_uint *arg_shape_data, mx_uint *in_shape_size, const mx_uint **in_shape_ndim, const mx_uint ***in_shape_data, mx_uint *out_shape_size, const mx_uint **out_shape_ndim, const mx_uint ***out_shape_data, mx_uint *aux_shape_size, const mx_uint **aux_shape_ndim, const mx_uint ***aux_shape_data, int *complete) |
partially infer shape of unknown input shapes given the known one. More... | |
MXNET_DLL int | MXSymbolInferType (SymbolHandle sym, mx_uint num_args, const char **keys, const int *arg_type_data, mx_uint *in_type_size, const int **in_type_data, mx_uint *out_type_size, const int **out_type_data, mx_uint *aux_type_size, const int **aux_type_data, int *complete) |
infer type of unknown input types given the known one. The types are packed into a CSR matrix represented by arg_ind_ptr and arg_type_data The call will be treated as a kwargs call if key != nullptr or num_args==0, otherwise it is positional. More... | |
MXNET_DLL int | MXExecutorFree (ExecutorHandle handle) |
Delete the executor. More... | |
MXNET_DLL int | MXExecutorPrint (ExecutorHandle handle, const char **out_str) |
Print the content of execution plan, used for debug. More... | |
MXNET_DLL int | MXExecutorForward (ExecutorHandle handle, int is_train) |
Executor forward method. More... | |
MXNET_DLL int | MXExecutorBackward (ExecutorHandle handle, mx_uint len, NDArrayHandle *head_grads) |
Excecutor run backward. More... | |
MXNET_DLL int | MXExecutorBackwardEx (ExecutorHandle handle, mx_uint len, NDArrayHandle *head_grads, int is_train) |
Excecutor run backward. More... | |
MXNET_DLL int | MXExecutorOutputs (ExecutorHandle handle, mx_uint *out_size, NDArrayHandle **out) |
Get executor's head NDArray. More... | |
MXNET_DLL int | MXExecutorBind (SymbolHandle symbol_handle, int dev_type, int dev_id, mx_uint len, NDArrayHandle *in_args, NDArrayHandle *arg_grad_store, mx_uint *grad_req_type, mx_uint aux_states_len, NDArrayHandle *aux_states, ExecutorHandle *out) |
Generate Executor from symbol. More... | |
MXNET_DLL int | MXExecutorBindX (SymbolHandle symbol_handle, int dev_type, int dev_id, mx_uint num_map_keys, const char **map_keys, const int *map_dev_types, const int *map_dev_ids, mx_uint len, NDArrayHandle *in_args, NDArrayHandle *arg_grad_store, mx_uint *grad_req_type, mx_uint aux_states_len, NDArrayHandle *aux_states, ExecutorHandle *out) |
Generate Executor from symbol, This is advanced function, allow specify group2ctx map. The user can annotate "ctx_group" attribute to name each group. More... | |
MXNET_DLL int | MXExecutorBindEX (SymbolHandle symbol_handle, int dev_type, int dev_id, mx_uint num_map_keys, const char **map_keys, const int *map_dev_types, const int *map_dev_ids, mx_uint len, NDArrayHandle *in_args, NDArrayHandle *arg_grad_store, mx_uint *grad_req_type, mx_uint aux_states_len, NDArrayHandle *aux_states, ExecutorHandle shared_exec, ExecutorHandle *out) |
Generate Executor from symbol, This is advanced function, allow specify group2ctx map. The user can annotate "ctx_group" attribute to name each group. More... | |
MXNET_DLL int | MXExecutorSimpleBind (SymbolHandle symbol_handle, int dev_type, int dev_id, const mx_uint num_g2c_keys, const char **g2c_keys, const int *g2c_dev_types, const int *g2c_dev_ids, const mx_uint provided_grad_req_list_len, const char **provided_grad_req_names, const char **provided_grad_req_types, const mx_uint num_provided_arg_shapes, const char **provided_arg_shape_names, const mx_uint *provided_arg_shape_data, const mx_uint *provided_arg_shape_idx, const mx_uint num_provided_arg_dtypes, const char **provided_arg_dtype_names, const int *provided_arg_dtypes, const mx_uint num_shared_arg_names, const char **shared_arg_name_list, int *shared_buffer_len, const char **shared_buffer_name_list, NDArrayHandle *shared_buffer_handle_list, const char ***updated_shared_buffer_name_list, NDArrayHandle **updated_shared_buffer_handle_list, mx_uint *num_in_args, NDArrayHandle **in_args, NDArrayHandle **arg_grads, mx_uint *num_aux_states, NDArrayHandle **aux_states, ExecutorHandle shared_exec_handle, ExecutorHandle *out) |
MXNET_DLL int | MXExecutorSetMonitorCallback (ExecutorHandle handle, ExecutorMonitorCallback callback, void *callback_handle) |
set a call back to notify the completion of operation More... | |
MXNET_DLL int | MXListDataIters (mx_uint *out_size, DataIterCreator **out_array) |
List all the available iterator entries. More... | |
MXNET_DLL int | MXDataIterCreateIter (DataIterCreator handle, mx_uint num_param, const char **keys, const char **vals, DataIterHandle *out) |
Init an iterator, init with parameters the array size of passed in arguments. More... | |
MXNET_DLL int | MXDataIterGetIterInfo (DataIterCreator creator, const char **name, const char **description, mx_uint *num_args, const char ***arg_names, const char ***arg_type_infos, const char ***arg_descriptions) |
Get the detailed information about data iterator. More... | |
MXNET_DLL int | MXDataIterFree (DataIterHandle handle) |
Free the handle to the IO module. More... | |
MXNET_DLL int | MXDataIterNext (DataIterHandle handle, int *out) |
Move iterator to next position. More... | |
MXNET_DLL int | MXDataIterBeforeFirst (DataIterHandle handle) |
Call iterator.Reset. More... | |
MXNET_DLL int | MXDataIterGetData (DataIterHandle handle, NDArrayHandle *out) |
Get the handle to the NDArray of underlying data. More... | |
MXNET_DLL int | MXDataIterGetIndex (DataIterHandle handle, uint64_t **out_index, uint64_t *out_size) |
Get the image index by array. More... | |
MXNET_DLL int | MXDataIterGetPadNum (DataIterHandle handle, int *pad) |
Get the padding number in current data batch. More... | |
MXNET_DLL int | MXDataIterGetLabel (DataIterHandle handle, NDArrayHandle *out) |
Get the handle to the NDArray of underlying label. More... | |
MXNET_DLL int | MXInitPSEnv (mx_uint num_vars, const char **keys, const char **vals) |
Initialized ps-lite environment variables. More... | |
MXNET_DLL int | MXKVStoreCreate (const char *type, KVStoreHandle *out) |
Create a kvstore. More... | |
MXNET_DLL int | MXKVStoreFree (KVStoreHandle handle) |
Delete a KVStore handle. More... | |
MXNET_DLL int | MXKVStoreInit (KVStoreHandle handle, mx_uint num, const int *keys, NDArrayHandle *vals) |
Init a list of (key,value) pairs in kvstore. More... | |
MXNET_DLL int | MXKVStoreInitEx (KVStoreHandle handle, mx_uint num, const char **keys, NDArrayHandle *vals) |
Init a list of (key,value) pairs in kvstore, where each key is a string. More... | |
MXNET_DLL int | MXKVStorePush (KVStoreHandle handle, mx_uint num, const int *keys, NDArrayHandle *vals, int priority) |
Push a list of (key,value) pairs to kvstore. More... | |
MXNET_DLL int | MXKVStorePushEx (KVStoreHandle handle, mx_uint num, const char **keys, NDArrayHandle *vals, int priority) |
Push a list of (key,value) pairs to kvstore, where each key is a string. More... | |
MXNET_DLL int | MXKVStorePull (KVStoreHandle handle, mx_uint num, const int *keys, NDArrayHandle *vals, int priority) |
pull a list of (key, value) pairs from the kvstore More... | |
MXNET_DLL int | MXKVStorePullEx (KVStoreHandle handle, mx_uint num, const char **keys, NDArrayHandle *vals, int priority) |
pull a list of (key, value) pairs from the kvstore, where each key is a string More... | |
MXNET_DLL int | MXKVStoreSetUpdater (KVStoreHandle handle, MXKVStoreUpdater updater, void *updater_handle) |
register an push updater More... | |
MXNET_DLL int | MXKVStoreGetType (KVStoreHandle handle, const char **type) |
get the type of the kvstore More... | |
MXNET_DLL int | MXKVStoreGetRank (KVStoreHandle handle, int *ret) |
return The rank of this node in its group, which is in [0, GroupSize). More... | |
MXNET_DLL int | MXKVStoreGetGroupSize (KVStoreHandle handle, int *ret) |
return The number of nodes in this group, which is More... | |
MXNET_DLL int | MXKVStoreIsWorkerNode (int *ret) |
return whether or not this process is a worker node. More... | |
MXNET_DLL int | MXKVStoreIsServerNode (int *ret) |
return whether or not this process is a server node. More... | |
MXNET_DLL int | MXKVStoreIsSchedulerNode (int *ret) |
return whether or not this process is a scheduler node. More... | |
MXNET_DLL int | MXKVStoreBarrier (KVStoreHandle handle) |
global barrier among all worker machines More... | |
MXNET_DLL int | MXKVStoreSetBarrierBeforeExit (KVStoreHandle handle, const int barrier_before_exit) |
whether to do barrier when finalize More... | |
MXNET_DLL int | MXKVStoreRunServer (KVStoreHandle handle, MXKVStoreServerController controller, void *controller_handle) |
MXNET_DLL int | MXKVStoreSendCommmandToServers (KVStoreHandle handle, int cmd_id, const char *cmd_body) |
MXNET_DLL int | MXKVStoreGetNumDeadNode (KVStoreHandle handle, const int node_id, int *number, const int timeout_sec DEFAULT(60)) |
Get the number of ps dead node(s) specified by {node_id}. More... | |
MXNET_DLL int | MXRecordIOWriterCreate (const char *uri, RecordIOHandle *out) |
Create a RecordIO writer object. More... | |
MXNET_DLL int | MXRecordIOWriterFree (RecordIOHandle handle) |
Delete a RecordIO writer object. More... | |
MXNET_DLL int | MXRecordIOWriterWriteRecord (RecordIOHandle handle, const char *buf, size_t size) |
Write a record to a RecordIO object. More... | |
MXNET_DLL int | MXRecordIOWriterTell (RecordIOHandle handle, size_t *pos) |
Get the current writer pointer position. More... | |
MXNET_DLL int | MXRecordIOReaderCreate (const char *uri, RecordIOHandle *out) |
Create a RecordIO reader object. More... | |
MXNET_DLL int | MXRecordIOReaderFree (RecordIOHandle handle) |
Delete a RecordIO reader object. More... | |
MXNET_DLL int | MXRecordIOReaderReadRecord (RecordIOHandle handle, char const **buf, size_t *size) |
Write a record to a RecordIO object. More... | |
MXNET_DLL int | MXRecordIOReaderSeek (RecordIOHandle handle, size_t pos) |
Set the current reader pointer position. More... | |
MXNET_DLL int | MXRtcCreate (char *name, mx_uint num_input, mx_uint num_output, char **input_names, char **output_names, NDArrayHandle *inputs, NDArrayHandle *outputs, char *kernel, RtcHandle *out) |
Create a MXRtc object. More... | |
MXNET_DLL int | MXRtcPush (RtcHandle handle, mx_uint num_input, mx_uint num_output, NDArrayHandle *inputs, NDArrayHandle *outputs, mx_uint gridDimX, mx_uint gridDimY, mx_uint gridDimZ, mx_uint blockDimX, mx_uint blockDimY, mx_uint blockDimZ) |
Run cuda kernel. More... | |
MXNET_DLL int | MXRtcFree (RtcHandle handle) |
Delete a MXRtc object. More... | |
MXNET_DLL int | MXCustomOpRegister (const char *op_type, CustomOpPropCreator creator) |
MXNET_DLL int | MXCustomFunctionRecord (int num_inputs, NDArrayHandle *inputs, int num_outputs, NDArrayHandle *outputs, MXCallbackList *callbacks) |
C API of mxnet.
#define DEFAULT | ( | x | ) |
Inhibit C++ name-mangling for MXNet functions.
Keep the default value in C++
#define MXNET_DLL |
MXNET_DLL prefix for windows.
typedef void* AtomicSymbolCreator |
handle to a function that takes param and creates symbol
typedef void* AtomicSymbolHandle |
handle to a AtomicSymbol
typedef void* CachedOpHandle |
handle to cached operator
typedef int(* CustomFunctionBwdFunc) (int, int, void **, const int *, const int, void *) |
typedef int(* CustomFunctionDelFunc) (void *) |
typedef int(* CustomOpBwdDepFunc) (const int *, const int *, const int *, int *, int **, void *) |
typedef int(* CustomOpCreateFunc) (const char *, int, unsigned **, const int *, const int *, struct MXCallbackList *, void *) |
typedef int(* CustomOpDelFunc) (void *) |
typedef int(* CustomOpFBFunc) (int, void **, int *, const int *, const int, void *) |
typedef int(* CustomOpInferShapeFunc) (int, int *, unsigned **, void *) |
typedef int(* CustomOpInferTypeFunc) (int, int *, void *) |
typedef int(* CustomOpListFunc) (char ***, void *) |
typedef int(* CustomOpPropCreator) (const char *, const int, const char **, const char **, struct MXCallbackList *) |
typedef void* DataIterCreator |
handle a dataiter creator
typedef void* DataIterHandle |
handle to a DataIterator
typedef void* ExecutorHandle |
handle to an Executor
typedef void(* ExecutorMonitorCallback) (const char *, NDArrayHandle, void *) |
typedef const void* FunctionHandle |
handle to a mxnet narray function that changes NDArray
typedef void* KVStoreHandle |
handle to KVStore
typedef float mx_float |
manually define float
typedef unsigned int mx_uint |
manually define unsigned int
typedef int(* MXGenericCallback) (void) |
typedef void( MXKVStoreServerController) (int head, const char *body, void *controller_handle) |
the prototype of a server controller
head | the head of the command |
body | the body of the command |
controller_handle | helper handle for implementing controller |
typedef void( MXKVStoreUpdater) (int key, NDArrayHandle recv, NDArrayHandle local, void *handle) |
user-defined updater for the kvstore It's this updater's responsibility to delete recv and local
the | key |
recv | the pushed value on this key |
local | the value stored on local on this key |
handle | The additional handle to the updater |
typedef void* NDArrayHandle |
handle to NDArray
typedef void* RecordIOHandle |
handle to RecordIO
typedef void* RtcHandle |
handle to MXRtc
typedef void* SymbolHandle |
handle to a symbol that can be bind as operator
enum CustomOpCallbacks |
MXNET_DLL int MXAutogradBackward | ( | mx_uint | num_output, |
NDArrayHandle * | output_handles, | ||
NDArrayHandle * | ograd_handles, | ||
int | retain_graph | ||
) |
compute the gradient of outputs w.r.t variabels
num_output | number of output NDArray |
output_handles | output NDArrays |
ograd_handles | head gradient for NDArrays |
retain_graph | whether to keep the graph after backward |
MXNET_DLL int MXAutogradBackwardEx | ( | mx_uint | num_output, |
NDArrayHandle * | output_handles, | ||
NDArrayHandle * | ograd_handles, | ||
int | retain_graph, | ||
int | is_train | ||
) |
compute the gradient of outputs w.r.t variabels
num_output | number of output NDArray |
output_handles | output NDArrays |
ograd_handles | head gradient for NDArrays |
retain_graph | whether to keep the graph after backward |
is_train | whether to do backward for training or inference |
MXNET_DLL int MXAutogradComputeGradient | ( | mx_uint | num_output, |
NDArrayHandle * | output_handles | ||
) |
compute the gradient of outputs w.r.t variabels
num_output | number of output NDArray |
output_handles | output NDArrays |
MXNET_DLL int MXAutogradGetSymbol | ( | NDArrayHandle | handle, |
SymbolHandle * | out | ||
) |
MXNET_DLL int MXAutogradIsRecording | ( | bool * | curr | ) |
get whether autograd recording is on
curr | returns the current status. |
MXNET_DLL int MXAutogradIsTraining | ( | bool * | curr | ) |
get whether training mode is on
curr | returns the current status. |
MXNET_DLL int MXAutogradMarkVariables | ( | mx_uint | num_var, |
NDArrayHandle * | var_handles, | ||
mx_uint * | reqs_array, | ||
NDArrayHandle * | grad_handles | ||
) |
mark NDArrays as variables to compute gradient for autograd
num_var | number of variable NDArrays |
var_handles | variable NDArrays |
MXNET_DLL int MXAutogradSetIsRecording | ( | int | is_recording, |
int * | prev | ||
) |
set whether to record operator for autograd
is_recording | 1 when recording, 0 when not recording. |
prev | returns the previous status before this set. |
MXNET_DLL int MXAutogradSetIsTraining | ( | int | is_training, |
int * | prev | ||
) |
set whether to record operator for autograd
is_train | 1 when training, 0 when testing |
prev | returns the previous status before this set. |
MXNET_DLL int MXCreateCachedOp | ( | SymbolHandle | handle, |
CachedOpHandle * | out | ||
) |
create cached operator
MXNET_DLL int MXCustomFunctionRecord | ( | int | num_inputs, |
NDArrayHandle * | inputs, | ||
int | num_outputs, | ||
NDArrayHandle * | outputs, | ||
MXCallbackList * | callbacks | ||
) |
MXNET_DLL int MXCustomOpRegister | ( | const char * | op_type, |
CustomOpPropCreator | creator | ||
) |
MXNET_DLL int MXDataIterBeforeFirst | ( | DataIterHandle | handle | ) |
Call iterator.Reset.
handle | the handle to iterator |
MXNET_DLL int MXDataIterCreateIter | ( | DataIterCreator | handle, |
mx_uint | num_param, | ||
const char ** | keys, | ||
const char ** | vals, | ||
DataIterHandle * | out | ||
) |
Init an iterator, init with parameters the array size of passed in arguments.
handle | of the iterator creator |
num_param | number of parameter |
keys | parameter keys |
vals | parameter values |
out | resulting iterator |
MXNET_DLL int MXDataIterFree | ( | DataIterHandle | handle | ) |
Free the handle to the IO module.
handle | the handle pointer to the data iterator |
MXNET_DLL int MXDataIterGetData | ( | DataIterHandle | handle, |
NDArrayHandle * | out | ||
) |
Get the handle to the NDArray of underlying data.
handle | the handle pointer to the data iterator |
out | handle to underlying data NDArray |
MXNET_DLL int MXDataIterGetIndex | ( | DataIterHandle | handle, |
uint64_t ** | out_index, | ||
uint64_t * | out_size | ||
) |
Get the image index by array.
handle | the handle pointer to the data iterator |
out_index | output index of the array. |
out_size | output size of the array. |
MXNET_DLL int MXDataIterGetIterInfo | ( | DataIterCreator | creator, |
const char ** | name, | ||
const char ** | description, | ||
mx_uint * | num_args, | ||
const char *** | arg_names, | ||
const char *** | arg_type_infos, | ||
const char *** | arg_descriptions | ||
) |
Get the detailed information about data iterator.
creator | the DataIterCreator. |
name | The returned name of the creator. |
description | The returned description of the symbol. |
num_args | Number of arguments. |
arg_names | Name of the arguments. |
arg_type_infos | Type informations about the arguments. |
arg_descriptions | Description information about the arguments. |
MXNET_DLL int MXDataIterGetLabel | ( | DataIterHandle | handle, |
NDArrayHandle * | out | ||
) |
Get the handle to the NDArray of underlying label.
handle | the handle pointer to the data iterator |
out | the handle to underlying label NDArray |
MXNET_DLL int MXDataIterGetPadNum | ( | DataIterHandle | handle, |
int * | pad | ||
) |
Get the padding number in current data batch.
handle | the handle pointer to the data iterator |
pad | pad number ptr |
MXNET_DLL int MXDataIterNext | ( | DataIterHandle | handle, |
int * | out | ||
) |
Move iterator to next position.
handle | the handle to iterator |
out | return value of next |
MXNET_DLL int MXDumpProfile | ( | ) |
Save profile and stop profiler.
MXNET_DLL int MXExecutorBackward | ( | ExecutorHandle | handle, |
mx_uint | len, | ||
NDArrayHandle * | head_grads | ||
) |
Excecutor run backward.
handle | execute handle |
len | lenth |
head_grads | NDArray handle for heads' gradient |
MXNET_DLL int MXExecutorBackwardEx | ( | ExecutorHandle | handle, |
mx_uint | len, | ||
NDArrayHandle * | head_grads, | ||
int | is_train | ||
) |
Excecutor run backward.
handle | execute handle |
len | lenth |
head_grads | NDArray handle for heads' gradient |
is_train | int value to indicate whether the backward pass is for evaluation |
MXNET_DLL int MXExecutorBind | ( | SymbolHandle | symbol_handle, |
int | dev_type, | ||
int | dev_id, | ||
mx_uint | len, | ||
NDArrayHandle * | in_args, | ||
NDArrayHandle * | arg_grad_store, | ||
mx_uint * | grad_req_type, | ||
mx_uint | aux_states_len, | ||
NDArrayHandle * | aux_states, | ||
ExecutorHandle * | out | ||
) |
Generate Executor from symbol.
symbol_handle | symbol handle |
dev_type | device type |
dev_id | device id |
len | length |
in_args | in args array |
arg_grad_store | arg grads handle array |
grad_req_type | grad req array |
aux_states_len | length of auxiliary states |
aux_states | auxiliary states array |
out | output executor handle |
MXNET_DLL int MXExecutorBindEX | ( | SymbolHandle | symbol_handle, |
int | dev_type, | ||
int | dev_id, | ||
mx_uint | num_map_keys, | ||
const char ** | map_keys, | ||
const int * | map_dev_types, | ||
const int * | map_dev_ids, | ||
mx_uint | len, | ||
NDArrayHandle * | in_args, | ||
NDArrayHandle * | arg_grad_store, | ||
mx_uint * | grad_req_type, | ||
mx_uint | aux_states_len, | ||
NDArrayHandle * | aux_states, | ||
ExecutorHandle | shared_exec, | ||
ExecutorHandle * | out | ||
) |
Generate Executor from symbol, This is advanced function, allow specify group2ctx map. The user can annotate "ctx_group" attribute to name each group.
symbol_handle | symbol handle |
dev_type | device type of default context |
dev_id | device id of default context |
num_map_keys | size of group2ctx map |
map_keys | keys of group2ctx map |
map_dev_types | device type of group2ctx map |
map_dev_ids | device id of group2ctx map |
len | length |
in_args | in args array |
arg_grad_store | arg grads handle array |
grad_req_type | grad req array |
aux_states_len | length of auxiliary states |
aux_states | auxiliary states array |
shared_exec | input executor handle for memory sharing |
out | output executor handle |
MXNET_DLL int MXExecutorBindX | ( | SymbolHandle | symbol_handle, |
int | dev_type, | ||
int | dev_id, | ||
mx_uint | num_map_keys, | ||
const char ** | map_keys, | ||
const int * | map_dev_types, | ||
const int * | map_dev_ids, | ||
mx_uint | len, | ||
NDArrayHandle * | in_args, | ||
NDArrayHandle * | arg_grad_store, | ||
mx_uint * | grad_req_type, | ||
mx_uint | aux_states_len, | ||
NDArrayHandle * | aux_states, | ||
ExecutorHandle * | out | ||
) |
Generate Executor from symbol, This is advanced function, allow specify group2ctx map. The user can annotate "ctx_group" attribute to name each group.
symbol_handle | symbol handle |
dev_type | device type of default context |
dev_id | device id of default context |
num_map_keys | size of group2ctx map |
map_keys | keys of group2ctx map |
map_dev_types | device type of group2ctx map |
map_dev_ids | device id of group2ctx map |
len | length |
in_args | in args array |
arg_grad_store | arg grads handle array |
grad_req_type | grad req array |
aux_states_len | length of auxiliary states |
aux_states | auxiliary states array |
out | output executor handle |
MXNET_DLL int MXExecutorForward | ( | ExecutorHandle | handle, |
int | is_train | ||
) |
Executor forward method.
handle | executor handle |
is_train | int value to indicate whether the forward pass is for evaluation |
MXNET_DLL int MXExecutorFree | ( | ExecutorHandle | handle | ) |
Delete the executor.
handle | the executor. |
MXNET_DLL int MXExecutorOutputs | ( | ExecutorHandle | handle, |
mx_uint * | out_size, | ||
NDArrayHandle ** | out | ||
) |
Get executor's head NDArray.
handle | executor handle |
out_size | output narray vector size |
out | out put narray handles |
MXNET_DLL int MXExecutorPrint | ( | ExecutorHandle | handle, |
const char ** | out_str | ||
) |
Print the content of execution plan, used for debug.
handle | the executor. |
out_str | pointer to hold the output string of the printing. |
MXNET_DLL int MXExecutorSetMonitorCallback | ( | ExecutorHandle | handle, |
ExecutorMonitorCallback | callback, | ||
void * | callback_handle | ||
) |
set a call back to notify the completion of operation
MXNET_DLL int MXExecutorSimpleBind | ( | SymbolHandle | symbol_handle, |
int | dev_type, | ||
int | dev_id, | ||
const mx_uint | num_g2c_keys, | ||
const char ** | g2c_keys, | ||
const int * | g2c_dev_types, | ||
const int * | g2c_dev_ids, | ||
const mx_uint | provided_grad_req_list_len, | ||
const char ** | provided_grad_req_names, | ||
const char ** | provided_grad_req_types, | ||
const mx_uint | num_provided_arg_shapes, | ||
const char ** | provided_arg_shape_names, | ||
const mx_uint * | provided_arg_shape_data, | ||
const mx_uint * | provided_arg_shape_idx, | ||
const mx_uint | num_provided_arg_dtypes, | ||
const char ** | provided_arg_dtype_names, | ||
const int * | provided_arg_dtypes, | ||
const mx_uint | num_shared_arg_names, | ||
const char ** | shared_arg_name_list, | ||
int * | shared_buffer_len, | ||
const char ** | shared_buffer_name_list, | ||
NDArrayHandle * | shared_buffer_handle_list, | ||
const char *** | updated_shared_buffer_name_list, | ||
NDArrayHandle ** | updated_shared_buffer_handle_list, | ||
mx_uint * | num_in_args, | ||
NDArrayHandle ** | in_args, | ||
NDArrayHandle ** | arg_grads, | ||
mx_uint * | num_aux_states, | ||
NDArrayHandle ** | aux_states, | ||
ExecutorHandle | shared_exec_handle, | ||
ExecutorHandle * | out | ||
) |
MXNET_DLL int MXFreeCachedOp | ( | CachedOpHandle | handle | ) |
free cached operator
MXNET_DLL int MXFuncDescribe | ( | FunctionHandle | fun, |
mx_uint * | num_use_vars, | ||
mx_uint * | num_scalars, | ||
mx_uint * | num_mutate_vars, | ||
int * | type_mask | ||
) |
get the argument requirements of the function
fun | input function handle |
num_use_vars | how many NDArrays to be passed in as used_vars |
num_scalars | scalar variable is needed |
num_mutate_vars | how many NDArrays to be passed in as mutate_vars |
type_mask | the type mask of this function |
MXNET_DLL int MXFuncGetInfo | ( | FunctionHandle | fun, |
const char ** | name, | ||
const char ** | description, | ||
mx_uint * | num_args, | ||
const char *** | arg_names, | ||
const char *** | arg_type_infos, | ||
const char *** | arg_descriptions, | ||
const char **return_type | DEFAULTNULL | ||
) |
Get the information of the function handle.
fun | The function handle. |
name | The returned name of the function. |
description | The returned description of the function. |
num_args | Number of arguments. |
arg_names | Name of the arguments. |
arg_type_infos | Type information about the arguments. |
arg_descriptions | Description information about the arguments. |
return_type | Return type of the function. |
MXNET_DLL int MXFuncInvoke | ( | FunctionHandle | fun, |
NDArrayHandle * | use_vars, | ||
mx_float * | scalar_args, | ||
NDArrayHandle * | mutate_vars | ||
) |
invoke a function, the array size of passed in arguments must match the values in the
fun | the function |
use_vars | the normal arguments passed to function |
scalar_args | the scalar qarguments |
mutate_vars | the mutate arguments |
MXNET_DLL int MXFuncInvokeEx | ( | FunctionHandle | fun, |
NDArrayHandle * | use_vars, | ||
mx_float * | scalar_args, | ||
NDArrayHandle * | mutate_vars, | ||
int | num_params, | ||
char ** | param_keys, | ||
char ** | param_vals | ||
) |
invoke a function, the array size of passed in arguments must match the values in the
fun | the function |
use_vars | the normal arguments passed to function |
scalar_args | the scalar qarguments |
mutate_vars | the mutate arguments |
num_params | number of keyword parameters |
param_keys | keys for keyword parameters |
param_vals | values for keyword parameters |
MXNET_DLL int MXGetFunction | ( | const char * | name, |
FunctionHandle * | out | ||
) |
get the function handle by name
name | the name of the function |
out | the corresponding function handle |
MXNET_DLL const char* MXGetLastError | ( | ) |
return str message of the last error all function in this file will return 0 when success and -1 when an error occured, MXGetLastError can be called to retrieve the error
this function is threadsafe and can be called by different thread
MXNET_DLL int MXImperativeInvoke | ( | AtomicSymbolCreator | creator, |
int | num_inputs, | ||
NDArrayHandle * | inputs, | ||
int * | num_outputs, | ||
NDArrayHandle ** | outputs, | ||
int | num_params, | ||
const char ** | param_keys, | ||
const char ** | param_vals | ||
) |
invoke a nnvm op and imperative function
creator | the op |
num_inputs | number of input NDArrays |
inputs | input NDArrays |
num_outputs | number of output NDArrays |
outputs | output NDArrays |
num_params | number of keyword parameters |
param_keys | keys for keyword parameters |
param_vals | values for keyword parameters |
Initialized ps-lite environment variables.
num_vars | number of variables to initialize |
keys | environment keys |
vals | environment values |
MXNET_DLL int MXInvokeCachedOp | ( | CachedOpHandle | handle, |
int | num_inputs, | ||
NDArrayHandle * | inputs, | ||
int * | num_outputs, | ||
NDArrayHandle ** | outputs | ||
) |
invoke cached operator
MXNET_DLL int MXKVStoreBarrier | ( | KVStoreHandle | handle | ) |
global barrier among all worker machines
handle | handle to the KVStore |
MXNET_DLL int MXKVStoreCreate | ( | const char * | type, |
KVStoreHandle * | out | ||
) |
Create a kvstore.
type | the type of KVStore |
out | The output type of KVStore |
MXNET_DLL int MXKVStoreFree | ( | KVStoreHandle | handle | ) |
Delete a KVStore handle.
handle | handle to the kvstore |
MXNET_DLL int MXKVStoreGetGroupSize | ( | KVStoreHandle | handle, |
int * | ret | ||
) |
return The number of nodes in this group, which is
IsWorkerNode() == true
,IsServerNode() == true
,IsSchedulerNode() == true
, handle | handle to the KVStore |
ret | the group size |
MXNET_DLL int MXKVStoreGetNumDeadNode | ( | KVStoreHandle | handle, |
const int | node_id, | ||
int * | number, | ||
const int timeout_sec | DEFAULT60 | ||
) |
Get the number of ps dead node(s) specified by {node_id}.
handle | handle to the KVStore |
node_id | Can be a node group or a single node. kScheduler = 1, kServerGroup = 2, kWorkerGroup = 4 |
number | Ouptut number of dead nodes |
timeout_sec | A node fails to send heartbeart in {timeout_sec} seconds will be presumed as 'dead' |
MXNET_DLL int MXKVStoreGetRank | ( | KVStoreHandle | handle, |
int * | ret | ||
) |
return The rank of this node in its group, which is in [0, GroupSize).
handle | handle to the KVStore |
ret | the node rank |
MXNET_DLL int MXKVStoreGetType | ( | KVStoreHandle | handle, |
const char ** | type | ||
) |
get the type of the kvstore
handle | handle to the KVStore |
type | a string type |
MXNET_DLL int MXKVStoreInit | ( | KVStoreHandle | handle, |
mx_uint | num, | ||
const int * | keys, | ||
NDArrayHandle * | vals | ||
) |
Init a list of (key,value) pairs in kvstore.
handle | handle to the kvstore |
num | the number of key-value pairs |
keys | the list of keys |
vals | the list of values |
MXNET_DLL int MXKVStoreInitEx | ( | KVStoreHandle | handle, |
mx_uint | num, | ||
const char ** | keys, | ||
NDArrayHandle * | vals | ||
) |
Init a list of (key,value) pairs in kvstore, where each key is a string.
handle | handle to the kvstore |
num | the number of key-value pairs |
keys | the list of keys |
vals | the list of values |
MXNET_DLL int MXKVStoreIsSchedulerNode | ( | int * | ret | ) |
return whether or not this process is a scheduler node.
ret | 1 for yes, 0 for no |
MXNET_DLL int MXKVStoreIsServerNode | ( | int * | ret | ) |
return whether or not this process is a server node.
ret | 1 for yes, 0 for no |
MXNET_DLL int MXKVStoreIsWorkerNode | ( | int * | ret | ) |
return whether or not this process is a worker node.
ret | 1 for yes, 0 for no |
MXNET_DLL int MXKVStorePull | ( | KVStoreHandle | handle, |
mx_uint | num, | ||
const int * | keys, | ||
NDArrayHandle * | vals, | ||
int | priority | ||
) |
pull a list of (key, value) pairs from the kvstore
handle | handle to the kvstore |
num | the number of key-value pairs |
keys | the list of keys |
vals | the list of values |
priority | the priority of the action |
MXNET_DLL int MXKVStorePullEx | ( | KVStoreHandle | handle, |
mx_uint | num, | ||
const char ** | keys, | ||
NDArrayHandle * | vals, | ||
int | priority | ||
) |
pull a list of (key, value) pairs from the kvstore, where each key is a string
handle | handle to the kvstore |
num | the number of key-value pairs |
keys | the list of keys |
vals | the list of values |
priority | the priority of the action |
MXNET_DLL int MXKVStorePush | ( | KVStoreHandle | handle, |
mx_uint | num, | ||
const int * | keys, | ||
NDArrayHandle * | vals, | ||
int | priority | ||
) |
Push a list of (key,value) pairs to kvstore.
handle | handle to the kvstore |
num | the number of key-value pairs |
keys | the list of keys |
vals | the list of values |
priority | the priority of the action |
MXNET_DLL int MXKVStorePushEx | ( | KVStoreHandle | handle, |
mx_uint | num, | ||
const char ** | keys, | ||
NDArrayHandle * | vals, | ||
int | priority | ||
) |
Push a list of (key,value) pairs to kvstore, where each key is a string.
handle | handle to the kvstore |
num | the number of key-value pairs |
keys | the list of keys |
vals | the list of values |
priority | the priority of the action |
MXNET_DLL int MXKVStoreRunServer | ( | KVStoreHandle | handle, |
MXKVStoreServerController | controller, | ||
void * | controller_handle | ||
) |
handle | handle to the KVStore |
controller | the user-defined server controller |
controller_handle | helper handle for implementing controller |
MXNET_DLL int MXKVStoreSendCommmandToServers | ( | KVStoreHandle | handle, |
int | cmd_id, | ||
const char * | cmd_body | ||
) |
handle | handle to the KVStore |
cmd_id | the head of the command |
cmd_body | the body of the command |
MXNET_DLL int MXKVStoreSetBarrierBeforeExit | ( | KVStoreHandle | handle, |
const int | barrier_before_exit | ||
) |
whether to do barrier when finalize
handle | handle to the KVStore |
barrier_before_exit | whether to do barrier when kvstore finalize |
MXNET_DLL int MXKVStoreSetUpdater | ( | KVStoreHandle | handle, |
MXKVStoreUpdater | updater, | ||
void * | updater_handle | ||
) |
register an push updater
handle | handle to the KVStore |
updater | udpater function |
updater_handle | The additional handle used to invoke the updater |
list all the available operator names, include entries.
out_size | the size of returned array |
out_array | the output operator name array. |
MXNET_DLL int MXListDataIters | ( | mx_uint * | out_size, |
DataIterCreator ** | out_array | ||
) |
List all the available iterator entries.
out_size | the size of returned iterators |
out_array | the output iteratos entries |
MXNET_DLL int MXListFunctions | ( | mx_uint * | out_size, |
FunctionHandle ** | out_array | ||
) |
list all the available functions handles most user can use it to list all the needed functions
out_size | the size of returned array |
out_array | the output function array |
MXNET_DLL int MXNDArrayAt | ( | NDArrayHandle | handle, |
mx_uint | idx, | ||
NDArrayHandle * | out | ||
) |
Index the NDArray along axis 0.
handle | the handle to the NDArray |
idx | the index |
out | The NDArrayHandle of output NDArray |
MXNET_DLL int MXNDArrayCreate | ( | const mx_uint * | shape, |
mx_uint | ndim, | ||
int | dev_type, | ||
int | dev_id, | ||
int | delay_alloc, | ||
NDArrayHandle * | out | ||
) |
create a NDArray with specified shape
shape | the pointer to the shape |
ndim | the dimension of the shape |
dev_type | device type, specify device we want to take |
dev_id | the device id of the specific device |
delay_alloc | whether to delay allocation until the narray is first mutated |
out | the returning handle |
MXNET_DLL int MXNDArrayCreateEx | ( | const mx_uint * | shape, |
mx_uint | ndim, | ||
int | dev_type, | ||
int | dev_id, | ||
int | delay_alloc, | ||
int | dtype, | ||
NDArrayHandle * | out | ||
) |
create a NDArray with specified shape and data type
shape | the pointer to the shape |
ndim | the dimension of the shape |
dev_type | device type, specify device we want to take |
dev_id | the device id of the specific device |
delay_alloc | whether to delay allocation until the narray is first mutated |
dtype | data type of created array |
out | the returning handle |
MXNET_DLL int MXNDArrayCreateNone | ( | NDArrayHandle * | out | ) |
create a NDArray handle that is not initialized can be used to pass in as mutate variables to hold the result of NDArray
out | the returning handle |
MXNET_DLL int MXNDArrayDetach | ( | NDArrayHandle | handle, |
NDArrayHandle * | out | ||
) |
detach and ndarray from computation graph by clearing entry_
handle | NDArray handle |
MXNET_DLL int MXNDArrayFree | ( | NDArrayHandle | handle | ) |
free the narray handle
handle | the handle to be freed |
MXNET_DLL int MXNDArrayGetContext | ( | NDArrayHandle | handle, |
int * | out_dev_type, | ||
int * | out_dev_id | ||
) |
get the context of the NDArray
handle | the handle to the narray |
out_dev_type | the output device type |
out_dev_id | the output device id |
MXNET_DLL int MXNDArrayGetData | ( | NDArrayHandle | handle, |
void ** | out_pdata | ||
) |
get the content of the data in NDArray
handle | the handle to the ndarray |
out_pdata | pointer holder to get pointer of data |
MXNET_DLL int MXNDArrayGetDType | ( | NDArrayHandle | handle, |
int * | out_dtype | ||
) |
get the type of the data in NDArray
handle | the handle to the narray |
out_dtype | pointer holder to get type of data |
MXNET_DLL int MXNDArrayGetGrad | ( | NDArrayHandle | handle, |
NDArrayHandle * | out | ||
) |
return gradient buffer attached to this NDArray
handle | NDArray handle |
MXNET_DLL int MXNDArrayGetGradState | ( | NDArrayHandle | handle, |
int * | out | ||
) |
set the flag for gradient array state.
handle | NDArray handle |
state | the new state. |
MXNET_DLL int MXNDArrayGetShape | ( | NDArrayHandle | handle, |
mx_uint * | out_dim, | ||
const mx_uint ** | out_pdata | ||
) |
get the shape of the array
handle | the handle to the narray |
out_dim | the output dimension |
out_pdata | pointer holder to get data pointer of the shape |
MXNET_DLL int MXNDArrayLoad | ( | const char * | fname, |
mx_uint * | out_size, | ||
NDArrayHandle ** | out_arr, | ||
mx_uint * | out_name_size, | ||
const char *** | out_names | ||
) |
Load list of narray from the file.
fname | name of the file. |
out_size | number of narray loaded. |
out_arr | head of the returning narray handles. |
out_name_size | size of output name arrray. |
out_names | the names of returning NDArrays, can be NULL |
MXNET_DLL int MXNDArrayLoadFromRawBytes | ( | const void * | buf, |
size_t | size, | ||
NDArrayHandle * | out | ||
) |
create a NDArray handle that is loaded from raw bytes.
buf | the head of the raw bytes |
size | size of the raw bytes |
out | the returning handle |
MXNET_DLL int MXNDArrayReshape | ( | NDArrayHandle | handle, |
int | ndim, | ||
int * | dims, | ||
NDArrayHandle * | out | ||
) |
Reshape the NDArray.
handle | the handle to the narray |
ndim | number of dimensions of new shape |
dims | new shape |
out | the NDArrayHandle of reshaped NDArray |
MXNET_DLL int MXNDArraySave | ( | const char * | fname, |
mx_uint | num_args, | ||
NDArrayHandle * | args, | ||
const char ** | keys | ||
) |
Save list of narray into the file.
fname | name of the file. |
num_args | number of arguments to save. |
args | the array of NDArrayHandles to be saved. |
keys | the name of the NDArray, optional, can be NULL |
MXNET_DLL int MXNDArraySaveRawBytes | ( | NDArrayHandle | handle, |
size_t * | out_size, | ||
const char ** | out_buf | ||
) |
save the NDArray into raw bytes.
handle | the NDArray handle |
out_size | size of the raw bytes |
out_buf | the head of returning memory bytes. |
MXNET_DLL int MXNDArraySetGradState | ( | NDArrayHandle | handle, |
int | state | ||
) |
set the flag for gradient array state.
handle | NDArray handle |
state | the new state. |
MXNET_DLL int MXNDArraySlice | ( | NDArrayHandle | handle, |
mx_uint | slice_begin, | ||
mx_uint | slice_end, | ||
NDArrayHandle * | out | ||
) |
Slice the NDArray along axis 0.
handle | the handle to the NDArray |
slice_begin | The beginning index of slice |
slice_end | The ending index of slice |
out | The NDArrayHandle of sliced NDArray |
MXNET_DLL int MXNDArraySyncCopyFromCPU | ( | NDArrayHandle | handle, |
const void * | data, | ||
size_t | size | ||
) |
Perform a synchronize copy from a continugous CPU memory region.
This function will call WaitToWrite before the copy is performed. This is useful to copy data from existing memory region that are not wrapped by NDArray(thus dependency not being tracked).
handle | the NDArray handle |
data | the data source to copy from. |
size | the memory size we want to copy from. |
MXNET_DLL int MXNDArraySyncCopyToCPU | ( | NDArrayHandle | handle, |
void * | data, | ||
size_t | size | ||
) |
Perform a synchronize copyto a continugous CPU memory region.
This function will call WaitToRead before the copy is performed. This is useful to copy data from existing memory region that are not wrapped by NDArray(thus dependency not being tracked).
handle | the NDArray handle |
data | the data source to copy into. |
size | the memory size we want to copy into. |
MXNET_DLL int MXNDArrayWaitAll | ( | ) |
wait until all delayed operations in the system is completed
MXNET_DLL int MXNDArrayWaitToRead | ( | NDArrayHandle | handle | ) |
Wait until all the pending writes with respect NDArray are finished. Always call this before read data out synchronizely.
handle | the NDArray handle |
MXNET_DLL int MXNDArrayWaitToWrite | ( | NDArrayHandle | handle | ) |
Wait until all the pending read/write with respect NDArray are finished. Always call this before write data into NDArray synchronizely.
handle | the NDArray handle |
MXNET_DLL int MXNotifyShutdown | ( | ) |
Notify the engine about a shutdown, This can help engine to print less messages into display.
User do not have to call this function.
MXNET_DLL int MXRandomSeed | ( | int | seed | ) |
Seed the global random number generators in mxnet.
seed | the random number seed. |
MXNET_DLL int MXRecordIOReaderCreate | ( | const char * | uri, |
RecordIOHandle * | out | ||
) |
Create a RecordIO reader object.
uri | path to file |
out | handle pointer to the created object |
MXNET_DLL int MXRecordIOReaderFree | ( | RecordIOHandle | handle | ) |
Delete a RecordIO reader object.
handle | handle to RecordIO object |
MXNET_DLL int MXRecordIOReaderReadRecord | ( | RecordIOHandle | handle, |
char const ** | buf, | ||
size_t * | size | ||
) |
Write a record to a RecordIO object.
handle | handle to RecordIO object |
buf | pointer to return buffer |
size | point to size of buffer |
MXNET_DLL int MXRecordIOReaderSeek | ( | RecordIOHandle | handle, |
size_t | pos | ||
) |
Set the current reader pointer position.
handle | handle to RecordIO object |
pos | target position |
MXNET_DLL int MXRecordIOWriterCreate | ( | const char * | uri, |
RecordIOHandle * | out | ||
) |
Create a RecordIO writer object.
uri | path to file |
out | handle pointer to the created object |
MXNET_DLL int MXRecordIOWriterFree | ( | RecordIOHandle | handle | ) |
Delete a RecordIO writer object.
handle | handle to RecordIO object |
MXNET_DLL int MXRecordIOWriterTell | ( | RecordIOHandle | handle, |
size_t * | pos | ||
) |
Get the current writer pointer position.
handle | handle to RecordIO object |
pos | handle to output position |
MXNET_DLL int MXRecordIOWriterWriteRecord | ( | RecordIOHandle | handle, |
const char * | buf, | ||
size_t | size | ||
) |
Write a record to a RecordIO object.
handle | handle to RecordIO object |
buf | buffer to write |
size | size of buffer |
MXNET_DLL int MXRtcCreate | ( | char * | name, |
mx_uint | num_input, | ||
mx_uint | num_output, | ||
char ** | input_names, | ||
char ** | output_names, | ||
NDArrayHandle * | inputs, | ||
NDArrayHandle * | outputs, | ||
char * | kernel, | ||
RtcHandle * | out | ||
) |
Create a MXRtc object.
MXNET_DLL int MXRtcPush | ( | RtcHandle | handle, |
mx_uint | num_input, | ||
mx_uint | num_output, | ||
NDArrayHandle * | inputs, | ||
NDArrayHandle * | outputs, | ||
mx_uint | gridDimX, | ||
mx_uint | gridDimY, | ||
mx_uint | gridDimZ, | ||
mx_uint | blockDimX, | ||
mx_uint | blockDimY, | ||
mx_uint | blockDimZ | ||
) |
Run cuda kernel.
MXNET_DLL int MXSetNumOMPThreads | ( | int | thread_num | ) |
Set the number of OMP threads to use.
MXNET_DLL int MXSetProfilerConfig | ( | int | mode, |
const char * | filename | ||
) |
Set up configuration of profiler.
mode | indicate the working mode of profiler, record anly symbolic operator when mode == 0, record all operator when mode == 1 |
filename | where to save trace file |
MXNET_DLL int MXSetProfilerState | ( | int | state | ) |
Set up state of profiler.
state | indicate the working state of profiler, profiler not running when state == 0, profiler running when state == 1 |
MXNET_DLL int MXSymbolCompose | ( | SymbolHandle | sym, |
const char * | name, | ||
mx_uint | num_args, | ||
const char ** | keys, | ||
SymbolHandle * | args | ||
) |
Compose the symbol on other symbols.
This function will change the sym hanlde. To achieve function apply behavior, copy the symbol first before apply.
sym | the symbol to apply |
name | the name of symbol |
num_args | number of arguments |
keys | the key of keyword args (optional) |
args | arguments to sym |
MXNET_DLL int MXSymbolCopy | ( | SymbolHandle | symbol, |
SymbolHandle * | out | ||
) |
Copy the symbol to another handle.
symbol | the source symbol |
out | used to hold the result of copy |
MXNET_DLL int MXSymbolCreateAtomicSymbol | ( | AtomicSymbolCreator | creator, |
mx_uint | num_param, | ||
const char ** | keys, | ||
const char ** | vals, | ||
SymbolHandle * | out | ||
) |
Create an AtomicSymbol.
creator | the AtomicSymbolCreator |
num_param | the number of parameters |
keys | the keys to the params |
vals | the vals of the params |
out | pointer to the created symbol handle |
MXNET_DLL int MXSymbolCreateFromFile | ( | const char * | fname, |
SymbolHandle * | out | ||
) |
Load a symbol from a json file.
fname | the file name. |
out | the output symbol. |
MXNET_DLL int MXSymbolCreateFromJSON | ( | const char * | json, |
SymbolHandle * | out | ||
) |
Load a symbol from a json string.
json | the json string. |
out | the output symbol. |
MXNET_DLL int MXSymbolCreateGroup | ( | mx_uint | num_symbols, |
SymbolHandle * | symbols, | ||
SymbolHandle * | out | ||
) |
Create a Symbol by grouping list of symbols together.
num_symbols | number of symbols to be grouped |
symbols | array of symbol handles |
out | pointer to the created symbol handle |
MXNET_DLL int MXSymbolCreateVariable | ( | const char * | name, |
SymbolHandle * | out | ||
) |
Create a Variable Symbol.
name | name of the variable |
out | pointer to the created symbol handle |
MXNET_DLL int MXSymbolFree | ( | SymbolHandle | symbol | ) |
Free the symbol handle.
symbol | the symbol |
MXNET_DLL int MXSymbolGetAtomicSymbolInfo | ( | AtomicSymbolCreator | creator, |
const char ** | name, | ||
const char ** | description, | ||
mx_uint * | num_args, | ||
const char *** | arg_names, | ||
const char *** | arg_type_infos, | ||
const char *** | arg_descriptions, | ||
const char ** | key_var_num_args, | ||
const char **return_type | DEFAULTNULL | ||
) |
Get the detailed information about atomic symbol.
creator | the AtomicSymbolCreator. |
name | The returned name of the creator. |
description | The returned description of the symbol. |
num_args | Number of arguments. |
arg_names | Name of the arguments. |
arg_type_infos | Type informations about the arguments. |
arg_descriptions | Description information about the arguments. |
key_var_num_args | The keyword argument for specifying variable number of arguments. When this parameter has non-zero length, the function allows variable number of positional arguments, and will need the caller to pass it in in MXSymbolCreateAtomicSymbol, With key = key_var_num_args, and value = number of positional arguments. |
return_type | Return type of the function, can be Symbol or Symbol[] |
MXNET_DLL int MXSymbolGetAtomicSymbolName | ( | AtomicSymbolCreator | creator, |
const char ** | name | ||
) |
Get the name of an atomic symbol.
creator | the AtomicSymbolCreator. |
name | The returned name of the creator. |
MXNET_DLL int MXSymbolGetAttr | ( | SymbolHandle | symbol, |
const char * | key, | ||
const char ** | out, | ||
int * | success | ||
) |
Get string attribute from symbol.
symbol | the source symbol |
key | The key of the symbol. |
out | The result attribute, can be NULL if the attribute do not exist. |
success | Whether the result is contained in out. |
MXNET_DLL int MXSymbolGetChildren | ( | SymbolHandle | symbol, |
SymbolHandle * | out | ||
) |
Get a symbol that contains only direct children.
symbol | The symbol |
out | The output symbol whose outputs are the direct children. |
MXNET_DLL int MXSymbolGetInternals | ( | SymbolHandle | symbol, |
SymbolHandle * | out | ||
) |
Get a symbol that contains all the internals.
symbol | The symbol |
out | The output symbol whose outputs are all the internals. |
MXNET_DLL int MXSymbolGetName | ( | SymbolHandle | symbol, |
const char ** | out, | ||
int * | success | ||
) |
Get string name from symbol.
symbol | the source symbol |
out | The result name. |
success | Whether the result is contained in out. |
MXNET_DLL int MXSymbolGetOutput | ( | SymbolHandle | symbol, |
mx_uint | index, | ||
SymbolHandle * | out | ||
) |
Get index-th outputs of the symbol.
symbol | The symbol |
index | the Index of the output. |
out | The output symbol whose outputs are the index-th symbol. |
MXNET_DLL int MXSymbolGrad | ( | SymbolHandle | sym, |
mx_uint | num_wrt, | ||
const char ** | wrt, | ||
SymbolHandle * | out | ||
) |
Get the gradient graph of the symbol.
sym | the symbol to get gradient |
num_wrt | number of arguments to get gradient |
wrt | the name of the arguments to get gradient |
out | the returned symbol that has gradient |
MXNET_DLL int MXSymbolInferShape | ( | SymbolHandle | sym, |
mx_uint | num_args, | ||
const char ** | keys, | ||
const mx_uint * | arg_ind_ptr, | ||
const mx_uint * | arg_shape_data, | ||
mx_uint * | in_shape_size, | ||
const mx_uint ** | in_shape_ndim, | ||
const mx_uint *** | in_shape_data, | ||
mx_uint * | out_shape_size, | ||
const mx_uint ** | out_shape_ndim, | ||
const mx_uint *** | out_shape_data, | ||
mx_uint * | aux_shape_size, | ||
const mx_uint ** | aux_shape_ndim, | ||
const mx_uint *** | aux_shape_data, | ||
int * | complete | ||
) |
infer shape of unknown input shapes given the known one. The shapes are packed into a CSR matrix represented by arg_ind_ptr and arg_shape_data The call will be treated as a kwargs call if key != nullptr or num_args==0, otherwise it is positional.
sym | symbol handle |
num_args | numbe of input arguments. |
keys | the key of keyword args (optional) |
arg_ind_ptr | the head pointer of the rows in CSR |
arg_shape_data | the content of the CSR |
in_shape_size | sizeof the returning array of in_shapes |
in_shape_ndim | returning array of shape dimensions of eachs input shape. |
in_shape_data | returning array of pointers to head of the input shape. |
out_shape_size | sizeof the returning array of out_shapes |
out_shape_ndim | returning array of shape dimensions of eachs input shape. |
out_shape_data | returning array of pointers to head of the input shape. |
aux_shape_size | sizeof the returning array of aux_shapes |
aux_shape_ndim | returning array of shape dimensions of eachs auxiliary shape. |
aux_shape_data | returning array of pointers to head of the auxiliary shape. |
complete | whether infer shape completes or more information is needed. |
MXNET_DLL int MXSymbolInferShapePartial | ( | SymbolHandle | sym, |
mx_uint | num_args, | ||
const char ** | keys, | ||
const mx_uint * | arg_ind_ptr, | ||
const mx_uint * | arg_shape_data, | ||
mx_uint * | in_shape_size, | ||
const mx_uint ** | in_shape_ndim, | ||
const mx_uint *** | in_shape_data, | ||
mx_uint * | out_shape_size, | ||
const mx_uint ** | out_shape_ndim, | ||
const mx_uint *** | out_shape_data, | ||
mx_uint * | aux_shape_size, | ||
const mx_uint ** | aux_shape_ndim, | ||
const mx_uint *** | aux_shape_data, | ||
int * | complete | ||
) |
partially infer shape of unknown input shapes given the known one.
Return partially inferred results if not all shapes could be inferred. The shapes are packed into a CSR matrix represented by arg_ind_ptr and arg_shape_data The call will be treated as a kwargs call if key != nullptr or num_args==0, otherwise it is positional.
sym | symbol handle |
num_args | numbe of input arguments. |
keys | the key of keyword args (optional) |
arg_ind_ptr | the head pointer of the rows in CSR |
arg_shape_data | the content of the CSR |
in_shape_size | sizeof the returning array of in_shapes |
in_shape_ndim | returning array of shape dimensions of eachs input shape. |
in_shape_data | returning array of pointers to head of the input shape. |
out_shape_size | sizeof the returning array of out_shapes |
out_shape_ndim | returning array of shape dimensions of eachs input shape. |
out_shape_data | returning array of pointers to head of the input shape. |
aux_shape_size | sizeof the returning array of aux_shapes |
aux_shape_ndim | returning array of shape dimensions of eachs auxiliary shape. |
aux_shape_data | returning array of pointers to head of the auxiliary shape. |
complete | whether infer shape completes or more information is needed. |
MXNET_DLL int MXSymbolInferType | ( | SymbolHandle | sym, |
mx_uint | num_args, | ||
const char ** | keys, | ||
const int * | arg_type_data, | ||
mx_uint * | in_type_size, | ||
const int ** | in_type_data, | ||
mx_uint * | out_type_size, | ||
const int ** | out_type_data, | ||
mx_uint * | aux_type_size, | ||
const int ** | aux_type_data, | ||
int * | complete | ||
) |
infer type of unknown input types given the known one. The types are packed into a CSR matrix represented by arg_ind_ptr and arg_type_data The call will be treated as a kwargs call if key != nullptr or num_args==0, otherwise it is positional.
sym | symbol handle |
num_args | numbe of input arguments. |
keys | the key of keyword args (optional) |
arg_type_data | the content of the CSR |
in_type_size | sizeof the returning array of in_types |
in_type_data | returning array of pointers to head of the input type. |
out_type_size | sizeof the returning array of out_types |
out_type_data | returning array of pointers to head of the input type. |
aux_type_size | sizeof the returning array of aux_types |
aux_type_data | returning array of pointers to head of the auxiliary type. |
complete | whether infer type completes or more information is needed. |
MXNET_DLL int MXSymbolListArguments | ( | SymbolHandle | symbol, |
mx_uint * | out_size, | ||
const char *** | out_str_array | ||
) |
List arguments in the symbol.
symbol | the symbol |
out_size | output size |
out_str_array | pointer to hold the output string array |
MXNET_DLL int MXSymbolListAtomicSymbolCreators | ( | mx_uint * | out_size, |
AtomicSymbolCreator ** | out_array | ||
) |
list all the available AtomicSymbolEntry
out_size | the size of returned array |
out_array | the output AtomicSymbolCreator array |
MXNET_DLL int MXSymbolListAttr | ( | SymbolHandle | symbol, |
mx_uint * | out_size, | ||
const char *** | out | ||
) |
Get all attributes from symbol, including all descendents.
symbol | the source symbol |
out_size | The number of output attributes |
out | 2*out_size strings representing key value pairs. |
MXNET_DLL int MXSymbolListAttrShallow | ( | SymbolHandle | symbol, |
mx_uint * | out_size, | ||
const char *** | out | ||
) |
Get all attributes from symbol, excluding descendents.
symbol | the source symbol |
out_size | The number of output attributes |
out | 2*out_size strings representing key value pairs. |
MXNET_DLL int MXSymbolListAuxiliaryStates | ( | SymbolHandle | symbol, |
mx_uint * | out_size, | ||
const char *** | out_str_array | ||
) |
List auxiliary states in the symbol.
symbol | the symbol |
out_size | output size |
out_str_array | pointer to hold the output string array |
MXNET_DLL int MXSymbolListOutputs | ( | SymbolHandle | symbol, |
mx_uint * | out_size, | ||
const char *** | out_str_array | ||
) |
List returns in the symbol.
symbol | the symbol |
out_size | output size |
out_str_array | pointer to hold the output string array |
MXNET_DLL int MXSymbolPrint | ( | SymbolHandle | symbol, |
const char ** | out_str | ||
) |
Print the content of symbol, used for debug.
symbol | the symbol |
out_str | pointer to hold the output string of the printing. |
MXNET_DLL int MXSymbolSaveToFile | ( | SymbolHandle | symbol, |
const char * | fname | ||
) |
Save a symbol into a json file.
symbol | the input symbol. |
fname | the file name. |
MXNET_DLL int MXSymbolSaveToJSON | ( | SymbolHandle | symbol, |
const char ** | out_json | ||
) |
Save a symbol into a json string.
symbol | the input symbol. |
out_json | output json string. |
MXNET_DLL int MXSymbolSetAttr | ( | SymbolHandle | symbol, |
const char * | key, | ||
const char * | value | ||
) |
Set string attribute from symbol. NOTE: Setting attribute to a symbol can affect the semantics(mutable/immutable) of symbolic graph.
Safe recommendaton: use immutable graph
Mutable graph (be careful about the semantics):
symbol | the source symbol |
key | The key of the symbol. |
value | The value to be saved. |