mxnet
Classes | Macros | Typedefs | Enumerations | Functions | Variables
c_api.h File Reference

C API of mxnet. More...

#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...
 
#define MXNET_BRANCH   "NotProvided"
 
#define MXNET_COMMIT_HASH   "NotProvided"
 
#define MXNDArrayCreateEx   MXNDArrayCreate
 

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 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 * DatasetCreator
 handle a dataset creator More...
 
typedef void * DatasetHandle
 handle to a Dataset More...
 
typedef void * BatchifyFunctionCreator
 handle to a BatchifyFunction creator More...
 
typedef void * BatchifyFunctionHandle
 handle to a BatchifyFunction 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 void * EngineVarHandle
 handle to Engine VarHandle More...
 
typedef void(* EngineAsyncFunc) (void *, 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(* 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

const MXNET_DLL 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, void **lib)
 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 MXLibInfoCompiledWithCXX11ABI (int *result)
 return whether the mxnet library is compiled with cxx11 abi 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 MXSetFlushDenorms (bool value, bool *prev_state)
 Change floating-point calculations when dealing with denormalized values. Currently this option is only supported in CPU backend. Flushing denormalized values to zero is enabled by default. 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 MXSetProfilerScope (const char *scope)
 Set the scope 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, 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 MXGetBranch (const char **out)
 get the MXNet library branch at build time, usually provided by cmake More...
 
MXNET_DLL int MXGetCommitHash (const char **out)
 get the MXNet library commit hash at build time, usually provided by cmake 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, 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 MXNDArrayCreate64 (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 MXNDArrayLegacySave (const char *fname, uint32_t num_args, NDArrayHandle *args, const char **keys)
 Save list of narray into the file. 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, 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 MXNDArrayGetShape64 (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, 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, 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, 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 MXSetOptimizationConstraints (unsigned int constraints, unsigned int *prev)
 set what optimization constraints to apply More...
 
MXNET_DLL int MXGetOptimizationConstraints (unsigned int *curr)
 get current optimization constraints 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 MXIsNumpyDefaultDtype (bool *curr)
 get numpy default data type More...
 
MXNET_DLL int MXSetIsNumpyDefaultDtype (bool dtype_flag, bool *prev)
 set numpy default data type 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 MXAutogradDropGrads (uint32_t num_var, NDArrayHandle *var_handles)
 unmark nonleaf NDArrays to free the memory 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, 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 MXCachedOpGetOptimizedSymbol (CachedOpHandle handle, SymbolHandle *out)
 get optimized graph from the cached op More...
 
MXNET_DLL int MXInvokeCachedOp (CachedOpHandle handle, int num_inputs, NDArrayHandle *inputs, int default_dev_type, int default_dev_id, int *num_outputs, NDArrayHandle **outputs, const int **out_stypes)
 invoke a cached op More...
 
MXNET_DLL int MXCachedOpRegisterOpHook (CachedOpHandle handle, CachedOpMonitorCallback callback, bool monitor_all)
 cached op set monitor callback More...
 
MXNET_DLL int MXNDArrayIsDeferredCompute (int *curr)
 Get current status of deferred compute mode. More...
 
MXNET_DLL int MXNDArraySetIsDeferredCompute (int deferred_compute_enabled, int *prev)
 set whether to enable deferred compute mode More...
 
MXNET_DLL int MXNDArraySetDeferredComputeVariable (NDArrayHandle *arrays, SymbolHandle *variables, int num)
 Associate variables with deferred compute arrays. More...
 
MXNET_DLL int MXNDArrayGetDeferredComputeSymbol (NDArrayHandle *output_handles, int num_outputs, SymbolHandle *out)
 Convert the graph constructed during deferred computation mode to a Symbol. More...
 
MXNET_DLL int MXNDArrayClearDeferredCompute (NDArrayHandle *arrays, int num)
 Clear the deferred compute info associated with the ndarrays. 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 MXSymbolGetInputs (SymbolHandle symbol, SymbolHandle *out)
 Get a symbol that contains all the inputs. 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 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 MXSymbolInferShape64 (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 More...
 
MXNET_DLL int MXSymbolInferShapePartial (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 MXSymbolInferShapePartial64 (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, const int target_dtype, const int cast_params_offline, const char *const offline_param_cast_attr_p, const uint32_t num_inputs, const char **const input_names_p, const uint32_t num_all_args, const char **const all_arg_names_p, const int *all_arg_types_p, const uint32_t num_target_dtype_ops, const char **const target_dtype_ops_p, const uint32_t num_fp32_ops, const char **const fp32_ops_p, const uint32_t num_widest_dtype_ops, const char **const widest_dtype_ops_p)
 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, const uint32_t num_input_shapes, const char **input_shape_names, const int64_t *input_shape_data, const uint32_t *input_shape_idx, const uint32_t num_input_dtypes, const char **input_dtype_names, const int *input_dtypes, const uint32_t num_input_stypes, const char **input_stype_names, const int *input_stypes, bool skip_infer, 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 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 MXDataIterGetLenHint (DataIterHandle handle, int64_t *len)
 Call iterator.GetLenHint. Note that some iterators don't provide length. 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 MXDataIterGetItems (DataIterHandle handle, int *num_outputs, NDArrayHandle **outputs)
 Get the handles to specified underlying ndarrays of index. More...
 
MXNET_DLL int MXListDatasets (uint32_t *out_size, DatasetCreator **out_array)
 List all the available dataset entries. More...
 
MXNET_DLL int MXDatasetCreateDataset (DatasetCreator handle, uint32_t num_param, const char **keys, const char **vals, DatasetHandle *out)
 Init an dataset, init with parameters the array size of passed in arguments. More...
 
MXNET_DLL int MXDatasetGetDatasetInfo (DatasetCreator 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 dataset. More...
 
MXNET_DLL int MXDatasetFree (DatasetHandle handle)
 Free the handle to the IO module. More...
 
MXNET_DLL int MXDatasetGetLen (DatasetHandle handle, uint64_t *out)
 Get dataset overal length(size) More...
 
MXNET_DLL int MXDatasetGetItems (DatasetHandle handle, uint64_t index, int *num_outputs, NDArrayHandle **outputs)
 Get Output NDArray given specified indices. More...
 
MXNET_DLL int MXListBatchifyFunctions (uint32_t *out_size, BatchifyFunctionCreator **out_array)
 List all the available batchify function entries. More...
 
MXNET_DLL int MXBatchifyFunctionCreateFunction (BatchifyFunctionCreator handle, uint32_t num_param, const char **keys, const char **vals, BatchifyFunctionHandle *out)
 Init an batchify function, init with parameters the array size of passed in arguments. More...
 
MXNET_DLL int MXBatchifyFunctionGetFunctionInfo (BatchifyFunctionCreator 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 batchify function. More...
 
MXNET_DLL int MXBatchifyFunctionInvoke (BatchifyFunctionHandle handle, int batch_size, int num_output, NDArrayHandle *inputs, NDArrayHandle **outputs)
 Invoke the Batchify Function. More...
 
MXNET_DLL int MXBatchifyFunctionFree (BatchifyFunctionHandle handle)
 Free the handle to the IO module. 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 MXStorageEmptyCache (int dev_type, int dev_id)
 Release all unreferenced memory from the devices storage managers memory pool. More...
 
MXNET_DLL int MXNDArrayCreateFromSharedMem (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...
 
MXNET_DLL int MXCheckDynamicShapeOp (SymbolHandle sym_handle, bool *has_dynamic_shape)
 This function checks if any dynamic shape op is present in the symbol. More...
 
MXNET_DLL int MXPushStreamDep (NDArrayHandle handle, int stream)
 Synchronize the consumer stream with the producer stream where the NDArray lives. More...
 
MXNET_DLL int MXGetCurrentStream (int device_id, int *stream)
 Get current stream pointer based on current device type and id. More...
 
MXNET_DLL int MXNVTXRangePush (const char *name, mx_uint color)
 Push a new NVTX range. Requires building with CUDA and NVTX. More...
 
MXNET_DLL int MXNVTXRangePop ()
 End the NVTX range. Requires building with CUDA and NVTX. More...
 
MXNET_DLL int MXCUDAProfilerStart ()
 Start CUDA profiling session. Requires building with CUDA and NVTX. More...
 
MXNET_DLL int MXCUDAProfilerStop ()
 End CUDA profiling session. Requires building with CUDA and NVTX. More...
 
MXNET_DLL int MXSetOptimizeLayout (bool val)
 Turns on or off Layout Optimization. More...
 
MXNET_DLL int MXGetOptimizeLayout (bool *val)
 Get current Layout Optimization status. More...
 

Variables

const typedef void * FunctionHandle
 handle to a mxnet narray function that changes NDArray More...
 
const typedef void * ContextHandle
 handle to Context More...
 
const typedef void * EngineFnPropertyHandle
 handle to Engine FnProperty More...
 

Detailed Description

C API of mxnet.

Macro Definition Documentation

◆ DEFAULT

#define DEFAULT (   x)

Inhibit C++ name-mangling for MXNet functions.

Keep the default value in C++

◆ MXNDArrayCreateEx

#define MXNDArrayCreateEx   MXNDArrayCreate

◆ MXNET_BRANCH

#define MXNET_BRANCH   "NotProvided"

◆ MXNET_COMMIT_HASH

#define MXNET_COMMIT_HASH   "NotProvided"

◆ MXNET_DLL

#define MXNET_DLL

MXNET_DLL prefix for windows.

Typedef Documentation

◆ AtomicSymbolCreator

typedef void* AtomicSymbolCreator

handle to a function that takes param and creates symbol

◆ AtomicSymbolHandle

typedef void* AtomicSymbolHandle

handle to a AtomicSymbol

◆ BatchifyFunctionCreator

typedef void* BatchifyFunctionCreator

handle to a BatchifyFunction creator

◆ BatchifyFunctionHandle

typedef void* BatchifyFunctionHandle

handle to a BatchifyFunction

◆ CachedOpHandle

typedef void* CachedOpHandle

handle to cached operator

◆ CachedOpMonitorCallback

typedef void(* CachedOpMonitorCallback) (const char *, const char *, NDArrayHandle)

Monitor callback called at operator level for cached op.

◆ CudaKernelHandle

typedef void* CudaKernelHandle

handle to rtc cuda kernel

◆ CudaModuleHandle

typedef void* CudaModuleHandle

handle to rtc cuda module

◆ CustomFunctionBwdFunc

typedef int(* CustomFunctionBwdFunc) (int, int, void **, const int *, const int, void *)

◆ CustomFunctionDelFunc

typedef int(* CustomFunctionDelFunc) (void *)

◆ CustomOpBackwardInferStorageTypeFunc

typedef int(* CustomOpBackwardInferStorageTypeFunc) (int, int *, int *, void *)

◆ CustomOpBwdDepFunc

typedef int(* CustomOpBwdDepFunc) (const int *, const int *, const int *, int *, int **, void *)

◆ CustomOpCreateFunc

typedef int(* CustomOpCreateFunc) (const char *, int, unsigned **, const int *, const int *, struct MXCallbackList *, void *)

◆ CustomOpDelFunc

typedef int(* CustomOpDelFunc) (void *)

◆ CustomOpFBFunc

typedef int(* CustomOpFBFunc) (int, void **, int *, const int *, const int, void *)

◆ CustomOpInferShapeFunc

typedef int(* CustomOpInferShapeFunc) (int, int *, int **, void *)

◆ CustomOpInferStorageTypeFunc

typedef int(* CustomOpInferStorageTypeFunc) (int, int *, void *)

◆ CustomOpInferTypeFunc

typedef int(* CustomOpInferTypeFunc) (int, int *, void *)

◆ CustomOpListFunc

typedef int(* CustomOpListFunc) (char ***, void *)

◆ CustomOpPropCreator

typedef int(* CustomOpPropCreator) (const char *, const int, const char **, const char **, struct MXCallbackList *)

◆ DataIterCreator

typedef void* DataIterCreator

handle a dataiter creator

◆ DataIterHandle

typedef void* DataIterHandle

handle to a DataIterator

◆ DatasetCreator

typedef void* DatasetCreator

handle a dataset creator

◆ DatasetHandle

typedef void* DatasetHandle

handle to a Dataset

◆ dim_t

typedef int64_t dim_t

data type to store dim size

◆ DLManagedTensorHandle

typedef void* DLManagedTensorHandle

handle to DLManagedTensor

◆ EngineAsyncFunc

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

Engine asynchronous operation.

◆ EngineFuncParamDeleter

typedef void(* EngineFuncParamDeleter) (void *)

Callback to free the param for EngineAsyncFunc/EngineSyncFunc.

◆ EngineSyncFunc

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

Engine synchronous operation.

◆ EngineVarHandle

typedef void* EngineVarHandle

handle to Engine VarHandle

◆ ExecutorHandle

typedef void* ExecutorHandle

handle to an Executor

◆ KVStoreHandle

typedef void* KVStoreHandle

handle to KVStore

◆ mx_float

typedef float mx_float

manually define float

◆ mx_uint

typedef uint32_t mx_uint

manually define unsigned int

◆ MXGenericCallback

typedef int(* MXGenericCallback) (void)

◆ MXKVStoreServerController

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

◆ MXKVStoreStrUpdater

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

◆ MXKVStoreUpdater

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

◆ NDArrayHandle

typedef void* NDArrayHandle

handle to NDArray

◆ ProfileHandle

typedef void* ProfileHandle

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

◆ RecordIOHandle

typedef void* RecordIOHandle

handle to RecordIO

◆ RtcHandle

typedef void* RtcHandle

handle to MXRtc

◆ SymbolHandle

typedef void* SymbolHandle

handle to a symbol that can be bind as operator

Enumeration Type Documentation

◆ CustomFunctionCallbacks

Enumerator
kCustomFunctionBackward 
kCustomFunctionDelete 

◆ CustomOpCallbacks

Enumerator
kCustomOpDelete 
kCustomOpForward 
kCustomOpBackward 

◆ CustomOpPropCallbacks

Enumerator
kCustomOpPropDelete 
kCustomOpPropListArguments 
kCustomOpPropListOutputs 
kCustomOpPropListAuxiliaryStates 
kCustomOpPropInferShape 
kCustomOpPropDeclareBackwardDependency 
kCustomOpPropCreateOperator 
kCustomOpPropInferType 
kCustomOpPropInferStorageType 
kCustomOpPropBackwardInferStorageType 

Function Documentation

◆ MXAggregateProfileStatsPrint()

MXNET_DLL int MXAggregateProfileStatsPrint ( 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

◆ MXAutogradBackward()

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

◆ MXAutogradBackwardEx()

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

◆ MXAutogradComputeGradient()

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

◆ MXAutogradDropGrads()

MXNET_DLL int MXAutogradDropGrads ( uint32_t  num_var,
NDArrayHandle var_handles 
)

unmark nonleaf NDArrays to free the memory

Parameters
num_varnumber of variable NDArrays
var_handlesvariable NDArrays
Returns
0 when success, -1 when failure happens

◆ MXAutogradGetSymbol()

MXNET_DLL int MXAutogradGetSymbol ( NDArrayHandle  handle,
SymbolHandle out 
)

◆ MXAutogradIsRecording()

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

◆ MXAutogradIsTraining()

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

◆ MXAutogradMarkVariables()

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

◆ MXAutogradSetIsRecording()

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

◆ MXAutogradSetIsTraining()

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

◆ MXBatchifyFunctionCreateFunction()

MXNET_DLL int MXBatchifyFunctionCreateFunction ( BatchifyFunctionCreator  handle,
uint32_t  num_param,
const char **  keys,
const char **  vals,
BatchifyFunctionHandle out 
)

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

Parameters
handleof the batchify function creator
num_paramnumber of parameter
keysparameter keys
valsparameter values
outresulting batchify function
Returns
0 when success, -1 when failure happens

◆ MXBatchifyFunctionFree()

MXNET_DLL int MXBatchifyFunctionFree ( BatchifyFunctionHandle  handle)

Free the handle to the IO module.

Parameters
handlethe handle pointer to the batchify function
Returns
0 when success, -1 when failure happens

◆ MXBatchifyFunctionGetFunctionInfo()

MXNET_DLL int MXBatchifyFunctionGetFunctionInfo ( BatchifyFunctionCreator  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 batchify function.

Parameters
creatorthe batchifyFunctionCreator.
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

◆ MXBatchifyFunctionInvoke()

MXNET_DLL int MXBatchifyFunctionInvoke ( BatchifyFunctionHandle  handle,
int  batch_size,
int  num_output,
NDArrayHandle inputs,
NDArrayHandle **  outputs 
)

Invoke the Batchify Function.

Parameters
handlethe handle pointer to the batchify function
batch_sizethe batch size
num_outputthe number of ndarrays for output
inputsthe pointers to input ndarrays
ouptutsthe pointers to output ndarrays
Returns
0 when success, -1 when failure happens

◆ MXCachedOpGetOptimizedSymbol()

MXNET_DLL int MXCachedOpGetOptimizedSymbol ( CachedOpHandle  handle,
SymbolHandle out 
)

get optimized graph from the cached op

◆ MXCachedOpRegisterOpHook()

MXNET_DLL int MXCachedOpRegisterOpHook ( CachedOpHandle  handle,
CachedOpMonitorCallback  callback,
bool  monitor_all 
)

cached op set monitor callback

◆ MXCheckDynamicShapeOp()

MXNET_DLL int MXCheckDynamicShapeOp ( SymbolHandle  sym_handle,
bool *  has_dynamic_shape 
)

This function checks if any dynamic shape op is present in the symbol.

Parameters
sym_handlehandler of the input symbol.
has_dynamic_shapeFlag to indicate if the symbol contains dynamic shape op.

◆ MXCreateCachedOp()

MXNET_DLL int MXCreateCachedOp ( 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

◆ MXCUDAProfilerStart()

MXNET_DLL int MXCUDAProfilerStart ( )

Start CUDA profiling session. Requires building with CUDA and NVTX.

◆ MXCUDAProfilerStop()

MXNET_DLL int MXCUDAProfilerStop ( )

End CUDA profiling session. Requires building with CUDA and NVTX.

◆ MXCustomFunctionRecord()

MXNET_DLL int MXCustomFunctionRecord ( int  num_inputs,
NDArrayHandle inputs,
int  num_outputs,
NDArrayHandle outputs,
struct MXCallbackList callbacks 
)

◆ MXCustomOpRegister()

MXNET_DLL int MXCustomOpRegister ( const char *  op_type,
CustomOpPropCreator  creator 
)

◆ MXDataIterBeforeFirst()

MXNET_DLL int MXDataIterBeforeFirst ( DataIterHandle  handle)

Call iterator.Reset.

Parameters
handlethe handle to iterator
Returns
0 when success, -1 when failure happens

◆ MXDataIterCreateIter()

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

◆ MXDataIterFree()

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

◆ MXDataIterGetData()

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

◆ MXDataIterGetIndex()

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

◆ MXDataIterGetItems()

MXNET_DLL int MXDataIterGetItems ( DataIterHandle  handle,
int *  num_outputs,
NDArrayHandle **  outputs 
)

Get the handles to specified underlying ndarrays of index.

Parameters
handlethe handle pointer to the data iterator
num_outputsthe length of outputs
outthe handle to an array of NDArrays that stores pointers to handles
Returns
0 when success, -1 when failure happens

◆ MXDataIterGetIterInfo()

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

◆ MXDataIterGetLabel()

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

◆ MXDataIterGetLenHint()

MXNET_DLL int MXDataIterGetLenHint ( DataIterHandle  handle,
int64_t *  len 
)

Call iterator.GetLenHint. Note that some iterators don't provide length.

Parameters
handlethe handle to iterator
Returns
0 when success, -1 when failure happens

◆ MXDataIterGetPadNum()

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

◆ MXDataIterNext()

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

◆ MXDatasetCreateDataset()

MXNET_DLL int MXDatasetCreateDataset ( DatasetCreator  handle,
uint32_t  num_param,
const char **  keys,
const char **  vals,
DatasetHandle out 
)

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

Parameters
handleof the dataset creator
num_paramnumber of parameter
keysparameter keys
valsparameter values
outresulting dataset
Returns
0 when success, -1 when failure happens

◆ MXDatasetFree()

MXNET_DLL int MXDatasetFree ( DatasetHandle  handle)

Free the handle to the IO module.

Parameters
handlethe handle pointer to the dataset
Returns
0 when success, -1 when failure happens

◆ MXDatasetGetDatasetInfo()

MXNET_DLL int MXDatasetGetDatasetInfo ( DatasetCreator  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 dataset.

Parameters
creatorthe DatasetCreator.
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

◆ MXDatasetGetItems()

MXNET_DLL int MXDatasetGetItems ( DatasetHandle  handle,
uint64_t  index,
int *  num_outputs,
NDArrayHandle **  outputs 
)

Get Output NDArray given specified indices.

Parameters
handlethe handle to dataset
indexthe index of the dataset item to be retrieved
num_outputsthe number of output ndarrays
outputsthe pointers to handles of ndarrays
is_scalarif not zeros then output should be casted to scalars
Returns
0 when success, -1 when failure happens

◆ MXDatasetGetLen()

MXNET_DLL int MXDatasetGetLen ( DatasetHandle  handle,
uint64_t *  out 
)

Get dataset overal length(size)

Parameters
handlethe handle to dataset
outreturn value of GetLen
Returns
0 when success, -1 when failure happens

◆ MXDumpProcessProfile()

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.

◆ MXDumpProfile()

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.

◆ MXEnginePushAsync()

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.

◆ MXEnginePushAsyncND()

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.

◆ MXEnginePushSync()

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.

◆ MXEnginePushSyncND()

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.

◆ MXEngineSetBulkSize()

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

◆ MXFreeCachedOp()

MXNET_DLL int MXFreeCachedOp ( CachedOpHandle  handle)

free cached operator

◆ MXFuncDescribe()

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

◆ MXFuncGetInfo()

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

◆ MXFuncInvoke()

MXNET_DLL int MXFuncInvoke ( 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

◆ MXGenAtomicSymbolFromSymbol()

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

◆ MXGenBackendSubgraph()

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

◆ MXGetBranch()

MXNET_DLL int MXGetBranch ( const char **  out)

get the MXNet library branch at build time, usually provided by cmake

Parameters
pointerto the string holding the branch name
Returns
0 when success, -1 when failure happens

◆ MXGetCommitHash()

MXNET_DLL int MXGetCommitHash ( const char **  out)

get the MXNet library commit hash at build time, usually provided by cmake

Parameters
pointerto the string holding the commit hash
Returns
0 when success, -1 when failure happens

◆ MXGetCurrentStream()

MXNET_DLL int MXGetCurrentStream ( int  device_id,
int *  stream 
)

Get current stream pointer based on current device type and id.

Parameters
device_idCurrent device id.
streamA pointer pointing to current stream.

◆ MXGetFunction()

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

◆ MXGetGPUCount()

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.

◆ MXGetGPUMemoryInformation()

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

◆ MXGetGPUMemoryInformation64()

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

◆ MXGetLastError()

const MXNET_DLL 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

◆ MXGetOptimizationConstraints()

MXNET_DLL int MXGetOptimizationConstraints ( unsigned int *  curr)

get current optimization constraints

Parameters
currreturns the current status
Returns
0 when success, -1 when failure happens

◆ MXGetOptimizeLayout()

MXNET_DLL int MXGetOptimizeLayout ( bool *  val)

Get current Layout Optimization status.

◆ MXGetVersion()

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

◆ MXImperativeInvoke()

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

◆ MXInitPSEnv()

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

◆ MXInvokeCachedOp()

MXNET_DLL int MXInvokeCachedOp ( CachedOpHandle  handle,
int  num_inputs,
NDArrayHandle inputs,
int  default_dev_type,
int  default_dev_id,
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
default_dev_typethe default context type
default_dev_idthe default context device id
outputsoutput NDArrays
out_stypesoutput ndarrays' stypes
Returns
0 when success, -1 when failure happens

◆ MXIsNumpyDefaultDtype()

MXNET_DLL int MXIsNumpyDefaultDtype ( bool *  curr)

get numpy default data type

Parameters
currreturns the current status
Returns
0 when success, -1 when failure happens

◆ MXIsNumpyShape()

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

◆ MXKVStoreBarrier()

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

◆ MXKVStoreBroadcast()

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

◆ MXKVStoreBroadcastEx()

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

◆ MXKVStoreCreate()

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

◆ MXKVStoreFree()

MXNET_DLL int MXKVStoreFree ( KVStoreHandle  handle)

Delete a KVStore handle.

Parameters
handlehandle to the kvstore
Returns
0 when success, -1 when failure happens

◆ MXKVStoreGetGroupSize()

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

◆ MXKVStoreGetNumDeadNode()

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'

◆ MXKVStoreGetRank()

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

◆ MXKVStoreGetType()

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

◆ MXKVStoreInit()

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

◆ MXKVStoreInitEx()

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

◆ MXKVStoreIsSchedulerNode()

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

◆ MXKVStoreIsServerNode()

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

◆ MXKVStoreIsWorkerNode()

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

◆ MXKVStorePull()

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

◆ MXKVStorePullEx()

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

◆ MXKVStorePullRowSparse()

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

◆ MXKVStorePullRowSparseEx()

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

◆ MXKVStorePullWithSparse()

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

◆ MXKVStorePullWithSparseEx()

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

◆ MXKVStorePush()

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

◆ MXKVStorePushEx()

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

◆ MXKVStorePushPull()

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

◆ MXKVStorePushPullEx()

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

◆ MXKVStoreRunServer()

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

◆ MXKVStoreSendCommmandToServers()

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

◆ MXKVStoreSetBarrierBeforeExit()

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

◆ MXKVStoreSetGradientCompression()

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

◆ MXKVStoreSetUpdater()

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

◆ MXKVStoreSetUpdaterEx()

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

◆ MXLibInfoCompiledWithCXX11ABI()

MXNET_DLL int MXLibInfoCompiledWithCXX11ABI ( int *  result)

return whether the mxnet library is compiled with cxx11 abi

Returns
whether mxnet is built with cxx11 abi

◆ MXLibInfoFeatures()

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.

◆ MXListAllOpNames()

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

◆ MXListBatchifyFunctions()

MXNET_DLL int MXListBatchifyFunctions ( uint32_t *  out_size,
BatchifyFunctionCreator **  out_array 
)

List all the available batchify function entries.

Parameters
out_sizethe size of returned batchify functions
out_arraythe output batchify function entries
Returns
0 when success, -1 when failure happens

◆ MXListDataIters()

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

◆ MXListDatasets()

MXNET_DLL int MXListDatasets ( uint32_t *  out_size,
DatasetCreator **  out_array 
)

List all the available dataset entries.

Parameters
out_sizethe size of returned datasets
out_arraythe output dataset entries
Returns
0 when success, -1 when failure happens

◆ MXListFunctions()

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

◆ MXLoadLib()

MXNET_DLL int MXLoadLib ( const char *  path,
unsigned  verbose,
void **  lib 
)

Load library dynamically.

Parameters
pathto the library .so file
0for quiet, 1 for verbose
Returns
0 when success, -1 when failure happens.

◆ MXNDArrayAt()

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

◆ MXNDArrayAt64()

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

◆ MXNDArrayCallDLPackDeleter()

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

◆ MXNDArrayClearDeferredCompute()

MXNET_DLL int MXNDArrayClearDeferredCompute ( NDArrayHandle arrays,
int  num 
)

Clear the deferred compute info associated with the ndarrays.

Parameters
arraysndarray handles of deferred compute outputs
numnumber of ndarrays
Returns
0 when success, -1 otherwise

◆ MXNDArrayCreate()

MXNET_DLL int MXNDArrayCreate ( 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

◆ MXNDArrayCreate64()

MXNET_DLL int MXNDArrayCreate64 ( 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

◆ MXNDArrayCreateFromSharedMem()

MXNET_DLL int MXNDArrayCreateFromSharedMem ( 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

◆ MXNDArrayCreateNone()

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

◆ MXNDArrayCreateSparseEx()

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

◆ MXNDArrayCreateSparseEx64()

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

◆ MXNDArrayDetach()

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

◆ MXNDArrayFree()

MXNET_DLL int MXNDArrayFree ( NDArrayHandle  handle)

free the narray handle

Parameters
handlethe handle to be freed
Returns
0 when success, -1 when failure happens

◆ MXNDArrayFromDLPack()

MXNET_DLL int MXNDArrayFromDLPack ( 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

◆ MXNDArrayGetAuxNDArray()

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.

◆ MXNDArrayGetAuxNDArray64()

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.

◆ MXNDArrayGetAuxType()

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

◆ MXNDArrayGetAuxType64()

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

◆ MXNDArrayGetContext()

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

◆ MXNDArrayGetData()

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

◆ MXNDArrayGetDataNDArray()

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.

◆ MXNDArrayGetDeferredComputeSymbol()

MXNET_DLL int MXNDArrayGetDeferredComputeSymbol ( NDArrayHandle output_handles,
int  num_outputs,
SymbolHandle out 
)

Convert the graph constructed during deferred computation mode to a Symbol.

Parameters
output_handlesndarray handles of outputs
outgrouped output symbol handle

Construct a Symbol for the deferred computation graph. output_handles specifies the outputs of interest which the returned symbol will compute.

◆ MXNDArrayGetDType()

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

◆ MXNDArrayGetGrad()

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

◆ MXNDArrayGetGradState()

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

◆ MXNDArrayGetShape()

MXNET_DLL int MXNDArrayGetShape ( 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

◆ MXNDArrayGetShape64()

MXNET_DLL int MXNDArrayGetShape64 ( 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

◆ MXNDArrayGetSharedMemHandle()

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.

◆ MXNDArrayGetStorageType()

MXNET_DLL int MXNDArrayGetStorageType ( NDArrayHandle  handle,
int *  out_storage_type 
)

get the storage type of the array

◆ MXNDArrayIsDeferredCompute()

MXNET_DLL int MXNDArrayIsDeferredCompute ( int *  curr)

Get current status of deferred compute mode.

Parameters
currreturns the current status.
Returns
0 when success, -1 when failure happens

◆ MXNDArrayLegacySave()

MXNET_DLL int MXNDArrayLegacySave ( 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

◆ MXNDArrayLoad()

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

◆ MXNDArrayLoadFromBuffer()

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

◆ MXNDArrayLoadFromRawBytes()

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

◆ MXNDArrayReshape()

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

◆ MXNDArrayReshape64()

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

◆ MXNDArraySave()

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

◆ MXNDArraySaveRawBytes()

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

◆ MXNDArraySetDeferredComputeVariable()

MXNET_DLL int MXNDArraySetDeferredComputeVariable ( NDArrayHandle arrays,
SymbolHandle variables,
int  num 
)

Associate variables with deferred compute arrays.

Parameters
arraysndarray handles to be matched with variables
variablessymbol handles of variables to be matched with ndarrays
numnumber of arrays and variables respectively
Returns
0 when success, -1 when failure happens

◆ MXNDArraySetGradState()

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

◆ MXNDArraySetIsDeferredCompute()

MXNET_DLL int MXNDArraySetIsDeferredCompute ( int  deferred_compute_enabled,
int *  prev 
)

set whether to enable deferred compute mode

Parameters
deferred_compute_enabled1 to enable, 0 to disable.
prevreturns the previous status before this set.
Returns
0 when success, -1 when failure happens

◆ MXNDArraySlice()

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

◆ MXNDArraySlice64()

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

◆ MXNDArraySyncCheckFormat()

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

◆ MXNDArraySyncCopyFromCPU()

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.

◆ MXNDArraySyncCopyFromNDArray()

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

◆ MXNDArraySyncCopyToCPU()

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.

◆ MXNDArrayToDLPack()

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

◆ MXNDArrayWaitAll()

MXNET_DLL int MXNDArrayWaitAll ( )

wait until all delayed operations in the system is completed

Returns
0 when success, -1 when failure happens

◆ MXNDArrayWaitToRead()

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

◆ MXNDArrayWaitToWrite()

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

◆ MXNotifyShutdown()

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.

◆ MXNVTXRangePop()

MXNET_DLL int MXNVTXRangePop ( )

End the NVTX range. Requires building with CUDA and NVTX.

◆ MXNVTXRangePush()

MXNET_DLL int MXNVTXRangePush ( const char *  name,
mx_uint  color 
)

Push a new NVTX range. Requires building with CUDA and NVTX.

Parameters
nameName of the range.
colorColor used to display the range in the visual profiling tools. Encoded as 256*256*R + 256*G + B.

◆ MXOptimizeForBackend()

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,
const uint32_t  num_input_shapes,
const char **  input_shape_names,
const int64_t *  input_shape_data,
const uint32_t *  input_shape_idx,
const uint32_t  num_input_dtypes,
const char **  input_dtype_names,
const int *  input_dtypes,
const uint32_t  num_input_stypes,
const char **  input_stype_names,
const int *  input_stypes,
bool  skip_infer,
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
num_input_shapesnumber of input shapes
input_shape_namesnames of the input shapes
input_shape_datapointer to the contiguous data shapes
input_shape_idxarray of per shape starting idx, the shape length for the i-th input shape is calculate as input_shape_idx[i+1] - input_shape_idx[i]
num_input_dtypesnumber of input data types
input_dtype_namesarray of names of the input data types
input_dtypesarray of values of the input data types
num_input_stypesnumberof input storage types
input_stype_namesarray of names of the input storage types
input_stypesarray of values of input storage types
skip_inferif the optimization should skip the attribute inferences (to use if the backend does not require shape inference)
new_args_cntpointer a number to store the number of new args
new_args_handlepointer on array to store the new args handles
new_arg_names_handlepointer on array to store the new args names
new_aux_cntpointer a number to store the number of new aux
new_aux_handlepointer on array to store the new aux handles
new_aux_names_handlepointer on array to store the new aux names

◆ MXProcessProfilePause()

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

◆ MXProfileAdjustCounter()

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.

◆ MXProfileCreateCounter()

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.

◆ MXProfileCreateDomain()

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.

◆ MXProfileCreateEvent()

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.

◆ MXProfileCreateFrame()

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.

◆ MXProfileCreateTask()

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.

◆ MXProfileDestroyHandle()

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.

◆ MXProfileDurationStart()

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.

◆ MXProfileDurationStop()

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.

◆ MXProfilePause()

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

◆ MXProfileSetCounter()

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.

◆ MXProfileSetMarker()

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.

◆ MXPushStreamDep()

MXNET_DLL int MXPushStreamDep ( NDArrayHandle  handle,
int  stream 
)

Synchronize the consumer stream with the producer stream where the NDArray lives.

Parameters
handleNDArray handle of producer.
streamA pointer to a stream from consumer.

◆ MXQuantizeSymbol()

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

◆ MXRandomSeed()

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.

◆ MXRandomSeedContext()

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.

◆ MXRecordIOReaderCreate()

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

◆ MXRecordIOReaderFree()

MXNET_DLL int MXRecordIOReaderFree ( RecordIOHandle  handle)

Delete a RecordIO reader object.

Parameters
handlehandle to RecordIO object
Returns
0 when success, -1 when failure happens

◆ MXRecordIOReaderReadRecord()

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

◆ MXRecordIOReaderSeek()

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

◆ MXRecordIOReaderTell()

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

◆ MXRecordIOWriterCreate()

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

◆ MXRecordIOWriterFree()

MXNET_DLL int MXRecordIOWriterFree ( RecordIOHandle  handle)

Delete a RecordIO writer object.

Parameters
handlehandle to RecordIO object
Returns
0 when success, -1 when failure happens

◆ MXRecordIOWriterTell()

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

◆ MXRecordIOWriterWriteRecord()

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

◆ MXReducePrecisionSymbol()

MXNET_DLL int MXReducePrecisionSymbol ( SymbolHandle  sym_handle,
SymbolHandle ret_sym_handle,
const int  target_dtype,
const int  cast_params_offline,
const char *const  offline_param_cast_attr_p,
const uint32_t  num_inputs,
const char **const  input_names_p,
const uint32_t  num_all_args,
const char **const  all_arg_names_p,
const int *  all_arg_types_p,
const uint32_t  num_target_dtype_ops,
const char **const  target_dtype_ops_p,
const uint32_t  num_fp32_ops,
const char **const  fp32_ops_p,
const uint32_t  num_widest_dtype_ops,
const char **const  widest_dtype_ops_p 
)

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
target_dtypetarget_dtype for mixed precision symbol
cast_params_offlinewhether to cast parameters offline to target_dtype
offline_param_cast_attr_pattibute that will hold the dtype a parameter should be offline cast to (when cast_params_offline is true)
num_inputsnumber of model inputs
input_names_pnames of model inputs
num_all_argsnumber of all model arguments
all_arg_names_pnames of all model arguments
all_arg_types_pdtypes of all model arguments
num_target_dtype_opsnumber of ops to be casted to target_dtype
target_dtype_ops_pop names to be casted to target_dtype
num_fp32_opsnumber of ops to be casted to FP32
fp32_ops_pop names to be casted to fp32
num_widest_dtype_opsnumber of ops to be casted to widest dtype
widest_dtype_ops_pop names to be casted to widest dtype
num_excluded_symbolsnumber of symbols to be excluded from casting
excluded_syms_psymbol names to be excluded from casting

◆ MXRtcCreate()

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.

◆ MXRtcCudaKernelCall()

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 
)

◆ MXRtcCudaKernelCreate()

MXNET_DLL int MXRtcCudaKernelCreate ( CudaModuleHandle  handle,
const char *  name,
int  num_args,
int *  is_ndarray,
int *  is_const,
int *  arg_types,
CudaKernelHandle out 
)

◆ MXRtcCudaKernelFree()

MXNET_DLL int MXRtcCudaKernelFree ( CudaKernelHandle  handle)

◆ MXRtcCudaModuleCreate()

MXNET_DLL int MXRtcCudaModuleCreate ( const char *  source,
int  num_options,
const char **  options,
int  num_exports,
const char **  exports,
CudaModuleHandle out 
)

◆ MXRtcCudaModuleFree()

MXNET_DLL int MXRtcCudaModuleFree ( CudaModuleHandle  handle)

◆ MXRtcFree()

MXNET_DLL int MXRtcFree ( RtcHandle  handle)

Delete a MXRtc object.

◆ MXRtcPush()

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.

◆ MXSetCalibTableToQuantizedSymbol()

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

◆ MXSetFlushDenorms()

MXNET_DLL int MXSetFlushDenorms ( bool  value,
bool *  prev_state 
)

Change floating-point calculations when dealing with denormalized values. Currently this option is only supported in CPU backend. Flushing denormalized values to zero is enabled by default.

Parameters
valuestate of flush-to-zero and denormals-are-zero to set.
prev_statestate of flush-to-zero and denormals-are-zero before setting new state.
Returns
0 when success, -1 when failure happens.

◆ MXSetIsNumpyDefaultDtype()

MXNET_DLL int MXSetIsNumpyDefaultDtype ( bool  dtype_flag,
bool *  prev 
)

set numpy default data type

Parameters
dtype_flagfalse when default dtype is flaot32, true when default dtype is flaot64.
prevreturns the previous status before this set
Returns
0 when success, -1 when failure happens

◆ MXSetIsNumpyShape()

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

◆ MXSetNumOMPThreads()

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.

◆ MXSetOptimizationConstraints()

MXNET_DLL int MXSetOptimizationConstraints ( unsigned int  constraints,
unsigned int *  prev 
)

set what optimization constraints to apply

Parameters
constraintsstate composed of OptConstraint flags.
prevreturns the previous status before this set.
Returns
0 when success, -1 when failure happens

◆ MXSetOptimizeLayout()

MXNET_DLL int MXSetOptimizeLayout ( bool  val)

Turns on or off Layout Optimization.

◆ MXSetProcessProfilerConfig()

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.

◆ MXSetProcessProfilerState()

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.

◆ MXSetProfilerConfig()

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.

◆ MXSetProfilerScope()

MXNET_DLL int MXSetProfilerScope ( const char *  scope)

Set the scope of profiler for current process.

Parameters
scopeindicate the working scope of profiler
Returns
0 when success, -1 when failure happens.

◆ MXSetProfilerState()

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.

◆ MXShallowCopyNDArray()

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

◆ MXShallowCopySymbol()

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

◆ MXStorageEmptyCache()

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

◆ MXSymbolCompose()

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

◆ MXSymbolCopy()

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

◆ MXSymbolCreateAtomicSymbol()

MXNET_DLL int MXSymbolCreateAtomicSymbol ( AtomicSymbolCreator  creator,
uint32_t  num_param,
const char **  keys,
const char **  vals,
SymbolHandle out 
)

Create an AtomicSymbol.

A Symbol is said to be atomic if it is not composed of other Symbols. Atomic Symbols can be composed.

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

◆ MXSymbolCreateFromFile()

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

◆ MXSymbolCreateFromJSON()

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

◆ MXSymbolCreateGroup()

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

◆ MXSymbolCreateVariable()

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

◆ MXSymbolCutSubgraph()

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.

◆ MXSymbolFree()

MXNET_DLL int MXSymbolFree ( SymbolHandle  symbol)

Free the symbol handle.

Parameters
symbolthe symbol
Returns
0 when success, -1 when failure happens

◆ MXSymbolGetAtomicSymbolInfo()

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

◆ MXSymbolGetAtomicSymbolName()

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.

◆ MXSymbolGetAttr()

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

◆ MXSymbolGetChildren()

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

◆ MXSymbolGetInputs()

MXNET_DLL int MXSymbolGetInputs ( SymbolHandle  symbol,
SymbolHandle out 
)

Get a symbol that contains all the inputs.

Parameters
symbolThe symbol
outThe output symbol whose outputs are all the internals.
Returns
0 when success, -1 when failure happens

◆ MXSymbolGetInputSymbols()

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.

◆ MXSymbolGetInternals()

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

◆ MXSymbolGetName()

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

◆ MXSymbolGetNumOutputs()

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

◆ MXSymbolGetOutput()

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

◆ MXSymbolGrad()

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

◆ MXSymbolInferShape()

MXNET_DLL int MXSymbolInferShape ( 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

◆ MXSymbolInferShape64()

MXNET_DLL int MXSymbolInferShape64 ( 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

◆ MXSymbolInferShapePartial()

MXNET_DLL int MXSymbolInferShapePartial ( 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

◆ MXSymbolInferShapePartial64()

MXNET_DLL int MXSymbolInferShapePartial64 ( 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

◆ MXSymbolInferType()

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

◆ MXSymbolInferTypePartial()

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

◆ MXSymbolListArguments()

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

◆ MXSymbolListAtomicSymbolCreators()

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

◆ MXSymbolListAttr()

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

◆ MXSymbolListAttrShallow()

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

◆ MXSymbolListAuxiliaryStates()

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

◆ MXSymbolListOutputs()

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

◆ MXSymbolPrint()

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

◆ MXSymbolRemoveAmpCast()

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

◆ MXSymbolSaveToFile()

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

◆ MXSymbolSaveToJSON()

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

◆ MXSymbolSetAttr()

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

Variable Documentation

◆ ContextHandle

const typedef void* ContextHandle

handle to Context

◆ EngineFnPropertyHandle

const typedef void* EngineFnPropertyHandle

handle to Engine FnProperty

◆ FunctionHandle

const typedef void* FunctionHandle

handle to a mxnet narray function that changes NDArray