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

Go to the source code of this file.

Classes

struct  NativeOpInfo
 
struct  NDArrayOpInfo
 
struct  MXCallbackList
 
struct  LibFeature
 

Macros

#define DEFAULT(x)
 Inhibit C++ name-mangling for MXNet functions. More...
 
#define MXNET_DLL
 MXNET_DLL prefix for windows. More...
 

Typedefs

typedef uint32_t mx_uint
 manually define unsigned int More...
 
typedef float mx_float
 manually define float More...
 
typedef int64_t dim_t
 data type to store dim size 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 * CudaModuleHandle
 handle to rtc cuda module More...
 
typedef void * CudaKernelHandle
 handle to rtc cuda kernel More...
 
typedef void * ProfileHandle
 handle to a Profile object (domain, duration, counter, etc.) More...
 
typedef void * DLManagedTensorHandle
 handle to DLManagedTensor More...
 
typedef const void * ContextHandle
 handle to Context More...
 
typedef const void * EngineFnPropertyHandle
 handle to Engine FnProperty More...
 
typedef void * EngineVarHandle
 handle to Engine VarHandle More...
 
typedef void(* EngineAsyncFunc) (void *, void *, void *)
 Engine asynchronous operation. More...
 
typedef void(* EngineSyncFunc) (void *, void *)
 Engine synchronous operation. More...
 
typedef void(* EngineFuncParamDeleter) (void *)
 Callback to free the param for EngineAsyncFunc/EngineSyncFunc. More...
 
typedef void(* ExecutorMonitorCallback) (const char *, NDArrayHandle, void *)
 
typedef void(* CachedOpMonitorCallback) (const char *, const char *, NDArrayHandle)
 Monitor callback called at operator level for cached op. More...
 
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 *, int **, void *)
 
typedef int(* CustomOpInferStorageTypeFunc) (int, int *, void *)
 
typedef int(* CustomOpBackwardInferStorageTypeFunc) (int, int *, int *, 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( MXKVStoreStrUpdater) (const char *key, NDArrayHandle recv, NDArrayHandle local, void *handle)
 user-defined updater for the kvstore with string keys 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...
 

Enumerations

enum  CustomOpCallbacks { kCustomOpDelete, kCustomOpForward, kCustomOpBackward }
 
enum  CustomOpPropCallbacks {
  kCustomOpPropDelete, kCustomOpPropListArguments, kCustomOpPropListOutputs, kCustomOpPropListAuxiliaryStates,
  kCustomOpPropInferShape, kCustomOpPropDeclareBackwardDependency, kCustomOpPropCreateOperator, kCustomOpPropInferType,
  kCustomOpPropInferStorageType, kCustomOpPropBackwardInferStorageType
}
 
enum  CustomFunctionCallbacks { kCustomFunctionBackward, kCustomFunctionDelete }
 

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 MXLoadLib (const char *path, unsigned verbose)
 Load library dynamically. More...
 
MXNET_DLL int MXLibInfoFeatures (const struct LibFeature **libFeature, size_t *size)
 Get list of features supported on the runtime. More...
 
MXNET_DLL int MXRandomSeed (int seed)
 Seed all global random number generators in mxnet. More...
 
MXNET_DLL int MXRandomSeedContext (int seed, int dev_type, int dev_id)
 Seed the global random number generator of the given device. 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 MXSetProcessProfilerConfig (int num_params, const char *const *keys, const char *const *vals, KVStoreHandle kvstoreHandle)
 Set up configuration of profiler for the process passed as profile_process in keys. More...
 
MXNET_DLL int MXSetProfilerConfig (int num_params, const char *const *keys, const char *const *vals)
 Set up configuration of profiler for worker/current process. More...
 
MXNET_DLL int MXSetProcessProfilerState (int state, int profile_process, KVStoreHandle kvStoreHandle)
 Set up state of profiler for either worker or server process. More...
 
MXNET_DLL int MXSetProfilerState (int state)
 Set up state of profiler for current process. More...
 
MXNET_DLL int MXDumpProcessProfile (int finished, int profile_process, KVStoreHandle kvStoreHandle)
 Save profile and stop profiler. More...
 
MXNET_DLL int MXDumpProfile (int finished)
 Save profile and stop profiler for worker/current process. More...
 
MXNET_DLL int MXAggregateProfileStatsPrint (const char **out_str, int reset)
 Deprecated, use MXAggregateProfileStatsPrintEx instead. More...
 
MXNET_DLL int MXAggregateProfileStatsPrintEx (const char **out_str, int reset, int format, int sort_by, int ascending)
 Print sorted aggregate stats to the a string How aggregate stats are stored will not change. More...
 
MXNET_DLL int MXProcessProfilePause (int paused, int profile_process, KVStoreHandle kvStoreHandle)
 Pause profiler tuning collection. More...
 
MXNET_DLL int MXProfilePause (int paused)
 Pause profiler tuning collection for worker/current process. More...
 
MXNET_DLL int MXProfileCreateDomain (const char *domain, ProfileHandle *out)
 Create profiling domain. More...
 
MXNET_DLL int MXProfileCreateTask (ProfileHandle domain, const char *task_name, ProfileHandle *out)
 Create profile task. More...
 
MXNET_DLL int MXProfileCreateFrame (ProfileHandle domain, const char *frame_name, ProfileHandle *out)
 Create profile frame. More...
 
MXNET_DLL int MXProfileCreateEvent (const char *event_name, ProfileHandle *out)
 Create profile event. More...
 
MXNET_DLL int MXProfileCreateCounter (ProfileHandle domain, const char *counter_name, ProfileHandle *out)
 Create profile counter. More...
 
MXNET_DLL int MXProfileDestroyHandle (ProfileHandle frame_handle)
 Destroy a frame. More...
 
MXNET_DLL int MXProfileDurationStart (ProfileHandle duration_handle)
 Start timing the duration of a profile duration object such as an event, task or frame. More...
 
MXNET_DLL int MXProfileDurationStop (ProfileHandle duration_handle)
 Stop timing the duration of a profile duration object such as an event, task or frame. More...
 
MXNET_DLL int MXProfileSetCounter (ProfileHandle counter_handle, uint64_t value)
 Set a counter, given its handle. More...
 
MXNET_DLL int MXProfileAdjustCounter (ProfileHandle counter_handle, int64_t value)
 Adjust a counter by the given amount, given its handle. More...
 
MXNET_DLL int MXProfileSetMarker (ProfileHandle domain, const char *instant_marker_name, const char *scope)
 Mark a single instant in time. More...
 
MXNET_DLL int MXSetNumOMPThreads (int thread_num)
 Set the number of OMP threads to use. More...
 
MXNET_DLL int MXEngineSetBulkSize (int bulk_size, int *prev_bulk_size)
 set bulk execution limit More...
 
MXNET_DLL int MXGetGPUCount (int *out)
 Get the number of GPUs. More...
 
MXNET_DLL int MXGetGPUMemoryInformation (int dev, int *free_mem, int *total_mem)
 get the free and total available memory on a GPU Note: Deprecated, use MXGetGPUMemoryInformation64 instead. More...
 
MXNET_DLL int MXGetGPUMemoryInformation64 (int dev, uint64_t *free_mem, uint64_t *total_mem)
 get the free and total available memory on a GPU More...
 
MXNET_DLL int MXGetVersion (int *out)
 get the MXNet library version as an integer More...
 
MXNET_DLL int MXNDArrayCreateNone (NDArrayHandle *out)
 Load TVM operator from the binary library. More...
 
MXNET_DLL int MXNDArrayCreate (const uint32_t *shape, uint32_t ndim, int dev_type, int dev_id, int delay_alloc, NDArrayHandle *out)
 create a NDArray with specified shape More...
 
MXNET_DLL int MXNDArrayCreateEx (const uint32_t *shape, uint32_t ndim, int dev_type, int dev_id, int delay_alloc, int dtype, NDArrayHandle *out)
 create a NDArray with specified shape and data type This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default) More...
 
MXNET_DLL int MXNDArrayCreateEx64 (const int64_t *shape, int ndim, int dev_type, int dev_id, int delay_alloc, int dtype, NDArrayHandle *out)
 create a NDArray with specified shape and data type This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support More...
 
MXNET_DLL int MXNDArrayCreateSparseEx (int storage_type, const uint32_t *shape, uint32_t ndim, int dev_type, int dev_id, int delay_alloc, int dtype, uint32_t num_aux, int *aux_type, uint32_t *aux_ndims, const uint32_t *aux_shape, NDArrayHandle *out)
 create an empty sparse NDArray with specified shape and data type This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default) More...
 
MXNET_DLL int MXNDArrayCreateSparseEx64 (int storage_type, const int64_t *shape, int ndim, int dev_type, int dev_id, int delay_alloc, int dtype, uint32_t num_aux, int *aux_type, int *aux_ndims, const int64_t *aux_shape, NDArrayHandle *out)
 create an empty sparse NDArray with specified shape and data type This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support 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, uint32_t num_args, NDArrayHandle *args, const char **keys)
 Save list of narray into the file. More...
 
MXNET_DLL int MXNDArrayLoad (const char *fname, uint32_t *out_size, NDArrayHandle **out_arr, uint32_t *out_name_size, const char ***out_names)
 Load list of narray from the file. More...
 
MXNET_DLL int MXNDArrayLoadFromBuffer (const void *ndarray_buffer, size_t size, uint32_t *out_size, NDArrayHandle **out_arr, uint32_t *out_name_size, const char ***out_names)
 Load list / dictionary of narrays from file content loaded into memory. This will load a list of ndarrays in a similar manner to MXNDArrayLoad, however, it loads from buffer containing the contents of a file, rather than from a specified file. More...
 
MXNET_DLL int MXNDArraySyncCopyFromCPU (NDArrayHandle handle, const void *data, size_t size)
 Perform a synchronize copy from a contiguous CPU memory region. More...
 
MXNET_DLL int MXNDArraySyncCopyToCPU (NDArrayHandle handle, void *data, size_t size)
 Perform a synchronize copyto a contiguous CPU memory region. More...
 
MXNET_DLL int MXNDArraySyncCopyFromNDArray (NDArrayHandle handle_dst, const NDArrayHandle handle_src, const int i)
 Copy src.data() to dst.data() if i = -1, else dst.aux_data(i) if i >= 0 This function blocks. Do not use it in performance critical code. More...
 
MXNET_DLL int MXNDArraySyncCheckFormat (NDArrayHandle handle, const bool full_check)
 check whether the NDArray format is valid 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, uint32_t slice_begin, uint32_t slice_end, NDArrayHandle *out)
 Slice the NDArray along axis 0. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default) More...
 
MXNET_DLL int MXNDArraySlice64 (NDArrayHandle handle, int64_t slice_begin, int64_t slice_end, NDArrayHandle *out)
 Slice the NDArray along axis 0. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support. More...
 
MXNET_DLL int MXNDArrayAt (NDArrayHandle handle, uint32_t idx, NDArrayHandle *out)
 Index the NDArray along axis 0. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default) More...
 
MXNET_DLL int MXNDArrayAt64 (NDArrayHandle handle, int64_t idx, NDArrayHandle *out)
 Index the NDArray along axis 0. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support. More...
 
MXNET_DLL int MXNDArrayGetStorageType (NDArrayHandle handle, int *out_storage_type)
 get the storage type of the array More...
 
MXNET_DLL int MXNDArrayReshape (NDArrayHandle handle, int ndim, int *dims, NDArrayHandle *out)
 Reshape the NDArray. More...
 
MXNET_DLL int MXNDArrayReshape64 (NDArrayHandle handle, int ndim, dim_t *dims, bool reverse, NDArrayHandle *out)
 Reshape the NDArray. More...
 
MXNET_DLL int MXNDArrayGetShape (NDArrayHandle handle, uint32_t *out_dim, const uint32_t **out_pdata)
 DEPRECATED. Use MXNDArrayGetShapeEx instead. get the shape of the array. More...
 
MXNET_DLL int MXNDArrayGetShapeEx (NDArrayHandle handle, int *out_dim, const int **out_pdata)
 get the shape of the array This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default) More...
 
MXNET_DLL int MXNDArrayGetShapeEx64 (NDArrayHandle handle, int *out_dim, const int64_t **out_pdata)
 get the shape of the array This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support More...
 
MXNET_DLL int MXNDArrayGetData (NDArrayHandle handle, void **out_pdata)
 get the content of the data in NDArray More...
 
MXNET_DLL int MXNDArrayToDLPack (NDArrayHandle handle, DLManagedTensorHandle *out_dlpack)
 Create a reference view of NDArray that represents as DLManagedTensor Notice: MXNet uses asynchronous execution. Please call MXNDArrayWaitToRead or MXNDArrayWaitToWrite before calling MXNDArrayToDLPack. More...
 
MXNET_DLL int MXNDArrayFromDLPack (DLManagedTensorHandle dlpack, NDArrayHandle *out_handle)
 DEPRECATED. Use MXNDArrayFromDLPackEx instead. More...
 
MXNET_DLL int MXNDArrayFromDLPackEx (DLManagedTensorHandle dlpack, const bool transient_handle, NDArrayHandle *out_handle)
 Create a NDArray backed by a dlpack tensor. More...
 
MXNET_DLL int MXNDArrayCallDLPackDeleter (DLManagedTensorHandle dlpack)
 Delete a dlpack tensor. More...
 
MXNET_DLL int MXNDArrayGetDType (NDArrayHandle handle, int *out_dtype)
 get the type of the data in NDArray More...
 
MXNET_DLL int MXNDArrayGetAuxType (NDArrayHandle handle, uint32_t i, int *out_type)
 get the type of the ith aux data in NDArray This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default) More...
 
MXNET_DLL int MXNDArrayGetAuxType64 (NDArrayHandle handle, int64_t i, int *out_type)
 get the type of the ith aux data in NDArray This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support More...
 
MXNET_DLL int MXNDArrayGetAuxNDArray (NDArrayHandle handle, uint32_t i, NDArrayHandle *out)
 Get a deep copy of the ith aux data blob This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default) in the form of an NDArray of default storage type. This function blocks. Do not use it in performance critical code. More...
 
MXNET_DLL int MXNDArrayGetAuxNDArray64 (NDArrayHandle handle, int64_t i, NDArrayHandle *out)
 Get a deep copy of the ith aux data blob This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support in the form of an NDArray of default storage type. This function blocks. Do not use it in performance critical code. More...
 
MXNET_DLL int MXNDArrayGetDataNDArray (NDArrayHandle handle, NDArrayHandle *out)
 Get a deep copy of the data blob in the form of an NDArray of default storage type. This function blocks. Do not use it in performance critical code. 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 (uint32_t *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, uint32_t *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, uint32_t *num_use_vars, uint32_t *num_scalars, uint32_t *num_mutate_vars, int *type_mask)
 get the argument requirements of the function More...
 
MXNET_DLL int MXFuncInvoke (FunctionHandle fun, NDArrayHandle *use_vars, 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, 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 MXImperativeInvokeEx (AtomicSymbolCreator creator, int num_inputs, NDArrayHandle *inputs, int *num_outputs, NDArrayHandle **outputs, int num_params, const char **param_keys, const char **param_vals, const int **out_stypes)
 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 MXIsNumpyShape (int *curr)
 get whether numpy compatibility is on More...
 
MXNET_DLL int MXSetIsNumpyShape (int is_np_shape, int *prev)
 set numpy compatibility switch More...
 
MXNET_DLL int MXAutogradMarkVariables (uint32_t num_var, NDArrayHandle *var_handles, uint32_t *reqs_array, NDArrayHandle *grad_handles)
 mark NDArrays as variables to compute gradient for autograd More...
 
MXNET_DLL int MXAutogradComputeGradient (uint32_t num_output, NDArrayHandle *output_handles)
 compute the gradient of outputs w.r.t variabels More...
 
MXNET_DLL int MXAutogradBackward (uint32_t 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 (uint32_t num_output, NDArrayHandle *output_handles, NDArrayHandle *ograd_handles, uint32_t num_variables, NDArrayHandle *var_handles, int retain_graph, int create_graph, int is_train, NDArrayHandle **grad_handles, int **grad_stypes)
 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 MXCreateCachedOpEx (SymbolHandle handle, int num_flags, const char **keys, const char **vals, CachedOpHandle *out)
 create cached operator More...
 
MXNET_DLL int MXCreateCachedOpEX (SymbolHandle handle, int num_flags, const char **keys, const char **vals, CachedOpHandle *out, bool thread_safe DEFAULT(false))
 create cached operator, allows to choose thread_safe version of cachedop 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 MXInvokeCachedOpEx (CachedOpHandle handle, int num_inputs, NDArrayHandle *inputs, int *num_outputs, NDArrayHandle **outputs, const int **out_stypes)
 invoke a cached op More...
 
MXNET_DLL int MXCachedOpRegisterOpHook (NDArrayHandle handle, CachedOpMonitorCallback callback, bool monitor_all)
 cached op set monitor callback More...
 
MXNET_DLL int MXListAllOpNames (uint32_t *out_size, const char ***out_array)
 list all the available operator names, include entries. More...
 
MXNET_DLL int MXSymbolListAtomicSymbolCreators (uint32_t *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 MXSymbolGetInputSymbols (SymbolHandle sym, SymbolHandle **inputs, int *input_size)
 Get the input symbols of the graph. More...
 
MXNET_DLL int MXSymbolCutSubgraph (SymbolHandle sym, SymbolHandle **inputs, int *input_size)
 Cut a subgraph whose nodes are marked with a subgraph attribute. The input graph will be modified. A variable node will be created for each edge that connects to nodes outside the subgraph. The outside nodes that connect to the subgraph will be returned. More...
 
MXNET_DLL int MXSymbolGetAtomicSymbolInfo (AtomicSymbolCreator creator, const char **name, const char **description, uint32_t *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, uint32_t 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 (uint32_t 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 MXSymbolRemoveAmpCast (SymbolHandle sym_handle, SymbolHandle *ret_sym_handle)
 Remove the operators amp_cast and amp_multicast. 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, uint32_t *out_size, const char ***out)
 Get all attributes from symbol, including all descendents. More...
 
MXNET_DLL int MXSymbolListAttrShallow (SymbolHandle symbol, uint32_t *out_size, const char ***out)
 Get all attributes from symbol, excluding descendents. More...
 
MXNET_DLL int MXSymbolListArguments (SymbolHandle symbol, uint32_t *out_size, const char ***out_str_array)
 List arguments in the symbol. More...
 
MXNET_DLL int MXSymbolListOutputs (SymbolHandle symbol, uint32_t *out_size, const char ***out_str_array)
 List returns in the symbol. More...
 
MXNET_DLL int MXSymbolGetNumOutputs (SymbolHandle symbol, uint32_t *output_count)
 Get number of outputs of 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, uint32_t index, SymbolHandle *out)
 Get index-th outputs of the symbol. More...
 
MXNET_DLL int MXSymbolListAuxiliaryStates (SymbolHandle symbol, uint32_t *out_size, const char ***out_str_array)
 List auxiliary states in the symbol. More...
 
MXNET_DLL int MXSymbolCompose (SymbolHandle sym, const char *name, uint32_t num_args, const char **keys, SymbolHandle *args)
 Compose the symbol on other symbols. More...
 
MXNET_DLL int MXSymbolGrad (SymbolHandle sym, uint32_t num_wrt, const char **wrt, SymbolHandle *out)
 Get the gradient graph of the symbol. More...
 
MXNET_DLL int MXSymbolInferShape (SymbolHandle sym, uint32_t num_args, const char **keys, const uint32_t *arg_ind_ptr, const uint32_t *arg_shape_data, uint32_t *in_shape_size, const uint32_t **in_shape_ndim, const uint32_t ***in_shape_data, uint32_t *out_shape_size, const uint32_t **out_shape_ndim, const uint32_t ***out_shape_data, uint32_t *aux_shape_size, const uint32_t **aux_shape_ndim, const uint32_t ***aux_shape_data, int *complete)
 DEPRECATED. Use MXSymbolInferShapeEx instead. 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 != NULL or num_args==0, otherwise it is positional. More...
 
MXNET_DLL int MXSymbolInferShapeEx (SymbolHandle sym, uint32_t num_args, const char **keys, const uint32_t *arg_ind_ptr, const int *arg_shape_data, uint32_t *in_shape_size, const int **in_shape_ndim, const int ***in_shape_data, uint32_t *out_shape_size, const int **out_shape_ndim, const int ***out_shape_data, uint32_t *aux_shape_size, const int **aux_shape_ndim, const int ***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 != NULL or num_args==0, otherwise it is positional. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default) More...
 
MXNET_DLL int MXSymbolInferShapeEx64 (SymbolHandle sym, uint32_t num_args, const char **keys, const int64_t *arg_ind_ptr, const int64_t *arg_shape_data, size_t *in_shape_size, const int **in_shape_ndim, const int64_t ***in_shape_data, size_t *out_shape_size, const int **out_shape_ndim, const int64_t ***out_shape_data, size_t *aux_shape_size, const int **aux_shape_ndim, const int64_t ***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 != NULL or num_args==0, otherwise it is positional. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support More...
 
MXNET_DLL int MXSymbolInferShapePartial (SymbolHandle sym, uint32_t num_args, const char **keys, const uint32_t *arg_ind_ptr, const uint32_t *arg_shape_data, uint32_t *in_shape_size, const uint32_t **in_shape_ndim, const uint32_t ***in_shape_data, uint32_t *out_shape_size, const uint32_t **out_shape_ndim, const uint32_t ***out_shape_data, uint32_t *aux_shape_size, const uint32_t **aux_shape_ndim, const uint32_t ***aux_shape_data, int *complete)
 DEPRECATED. Use MXSymbolInferShapePartialEx instead. partially infer shape of unknown input shapes given the known one. More...
 
MXNET_DLL int MXSymbolInferShapePartialEx (SymbolHandle sym, uint32_t num_args, const char **keys, const uint32_t *arg_ind_ptr, const int *arg_shape_data, uint32_t *in_shape_size, const int **in_shape_ndim, const int ***in_shape_data, uint32_t *out_shape_size, const int **out_shape_ndim, const int ***out_shape_data, uint32_t *aux_shape_size, const int **aux_shape_ndim, const int ***aux_shape_data, int *complete)
 partially infer shape of unknown input shapes given the known one. More...
 
MXNET_DLL int MXSymbolInferShapePartialEx64 (SymbolHandle sym, uint32_t num_args, const char **keys, const int64_t *arg_ind_ptr, const int64_t *arg_shape_data, size_t *in_shape_size, const int **in_shape_ndim, const int64_t ***in_shape_data, size_t *out_shape_size, const int **out_shape_ndim, const int64_t ***out_shape_data, size_t *aux_shape_size, const int **aux_shape_ndim, const int64_t ***aux_shape_data, int *complete)
 partially infer shape of unknown input shapes given the known one. More...
 
MXNET_DLL int MXSymbolInferType (SymbolHandle sym, uint32_t num_args, const char **keys, const int *arg_type_data, uint32_t *in_type_size, const int **in_type_data, uint32_t *out_type_size, const int **out_type_data, uint32_t *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 != NULL or num_args==0, otherwise it is positional. More...
 
MXNET_DLL int MXSymbolInferTypePartial (SymbolHandle sym, uint32_t num_args, const char **keys, const int *arg_type_data, uint32_t *in_type_size, const int **in_type_data, uint32_t *out_type_size, const int **out_type_data, uint32_t *aux_type_size, const int **aux_type_data, int *complete)
 partially infer type of unknown input types given the known one. More...
 
MXNET_DLL int MXQuantizeSymbol (SymbolHandle sym_handle, SymbolHandle *ret_sym_handle, const int *dev_type, const uint32_t num_excluded_sym_names, const char **excluded_sym_names, const uint32_t num_excluded_op_names, const char **excluded_op_names, const uint32_t num_offline, const char **offline_params, const char *quantized_dtype, const bool calib_quantize, const char *quantize_mode, const char *quantize_granularity, uint32_t *out_num_calib_names, const char ***out_calib_names)
 Convert a symbol into a quantized symbol where FP32 operators are replaced with INT8. More...
 
MXNET_DLL int MXReducePrecisionSymbol (SymbolHandle sym_handle, SymbolHandle *ret_sym_handle, uint32_t num_args, const int *arg_type_data, uint32_t num_ind_ptr, const int *ind_ptr, const int *target_dtype, const int cast_optional_params, const uint32_t num_target_dtype_op_names, const uint32_t num_fp32_op_names, const uint32_t num_widest_dtype_op_names, const uint32_t num_conditional_fp32_op_names, const uint32_t num_excluded_symbols, const uint32_t num_model_params, const char **target_dtype_op_names, const char **fp32_op_names, const char **widest_dtype_op_names, const char **conditional_fp32_op_names, const char **excluded_symbols, const char **conditional_param_names, const char **conditional_param_vals, const char **model_param_names, const char **arg_names)
 Convert a symbol into a mixed precision symbol with cast operators for target dtype casting. More...
 
MXNET_DLL int MXSetCalibTableToQuantizedSymbol (SymbolHandle qsym_handle, const uint32_t num_layers, const char **layer_names, const float *low_quantiles, const float *high_quantiles, SymbolHandle *ret_sym_handle)
 Set calibration table to node attributes in the sym. More...
 
MXNET_DLL int MXGenBackendSubgraph (SymbolHandle sym_handle, const char *backend, SymbolHandle *ret_sym_handle)
 Run subgraph pass based on the backend provided. More...
 
MXNET_DLL int MXGenAtomicSymbolFromSymbol (SymbolHandle sym_handle, SymbolHandle *ret_sym_handle)
 Generate atomic symbol (able to be composed) from a source symbol. More...
 
MXNET_DLL int MXOptimizeForBackend (SymbolHandle sym_handle, const char *backend_name, const int dev_type, SymbolHandle *ret_sym_handle, const mx_uint args_len, NDArrayHandle *in_args_handle, const mx_uint aux_len, NDArrayHandle *in_aux_handle, const mx_uint num_options, const char **keys, const char **vals, int *new_args_cnt, NDArrayHandle **new_args_handle, char ***new_arg_names_handle, int *new_aux_cnt, NDArrayHandle **new_aux_handle, char ***new_aux_names_handle)
 Partitions symbol for given backend, potentially creating subgraphs. 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, uint32_t len, NDArrayHandle *head_grads)
 Excecutor run backward. More...
 
MXNET_DLL int MXExecutorBackwardEx (ExecutorHandle handle, uint32_t len, NDArrayHandle *head_grads, int is_train)
 Excecutor run backward. More...
 
MXNET_DLL int MXExecutorOutputs (ExecutorHandle handle, uint32_t *out_size, NDArrayHandle **out)
 Get executor's head NDArray. More...
 
MXNET_DLL int MXExecutorBind (SymbolHandle symbol_handle, int dev_type, int dev_id, uint32_t len, NDArrayHandle *in_args, NDArrayHandle *arg_grad_store, uint32_t *grad_req_type, uint32_t 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, uint32_t num_map_keys, const char **map_keys, const int *map_dev_types, const int *map_dev_ids, uint32_t len, NDArrayHandle *in_args, NDArrayHandle *arg_grad_store, uint32_t *grad_req_type, uint32_t 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, uint32_t num_map_keys, const char **map_keys, const int *map_dev_types, const int *map_dev_ids, uint32_t len, NDArrayHandle *in_args, NDArrayHandle *arg_grad_store, uint32_t *grad_req_type, uint32_t 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 uint32_t num_g2c_keys, const char **g2c_keys, const int *g2c_dev_types, const int *g2c_dev_ids, const uint32_t provided_grad_req_list_len, const char **provided_grad_req_names, const char **provided_grad_req_types, const uint32_t num_provided_arg_shapes, const char **provided_arg_shape_names, const uint32_t *provided_arg_shape_data, const uint32_t *provided_arg_shape_idx, const uint32_t num_provided_arg_dtypes, const char **provided_arg_dtype_names, const int *provided_arg_dtypes, const uint32_t num_provided_arg_stypes, const char **provided_arg_stype_names, const int *provided_arg_stypes, const uint32_t 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, uint32_t *num_in_args, NDArrayHandle **in_args, NDArrayHandle **arg_grads, uint32_t *num_aux_states, NDArrayHandle **aux_states, ExecutorHandle shared_exec_handle, ExecutorHandle *out)
 DEPRECATED. Use MXExecutorSimpleBindEx instead. More...
 
MXNET_DLL int MXExecutorSimpleBindEx (SymbolHandle symbol_handle, int dev_type, int dev_id, const uint32_t num_g2c_keys, const char **g2c_keys, const int *g2c_dev_types, const int *g2c_dev_ids, const uint32_t provided_grad_req_list_len, const char **provided_grad_req_names, const char **provided_grad_req_types, const uint32_t num_provided_arg_shapes, const char **provided_arg_shape_names, const int *provided_arg_shape_data, const uint32_t *provided_arg_shape_idx, const uint32_t num_provided_arg_dtypes, const char **provided_arg_dtype_names, const int *provided_arg_dtypes, const uint32_t num_provided_arg_stypes, const char **provided_arg_stype_names, const int *provided_arg_stypes, const uint32_t 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, uint32_t *num_in_args, NDArrayHandle **in_args, NDArrayHandle **arg_grads, uint32_t *num_aux_states, NDArrayHandle **aux_states, ExecutorHandle shared_exec_handle, ExecutorHandle *out)
 
MXNET_DLL int MXExecutorSimpleBindEx64 (SymbolHandle symbol_handle, int dev_type, int dev_id, const uint32_t num_g2c_keys, const char **g2c_keys, const int *g2c_dev_types, const int *g2c_dev_ids, const uint32_t provided_grad_req_list_len, const char **provided_grad_req_names, const char **provided_grad_req_types, const uint32_t num_provided_arg_shapes, const char **provided_arg_shape_names, const int64_t *provided_arg_shape_data, const uint32_t *provided_arg_shape_idx, const uint32_t num_provided_arg_dtypes, const char **provided_arg_dtype_names, const int *provided_arg_dtypes, const uint32_t num_provided_arg_stypes, const char **provided_arg_stype_names, const int *provided_arg_stypes, const uint32_t 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, uint32_t *num_in_args, NDArrayHandle **in_args, NDArrayHandle **arg_grads, uint32_t *num_aux_states, NDArrayHandle **aux_states, ExecutorHandle shared_exec_handle, ExecutorHandle *out)
 
MXNET_DLL int MXExecutorReshape (int partial_shaping, int allow_up_sizing, int dev_type, int dev_id, uint32_t num_map_keys, const char **map_keys, const int *map_dev_types, const int *map_dev_ids, const uint32_t num_provided_arg_shapes, const char **provided_arg_shape_names, const uint32_t *provided_arg_shape_data, const uint32_t *provided_arg_shape_idx, uint32_t *num_in_args, NDArrayHandle **in_args, NDArrayHandle **arg_grads, uint32_t *num_aux_states, NDArrayHandle **aux_states, ExecutorHandle shared_exec, ExecutorHandle *out)
 DEPRECATED. Use MXExecutorReshapeEx instead. Return a new executor with the same symbol and shared memory, but different input/output shapes. More...
 
MXNET_DLL int MXExecutorReshapeEx (int partial_shaping, int allow_up_sizing, int dev_type, int dev_id, uint32_t num_map_keys, const char **map_keys, const int *map_dev_types, const int *map_dev_ids, const uint32_t num_provided_arg_shapes, const char **provided_arg_shape_names, const int *provided_arg_shape_data, const uint32_t *provided_arg_shape_idx, uint32_t *num_in_args, NDArrayHandle **in_args, NDArrayHandle **arg_grads, uint32_t *num_aux_states, NDArrayHandle **aux_states, ExecutorHandle shared_exec, ExecutorHandle *out)
 Return a new executor with the same symbol and shared memory, but different input/output shapes. More...
 
MXNET_DLL int MXExecutorGetOptimizedSymbol (ExecutorHandle handle, SymbolHandle *out)
 get optimized graph from graph executor More...
 
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 MXExecutorSetMonitorCallbackEX (ExecutorHandle handle, ExecutorMonitorCallback callback, void *callback_handle, bool monitor_all)
 set a call back to notify the completion of operation More...
 
MXNET_DLL int MXListDataIters (uint32_t *out_size, DataIterCreator **out_array)
 List all the available iterator entries. More...
 
MXNET_DLL int MXDataIterCreateIter (DataIterCreator handle, uint32_t 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, uint32_t *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 (uint32_t 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 MXKVStoreSetGradientCompression (KVStoreHandle handle, uint32_t num_params, const char **keys, const char **vals)
 Set parameters to use low-bit compressed gradients. More...
 
MXNET_DLL int MXKVStoreFree (KVStoreHandle handle)
 Delete a KVStore handle. More...
 
MXNET_DLL int MXKVStoreInit (KVStoreHandle handle, uint32_t num, const int *keys, NDArrayHandle *vals)
 Init a list of (key,value) pairs in kvstore. More...
 
MXNET_DLL int MXKVStoreInitEx (KVStoreHandle handle, uint32_t 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, uint32_t num, const int *keys, NDArrayHandle *vals, int priority)
 Push a list of (key,value) pairs to kvstore. More...
 
MXNET_DLL int MXKVStorePushEx (KVStoreHandle handle, uint32_t 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 MXKVStorePullWithSparse (KVStoreHandle handle, uint32_t num, const int *keys, NDArrayHandle *vals, int priority, bool ignore_sparse)
 pull a list of (key, value) pairs from the kvstore More...
 
MXNET_DLL int MXKVStorePullWithSparseEx (KVStoreHandle handle, uint32_t num, const char **keys, NDArrayHandle *vals, int priority, bool ignore_sparse)
 pull a list of (key, value) pairs from the kvstore, where each key is a string More...
 
MXNET_DLL int MXKVStorePull (KVStoreHandle handle, uint32_t 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, uint32_t 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 MXKVStorePullRowSparse (KVStoreHandle handle, uint32_t num, const int *keys, NDArrayHandle *vals, const NDArrayHandle *row_ids, int priority)
 pull a list of (key, value) pairs from the kvstore, where each key is an integer. The NDArray pulled back will be in row_sparse storage with only the specified row_ids present based row_ids (others rows are zeros). More...
 
MXNET_DLL int MXKVStorePullRowSparseEx (KVStoreHandle handle, uint32_t num, const char **keys, NDArrayHandle *vals, const NDArrayHandle *row_ids, int priority)
 pull a list of (key, value) pairs from the kvstore, where each key is a string. The NDArray pulled back will be in row_sparse storage with only the specified row_ids present based row_ids (others rows are zeros). More...
 
MXNET_DLL int MXKVStoreBroadcast (KVStoreHandle handle, mx_uint vnum, const int *vkeys, mx_uint onum, const int *okeys, NDArrayHandle *vals, NDArrayHandle *outs, int priority)
 broadcast a list of (key, value) pairs from the kvstore More...
 
MXNET_DLL int MXKVStoreBroadcastEx (KVStoreHandle handle, mx_uint vnum, const char **vkeys, mx_uint onum, const char **okeys, NDArrayHandle *vals, NDArrayHandle *outs, int priority)
 broadcast a list of (key, value) pairs from the kvstore, where each key is a string More...
 
MXNET_DLL int MXKVStorePushPull (KVStoreHandle handle, mx_uint vnum, const int *vkeys, mx_uint onum, const int *okeys, NDArrayHandle *vals, NDArrayHandle *outs, int priority)
 push and pull a list of (key, value) pairs from the kvstore More...
 
MXNET_DLL int MXKVStorePushPullEx (KVStoreHandle handle, mx_uint vnum, const char **vkeys, mx_uint onum, const char **okeys, NDArrayHandle *vals, NDArrayHandle *outs, int priority)
 push and 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 a push updater More...
 
MXNET_DLL int MXKVStoreSetUpdaterEx (KVStoreHandle handle, MXKVStoreUpdater updater, MXKVStoreStrUpdater str_updater, void *updater_handle)
 register a push updater with int keys and one with string keys 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)
 Run as server (or scheduler) More...
 
MXNET_DLL int MXKVStoreSendCommmandToServers (KVStoreHandle handle, int cmd_id, const char *cmd_body)
 Send a command to all server nodes. More...
 
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 MXRecordIOReaderTell (RecordIOHandle handle, size_t *pos)
 Get the current writer pointer position. More...
 
MXNET_DLL int MXRtcCreate (char *name, uint32_t num_input, uint32_t 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, uint32_t num_input, uint32_t num_output, NDArrayHandle *inputs, NDArrayHandle *outputs, uint32_t gridDimX, uint32_t gridDimY, uint32_t gridDimZ, uint32_t blockDimX, uint32_t blockDimY, uint32_t 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, struct MXCallbackList *callbacks)
 
MXNET_DLL int MXRtcCudaModuleCreate (const char *source, int num_options, const char **options, int num_exports, const char **exports, CudaModuleHandle *out)
 
MXNET_DLL int MXRtcCudaModuleFree (CudaModuleHandle handle)
 
MXNET_DLL int MXRtcCudaKernelCreate (CudaModuleHandle handle, const char *name, int num_args, int *is_ndarray, int *is_const, int *arg_types, CudaKernelHandle *out)
 
MXNET_DLL int MXRtcCudaKernelFree (CudaKernelHandle handle)
 
MXNET_DLL int MXRtcCudaKernelCall (CudaKernelHandle handle, int dev_id, void **args, uint32_t grid_dim_x, uint32_t grid_dim_y, uint32_t grid_dim_z, uint32_t block_dim_x, uint32_t block_dim_y, uint32_t block_dim_z, uint32_t shared_mem)
 
MXNET_DLL int MXNDArrayGetSharedMemHandle (NDArrayHandle handle, int *shared_pid, int *shared_id)
 Get shared memory handle from NDArray. More...
 
MXNET_DLL int MXNDArrayCreateFromSharedMem (int shared_pid, int shared_id, const uint32_t *shape, uint32_t ndim, int dtype, NDArrayHandle *out)
 DEPRECATED. Use MXNDArrayCreateFromSharedMemEx instead. Reconstruct NDArray from shared memory handle. More...
 
MXNET_DLL int MXStorageEmptyCache (int dev_type, int dev_id)
 Release all unreferenced memory from the devices storage managers memory pool. More...
 
MXNET_DLL int MXNDArrayCreateFromSharedMemEx (int shared_pid, int shared_id, const int *shape, int ndim, int dtype, NDArrayHandle *out)
 Reconstruct NDArray from shared memory handle. More...
 
MXNET_DLL int MXEnginePushAsync (EngineAsyncFunc async_func, void *func_param, EngineFuncParamDeleter deleter, ContextHandle ctx_handle, EngineVarHandle const_vars_handle, int num_const_vars, EngineVarHandle mutable_vars_handle, int num_mutable_vars, EngineFnPropertyHandle prop_handle DEFAULT(NULL), int priority DEFAULT(0), const char *opr_name DEFAULT(NULL), bool wait DEFAULT(false))
 Push an asynchronous operation to the engine. More...
 
MXNET_DLL int MXEnginePushSync (EngineSyncFunc sync_func, void *func_param, EngineFuncParamDeleter deleter, ContextHandle ctx_handle, EngineVarHandle const_vars_handle, int num_const_vars, EngineVarHandle mutable_vars_handle, int num_mutable_vars, EngineFnPropertyHandle prop_handle DEFAULT(NULL), int priority DEFAULT(0), const char *opr_name DEFAULT(NULL))
 Push a synchronous operation to the engine. More...
 
MXNET_DLL int MXShallowCopyNDArray (NDArrayHandle src, NDArrayHandle *out)
 Create an NDArray from source sharing the same data chunk. More...
 
MXNET_DLL int MXShallowCopySymbol (SymbolHandle src, SymbolHandle *out)
 Create an Symbol from source sharing the same graph structure. More...
 
MXNET_DLL int MXEnginePushAsyncND (EngineAsyncFunc async_func, void *func_param, EngineFuncParamDeleter deleter, ContextHandle ctx_handle, NDArrayHandle *const_nds_handle, int num_const_nds, NDArrayHandle *mutable_nds_handle, int num_mutable_nds, EngineFnPropertyHandle prop_handle DEFAULT(NULL), int priority DEFAULT(0), const char *opr_name DEFAULT(NULL), bool wait DEFAULT(false))
 Push an asynchronous operation to the engine. More...
 
MXNET_DLL int MXEnginePushSyncND (EngineSyncFunc sync_func, void *func_param, EngineFuncParamDeleter deleter, ContextHandle ctx_handle, NDArrayHandle *const_nds_handle, int num_const_nds, NDArrayHandle *mutable_nds_handle, int num_mutable_nds, EngineFnPropertyHandle prop_handle DEFAULT(NULL), int priority DEFAULT(0), const char *opr_name DEFAULT(NULL))
 Push a synchronous operation to the engine. More...
 

Macro Definition Documentation

#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 Documentation

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 void(* CachedOpMonitorCallback) (const char *, const char *, NDArrayHandle)

Monitor callback called at operator level for cached op.

typedef const void* ContextHandle

handle to Context

typedef void* CudaKernelHandle

handle to rtc cuda kernel

typedef void* CudaModuleHandle

handle to rtc cuda module

typedef int(* CustomFunctionBwdFunc) (int, int, void **, const int *, const int, void *)
typedef int(* CustomFunctionDelFunc) (void *)
typedef int(* CustomOpBackwardInferStorageTypeFunc) (int, 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(* CustomOpDelFunc) (void *)
typedef int(* CustomOpFBFunc) (int, void **, int *, const int *, const int, void *)
typedef int(* CustomOpInferShapeFunc) (int, int *, int **, void *)
typedef int(* CustomOpInferStorageTypeFunc) (int, int *, 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 int64_t dim_t

data type to store dim size

typedef void* DLManagedTensorHandle

handle to DLManagedTensor

typedef void(* EngineAsyncFunc) (void *, void *, void *)

Engine asynchronous operation.

typedef const void* EngineFnPropertyHandle

handle to Engine FnProperty

typedef void(* EngineFuncParamDeleter) (void *)

Callback to free the param for EngineAsyncFunc/EngineSyncFunc.

typedef void(* EngineSyncFunc) (void *, void *)

Engine synchronous operation.

typedef void* EngineVarHandle

handle to Engine VarHandle

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 uint32_t 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

Parameters
headthe head of the command
bodythe body of the command
controller_handlehelper handle for implementing controller
typedef void( MXKVStoreStrUpdater) (const char *key, NDArrayHandle recv, NDArrayHandle local, void *handle)

user-defined updater for the kvstore with string keys It's this updater's responsibility to delete recv and local

Parameters
thekey
recvthe pushed value on this key
localthe value stored on local on this key
handleThe additional handle to the updater
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

Parameters
thekey
recvthe pushed value on this key
localthe value stored on local on this key
handleThe additional handle to the updater
typedef void* NDArrayHandle

handle to NDArray

typedef void* ProfileHandle

handle to a Profile object (domain, duration, counter, etc.)

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

Enumeration Type Documentation

Enumerator
kCustomFunctionBackward 
kCustomFunctionDelete 
Enumerator
kCustomOpDelete 
kCustomOpForward 
kCustomOpBackward 
Enumerator
kCustomOpPropDelete 
kCustomOpPropListArguments 
kCustomOpPropListOutputs 
kCustomOpPropListAuxiliaryStates 
kCustomOpPropInferShape 
kCustomOpPropDeclareBackwardDependency 
kCustomOpPropCreateOperator 
kCustomOpPropInferType 
kCustomOpPropInferStorageType 
kCustomOpPropBackwardInferStorageType 

Function Documentation

MXNET_DLL int MXAggregateProfileStatsPrint ( const char **  out_str,
int  reset 
)

Deprecated, use MXAggregateProfileStatsPrintEx instead.

Parameters
out_strWill receive a pointer to the output string
resetClear the aggregate stats after printing
Returns
0 when success, -1 when failure happens.
Note
MXNET_DLL int MXAggregateProfileStatsPrintEx ( const char **  out_str,
int  reset,
int  format,
int  sort_by,
int  ascending 
)

Print sorted aggregate stats to the a string How aggregate stats are stored will not change.

Parameters
out_strwill receive a pointer to the output string
resetclear the aggregate stats after printing
formatwhether to return in tabular or json format
sort_bysort by total, avg, min, max, or count
ascendingwhether to sort ascendingly
Returns
0 when success, -1 when failure happens.
Note
MXNET_DLL int MXAutogradBackward ( uint32_t  num_output,
NDArrayHandle output_handles,
NDArrayHandle ograd_handles,
int  retain_graph 
)

compute the gradient of outputs w.r.t variabels

Parameters
num_outputnumber of output NDArray
output_handlesoutput NDArrays
ograd_handleshead gradient for NDArrays
retain_graphwhether to keep the graph after backward
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXAutogradBackwardEx ( uint32_t  num_output,
NDArrayHandle output_handles,
NDArrayHandle ograd_handles,
uint32_t  num_variables,
NDArrayHandle var_handles,
int  retain_graph,
int  create_graph,
int  is_train,
NDArrayHandle **  grad_handles,
int **  grad_stypes 
)

compute the gradient of outputs w.r.t variabels

Parameters
num_outputnumber of output NDArray
output_handlesoutput NDArrays
ograd_handleshead gradient for NDArrays
num_variablesnumber of variables
MXNET_DLL int MXAutogradComputeGradient ( uint32_t  num_output,
NDArrayHandle output_handles 
)

compute the gradient of outputs w.r.t variabels

Parameters
num_outputnumber of output NDArray
output_handlesoutput NDArrays
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXAutogradGetSymbol ( NDArrayHandle  handle,
SymbolHandle out 
)
MXNET_DLL int MXAutogradIsRecording ( bool *  curr)

get whether autograd recording is on

Parameters
currreturns the current status.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXAutogradIsTraining ( bool *  curr)

get whether training mode is on

Parameters
currreturns the current status.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXAutogradMarkVariables ( uint32_t  num_var,
NDArrayHandle var_handles,
uint32_t *  reqs_array,
NDArrayHandle grad_handles 
)

mark NDArrays as variables to compute gradient for autograd

Parameters
num_varnumber of variable NDArrays
var_handlesvariable NDArrays
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXAutogradSetIsRecording ( int  is_recording,
int *  prev 
)

set whether to record operator for autograd

Parameters
is_recording1 when recording, 0 when not recording.
prevreturns the previous status before this set.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXAutogradSetIsTraining ( int  is_training,
int *  prev 
)

set whether to record operator for autograd

Parameters
is_training1 when training, 0 when testing
prevreturns the previous status before this set.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXCachedOpRegisterOpHook ( NDArrayHandle  handle,
CachedOpMonitorCallback  callback,
bool  monitor_all 
)

cached op set monitor callback

MXNET_DLL int MXCreateCachedOp ( SymbolHandle  handle,
CachedOpHandle out 
)

create cached operator

MXNET_DLL int MXCreateCachedOpEx ( SymbolHandle  handle,
int  num_flags,
const char **  keys,
const char **  vals,
CachedOpHandle out 
)

create cached operator

MXNET_DLL int MXCreateCachedOpEX ( SymbolHandle  handle,
int  num_flags,
const char **  keys,
const char **  vals,
CachedOpHandle out,
bool thread_safe   DEFAULTfalse 
)

create cached operator, allows to choose thread_safe version of cachedop

MXNET_DLL int MXCustomFunctionRecord ( int  num_inputs,
NDArrayHandle inputs,
int  num_outputs,
NDArrayHandle outputs,
struct MXCallbackList callbacks 
)
MXNET_DLL int MXCustomOpRegister ( const char *  op_type,
CustomOpPropCreator  creator 
)
MXNET_DLL int MXDataIterBeforeFirst ( DataIterHandle  handle)

Call iterator.Reset.

Parameters
handlethe handle to iterator
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXDataIterCreateIter ( DataIterCreator  handle,
uint32_t  num_param,
const char **  keys,
const char **  vals,
DataIterHandle out 
)

Init an iterator, init with parameters the array size of passed in arguments.

Parameters
handleof the iterator creator
num_paramnumber of parameter
keysparameter keys
valsparameter values
outresulting iterator
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXDataIterFree ( DataIterHandle  handle)

Free the handle to the IO module.

Parameters
handlethe handle pointer to the data iterator
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXDataIterGetData ( DataIterHandle  handle,
NDArrayHandle out 
)

Get the handle to the NDArray of underlying data.

Parameters
handlethe handle pointer to the data iterator
outhandle to underlying data NDArray
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXDataIterGetIndex ( DataIterHandle  handle,
uint64_t **  out_index,
uint64_t *  out_size 
)

Get the image index by array.

Parameters
handlethe handle pointer to the data iterator
out_indexoutput index of the array.
out_sizeoutput size of the array.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXDataIterGetIterInfo ( DataIterCreator  creator,
const char **  name,
const char **  description,
uint32_t *  num_args,
const char ***  arg_names,
const char ***  arg_type_infos,
const char ***  arg_descriptions 
)

Get the detailed information about data iterator.

Parameters
creatorthe DataIterCreator.
nameThe returned name of the creator.
descriptionThe returned description of the symbol.
num_argsNumber of arguments.
arg_namesName of the arguments.
arg_type_infosType informations about the arguments.
arg_descriptionsDescription information about the arguments.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXDataIterGetLabel ( DataIterHandle  handle,
NDArrayHandle out 
)

Get the handle to the NDArray of underlying label.

Parameters
handlethe handle pointer to the data iterator
outthe handle to underlying label NDArray
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXDataIterGetPadNum ( DataIterHandle  handle,
int *  pad 
)

Get the padding number in current data batch.

Parameters
handlethe handle pointer to the data iterator
padpad number ptr
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXDataIterNext ( DataIterHandle  handle,
int *  out 
)

Move iterator to next position.

Parameters
handlethe handle to iterator
outreturn value of next
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXDumpProcessProfile ( int  finished,
int  profile_process,
KVStoreHandle  kvStoreHandle 
)

Save profile and stop profiler.

Parameters
finishedtrue if stat output should stop after this point
profile_processan int, when 0 command is for worker/current process, when 1 command is for server process
kvstoreHandlehandle to kvstore
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXDumpProfile ( int  finished)

Save profile and stop profiler for worker/current process.

Parameters
finishedtrue if stat output should stop after this point
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXEnginePushAsync ( EngineAsyncFunc  async_func,
void *  func_param,
EngineFuncParamDeleter  deleter,
ContextHandle  ctx_handle,
EngineVarHandle  const_vars_handle,
int  num_const_vars,
EngineVarHandle  mutable_vars_handle,
int  num_mutable_vars,
EngineFnPropertyHandle prop_handle   DEFAULTNULL,
int priority   DEFAULT0,
const char *opr_name   DEFAULTNULL,
bool wait   DEFAULTfalse 
)

Push an asynchronous operation to the engine.

Parameters
async_funcExecution function whici takes a parameter on_complete that must be called when the execution ompletes.
func_paramThe parameter set on calling async_func, can be NULL.
deleterThe callback to free func_param, can be NULL.
ctx_handleExecution context.
const_vars_handleThe variables that current operation will use but not mutate.
num_const_varsThe number of const_vars_handle.
mutable_vars_handleThe variables that current operation will mutate.
num_mutable_varsThe number of mutable_vars_handle.
prop_handleProperty of the function.
priorityPriority of the action, as hint to the engine.
opr_nameThe operation name.
waitWhether this is a WaitForVar operation.
MXNET_DLL int MXEnginePushAsyncND ( EngineAsyncFunc  async_func,
void *  func_param,
EngineFuncParamDeleter  deleter,
ContextHandle  ctx_handle,
NDArrayHandle const_nds_handle,
int  num_const_nds,
NDArrayHandle mutable_nds_handle,
int  num_mutable_nds,
EngineFnPropertyHandle prop_handle   DEFAULTNULL,
int priority   DEFAULT0,
const char *opr_name   DEFAULTNULL,
bool wait   DEFAULTfalse 
)

Push an asynchronous operation to the engine.

Parameters
async_funcExecution function whici takes a parameter on_complete that must be called when the execution ompletes.
func_paramThe parameter set on calling async_func, can be NULL.
deleterThe callback to free func_param, can be NULL.
ctx_handleExecution context.
const_nds_handleThe NDArrays that current operation will use but not mutate.
num_const_ndsThe number of const_nds_handle.
mutable_nds_handleThe NDArrays that current operation will mutate.
num_mutable_ndsThe number of mutable_nds_handle.
prop_handleProperty of the function.
priorityPriority of the action, as hint to the engine.
opr_nameThe operation name.
waitWhether this is a WaitForVar operation.
MXNET_DLL int MXEnginePushSync ( EngineSyncFunc  sync_func,
void *  func_param,
EngineFuncParamDeleter  deleter,
ContextHandle  ctx_handle,
EngineVarHandle  const_vars_handle,
int  num_const_vars,
EngineVarHandle  mutable_vars_handle,
int  num_mutable_vars,
EngineFnPropertyHandle prop_handle   DEFAULTNULL,
int priority   DEFAULT0,
const char *opr_name   DEFAULTNULL 
)

Push a synchronous operation to the engine.

Parameters
sync_funcExecution function that executes the operation.
func_paramThe parameter set on calling sync_func, can be NULL.
deleterThe callback to free func_param, can be NULL.
ctx_handleExecution context.
const_vars_handleThe variables that current operation will use but not mutate.
num_const_varsThe number of const_vars_handle.
mutable_vars_handleThe variables that current operation will mutate.
num_mutable_varsThe number of mutable_vars_handle.
prop_handleProperty of the function.
priorityPriority of the action, as hint to the engine.
opr_nameThe operation name.
MXNET_DLL int MXEnginePushSyncND ( EngineSyncFunc  sync_func,
void *  func_param,
EngineFuncParamDeleter  deleter,
ContextHandle  ctx_handle,
NDArrayHandle const_nds_handle,
int  num_const_nds,
NDArrayHandle mutable_nds_handle,
int  num_mutable_nds,
EngineFnPropertyHandle prop_handle   DEFAULTNULL,
int priority   DEFAULT0,
const char *opr_name   DEFAULTNULL 
)

Push a synchronous operation to the engine.

Parameters
sync_funcExecution function that executes the operation.
func_paramThe parameter set on calling sync_func, can be NULL.
deleterThe callback to free func_param, can be NULL.
ctx_handleExecution context.
const_nds_handleThe NDArrays that current operation will use but not mutate.
num_const_ndsThe number of const_nds_handle.
mutable_nds_handleThe NDArrays that current operation will mutate.
num_mutable_ndsThe number of mutable_nds_handle.
prop_handleProperty of the function.
priorityPriority of the action, as hint to the engine.
opr_nameThe operation name.
MXNET_DLL int MXEngineSetBulkSize ( int  bulk_size,
int *  prev_bulk_size 
)

set bulk execution limit

Parameters
bulk_sizenew bulk_size
prev_bulk_sizeprevious bulk_size
MXNET_DLL int MXExecutorBackward ( ExecutorHandle  handle,
uint32_t  len,
NDArrayHandle head_grads 
)

Excecutor run backward.

Parameters
handleexecute handle
lenlenth
head_gradsNDArray handle for heads' gradient
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXExecutorBackwardEx ( ExecutorHandle  handle,
uint32_t  len,
NDArrayHandle head_grads,
int  is_train 
)

Excecutor run backward.

Parameters
handleexecute handle
lenlenth
head_gradsNDArray handle for heads' gradient
is_trainint value to indicate whether the backward pass is for evaluation
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXExecutorBind ( SymbolHandle  symbol_handle,
int  dev_type,
int  dev_id,
uint32_t  len,
NDArrayHandle in_args,
NDArrayHandle arg_grad_store,
uint32_t *  grad_req_type,
uint32_t  aux_states_len,
NDArrayHandle aux_states,
ExecutorHandle out 
)

Generate Executor from symbol.

Parameters
symbol_handlesymbol handle
dev_typedevice type
dev_iddevice id
lenlength
in_argsin args array
arg_grad_storearg grads handle array
grad_req_typegrad req array
aux_states_lenlength of auxiliary states
aux_statesauxiliary states array
outoutput executor handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXExecutorBindEX ( SymbolHandle  symbol_handle,
int  dev_type,
int  dev_id,
uint32_t  num_map_keys,
const char **  map_keys,
const int *  map_dev_types,
const int *  map_dev_ids,
uint32_t  len,
NDArrayHandle in_args,
NDArrayHandle arg_grad_store,
uint32_t *  grad_req_type,
uint32_t  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.

Parameters
symbol_handlesymbol handle
dev_typedevice type of default context
dev_iddevice id of default context
num_map_keyssize of group2ctx map
map_keyskeys of group2ctx map
map_dev_typesdevice type of group2ctx map
map_dev_idsdevice id of group2ctx map
lenlength
in_argsin args array
arg_grad_storearg grads handle array
grad_req_typegrad req array
aux_states_lenlength of auxiliary states
aux_statesauxiliary states array
shared_execinput executor handle for memory sharing
outoutput executor handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXExecutorBindX ( SymbolHandle  symbol_handle,
int  dev_type,
int  dev_id,
uint32_t  num_map_keys,
const char **  map_keys,
const int *  map_dev_types,
const int *  map_dev_ids,
uint32_t  len,
NDArrayHandle in_args,
NDArrayHandle arg_grad_store,
uint32_t *  grad_req_type,
uint32_t  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.

Parameters
symbol_handlesymbol handle
dev_typedevice type of default context
dev_iddevice id of default context
num_map_keyssize of group2ctx map
map_keyskeys of group2ctx map
map_dev_typesdevice type of group2ctx map
map_dev_idsdevice id of group2ctx map
lenlength
in_argsin args array
arg_grad_storearg grads handle array
grad_req_typegrad req array
aux_states_lenlength of auxiliary states
aux_statesauxiliary states array
outoutput executor handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXExecutorForward ( ExecutorHandle  handle,
int  is_train 
)

Executor forward method.

Parameters
handleexecutor handle
is_trainint value to indicate whether the forward pass is for evaluation
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXExecutorFree ( ExecutorHandle  handle)

Delete the executor.

Parameters
handlethe executor.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXExecutorGetOptimizedSymbol ( ExecutorHandle  handle,
SymbolHandle out 
)

get optimized graph from graph executor

MXNET_DLL int MXExecutorOutputs ( ExecutorHandle  handle,
uint32_t *  out_size,
NDArrayHandle **  out 
)

Get executor's head NDArray.

Parameters
handleexecutor handle
out_sizeoutput narray vector size
outout put narray handles
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXExecutorPrint ( ExecutorHandle  handle,
const char **  out_str 
)

Print the content of execution plan, used for debug.

Parameters
handlethe executor.
out_strpointer to hold the output string of the printing.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXExecutorReshape ( int  partial_shaping,
int  allow_up_sizing,
int  dev_type,
int  dev_id,
uint32_t  num_map_keys,
const char **  map_keys,
const int *  map_dev_types,
const int *  map_dev_ids,
const uint32_t  num_provided_arg_shapes,
const char **  provided_arg_shape_names,
const uint32_t *  provided_arg_shape_data,
const uint32_t *  provided_arg_shape_idx,
uint32_t *  num_in_args,
NDArrayHandle **  in_args,
NDArrayHandle **  arg_grads,
uint32_t *  num_aux_states,
NDArrayHandle **  aux_states,
ExecutorHandle  shared_exec,
ExecutorHandle out 
)

DEPRECATED. Use MXExecutorReshapeEx instead. Return a new executor with the same symbol and shared memory, but different input/output shapes.

Parameters
partial_shapingWhether to allow changing the shape of unspecified arguments.
allow_up_sizingWhether to allow allocating new ndarrays that's larger than the original.
dev_typedevice type of default context
dev_iddevice id of default context
num_map_keyssize of group2ctx map
map_keyskeys of group2ctx map
map_dev_typesdevice type of group2ctx map
map_dev_idsdevice id of group2ctx map
num_in_argslength of in_args
in_argsin args array
arg_gradsarg grads handle array
num_aux_stateslength of auxiliary states
aux_statesauxiliary states array
shared_execinput executor handle for memory sharing
outoutput executor handle
Returns
a new executor
MXNET_DLL int MXExecutorReshapeEx ( int  partial_shaping,
int  allow_up_sizing,
int  dev_type,
int  dev_id,
uint32_t  num_map_keys,
const char **  map_keys,
const int *  map_dev_types,
const int *  map_dev_ids,
const uint32_t  num_provided_arg_shapes,
const char **  provided_arg_shape_names,
const int *  provided_arg_shape_data,
const uint32_t *  provided_arg_shape_idx,
uint32_t *  num_in_args,
NDArrayHandle **  in_args,
NDArrayHandle **  arg_grads,
uint32_t *  num_aux_states,
NDArrayHandle **  aux_states,
ExecutorHandle  shared_exec,
ExecutorHandle out 
)

Return a new executor with the same symbol and shared memory, but different input/output shapes.

Parameters
partial_shapingWhether to allow changing the shape of unspecified arguments.
allow_up_sizingWhether to allow allocating new ndarrays that's larger than the original.
dev_typedevice type of default context
dev_iddevice id of default context
num_map_keyssize of group2ctx map
map_keyskeys of group2ctx map
map_dev_typesdevice type of group2ctx map
map_dev_idsdevice id of group2ctx map
num_in_argslength of in_args
in_argsin args array
arg_gradsarg grads handle array
num_aux_stateslength of auxiliary states
aux_statesauxiliary states array
shared_execinput executor handle for memory sharing
outoutput executor handle
Returns
a new executor
MXNET_DLL int MXExecutorSetMonitorCallback ( ExecutorHandle  handle,
ExecutorMonitorCallback  callback,
void *  callback_handle 
)

set a call back to notify the completion of operation

MXNET_DLL int MXExecutorSetMonitorCallbackEX ( ExecutorHandle  handle,
ExecutorMonitorCallback  callback,
void *  callback_handle,
bool  monitor_all 
)

set a call back to notify the completion of operation

Parameters
monitor_allIf true, monitor both input and output, otherwise monitor output only.
MXNET_DLL int MXExecutorSimpleBind ( SymbolHandle  symbol_handle,
int  dev_type,
int  dev_id,
const uint32_t  num_g2c_keys,
const char **  g2c_keys,
const int *  g2c_dev_types,
const int *  g2c_dev_ids,
const uint32_t  provided_grad_req_list_len,
const char **  provided_grad_req_names,
const char **  provided_grad_req_types,
const uint32_t  num_provided_arg_shapes,
const char **  provided_arg_shape_names,
const uint32_t *  provided_arg_shape_data,
const uint32_t *  provided_arg_shape_idx,
const uint32_t  num_provided_arg_dtypes,
const char **  provided_arg_dtype_names,
const int *  provided_arg_dtypes,
const uint32_t  num_provided_arg_stypes,
const char **  provided_arg_stype_names,
const int *  provided_arg_stypes,
const uint32_t  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,
uint32_t *  num_in_args,
NDArrayHandle **  in_args,
NDArrayHandle **  arg_grads,
uint32_t *  num_aux_states,
NDArrayHandle **  aux_states,
ExecutorHandle  shared_exec_handle,
ExecutorHandle out 
)

DEPRECATED. Use MXExecutorSimpleBindEx instead.

MXNET_DLL int MXExecutorSimpleBindEx ( SymbolHandle  symbol_handle,
int  dev_type,
int  dev_id,
const uint32_t  num_g2c_keys,
const char **  g2c_keys,
const int *  g2c_dev_types,
const int *  g2c_dev_ids,
const uint32_t  provided_grad_req_list_len,
const char **  provided_grad_req_names,
const char **  provided_grad_req_types,
const uint32_t  num_provided_arg_shapes,
const char **  provided_arg_shape_names,
const int *  provided_arg_shape_data,
const uint32_t *  provided_arg_shape_idx,
const uint32_t  num_provided_arg_dtypes,
const char **  provided_arg_dtype_names,
const int *  provided_arg_dtypes,
const uint32_t  num_provided_arg_stypes,
const char **  provided_arg_stype_names,
const int *  provided_arg_stypes,
const uint32_t  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,
uint32_t *  num_in_args,
NDArrayHandle **  in_args,
NDArrayHandle **  arg_grads,
uint32_t *  num_aux_states,
NDArrayHandle **  aux_states,
ExecutorHandle  shared_exec_handle,
ExecutorHandle out 
)
MXNET_DLL int MXExecutorSimpleBindEx64 ( SymbolHandle  symbol_handle,
int  dev_type,
int  dev_id,
const uint32_t  num_g2c_keys,
const char **  g2c_keys,
const int *  g2c_dev_types,
const int *  g2c_dev_ids,
const uint32_t  provided_grad_req_list_len,
const char **  provided_grad_req_names,
const char **  provided_grad_req_types,
const uint32_t  num_provided_arg_shapes,
const char **  provided_arg_shape_names,
const int64_t *  provided_arg_shape_data,
const uint32_t *  provided_arg_shape_idx,
const uint32_t  num_provided_arg_dtypes,
const char **  provided_arg_dtype_names,
const int *  provided_arg_dtypes,
const uint32_t  num_provided_arg_stypes,
const char **  provided_arg_stype_names,
const int *  provided_arg_stypes,
const uint32_t  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,
uint32_t *  num_in_args,
NDArrayHandle **  in_args,
NDArrayHandle **  arg_grads,
uint32_t *  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,
uint32_t *  num_use_vars,
uint32_t *  num_scalars,
uint32_t *  num_mutate_vars,
int *  type_mask 
)

get the argument requirements of the function

Parameters
funinput function handle
num_use_varshow many NDArrays to be passed in as used_vars
num_scalarsscalar variable is needed
num_mutate_varshow many NDArrays to be passed in as mutate_vars
type_maskthe type mask of this function
Returns
0 when success, -1 when failure happens
See also
MXFuncInvoke
MXNET_DLL int MXFuncGetInfo ( FunctionHandle  fun,
const char **  name,
const char **  description,
uint32_t *  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.

Parameters
funThe function handle.
nameThe returned name of the function.
descriptionThe returned description of the function.
num_argsNumber of arguments.
arg_namesName of the arguments.
arg_type_infosType information about the arguments.
arg_descriptionsDescription information about the arguments.
return_typeReturn type of the function.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXFuncInvoke ( FunctionHandle  fun,
NDArrayHandle use_vars,
float *  scalar_args,
NDArrayHandle mutate_vars 
)

invoke a function, the array size of passed in arguments must match the values in the

Parameters
funthe function
use_varsthe normal arguments passed to function
scalar_argsthe scalar qarguments
mutate_varsthe mutate arguments
Returns
0 when success, -1 when failure happens
See also
MXFuncDescribeArgs
MXNET_DLL int MXFuncInvokeEx ( FunctionHandle  fun,
NDArrayHandle use_vars,
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

Parameters
funthe function
use_varsthe normal arguments passed to function
scalar_argsthe scalar qarguments
mutate_varsthe mutate arguments
num_paramsnumber of keyword parameters
param_keyskeys for keyword parameters
param_valsvalues for keyword parameters
Returns
0 when success, -1 when failure happens
See also
MXFuncDescribeArgs
MXNET_DLL int MXGenAtomicSymbolFromSymbol ( SymbolHandle  sym_handle,
SymbolHandle ret_sym_handle 
)

Generate atomic symbol (able to be composed) from a source symbol.

Parameters
sym_handlesource symbol
ret_sym_handlereturned atomic symbol
MXNET_DLL int MXGenBackendSubgraph ( SymbolHandle  sym_handle,
const char *  backend,
SymbolHandle ret_sym_handle 
)

Run subgraph pass based on the backend provided.

Parameters
sym_handlesymbol to be converted
backendbackend names for subgraph pass
ret_sym_handlereturned symbol
MXNET_DLL int MXGetFunction ( const char *  name,
FunctionHandle out 
)

get the function handle by name

Parameters
namethe name of the function
outthe corresponding function handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXGetGPUCount ( int *  out)

Get the number of GPUs.

Parameters
pointerto int that will hold the number of GPUs available.
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXGetGPUMemoryInformation ( int  dev,
int *  free_mem,
int *  total_mem 
)

get the free and total available memory on a GPU Note: Deprecated, use MXGetGPUMemoryInformation64 instead.

Parameters
devthe GPU number to query
free_mempointer to the integer holding free GPU memory
total_mempointer to the integer holding total GPU memory
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXGetGPUMemoryInformation64 ( int  dev,
uint64_t *  free_mem,
uint64_t *  total_mem 
)

get the free and total available memory on a GPU

Parameters
devthe GPU number to query
free_mempointer to the uint64_t holding free GPU memory
total_mempointer to the uint64_t holding total GPU memory
Returns
0 when success, -1 when failure happens
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

Returns
error info
MXNET_DLL int MXGetVersion ( int *  out)

get the MXNet library version as an integer

Parameters
pointerto the integer holding the version number
Returns
0 when success, -1 when failure happens
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

Parameters
creatorthe op
num_inputsnumber of input NDArrays
inputsinput NDArrays
num_outputsnumber of output NDArrays
outputsoutput NDArrays
num_paramsnumber of keyword parameters
param_keyskeys for keyword parameters
param_valsvalues for keyword parameters
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXImperativeInvokeEx ( AtomicSymbolCreator  creator,
int  num_inputs,
NDArrayHandle inputs,
int *  num_outputs,
NDArrayHandle **  outputs,
int  num_params,
const char **  param_keys,
const char **  param_vals,
const int **  out_stypes 
)

invoke a nnvm op and imperative function

Parameters
creatorthe op
num_inputsnumber of input NDArrays
inputsinput NDArrays
num_outputsnumber of output NDArrays
outputsoutput NDArrays
num_paramsnumber of keyword parameters
param_keyskeys for keyword parameters
param_valsvalues for keyword parameters
out_stypesoutput ndarrays' stypes
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXInitPSEnv ( uint32_t  num_vars,
const char **  keys,
const char **  vals 
)

Initialized ps-lite environment variables.

Parameters
num_varsnumber of variables to initialize
keysenvironment keys
valsenvironment values
MXNET_DLL int MXInvokeCachedOp ( CachedOpHandle  handle,
int  num_inputs,
NDArrayHandle inputs,
int *  num_outputs,
NDArrayHandle **  outputs 
)

invoke cached operator

MXNET_DLL int MXInvokeCachedOpEx ( CachedOpHandle  handle,
int  num_inputs,
NDArrayHandle inputs,
int *  num_outputs,
NDArrayHandle **  outputs,
const int **  out_stypes 
)

invoke a cached op

Parameters
handlethe handle to the cached op
num_inputsnumber of input NDArrays
inputsinput NDArrays
num_outputsnumber of output NDArrays
outputsoutput NDArrays
out_stypesoutput ndarrays' stypes
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXIsNumpyShape ( int *  curr)

get whether numpy compatibility is on

Parameters
currreturns the current status
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreBarrier ( KVStoreHandle  handle)

global barrier among all worker machines

Parameters
handlehandle to the KVStore
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreBroadcast ( KVStoreHandle  handle,
mx_uint  vnum,
const int *  vkeys,
mx_uint  onum,
const int *  okeys,
NDArrayHandle vals,
NDArrayHandle outs,
int  priority 
)

broadcast a list of (key, value) pairs from the kvstore

Parameters
handlehandle to the kvstore
vnumthe number of key-value pairs corresponding to vkeys
vkeysthe list of keys for the values to be pushed
onumthe number of key-value pairs corresponding to okeys
okeysthe list of keys for the values to be pulled
valsthe list of values
outsthe list of outputs
prioritythe priority of the action
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreBroadcastEx ( KVStoreHandle  handle,
mx_uint  vnum,
const char **  vkeys,
mx_uint  onum,
const char **  okeys,
NDArrayHandle vals,
NDArrayHandle outs,
int  priority 
)

broadcast a list of (key, value) pairs from the kvstore, where each key is a string

Parameters
handlehandle to the kvstore
vnumthe number of key-value pairs corresponding to vkeys
vkeysthe list of keys for the values to be pushed
onumthe number of key-value pairs corresponding to okeys
okeysthe list of keys for the values to be pulled
valsthe list of values
outsthe list of outputs
prioritythe priority of the action
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreCreate ( const char *  type,
KVStoreHandle out 
)

Create a kvstore.

Parameters
typethe type of KVStore
outThe output type of KVStore
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreFree ( KVStoreHandle  handle)

Delete a KVStore handle.

Parameters
handlehandle to the kvstore
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreGetGroupSize ( KVStoreHandle  handle,
int *  ret 
)

return The number of nodes in this group, which is

  • number of workers if if IsWorkerNode() == true,
  • number of servers if if IsServerNode() == true,
  • 1 if IsSchedulerNode() == true,
    Parameters
    handlehandle to the KVStore
    retthe group size
    Returns
    0 when success, -1 when failure happens
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}.

Parameters
handlehandle to the KVStore
node_idCan be a node group or a single node. kScheduler = 1, kServerGroup = 2, kWorkerGroup = 4
numberOuptut number of dead nodes
timeout_secA 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).

Parameters
handlehandle to the KVStore
retthe node rank
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreGetType ( KVStoreHandle  handle,
const char **  type 
)

get the type of the kvstore

Parameters
handlehandle to the KVStore
typea string type
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreInit ( KVStoreHandle  handle,
uint32_t  num,
const int *  keys,
NDArrayHandle vals 
)

Init a list of (key,value) pairs in kvstore.

Parameters
handlehandle to the kvstore
numthe number of key-value pairs
keysthe list of keys
valsthe list of values
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreInitEx ( KVStoreHandle  handle,
uint32_t  num,
const char **  keys,
NDArrayHandle vals 
)

Init a list of (key,value) pairs in kvstore, where each key is a string.

Parameters
handlehandle to the kvstore
numthe number of key-value pairs
keysthe list of keys
valsthe list of values
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreIsSchedulerNode ( int *  ret)

return whether or not this process is a scheduler node.

Parameters
ret1 for yes, 0 for no
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreIsServerNode ( int *  ret)

return whether or not this process is a server node.

Parameters
ret1 for yes, 0 for no
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreIsWorkerNode ( int *  ret)

return whether or not this process is a worker node.

Parameters
ret1 for yes, 0 for no
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStorePull ( KVStoreHandle  handle,
uint32_t  num,
const int *  keys,
NDArrayHandle vals,
int  priority 
)

pull a list of (key, value) pairs from the kvstore

Parameters
handlehandle to the kvstore
numthe number of key-value pairs
keysthe list of keys
valsthe list of values
prioritythe priority of the action
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStorePullEx ( KVStoreHandle  handle,
uint32_t  num,
const char **  keys,
NDArrayHandle vals,
int  priority 
)

pull a list of (key, value) pairs from the kvstore, where each key is a string

Parameters
handlehandle to the kvstore
numthe number of key-value pairs
keysthe list of keys
valsthe list of values
prioritythe priority of the action
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStorePullRowSparse ( KVStoreHandle  handle,
uint32_t  num,
const int *  keys,
NDArrayHandle vals,
const NDArrayHandle row_ids,
int  priority 
)

pull a list of (key, value) pairs from the kvstore, where each key is an integer. The NDArray pulled back will be in row_sparse storage with only the specified row_ids present based row_ids (others rows are zeros).

Parameters
handlehandle to the kvstore
numthe number of key-value pairs
keysthe list of keys
valsthe list of values
row_idsthe list of row_id NDArrays
prioritythe priority of the action
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStorePullRowSparseEx ( KVStoreHandle  handle,
uint32_t  num,
const char **  keys,
NDArrayHandle vals,
const NDArrayHandle row_ids,
int  priority 
)

pull a list of (key, value) pairs from the kvstore, where each key is a string. The NDArray pulled back will be in row_sparse storage with only the specified row_ids present based row_ids (others rows are zeros).

Parameters
handlehandle to the kvstore
numthe number of key-value pairs
keysthe list of keys
valsthe list of values
row_idsthe list of row_id NDArrays
prioritythe priority of the action
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStorePullWithSparse ( KVStoreHandle  handle,
uint32_t  num,
const int *  keys,
NDArrayHandle vals,
int  priority,
bool  ignore_sparse 
)

pull a list of (key, value) pairs from the kvstore

Parameters
handlehandle to the kvstore
numthe number of key-value pairs
keysthe list of keys
valsthe list of values
prioritythe priority of the action
ignore_sparsewhether to ignore sparse arrays in the request
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStorePullWithSparseEx ( KVStoreHandle  handle,
uint32_t  num,
const char **  keys,
NDArrayHandle vals,
int  priority,
bool  ignore_sparse 
)

pull a list of (key, value) pairs from the kvstore, where each key is a string

Parameters
handlehandle to the kvstore
numthe number of key-value pairs
keysthe list of keys
valsthe list of values
prioritythe priority of the action
ignore_sparsewhether to ignore sparse arrays in the request
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStorePush ( KVStoreHandle  handle,
uint32_t  num,
const int *  keys,
NDArrayHandle vals,
int  priority 
)

Push a list of (key,value) pairs to kvstore.

Parameters
handlehandle to the kvstore
numthe number of key-value pairs
keysthe list of keys
valsthe list of values
prioritythe priority of the action
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStorePushEx ( KVStoreHandle  handle,
uint32_t  num,
const char **  keys,
NDArrayHandle vals,
int  priority 
)

Push a list of (key,value) pairs to kvstore, where each key is a string.

Parameters
handlehandle to the kvstore
numthe number of key-value pairs
keysthe list of keys
valsthe list of values
prioritythe priority of the action
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStorePushPull ( KVStoreHandle  handle,
mx_uint  vnum,
const int *  vkeys,
mx_uint  onum,
const int *  okeys,
NDArrayHandle vals,
NDArrayHandle outs,
int  priority 
)

push and pull a list of (key, value) pairs from the kvstore

Parameters
handlehandle to the kvstore
vnumthe number of key-value pairs corresponding to vkeys
vkeysthe list of keys for the values to be pushed
onumthe number of key-value pairs corresponding to okeys
okeysthe list of keys for the values to be pulled
valsthe list of values
outsthe list of outputs
prioritythe priority of the action
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStorePushPullEx ( KVStoreHandle  handle,
mx_uint  vnum,
const char **  vkeys,
mx_uint  onum,
const char **  okeys,
NDArrayHandle vals,
NDArrayHandle outs,
int  priority 
)

push and pull a list of (key, value) pairs from the kvstore, where each key is a string

Parameters
handlehandle to the kvstore
vnumthe number of key-value pairs corresponding to vkeys
vkeysthe list of keys for the values to be pushed
onumthe number of key-value pairs corresponding to okeys
okeysthe list of keys for the values to be pulled
valsthe list of values
outsthe list of outputs
prioritythe priority of the action
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreRunServer ( KVStoreHandle  handle,
MXKVStoreServerController  controller,
void *  controller_handle 
)

Run as server (or scheduler)

Parameters
handlehandle to the KVStore
controllerthe user-defined server controller
controller_handlehelper handle for implementing controller
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreSendCommmandToServers ( KVStoreHandle  handle,
int  cmd_id,
const char *  cmd_body 
)

Send a command to all server nodes.

Parameters
handlehandle to the KVStore
cmd_idthe head of the command
cmd_bodythe body of the command
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreSetBarrierBeforeExit ( KVStoreHandle  handle,
const int  barrier_before_exit 
)

whether to do barrier when finalize

Parameters
handlehandle to the KVStore
barrier_before_exitwhether to do barrier when kvstore finalize
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreSetGradientCompression ( KVStoreHandle  handle,
uint32_t  num_params,
const char **  keys,
const char **  vals 
)

Set parameters to use low-bit compressed gradients.

Parameters
handlehandle to the kvstore
keyskeys for compression parameters
valsvalues for compression parameters
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreSetUpdater ( KVStoreHandle  handle,
MXKVStoreUpdater  updater,
void *  updater_handle 
)

register a push updater

Parameters
handlehandle to the KVStore
updaterudpater function
updater_handleThe additional handle used to invoke the updater
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXKVStoreSetUpdaterEx ( KVStoreHandle  handle,
MXKVStoreUpdater  updater,
MXKVStoreStrUpdater  str_updater,
void *  updater_handle 
)

register a push updater with int keys and one with string keys

Parameters
handlehandle to the KVStore
updaterupdater function with int keys
str_updaterupdater function with string keys
updater_handleThe additional handle used to invoke the updater
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXLibInfoFeatures ( const struct LibFeature **  libFeature,
size_t *  size 
)

Get list of features supported on the runtime.

Parameters
libFeaturepointer to array of LibFeature
sizeof the array
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXListAllOpNames ( uint32_t *  out_size,
const char ***  out_array 
)

list all the available operator names, include entries.

Parameters
out_sizethe size of returned array
out_arraythe output operator name array.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXListDataIters ( uint32_t *  out_size,
DataIterCreator **  out_array 
)

List all the available iterator entries.

Parameters
out_sizethe size of returned iterators
out_arraythe output iteratos entries
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXListFunctions ( uint32_t *  out_size,
FunctionHandle **  out_array 
)

list all the available functions handles most user can use it to list all the needed functions

Parameters
out_sizethe size of returned array
out_arraythe output function array
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXLoadLib ( const char *  path,
unsigned  verbose 
)

Load library dynamically.

Parameters
pathto the library .so file
0for quiet, 1 for verbose
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXNDArrayAt ( NDArrayHandle  handle,
uint32_t  idx,
NDArrayHandle out 
)

Index the NDArray along axis 0. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default)

Parameters
handlethe handle to the NDArray
idxthe index
outThe NDArrayHandle of output NDArray
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayAt64 ( NDArrayHandle  handle,
int64_t  idx,
NDArrayHandle out 
)

Index the NDArray along axis 0. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support.

Parameters
handlethe handle to the NDArray
idxthe index
outThe NDArrayHandle of output NDArray
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayCallDLPackDeleter ( DLManagedTensorHandle  dlpack)

Delete a dlpack tensor.

Parameters
dlpackthe pointer of the input DLManagedTensor
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayCreate ( const uint32_t *  shape,
uint32_t  ndim,
int  dev_type,
int  dev_id,
int  delay_alloc,
NDArrayHandle out 
)

create a NDArray with specified shape

Parameters
shapethe pointer to the shape
ndimthe dimension of the shape
dev_typedevice type, specify device we want to take
dev_idthe device id of the specific device
delay_allocwhether to delay allocation until the narray is first mutated
outthe returning handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayCreateEx ( const uint32_t *  shape,
uint32_t  ndim,
int  dev_type,
int  dev_id,
int  delay_alloc,
int  dtype,
NDArrayHandle out 
)

create a NDArray with specified shape and data type This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default)

Parameters
shapethe pointer to the shape
ndimthe dimension of the shape
dev_typedevice type, specify device we want to take
dev_idthe device id of the specific device
delay_allocwhether to delay allocation until the narray is first mutated
dtypedata type of created array
outthe returning handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayCreateEx64 ( const int64_t *  shape,
int  ndim,
int  dev_type,
int  dev_id,
int  delay_alloc,
int  dtype,
NDArrayHandle out 
)

create a NDArray with specified shape and data type This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support

Parameters
shapethe pointer to int64_t shape
ndimthe dimension of the shape
dev_typedevice type, specify device we want to take
dev_idthe device id of the specific device
delay_allocwhether to delay allocation until the narray is first mutated
dtypedata type of created array
outthe returning handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayCreateFromSharedMem ( int  shared_pid,
int  shared_id,
const uint32_t *  shape,
uint32_t  ndim,
int  dtype,
NDArrayHandle out 
)

DEPRECATED. Use MXNDArrayCreateFromSharedMemEx instead. Reconstruct NDArray from shared memory handle.

Parameters
shared_pidshared PID
shared_idshared memory id
shapepointer to NDArray dimensions
ndimnumber of NDArray dimensions
dtypedata type of NDArray
outconstructed NDArray
MXNET_DLL int MXNDArrayCreateFromSharedMemEx ( int  shared_pid,
int  shared_id,
const int *  shape,
int  ndim,
int  dtype,
NDArrayHandle out 
)

Reconstruct NDArray from shared memory handle.

Parameters
shared_pidshared PID
shared_idshared memory id
shapepointer to NDArray dimensions
ndimnumber of NDArray dimensions
dtypedata type of NDArray
outconstructed NDArray
MXNET_DLL int MXNDArrayCreateNone ( NDArrayHandle out)

Load TVM operator from the binary library.

Parameters
libpathTVM operators lib file
Returns
0 when success, -1 when failure happens

create a NDArray handle that is not initialized can be used to pass in as mutate variables to hold the result of NDArray

Parameters
outthe returning handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayCreateSparseEx ( int  storage_type,
const uint32_t *  shape,
uint32_t  ndim,
int  dev_type,
int  dev_id,
int  delay_alloc,
int  dtype,
uint32_t  num_aux,
int *  aux_type,
uint32_t *  aux_ndims,
const uint32_t *  aux_shape,
NDArrayHandle out 
)

create an empty sparse NDArray with specified shape and data type This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default)

Parameters
storage_typethe storage type of the ndarray
shapethe pointer to the shape
ndimthe dimension of the shape
dev_typedevice type, specify device we want to take
dev_idthe device id of the specific device
delay_allocwhether to delay allocation until the narray is first mutated
dtypedata type of created array
num_auxthe number of aux data to support this ndarray
aux_typedata type of the aux data for the created array
aux_ndimsthe dimension of the shapes of aux data
aux_shapethe shapes of aux data
outthe returning handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayCreateSparseEx64 ( int  storage_type,
const int64_t *  shape,
int  ndim,
int  dev_type,
int  dev_id,
int  delay_alloc,
int  dtype,
uint32_t  num_aux,
int *  aux_type,
int *  aux_ndims,
const int64_t *  aux_shape,
NDArrayHandle out 
)

create an empty sparse NDArray with specified shape and data type This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support

Parameters
storage_typethe storage type of the ndarray
shapethe pointer to the shape
ndimthe dimension of the shape
dev_typedevice type, specify device we want to take
dev_idthe device id of the specific device
delay_allocwhether to delay allocation until the narray is first mutated
dtypedata type of created array
num_auxthe number of aux data to support this ndarray
aux_typedata type of the aux data for the created array
aux_ndimsthe dimension of the shapes of aux data
aux_shapethe shapes of aux data
outthe returning handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayDetach ( NDArrayHandle  handle,
NDArrayHandle out 
)

detach and ndarray from computation graph by clearing entry_

Parameters
handleNDArray handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayFree ( NDArrayHandle  handle)

free the narray handle

Parameters
handlethe handle to be freed
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayFromDLPack ( DLManagedTensorHandle  dlpack,
NDArrayHandle out_handle 
)

DEPRECATED. Use MXNDArrayFromDLPackEx instead.

This allows us to create a NDArray using the memory allocated by an external deep learning framework that is DLPack compatible.

The memory is retained until the NDArray went out of scope.

Parameters
dlpackthe pointer of the input DLManagedTensor
transient_handlewhether the handle will be destructed before calling the deleter
out_handlepointer holder to get pointer of NDArray
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayFromDLPackEx ( DLManagedTensorHandle  dlpack,
const bool  transient_handle,
NDArrayHandle out_handle 
)

Create a NDArray backed by a dlpack tensor.

This allows us to create a NDArray using the memory allocated by an external deep learning framework that is DLPack compatible.

The memory is retained until the NDArray went out of scope.

Parameters
dlpackthe pointer of the input DLManagedTensor
transient_handlewhether the handle will be destructed before calling the deleter
out_handlepointer holder to get pointer of NDArray
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayGetAuxNDArray ( NDArrayHandle  handle,
uint32_t  i,
NDArrayHandle out 
)

Get a deep copy of the ith aux data blob This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default) in the form of an NDArray of default storage type. This function blocks. Do not use it in performance critical code.

MXNET_DLL int MXNDArrayGetAuxNDArray64 ( NDArrayHandle  handle,
int64_t  i,
NDArrayHandle out 
)

Get a deep copy of the ith aux data blob This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support in the form of an NDArray of default storage type. This function blocks. Do not use it in performance critical code.

MXNET_DLL int MXNDArrayGetAuxType ( NDArrayHandle  handle,
uint32_t  i,
int *  out_type 
)

get the type of the ith aux data in NDArray This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default)

Parameters
handlethe handle to the narray
ithe index of the aux data
out_typepointer holder to get type of aux data
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayGetAuxType64 ( NDArrayHandle  handle,
int64_t  i,
int *  out_type 
)

get the type of the ith aux data in NDArray This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support

Parameters
handlethe handle to the narray
ithe index of the aux data
out_typepointer holder to get type of aux data
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayGetContext ( NDArrayHandle  handle,
int *  out_dev_type,
int *  out_dev_id 
)

get the context of the NDArray

Parameters
handlethe handle to the narray
out_dev_typethe output device type
out_dev_idthe output device id
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayGetData ( NDArrayHandle  handle,
void **  out_pdata 
)

get the content of the data in NDArray

Parameters
handlethe handle to the ndarray
out_pdatapointer holder to get pointer of data
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayGetDataNDArray ( NDArrayHandle  handle,
NDArrayHandle out 
)

Get a deep copy of the data blob in the form of an NDArray of default storage type. This function blocks. Do not use it in performance critical code.

MXNET_DLL int MXNDArrayGetDType ( NDArrayHandle  handle,
int *  out_dtype 
)

get the type of the data in NDArray

Parameters
handlethe handle to the narray
out_dtypepointer holder to get type of data
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayGetGrad ( NDArrayHandle  handle,
NDArrayHandle out 
)

return gradient buffer attached to this NDArray

Parameters
handleNDArray handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayGetGradState ( NDArrayHandle  handle,
int *  out 
)

set the flag for gradient array state.

Parameters
handleNDArray handle
statethe new state.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayGetShape ( NDArrayHandle  handle,
uint32_t *  out_dim,
const uint32_t **  out_pdata 
)

DEPRECATED. Use MXNDArrayGetShapeEx instead. get the shape of the array.

Parameters
handlethe handle to the narray
out_dimthe output dimension
out_pdatapointer holder to get data pointer of the shape
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayGetShapeEx ( NDArrayHandle  handle,
int *  out_dim,
const int **  out_pdata 
)

get the shape of the array This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default)

Parameters
handlethe handle to the narray
out_dimthe output dimension
out_pdatapointer holder to get data pointer of the shape
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayGetShapeEx64 ( NDArrayHandle  handle,
int *  out_dim,
const int64_t **  out_pdata 
)

get the shape of the array This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support

Parameters
handlethe handle to the narray
out_dimthe output dimension
out_pdatapointer holder to get data pointer of the shape
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayGetSharedMemHandle ( NDArrayHandle  handle,
int *  shared_pid,
int *  shared_id 
)

Get shared memory handle from NDArray.

Parameters
handleNDArray handle.
shared_pidoutput PID
shared_idoutput shared memory id.
MXNET_DLL int MXNDArrayGetStorageType ( NDArrayHandle  handle,
int *  out_storage_type 
)

get the storage type of the array

MXNET_DLL int MXNDArrayLoad ( const char *  fname,
uint32_t *  out_size,
NDArrayHandle **  out_arr,
uint32_t *  out_name_size,
const char ***  out_names 
)

Load list of narray from the file.

Parameters
fnamename of the file.
out_sizenumber of narray loaded.
out_arrhead of the returning narray handles.
out_name_sizesize of output name arrray.
out_namesthe names of returning NDArrays, can be NULL
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayLoadFromBuffer ( const void *  ndarray_buffer,
size_t  size,
uint32_t *  out_size,
NDArrayHandle **  out_arr,
uint32_t *  out_name_size,
const char ***  out_names 
)

Load list / dictionary of narrays from file content loaded into memory. This will load a list of ndarrays in a similar manner to MXNDArrayLoad, however, it loads from buffer containing the contents of a file, rather than from a specified file.

Parameters
ndarray_bufferpointer to the start of the ndarray file content
sizesize of the file
out_sizenumber of narray loaded.
out_arrhead of the returning narray handles.
out_name_sizesize of output name arrray.
out_namesthe names of returning NDArrays, can be NULL
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayLoadFromRawBytes ( const void *  buf,
size_t  size,
NDArrayHandle out 
)

create a NDArray handle that is loaded from raw bytes.

Parameters
bufthe head of the raw bytes
sizesize of the raw bytes
outthe returning handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayReshape ( NDArrayHandle  handle,
int  ndim,
int *  dims,
NDArrayHandle out 
)

Reshape the NDArray.

Parameters
handlethe handle to the narray
ndimnumber of dimensions of new shape
dimsnew shape
outthe NDArrayHandle of reshaped NDArray
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayReshape64 ( NDArrayHandle  handle,
int  ndim,
dim_t dims,
bool  reverse,
NDArrayHandle out 
)

Reshape the NDArray.

Parameters
handlethe handle to the narray
ndimnumber of dimensions of new shape
dimsnew shape
outthe NDArrayHandle of reshaped NDArray
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArraySave ( const char *  fname,
uint32_t  num_args,
NDArrayHandle args,
const char **  keys 
)

Save list of narray into the file.

Parameters
fnamename of the file.
num_argsnumber of arguments to save.
argsthe array of NDArrayHandles to be saved.
keysthe name of the NDArray, optional, can be NULL
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArraySaveRawBytes ( NDArrayHandle  handle,
size_t *  out_size,
const char **  out_buf 
)

save the NDArray into raw bytes.

Parameters
handlethe NDArray handle
out_sizesize of the raw bytes
out_bufthe head of returning memory bytes.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArraySetGradState ( NDArrayHandle  handle,
int  state 
)

set the flag for gradient array state.

Parameters
handleNDArray handle
statethe new state.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArraySlice ( NDArrayHandle  handle,
uint32_t  slice_begin,
uint32_t  slice_end,
NDArrayHandle out 
)

Slice the NDArray along axis 0. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default)

Parameters
handlethe handle to the NDArray
slice_beginThe beginning index of slice
slice_endThe ending index of slice
outThe NDArrayHandle of sliced NDArray
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArraySlice64 ( NDArrayHandle  handle,
int64_t  slice_begin,
int64_t  slice_end,
NDArrayHandle out 
)

Slice the NDArray along axis 0. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support.

Parameters
handlethe handle to the NDArray
slice_beginThe beginning index of slice
slice_endThe ending index of slice
outThe NDArrayHandle of sliced NDArray
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArraySyncCheckFormat ( NDArrayHandle  handle,
const bool  full_check 
)

check whether the NDArray format is valid

Parameters
full_checkif True, rigorous check, O(N) operations Otherwise basic check, O(1) operations
MXNET_DLL int MXNDArraySyncCopyFromCPU ( NDArrayHandle  handle,
const void *  data,
size_t  size 
)

Perform a synchronize copy from a contiguous 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).

Parameters
handlethe NDArray handle
datathe data source to copy from.
sizethe memory size we want to copy from.
MXNET_DLL int MXNDArraySyncCopyFromNDArray ( NDArrayHandle  handle_dst,
const NDArrayHandle  handle_src,
const int  i 
)

Copy src.data() to dst.data() if i = -1, else dst.aux_data(i) if i >= 0 This function blocks. Do not use it in performance critical code.

Parameters
handle_dsthandle of a dst ndarray whose data/aux_data has been allocated
handle_srchandle of a src ndarray which has default storage type
idst data blob indicator
MXNET_DLL int MXNDArraySyncCopyToCPU ( NDArrayHandle  handle,
void *  data,
size_t  size 
)

Perform a synchronize copyto a contiguous 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).

Parameters
handlethe NDArray handle
datathe data source to copy into.
sizethe memory size we want to copy into.
MXNET_DLL int MXNDArrayToDLPack ( NDArrayHandle  handle,
DLManagedTensorHandle out_dlpack 
)

Create a reference view of NDArray that represents as DLManagedTensor Notice: MXNet uses asynchronous execution. Please call MXNDArrayWaitToRead or MXNDArrayWaitToWrite before calling MXNDArrayToDLPack.

Parameters
handlethe handle to the ndarray
out_dlpackpointer holder to get pointer of DLManagedTensor
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXNDArrayWaitAll ( )

wait until all delayed operations in the system is completed

Returns
0 when success, -1 when failure happens
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.

Parameters
handlethe NDArray handle
Returns
0 when success, -1 when failure happens
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.

Parameters
handlethe NDArray handle
Returns
0 when success, -1 when failure happens
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.

Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXOptimizeForBackend ( SymbolHandle  sym_handle,
const char *  backend_name,
const int  dev_type,
SymbolHandle ret_sym_handle,
const mx_uint  args_len,
NDArrayHandle in_args_handle,
const mx_uint  aux_len,
NDArrayHandle in_aux_handle,
const mx_uint  num_options,
const char **  keys,
const char **  vals,
int *  new_args_cnt,
NDArrayHandle **  new_args_handle,
char ***  new_arg_names_handle,
int *  new_aux_cnt,
NDArrayHandle **  new_aux_handle,
char ***  new_aux_names_handle 
)

Partitions symbol for given backend, potentially creating subgraphs.

Parameters
sym_handlesymbol to be partitioned
dev_typecontext device type
backend_namebackend name
ret_sym_handlepartitioned symbol returned
lennumber of args
in_args_handleargs array
num_optionsnumber of key value pairs
keyskeys for options
valsvalues corresponding to keys
MXNET_DLL int MXProcessProfilePause ( int  paused,
int  profile_process,
KVStoreHandle  kvStoreHandle 
)

Pause profiler tuning collection.

Parameters
pausedIf nonzero, profiling pauses. Otherwise, profiling resumes/continues
profile_processinteger which denotes whether to process worker or server process
kvstoreHandlehandle to kvstore
Returns
0 when success, -1 when failure happens.
Note
pausing and resuming is global and not recursive
MXNET_DLL int MXProfileAdjustCounter ( ProfileHandle  counter_handle,
int64_t  value 
)

Adjust a counter by the given amount, given its handle.

Parameters
counter_handleHandle to counter to adjust
valueValue to adjust the counter by (64-bit signed integer)
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXProfileCreateCounter ( ProfileHandle  domain,
const char *  counter_name,
ProfileHandle out 
)

Create profile counter.

Parameters
nameName of the counter
domainDomain of the counter
outOutput handle
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXProfileCreateDomain ( const char *  domain,
ProfileHandle out 
)

Create profiling domain.

Parameters
domainString representing the domain name to create
outReturn domain object
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXProfileCreateEvent ( const char *  event_name,
ProfileHandle out 
)

Create profile event.

Parameters
nameName of the event
outOutput handle
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXProfileCreateFrame ( ProfileHandle  domain,
const char *  frame_name,
ProfileHandle out 
)

Create profile frame.

Parameters
nameName of the frame
domainDomain of the frame
outOutput handle
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXProfileCreateTask ( ProfileHandle  domain,
const char *  task_name,
ProfileHandle out 
)

Create profile task.

Parameters
nameName of the task
domainDomain of the task
outOutput handle
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXProfileDestroyHandle ( ProfileHandle  frame_handle)

Destroy a frame.

Parameters
frame_handleHandle to frame to destroy
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXProfileDurationStart ( ProfileHandle  duration_handle)

Start timing the duration of a profile duration object such as an event, task or frame.

Parameters
duration_handlehandle to the duration object
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXProfileDurationStop ( ProfileHandle  duration_handle)

Stop timing the duration of a profile duration object such as an event, task or frame.

Parameters
duration_handlehandle to the duration object
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXProfilePause ( int  paused)

Pause profiler tuning collection for worker/current process.

Parameters
pausedIf nonzero, profiling pauses. Otherwise, profiling resumes/continues
Returns
0 when success, -1 when failure happens.
Note
pausing and resuming is global and not recursive
MXNET_DLL int MXProfileSetCounter ( ProfileHandle  counter_handle,
uint64_t  value 
)

Set a counter, given its handle.

Parameters
counter_handleHandle to counter to set
valueValue to set the counter to (64-bit unsigned integer)
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXProfileSetMarker ( ProfileHandle  domain,
const char *  instant_marker_name,
const char *  scope 
)

Mark a single instant in time.

Parameters
domainDomain of the marker
instant_marker_nameName of the marker
scopeScope of marker ('global', 'process', 'thread', 'task', 'marker')
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXQuantizeSymbol ( SymbolHandle  sym_handle,
SymbolHandle ret_sym_handle,
const int *  dev_type,
const uint32_t  num_excluded_sym_names,
const char **  excluded_sym_names,
const uint32_t  num_excluded_op_names,
const char **  excluded_op_names,
const uint32_t  num_offline,
const char **  offline_params,
const char *  quantized_dtype,
const bool  calib_quantize,
const char *  quantize_mode,
const char *  quantize_granularity,
uint32_t *  out_num_calib_names,
const char ***  out_calib_names 
)

Convert a symbol into a quantized symbol where FP32 operators are replaced with INT8.

Parameters
sym_handlesymbol to be converted
ret_sym_handlequantized symbol result
dev_typedevice type
num_excluded_sym_namesnumber of layers excluded from being quantized in the input symbol
excluded_sym_namesnode names to be excluded from being quantized
num_excluded_op_namesnumber of operators excluded from being quantized in the input symbol
excluded_op_namesoperator names to be excluded from being quantized
num_offlinenumber of parameters that are quantized offline
offline_paramsarray of c strings representing the names of params quantized offline
quantized_dtypethe quantized destination type for input data
calib_quantizeDeprecated. quantize op will always be calibrated if could
quantize_modequantize mode to be used in quantize pass
quantize_granularityquantize granularity, tensor-wise or channel-wise
out_num_calib_namesreturn the number of nodes to be calibrated
out_calib_namesreturn the node names to be calibrated
MXNET_DLL int MXRandomSeed ( int  seed)

Seed all global random number generators in mxnet.

Parameters
seedthe random number seed.
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXRandomSeedContext ( int  seed,
int  dev_type,
int  dev_id 
)

Seed the global random number generator of the given device.

Parameters
seedthe random number seed.
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXRecordIOReaderCreate ( const char *  uri,
RecordIOHandle out 
)

Create a RecordIO reader object.

Parameters
uripath to file
outhandle pointer to the created object
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXRecordIOReaderFree ( RecordIOHandle  handle)

Delete a RecordIO reader object.

Parameters
handlehandle to RecordIO object
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXRecordIOReaderReadRecord ( RecordIOHandle  handle,
char const **  buf,
size_t *  size 
)

Write a record to a RecordIO object.

Parameters
handlehandle to RecordIO object
bufpointer to return buffer
sizepoint to size of buffer
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXRecordIOReaderSeek ( RecordIOHandle  handle,
size_t  pos 
)

Set the current reader pointer position.

Parameters
handlehandle to RecordIO object
postarget position
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXRecordIOReaderTell ( RecordIOHandle  handle,
size_t *  pos 
)

Get the current writer pointer position.

Parameters
handlehandle to RecordIO object
poshandle to output position
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXRecordIOWriterCreate ( const char *  uri,
RecordIOHandle out 
)

Create a RecordIO writer object.

Parameters
uripath to file
outhandle pointer to the created object
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXRecordIOWriterFree ( RecordIOHandle  handle)

Delete a RecordIO writer object.

Parameters
handlehandle to RecordIO object
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXRecordIOWriterTell ( RecordIOHandle  handle,
size_t *  pos 
)

Get the current writer pointer position.

Parameters
handlehandle to RecordIO object
poshandle to output position
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXRecordIOWriterWriteRecord ( RecordIOHandle  handle,
const char *  buf,
size_t  size 
)

Write a record to a RecordIO object.

Parameters
handlehandle to RecordIO object
bufbuffer to write
sizesize of buffer
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXReducePrecisionSymbol ( SymbolHandle  sym_handle,
SymbolHandle ret_sym_handle,
uint32_t  num_args,
const int *  arg_type_data,
uint32_t  num_ind_ptr,
const int *  ind_ptr,
const int *  target_dtype,
const int  cast_optional_params,
const uint32_t  num_target_dtype_op_names,
const uint32_t  num_fp32_op_names,
const uint32_t  num_widest_dtype_op_names,
const uint32_t  num_conditional_fp32_op_names,
const uint32_t  num_excluded_symbols,
const uint32_t  num_model_params,
const char **  target_dtype_op_names,
const char **  fp32_op_names,
const char **  widest_dtype_op_names,
const char **  conditional_fp32_op_names,
const char **  excluded_symbols,
const char **  conditional_param_names,
const char **  conditional_param_vals,
const char **  model_param_names,
const char **  arg_names 
)

Convert a symbol into a mixed precision symbol with cast operators for target dtype casting.

Parameters
sym_handlesymbol to be converted
ret_sym_handlemixed precision symbol result
num_argsnumber of arguments for known dtypes
arg_type_dataarg types of the arguments
target_dtypetarget_dtype for mixed precision symbol
cast_optional_paramswhether to cast optional params to target_dtype
num_target_dtype_op_namesnumber of ops to be casted to target_dtype
num_fp32_op_namesnumber of ops to be casted to FP32
num_widest_dtype_op_namesnumber of ops to be casted to widest dtype
num_conditional_fp32_op_namesnumber of ops to be casted to FP32 based on a condition
num_excluded_symbolsnumber of symbols to be excluded from casting
num_model_paramsnumber of model parameters
num_widest_dtype_op_namesnumber of ops to be casted to the widest dtype
num_conditional_fp32_op_namesnumber of ops to be cast to fp32 based on precision
target_dtype_op_namesop names to be casted to target_dtype
fp32_op_namesop names to be casted to fp32
widest_dtype_op_namesnames to be casted to widest dtype
conditional_fp32_op_namesnames to be casted to FP32 conditionally
excluded_symbolssymbol names to be excluded from casting
param_namesparam names for conditional FP32 casting
param_valuesparam values for conditional FP32 casting
arg_namesargument names for which type information is provided
model_param_namesnames for model parameters
MXNET_DLL int MXRtcCreate ( char *  name,
uint32_t  num_input,
uint32_t  num_output,
char **  input_names,
char **  output_names,
NDArrayHandle inputs,
NDArrayHandle outputs,
char *  kernel,
RtcHandle out 
)

Create a MXRtc object.

MXNET_DLL int MXRtcCudaKernelCall ( CudaKernelHandle  handle,
int  dev_id,
void **  args,
uint32_t  grid_dim_x,
uint32_t  grid_dim_y,
uint32_t  grid_dim_z,
uint32_t  block_dim_x,
uint32_t  block_dim_y,
uint32_t  block_dim_z,
uint32_t  shared_mem 
)
MXNET_DLL int MXRtcCudaKernelCreate ( CudaModuleHandle  handle,
const char *  name,
int  num_args,
int *  is_ndarray,
int *  is_const,
int *  arg_types,
CudaKernelHandle out 
)
MXNET_DLL int MXRtcCudaKernelFree ( CudaKernelHandle  handle)
MXNET_DLL int MXRtcCudaModuleCreate ( const char *  source,
int  num_options,
const char **  options,
int  num_exports,
const char **  exports,
CudaModuleHandle out 
)
MXNET_DLL int MXRtcCudaModuleFree ( CudaModuleHandle  handle)
MXNET_DLL int MXRtcFree ( RtcHandle  handle)

Delete a MXRtc object.

MXNET_DLL int MXRtcPush ( RtcHandle  handle,
uint32_t  num_input,
uint32_t  num_output,
NDArrayHandle inputs,
NDArrayHandle outputs,
uint32_t  gridDimX,
uint32_t  gridDimY,
uint32_t  gridDimZ,
uint32_t  blockDimX,
uint32_t  blockDimY,
uint32_t  blockDimZ 
)

Run cuda kernel.

MXNET_DLL int MXSetCalibTableToQuantizedSymbol ( SymbolHandle  qsym_handle,
const uint32_t  num_layers,
const char **  layer_names,
const float *  low_quantiles,
const float *  high_quantiles,
SymbolHandle ret_sym_handle 
)

Set calibration table to node attributes in the sym.

Parameters
sym_handlesymbol whose node attributes are to be set by calibration table
num_layersnumber of layers in the calibration table
layernames stored as keys in the calibration table
low_quantileslow quantiles of layers stored in the calibration table
high_quantileshigh quantiles of layers stored in the calibration table
ret_sym_handlereturned symbol
MXNET_DLL int MXSetIsNumpyShape ( int  is_np_shape,
int *  prev 
)

set numpy compatibility switch

Parameters
is_np_shape1 when numpy shape semantics is thread local on, 2 when numpy shape semantics is global on and 0 when off
prevreturns the previous status before this set
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSetNumOMPThreads ( int  thread_num)

Set the number of OMP threads to use.

Parameters
thread_numNumber of OMP threads desired
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXSetProcessProfilerConfig ( int  num_params,
const char *const *  keys,
const char *const *  vals,
KVStoreHandle  kvstoreHandle 
)

Set up configuration of profiler for the process passed as profile_process in keys.

Parameters
num_paramsNumber of parameters
keysarray of parameter keys
valsarray of parameter values
kvstoreHandlehandle to kvstore
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXSetProcessProfilerState ( int  state,
int  profile_process,
KVStoreHandle  kvStoreHandle 
)

Set up state of profiler for either worker or server process.

Parameters
stateindicate the working state of profiler, profiler not running when state == 0, profiler running when state == 1
profile_processan int, when 0 command is for worker/current process, when 1 command is for server process
kvstoreHandlehandle to kvstore, needed for server process profiling
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXSetProfilerConfig ( int  num_params,
const char *const *  keys,
const char *const *  vals 
)

Set up configuration of profiler for worker/current process.

Parameters
num_paramsNumber of parameters
keysarray of parameter keys
valsarray of parameter values
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXSetProfilerState ( int  state)

Set up state of profiler for current process.

Parameters
stateindicate the working state of profiler, profiler not running when state == 0, profiler running when state == 1
Returns
0 when success, -1 when failure happens.
MXNET_DLL int MXShallowCopyNDArray ( NDArrayHandle  src,
NDArrayHandle out 
)

Create an NDArray from source sharing the same data chunk.

Parameters
srcsource NDArray
outnew NDArray sharing the same data chunck with src
MXNET_DLL int MXShallowCopySymbol ( SymbolHandle  src,
SymbolHandle out 
)

Create an Symbol from source sharing the same graph structure.

Parameters
srcsource Symbol
outnew Symbol sharing the same graph structure with src
MXNET_DLL int MXStorageEmptyCache ( int  dev_type,
int  dev_id 
)

Release all unreferenced memory from the devices storage managers memory pool.

Parameters
dev_typedevice type, specify device we want to take
dev_idthe device id of the specific device
MXNET_DLL int MXSymbolCompose ( SymbolHandle  sym,
const char *  name,
uint32_t  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.

Parameters
symthe symbol to apply
namethe name of symbol
num_argsnumber of arguments
keysthe key of keyword args (optional)
argsarguments to sym
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolCopy ( SymbolHandle  symbol,
SymbolHandle out 
)

Copy the symbol to another handle.

Parameters
symbolthe source symbol
outused to hold the result of copy
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolCreateAtomicSymbol ( AtomicSymbolCreator  creator,
uint32_t  num_param,
const char **  keys,
const char **  vals,
SymbolHandle out 
)

Create an AtomicSymbol.

Parameters
creatorthe AtomicSymbolCreator
num_paramthe number of parameters
keysthe keys to the params
valsthe vals of the params
outpointer to the created symbol handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolCreateFromFile ( const char *  fname,
SymbolHandle out 
)

Load a symbol from a json file.

Parameters
fnamethe file name.
outthe output symbol.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolCreateFromJSON ( const char *  json,
SymbolHandle out 
)

Load a symbol from a json string.

Parameters
jsonthe json string.
outthe output symbol.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolCreateGroup ( uint32_t  num_symbols,
SymbolHandle symbols,
SymbolHandle out 
)

Create a Symbol by grouping list of symbols together.

Parameters
num_symbolsnumber of symbols to be grouped
symbolsarray of symbol handles
outpointer to the created symbol handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolCreateVariable ( const char *  name,
SymbolHandle out 
)

Create a Variable Symbol.

Parameters
namename of the variable
outpointer to the created symbol handle
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolCutSubgraph ( SymbolHandle  sym,
SymbolHandle **  inputs,
int *  input_size 
)

Cut a subgraph whose nodes are marked with a subgraph attribute. The input graph will be modified. A variable node will be created for each edge that connects to nodes outside the subgraph. The outside nodes that connect to the subgraph will be returned.

Parameters
symThe graph.
inputsThe nodes that connect to the subgraph.
input_sizeThe number of such nodes.
MXNET_DLL int MXSymbolFree ( SymbolHandle  symbol)

Free the symbol handle.

Parameters
symbolthe symbol
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolGetAtomicSymbolInfo ( AtomicSymbolCreator  creator,
const char **  name,
const char **  description,
uint32_t *  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.

Parameters
creatorthe AtomicSymbolCreator.
nameThe returned name of the creator.
descriptionThe returned description of the symbol.
num_argsNumber of arguments.
arg_namesName of the arguments.
arg_type_infosType informations about the arguments.
arg_descriptionsDescription information about the arguments.
key_var_num_argsThe 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_typeReturn type of the function, can be Symbol or Symbol[]
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolGetAtomicSymbolName ( AtomicSymbolCreator  creator,
const char **  name 
)

Get the name of an atomic symbol.

Parameters
creatorthe AtomicSymbolCreator.
nameThe returned name of the creator.
MXNET_DLL int MXSymbolGetAttr ( SymbolHandle  symbol,
const char *  key,
const char **  out,
int *  success 
)

Get string attribute from symbol.

Parameters
symbolthe source symbol
keyThe key of the symbol.
outThe result attribute, can be NULL if the attribute do not exist.
successWhether the result is contained in out.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolGetChildren ( SymbolHandle  symbol,
SymbolHandle out 
)

Get a symbol that contains only direct children.

Parameters
symbolThe symbol
outThe output symbol whose outputs are the direct children.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolGetInputSymbols ( SymbolHandle  sym,
SymbolHandle **  inputs,
int *  input_size 
)

Get the input symbols of the graph.

Parameters
symThe graph.
inputsThe input symbols of the graph.
input_sizethe number of input symbols returned.
MXNET_DLL int MXSymbolGetInternals ( SymbolHandle  symbol,
SymbolHandle out 
)

Get a symbol that contains all the internals.

Parameters
symbolThe symbol
outThe output symbol whose outputs are all the internals.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolGetName ( SymbolHandle  symbol,
const char **  out,
int *  success 
)

Get string name from symbol.

Parameters
symbolthe source symbol
outThe result name.
successWhether the result is contained in out.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolGetNumOutputs ( SymbolHandle  symbol,
uint32_t *  output_count 
)

Get number of outputs of the symbol.

Parameters
symbolThe symbol
out_sizenumber of outputs
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolGetOutput ( SymbolHandle  symbol,
uint32_t  index,
SymbolHandle out 
)

Get index-th outputs of the symbol.

Parameters
symbolThe symbol
indexthe Index of the output.
outThe output symbol whose outputs are the index-th symbol.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolGrad ( SymbolHandle  sym,
uint32_t  num_wrt,
const char **  wrt,
SymbolHandle out 
)

Get the gradient graph of the symbol.

Parameters
symthe symbol to get gradient
num_wrtnumber of arguments to get gradient
wrtthe name of the arguments to get gradient
outthe returned symbol that has gradient
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolInferShape ( SymbolHandle  sym,
uint32_t  num_args,
const char **  keys,
const uint32_t *  arg_ind_ptr,
const uint32_t *  arg_shape_data,
uint32_t *  in_shape_size,
const uint32_t **  in_shape_ndim,
const uint32_t ***  in_shape_data,
uint32_t *  out_shape_size,
const uint32_t **  out_shape_ndim,
const uint32_t ***  out_shape_data,
uint32_t *  aux_shape_size,
const uint32_t **  aux_shape_ndim,
const uint32_t ***  aux_shape_data,
int *  complete 
)

DEPRECATED. Use MXSymbolInferShapeEx instead. 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 != NULL or num_args==0, otherwise it is positional.

Parameters
symsymbol handle
num_argsnumbe of input arguments.
keysthe key of keyword args (optional)
arg_ind_ptrthe head pointer of the rows in CSR
arg_shape_datathe content of the CSR
in_shape_sizesizeof the returning array of in_shapes
in_shape_ndimreturning array of shape dimensions of each input shape.
in_shape_datareturning array of pointers to head of the input shape.
out_shape_sizesizeof the returning array of out_shapes
out_shape_ndimreturning array of shape dimensions of each output shape.
out_shape_datareturning array of pointers to head of the output shape.
aux_shape_sizesizeof the returning array of aux_shapes
aux_shape_ndimreturning array of shape dimensions of each auxiliary shape.
aux_shape_datareturning array of pointers to head of the auxiliary shape.
completewhether infer shape completes or more information is needed.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolInferShapeEx ( SymbolHandle  sym,
uint32_t  num_args,
const char **  keys,
const uint32_t *  arg_ind_ptr,
const int *  arg_shape_data,
uint32_t *  in_shape_size,
const int **  in_shape_ndim,
const int ***  in_shape_data,
uint32_t *  out_shape_size,
const int **  out_shape_ndim,
const int ***  out_shape_data,
uint32_t *  aux_shape_size,
const int **  aux_shape_ndim,
const int ***  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 != NULL or num_args==0, otherwise it is positional. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default)

Parameters
symsymbol handle
num_argsnumber of input arguments.
keysthe key of keyword args (optional)
arg_ind_ptrthe head pointer of the rows in CSR
arg_shape_datathe content of the CSR
in_shape_sizesizeof the returning array of in_shapes
in_shape_ndimreturning array of shape dimensions of eachs input shape.
in_shape_datareturning array of pointers to head of the input shape.
out_shape_sizesizeof the returning array of out_shapes
out_shape_ndimreturning array of shape dimensions of each output shape.
out_shape_datareturning array of pointers to head of the output shape.
aux_shape_sizesizeof the returning array of aux_shapes
aux_shape_ndimreturning array of shape dimensions of each auxiliary shape.
aux_shape_datareturning array of pointers to head of the auxiliary shape.
completewhether infer shape completes or more information is needed.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolInferShapeEx64 ( SymbolHandle  sym,
uint32_t  num_args,
const char **  keys,
const int64_t *  arg_ind_ptr,
const int64_t *  arg_shape_data,
size_t *  in_shape_size,
const int **  in_shape_ndim,
const int64_t ***  in_shape_data,
size_t *  out_shape_size,
const int **  out_shape_ndim,
const int64_t ***  out_shape_data,
size_t *  aux_shape_size,
const int **  aux_shape_ndim,
const int64_t ***  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 != NULL or num_args==0, otherwise it is positional. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support

Parameters
symsymbol handle
num_argsnumber of input arguments.
keysthe key of keyword args (optional)
arg_ind_ptrthe head pointer of the rows in CSR
arg_shape_datathe content of the CSR
in_shape_sizesizeof the returning array of in_shapes
in_shape_ndimreturning array of shape dimensions of each input shape.
in_shape_datareturning array of pointers to head of the input shape.
out_shape_sizesizeof the returning array of out_shapes
out_shape_ndimreturning array of shape dimensions of each output shape.
out_shape_datareturning array of pointers to head of the output shape.
aux_shape_sizesizeof the returning array of aux_shapes
aux_shape_ndimreturning array of shape dimensions of each auxiliary shape.
aux_shape_datareturning array of pointers to head of the auxiliary shape.
completewhether infer shape completes or more information is needed.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolInferShapePartial ( SymbolHandle  sym,
uint32_t  num_args,
const char **  keys,
const uint32_t *  arg_ind_ptr,
const uint32_t *  arg_shape_data,
uint32_t *  in_shape_size,
const uint32_t **  in_shape_ndim,
const uint32_t ***  in_shape_data,
uint32_t *  out_shape_size,
const uint32_t **  out_shape_ndim,
const uint32_t ***  out_shape_data,
uint32_t *  aux_shape_size,
const uint32_t **  aux_shape_ndim,
const uint32_t ***  aux_shape_data,
int *  complete 
)

DEPRECATED. Use MXSymbolInferShapePartialEx instead. 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 != NULL or num_args==0, otherwise it is positional.

Parameters
symsymbol handle
num_argsnumbe of input arguments.
keysthe key of keyword args (optional)
arg_ind_ptrthe head pointer of the rows in CSR
arg_shape_datathe content of the CSR
in_shape_sizesizeof the returning array of in_shapes
in_shape_ndimreturning array of shape dimensions of each input shape.
in_shape_datareturning array of pointers to head of the input shape.
out_shape_sizesizeof the returning array of out_shapes
out_shape_ndimreturning array of shape dimensions of each output shape.
out_shape_datareturning array of pointers to head of the output shape.
aux_shape_sizesizeof the returning array of aux_shapes
aux_shape_ndimreturning array of shape dimensions of each auxiliary shape.
aux_shape_datareturning array of pointers to head of the auxiliary shape.
completewhether infer shape completes or more information is needed.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolInferShapePartialEx ( SymbolHandle  sym,
uint32_t  num_args,
const char **  keys,
const uint32_t *  arg_ind_ptr,
const int *  arg_shape_data,
uint32_t *  in_shape_size,
const int **  in_shape_ndim,
const int ***  in_shape_data,
uint32_t *  out_shape_size,
const int **  out_shape_ndim,
const int ***  out_shape_data,
uint32_t *  aux_shape_size,
const int **  aux_shape_ndim,
const int ***  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 != NULL or num_args==0, otherwise it is positional. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by default)

Parameters
symsymbol handle
num_argsnumber of input arguments.
keysthe key of keyword args (optional)
arg_ind_ptrthe head pointer of the rows in CSR
arg_shape_datathe content of the CSR
in_shape_sizesizeof the returning array of in_shapes
in_shape_ndimreturning array of shape dimensions of each input shape.
in_shape_datareturning array of pointers to head of the input shape.
out_shape_sizesizeof the returning array of out_shapes
out_shape_ndimreturning array of shape dimensions of each output shape.
out_shape_datareturning array of pointers to head of the output shape.
aux_shape_sizesizeof the returning array of aux_shapes
aux_shape_ndimreturning array of shape dimensions of each auxiliary shape.
aux_shape_datareturning array of pointers to head of the auxiliary shape.
completewhether infer shape completes or more information is needed.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolInferShapePartialEx64 ( SymbolHandle  sym,
uint32_t  num_args,
const char **  keys,
const int64_t *  arg_ind_ptr,
const int64_t *  arg_shape_data,
size_t *  in_shape_size,
const int **  in_shape_ndim,
const int64_t ***  in_shape_data,
size_t *  out_shape_size,
const int **  out_shape_ndim,
const int64_t ***  out_shape_data,
size_t *  aux_shape_size,
const int **  aux_shape_ndim,
const int64_t ***  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 != NULL or num_args==0, otherwise it is positional. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not default) i.e. Large Tensor Support

Parameters
symsymbol handle
num_argsnumber of input arguments.
keysthe key of keyword args (optional)
arg_ind_ptrthe head pointer of the rows in CSR
arg_shape_datathe content of the CSR
in_shape_sizesizeof the returning array of in_shapes
in_shape_ndimreturning array of shape dimensions of each input shape.
in_shape_datareturning array of pointers to head of the input shape.
out_shape_sizesizeof the returning array of out_shapes
out_shape_ndimreturning array of shape dimensions of each output shape.
out_shape_datareturning array of pointers to head of the output shape.
aux_shape_sizesizeof the returning array of aux_shapes
aux_shape_ndimreturning array of shape dimensions of each auxiliary shape.
aux_shape_datareturning array of pointers to head of the auxiliary shape.
completewhether infer shape completes or more information is needed.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolInferType ( SymbolHandle  sym,
uint32_t  num_args,
const char **  keys,
const int *  arg_type_data,
uint32_t *  in_type_size,
const int **  in_type_data,
uint32_t *  out_type_size,
const int **  out_type_data,
uint32_t *  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 != NULL or num_args==0, otherwise it is positional.

Parameters
symsymbol handle
num_argsnumbe of input arguments.
keysthe key of keyword args (optional)
arg_type_datathe content of the CSR
in_type_sizesizeof the returning array of in_types
in_type_datareturning array of pointers to head of the input type.
out_type_sizesizeof the returning array of out_types
out_type_datareturning array of pointers to head of the output type.
aux_type_sizesizeof the returning array of aux_types
aux_type_datareturning array of pointers to head of the auxiliary type.
completewhether infer type completes or more information is needed.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolInferTypePartial ( SymbolHandle  sym,
uint32_t  num_args,
const char **  keys,
const int *  arg_type_data,
uint32_t *  in_type_size,
const int **  in_type_data,
uint32_t *  out_type_size,
const int **  out_type_data,
uint32_t *  aux_type_size,
const int **  aux_type_data,
int *  complete 
)

partially infer type of unknown input types given the known one.

Return partially inferred results if not all types could be inferred. 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 != NULL or num_args==0, otherwise it is positional.

Parameters
symsymbol handle
num_argsnumbe of input arguments.
keysthe key of keyword args (optional)
arg_type_datathe content of the CSR
in_type_sizesizeof the returning array of in_types
in_type_datareturning array of pointers to head of the input type.
out_type_sizesizeof the returning array of out_types
out_type_datareturning array of pointers to head of the output type.
aux_type_sizesizeof the returning array of aux_types
aux_type_datareturning array of pointers to head of the auxiliary type.
completewhether infer type completes or more information is needed.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolListArguments ( SymbolHandle  symbol,
uint32_t *  out_size,
const char ***  out_str_array 
)

List arguments in the symbol.

Parameters
symbolthe symbol
out_sizeoutput size
out_str_arraypointer to hold the output string array
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolListAtomicSymbolCreators ( uint32_t *  out_size,
AtomicSymbolCreator **  out_array 
)

list all the available AtomicSymbolEntry

Parameters
out_sizethe size of returned array
out_arraythe output AtomicSymbolCreator array
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolListAttr ( SymbolHandle  symbol,
uint32_t *  out_size,
const char ***  out 
)

Get all attributes from symbol, including all descendents.

Parameters
symbolthe source symbol
out_sizeThe number of output attributes
out2*out_size strings representing key value pairs.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolListAttrShallow ( SymbolHandle  symbol,
uint32_t *  out_size,
const char ***  out 
)

Get all attributes from symbol, excluding descendents.

Parameters
symbolthe source symbol
out_sizeThe number of output attributes
out2*out_size strings representing key value pairs.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolListAuxiliaryStates ( SymbolHandle  symbol,
uint32_t *  out_size,
const char ***  out_str_array 
)

List auxiliary states in the symbol.

Parameters
symbolthe symbol
out_sizeoutput size
out_str_arraypointer to hold the output string array
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolListOutputs ( SymbolHandle  symbol,
uint32_t *  out_size,
const char ***  out_str_array 
)

List returns in the symbol.

Parameters
symbolthe symbol
out_sizeoutput size
out_str_arraypointer to hold the output string array
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolPrint ( SymbolHandle  symbol,
const char **  out_str 
)

Print the content of symbol, used for debug.

Parameters
symbolthe symbol
out_strpointer to hold the output string of the printing.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolRemoveAmpCast ( SymbolHandle  sym_handle,
SymbolHandle ret_sym_handle 
)

Remove the operators amp_cast and amp_multicast.

Parameters
sym_handlethe input symbol.
ret_sym_handlethe output symbol.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolSaveToFile ( SymbolHandle  symbol,
const char *  fname 
)

Save a symbol into a json file.

Parameters
symbolthe input symbol.
fnamethe file name.
Returns
0 when success, -1 when failure happens
MXNET_DLL int MXSymbolSaveToJSON ( SymbolHandle  symbol,
const char **  out_json 
)

Save a symbol into a json string.

Parameters
symbolthe input symbol.
out_jsonoutput json string.
Returns
0 when success, -1 when failure happens
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

  • Only allow set attributes during creation of new symbol as optional parameter

Mutable graph (be careful about the semantics):

  • Allow set attr at any point.
  • Mutating an attribute of some common node of two graphs can cause confusion from user.
Parameters
symbolthe source symbol
keyThe key of the symbol.
valueThe value to be saved.
Returns
0 when success, -1 when failure happens