Go to the documentation of this file.
24 #ifndef MXNET_C_API_H_
25 #define MXNET_C_API_H_
34 #define DEFAULT(x) = x
48 #define MXNET_DLL __declspec(dllexport)
50 #define MXNET_DLL __declspec(dllimport)
57 #define MXNET_BRANCH "NotProvided"
60 #ifndef MXNET_COMMIT_HASH
61 #define MXNET_COMMIT_HASH "NotProvided"
130 void (*
forward)(int,
float**,
int*,
unsigned**,
int*,
void*);
131 void (*
backward)(int,
float**,
int*,
unsigned**,
int*,
void*);
314 const char*
const* keys,
315 const char*
const* vals,
436 const char* frame_name,
455 const char* counter_name,
503 const char* instant_marker_name,
573 MXNET_DLL int MXLoadTVMOp(
const char* libpath);
575 struct OtherOptionEntity {
579 struct OtherOptionSpace {
580 OtherOptionEntity* entities;
586 char** entity_map_key;
587 OtherOptionEntity* entity_map_val;
589 char** space_map_key;
590 OtherOptionSpace* space_map_val;
593 typedef struct ConfigSpaces {
596 ConfigSpace* spaces_val;
599 MXNET_DLL int MXLoadTVMConfig(ConfigSpaces config);
600 #endif // MXNET_USE_TVM_OP
635 #define MXNDArrayCreateEx MXNDArrayCreate // backward compatibility for external deps
679 const uint32_t* shape,
688 const uint32_t* aux_shape,
711 const int64_t* shape,
720 const int64_t* aux_shape,
775 uint32_t* out_name_size,
776 const char*** out_names);
796 uint32_t* out_name_size,
797 const char*** out_names);
883 uint32_t slice_begin,
1008 const bool transient_handle,
1139 const char** description,
1141 const char*** arg_names,
1142 const char*** arg_type_infos,
1143 const char*** arg_descriptions,
1144 const char** return_type
DEFAULT(NULL));
1156 uint32_t* num_use_vars,
1157 uint32_t* num_scalars,
1158 uint32_t* num_mutate_vars,
1199 const char** param_keys,
1200 const char** param_vals,
1201 const int** out_stypes);
1277 uint32_t* reqs_array,
1319 uint32_t num_variables,
1342 bool thread_safe
DEFAULT(
false));
1369 int default_dev_type,
1373 const int** out_stypes);
1492 const char** description,
1494 const char*** arg_names,
1495 const char*** arg_type_infos,
1496 const char*** arg_descriptions,
1497 const char** key_var_num_args,
1498 const char** return_type
DEFAULT(NULL));
1647 const char*** out_str_array);
1658 const char*** out_str_array);
1707 const char*** out_str_array);
1766 const uint32_t* arg_ind_ptr,
1767 const int* arg_shape_data,
1768 uint32_t* in_shape_size,
1769 const int** in_shape_ndim,
1770 const int*** in_shape_data,
1771 uint32_t* out_shape_size,
1772 const int** out_shape_ndim,
1773 const int*** out_shape_data,
1774 uint32_t* aux_shape_size,
1775 const int** aux_shape_ndim,
1776 const int*** aux_shape_data,
1807 const int64_t* arg_ind_ptr,
1808 const int64_t* arg_shape_data,
1809 size_t* in_shape_size,
1810 const int** in_shape_ndim,
1811 const int64_t*** in_shape_data,
1812 size_t* out_shape_size,
1813 const int** out_shape_ndim,
1814 const int64_t*** out_shape_data,
1815 size_t* aux_shape_size,
1816 const int** aux_shape_ndim,
1817 const int64_t*** aux_shape_data,
1849 const uint32_t* arg_ind_ptr,
1850 const int* arg_shape_data,
1851 uint32_t* in_shape_size,
1852 const int** in_shape_ndim,
1853 const int*** in_shape_data,
1854 uint32_t* out_shape_size,
1855 const int** out_shape_ndim,
1856 const int*** out_shape_data,
1857 uint32_t* aux_shape_size,
1858 const int** aux_shape_ndim,
1859 const int*** aux_shape_data,
1891 const int64_t* arg_ind_ptr,
1892 const int64_t* arg_shape_data,
1893 size_t* in_shape_size,
1894 const int** in_shape_ndim,
1895 const int64_t*** in_shape_data,
1896 size_t* out_shape_size,
1897 const int** out_shape_ndim,
1898 const int64_t*** out_shape_data,
1899 size_t* aux_shape_size,
1900 const int** aux_shape_ndim,
1901 const int64_t*** aux_shape_data,
1926 const int* arg_type_data,
1927 uint32_t* in_type_size,
1928 const int** in_type_data,
1929 uint32_t* out_type_size,
1930 const int** out_type_data,
1931 uint32_t* aux_type_size,
1932 const int** aux_type_data,
1959 const int* arg_type_data,
1960 uint32_t* in_type_size,
1961 const int** in_type_data,
1962 uint32_t* out_type_size,
1963 const int** out_type_data,
1964 uint32_t* aux_type_size,
1965 const int** aux_type_data,
1989 const int* dev_type,
1990 const uint32_t num_excluded_sym_names,
1991 const char** excluded_sym_names,
1992 const uint32_t num_excluded_op_names,
1993 const char** excluded_op_names,
1994 const uint32_t num_offline,
1995 const char** offline_params,
1996 const char* quantized_dtype,
1997 const bool calib_quantize,
1998 const char* quantize_mode,
1999 const char* quantize_granularity,
2000 uint32_t* out_num_calib_names,
2001 const char*** out_calib_names);
2028 const int target_dtype,
2029 const int cast_params_offline,
2030 const char*
const offline_param_cast_attr_p,
2031 const uint32_t num_inputs,
2032 const char**
const input_names_p,
2033 const uint32_t num_all_args,
2034 const char**
const all_arg_names_p,
2035 const int* all_arg_types_p,
2036 const uint32_t num_target_dtype_ops,
2037 const char**
const target_dtype_ops_p,
2038 const uint32_t num_fp32_ops,
2039 const char**
const fp32_ops_p,
2040 const uint32_t num_widest_dtype_ops,
2041 const char**
const widest_dtype_ops_p);
2053 const uint32_t num_layers,
2054 const char** layer_names,
2055 const float* low_quantiles,
2056 const float* high_quantiles,
2066 const char* backend,
2107 const char* backend_name,
2117 const uint32_t num_input_shapes,
2118 const char** input_shape_names,
2119 const int64_t* input_shape_data,
2120 const uint32_t* input_shape_idx,
2121 const uint32_t num_input_dtypes,
2122 const char** input_dtype_names,
2123 const int* input_dtypes,
2124 const uint32_t num_input_stypes,
2125 const char** input_stype_names,
2126 const int* input_stypes,
2130 char*** new_arg_names_handle,
2133 char*** new_aux_names_handle);
2173 const char** description,
2175 const char*** arg_names,
2176 const char*** arg_type_infos,
2177 const char*** arg_descriptions);
2278 const char** description,
2280 const char*** arg_names,
2281 const char*** arg_type_infos,
2282 const char*** arg_descriptions);
2345 const char** description,
2347 const char*** arg_names,
2348 const char*** arg_type_infos,
2349 const char*** arg_descriptions);
2397 uint32_t num_params,
2476 bool ignore_sparse);
2492 bool ignore_sparse);
2673 void* updater_handle);
2685 void* updater_handle);
2772 void* controller_handle);
2783 const char* cmd_body);
2798 const int timeout_sec
DEFAULT(60));
2877 uint32_t num_output,
2879 char** output_names,
2890 uint32_t num_output,
2898 uint32_t blockDimZ);
2934 const char** options,
2936 const char** exports,
2981 uint32_t grid_dim_x,
2982 uint32_t grid_dim_y,
2983 uint32_t grid_dim_z,
2984 uint32_t block_dim_x,
2985 uint32_t block_dim_y,
2986 uint32_t block_dim_z,
2987 uint32_t shared_mem);
3043 int num_mutable_vars,
3046 const char* opr_name
DEFAULT(NULL),
3071 int num_mutable_vars,
3074 const char* opr_name
DEFAULT(NULL));
3112 int num_mutable_nds,
3115 const char* opr_name
DEFAULT(NULL),
3140 int num_mutable_nds,
3143 const char* opr_name
DEFAULT(NULL));
3201 #endif // __cplusplus
3203 #endif // MXNET_C_API_H_
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
MXNET_DLL int MXDatasetFree(DatasetHandle handle)
Free the handle to the IO module.
MXNET_DLL int MXPushStreamDep(NDArrayHandle handle, int stream)
Synchronize the consumer stream with the producer stream where the NDArray lives.
MXNET_DLL int MXKVStoreSetUpdater(KVStoreHandle handle, MXKVStoreUpdater updater, void *updater_handle)
register a push updater
bool(* infer_shape)(int, int *, unsigned **, void *)
Definition: c_api.h:146
void(* EngineFuncParamDeleter)(void *)
Callback to free the param for EngineAsyncFunc/EngineSyncFunc.
Definition: c_api.h:125
int(* CustomOpInferTypeFunc)(int, int *, void *)
Definition: c_api.h:204
void ** contexts
Definition: c_api.h:164
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 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.
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 fl...
@ kCustomOpPropListArguments
Definition: c_api.h:176
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
MXNET_DLL int MXNDArraySetIsDeferredCompute(int deferred_compute_enabled, int *prev)
set whether to enable deferred compute mode
bool(* list_arguments)(char ***, void *)
Definition: c_api.h:148
MXNET_DLL int MXSetProfilerScope(const char *scope)
Set the scope of profiler for current process.
MXNET_DLL int MXEngineSetBulkSize(int bulk_size, int *prev_bulk_size)
set bulk execution limit
MXNET_DLL int MXNDArrayGetContext(NDArrayHandle handle, int *out_dev_type, int *out_dev_id)
get the context of the NDArray
MXNET_DLL int MXAutogradSetIsTraining(int is_training, int *prev)
set whether to record operator for autograd
int(** callbacks)(void)
Definition: c_api.h:163
MXNET_DLL int MXSymbolCreateFromFile(const char *fname, SymbolHandle *out)
Load a symbol from a json file.
void * CachedOpHandle
handle to cached operator
Definition: c_api.h:80
MXNET_DLL int MXNDArrayClearDeferredCompute(NDArrayHandle *arrays, int num)
Clear the deferred compute info associated with the ndarrays.
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
void * DatasetHandle
handle to a Dataset
Definition: c_api.h:94
@ kCustomOpForward
Definition: c_api.h:172
MXNET_DLL int MXNDArrayGetStorageType(NDArrayHandle handle, int *out_storage_type)
get the storage type of the array
MXNET_DLL int MXRecordIOReaderCreate(const char *uri, RecordIOHandle *out)
Create a RecordIO reader object.
void(* EngineAsyncFunc)(void *, void *, void *, void *)
Engine asynchronous operation.
Definition: c_api.h:121
@ kCustomOpPropBackwardInferStorageType
Definition: c_api.h:184
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.
MXNET_DLL int MXSymbolCreateFromJSON(const char *json, SymbolHandle *out)
Load a symbol from a json string.
MXNET_DLL int MXSetOptimizeLayout(bool val)
Turns on or off Layout Optimization.
MXNET_DLL int MXKVStoreRunServer(KVStoreHandle handle, MXKVStoreServerController controller, void *controller_handle)
Run as server (or scheduler)
MXNET_DLL int MXNDArrayReshape(NDArrayHandle handle, int ndim, int *dims, NDArrayHandle *out)
Reshape the NDArray.
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.
MXNET_DLL int MXDataIterBeforeFirst(DataIterHandle handle)
Call iterator.Reset.
MXNET_DLL int MXSymbolGetInternals(SymbolHandle symbol, SymbolHandle *out)
Get a symbol that contains all the internals.
void * p_list_outputs
Definition: c_api.h:139
@ kCustomOpPropCreateOperator
Definition: c_api.h:181
MXNET_DLL int MXNDArrayToDLPack(NDArrayHandle handle, DLManagedTensorHandle *out_dlpack)
Create a reference view of NDArray that represents as DLManagedTensor Notice: MXNet uses asynchronous...
MXNET_DLL int MXSymbolFree(SymbolHandle symbol)
Free the symbol handle.
MXNET_DLL int MXKVStoreGetType(KVStoreHandle handle, const char **type)
get the type of the kvstore
MXNET_DLL int MXGetGPUCount(int *out)
Get the number of GPUs.
MXNET_DLL int MXSymbolGetName(SymbolHandle symbol, const char **out, int *success)
Get string name from symbol.
MXNET_DLL int MXLoadLib(const char *path, unsigned verbose, void **lib)
Load library dynamically.
MXNET_DLL int MXKVStoreSetGradientCompression(KVStoreHandle handle, uint32_t num_params, const char **keys, const char **vals)
Set parameters to use low-bit compressed gradients.
void(* CachedOpMonitorCallback)(const char *, const char *, NDArrayHandle)
Monitor callback called at operator level for cached op.
Definition: c_api.h:127
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.
void(* list_arguments)(char ***, void *)
Definition: c_api.h:134
MXNET_DLL int MXProfileCreateCounter(ProfileHandle domain, const char *counter_name, ProfileHandle *out)
Create profile counter.
MXNET_DLL int MXProfileDestroyHandle(ProfileHandle frame_handle)
Destroy a frame.
MXNET_DLL int MXSymbolListOutputs(SymbolHandle symbol, uint32_t *out_size, const char ***out_str_array)
List returns in the symbol.
MXNET_DLL int MXSymbolSaveToFile(SymbolHandle symbol, const char *fname)
Save a symbol into a json file.
MXNET_DLL int MXSymbolListArguments(SymbolHandle symbol, uint32_t *out_size, const char ***out_str_array)
List arguments in the symbol.
void * AtomicSymbolHandle
handle to a AtomicSymbol
Definition: c_api.h:84
void * BatchifyFunctionHandle
handle to a BatchifyFunction
Definition: c_api.h:98
MXNET_DLL int MXRecordIOWriterTell(RecordIOHandle handle, size_t *pos)
Get the current writer pointer position.
MXNET_DLL int MXRecordIOReaderReadRecord(RecordIOHandle handle, char const **buf, size_t *size)
Write a record to a RecordIO object.
MXNET_DLL int MXKVStoreSendCommmandToServers(KVStoreHandle handle, int cmd_id, const char *cmd_body)
Send a command to all server nodes.
MXNET_DLL int MXGenBackendSubgraph(SymbolHandle sym_handle, const char *backend, SymbolHandle *ret_sym_handle)
Run subgraph pass based on the backend provided.
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
bool enabled
Definition: c_api.h:169
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_INT6...
@ kCustomOpPropDeclareBackwardDependency
Definition: c_api.h:180
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.
MXNET_DLL int MXKVStoreCreate(const char *type, KVStoreHandle *out)
Create a kvstore.
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.
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
int(* CustomOpCreateFunc)(const char *, int, unsigned **, const int *, const int *, struct MXCallbackList *, void *)
Definition: c_api.h:211
MXNET_DLL int MXGenAtomicSymbolFromSymbol(SymbolHandle sym_handle, SymbolHandle *ret_sym_handle)
Generate atomic symbol (able to be composed) from a source symbol.
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(mutabl...
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
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.
void * p_list_arguments
Definition: c_api.h:155
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
MXNET_DLL int MXSetNumOMPThreads(int thread_num)
Set the number of OMP threads to use.
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...
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....
MXNET_DLL int MXKVStoreInit(KVStoreHandle handle, uint32_t num, const int *keys, NDArrayHandle *vals)
Init a list of (key,value) pairs in kvstore.
MXNET_DLL int MXNDArrayCallDLPackDeleter(DLManagedTensorHandle dlpack)
Delete a dlpack tensor.
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.
MXNET_DLL int MXGetCommitHash(const char **out)
get the MXNet library commit hash at build time, usually provided by cmake
int(* CustomFunctionBwdFunc)(int, int, void **, const int *, const int, void *)
Definition: c_api.h:226
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_...
bool(* forward)(int, void **, int *, void *)
Definition: c_api.h:144
void * DLManagedTensorHandle
handle to DLManagedTensor
Definition: c_api.h:112
int(* CustomOpPropCreator)(const char *, const int, const char **, const char **, struct MXCallbackList *)
Definition: c_api.h:218
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_...
void(* EngineSyncFunc)(void *, void *)
Engine synchronous operation.
Definition: c_api.h:123
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
void * p_backward
Definition: c_api.h:137
void * CudaKernelHandle
handle to rtc cuda kernel
Definition: c_api.h:108
MXNET_DLL int MXRandomSeedContext(int seed, int dev_type, int dev_id)
Seed the global random number generator of the given device.
MXNET_DLL int MXSetFlushDenorms(bool value, bool *prev_state)
Change floating-point calculations when dealing with denormalized values. Currently this option is on...
MXNET_DLL int MXSetProcessProfilerState(int state, int profile_process, KVStoreHandle kvStoreHandle)
Set up state of profiler for either worker or server process.
MXNET_DLL int MXKVStoreIsWorkerNode(int *ret)
return whether or not this process is a worker node.
MXNET_DLL int MXDataIterGetItems(DataIterHandle handle, int *num_outputs, NDArrayHandle **outputs)
Get the handles to specified underlying ndarrays of index.
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...
MXNET_DLL int MXCachedOpRegisterOpHook(CachedOpHandle handle, CachedOpMonitorCallback callback, bool monitor_all)
cached op set monitor callback
MXNET_DLL int MXNDArrayFromDLPack(DLManagedTensorHandle dlpack, const bool transient_handle, NDArrayHandle *out_handle)
Create a NDArray backed by a dlpack tensor.
@ kCustomFunctionBackward
Definition: c_api.h:224
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
Definition: c_api.h:2651
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
MXNET_DLL int MXRtcCudaKernelCreate(CudaModuleHandle handle, const char *name, int num_args, int *is_ndarray, int *is_const, int *arg_types, CudaKernelHandle *out)
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 re...
Definition: c_api.h:2660
MXNET_DLL int MXProfileSetMarker(ProfileHandle domain, const char *instant_marker_name, const char *scope)
Mark a single instant in time.
MXNET_DLL int MXSymbolCreateVariable(const char *name, SymbolHandle *out)
Create a Variable Symbol.
CustomOpPropCallbacks
Definition: c_api.h:174
MXNET_DLL int MXSymbolGetAttr(SymbolHandle symbol, const char *key, const char **out, int *success)
Get string attribute from symbol.
MXNET_DLL int MXSymbolRemoveAmpCast(SymbolHandle sym_handle, SymbolHandle *ret_sym_handle)
Remove the operators amp_cast and amp_multicast.
MXNET_DLL int MXSymbolSaveToJSON(SymbolHandle symbol, const char **out_json)
Save a symbol into a json string.
void * CudaModuleHandle
handle to rtc cuda module
Definition: c_api.h:106
void * BatchifyFunctionCreator
handle to a BatchifyFunction creator
Definition: c_api.h:96
MXNET_DLL int MXProfileAdjustCounter(ProfileHandle counter_handle, int64_t value)
Adjust a counter by the given amount, given its handle.
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=...
MXNET_DLL int MXDataIterGetLabel(DataIterHandle handle, NDArrayHandle *out)
Get the handle to the NDArray of underlying label.
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.
MXNET_DLL int MXDataIterGetData(DataIterHandle handle, NDArrayHandle *out)
Get the handle to the NDArray of underlying data.
MXNET_DLL int MXSymbolGetInputs(SymbolHandle symbol, SymbolHandle *out)
Get a symbol that contains all the inputs.
@ kCustomOpBackward
Definition: c_api.h:172
MXNET_DLL int MXSymbolCopy(SymbolHandle symbol, SymbolHandle *out)
Copy the symbol to another handle.
MXNET_DLL int MXProcessProfilePause(int paused, int profile_process, KVStoreHandle kvStoreHandle)
Pause profiler tuning collection.
MXNET_DLL int MXAutogradGetSymbol(NDArrayHandle handle, SymbolHandle *out)
MXNET_DLL int MXNDArrayGetSharedMemHandle(NDArrayHandle handle, int *shared_pid, int *shared_id)
Get shared memory handle from NDArray.
MXNET_DLL int MXSymbolListAtomicSymbolCreators(uint32_t *out_size, AtomicSymbolCreator **out_array)
list all the available AtomicSymbolEntry
void * ProfileHandle
handle to a Profile object (domain, duration, counter, etc.)
Definition: c_api.h:110
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.
void * RtcHandle
handle to MXRtc
Definition: c_api.h:104
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
MXNET_DLL int MXKVStoreIsSchedulerNode(int *ret)
return whether or not this process is a scheduler node.
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 in...
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_I...
void * p_list_arguments
Definition: c_api.h:140
MXNET_DLL int MXDumpProfile(int finished)
Save profile and stop profiler for worker/current process.
MXNET_DLL int MXSetOptimizationConstraints(unsigned int constraints, unsigned int *prev)
set what optimization constraints to apply
MXNET_DLL int MXDatasetGetItems(DatasetHandle handle, uint64_t index, int *num_outputs, NDArrayHandle **outputs)
Get Output NDArray given specified indices.
int(* CustomOpFBFunc)(int, void **, int *, const int *, const int, void *)
Definition: c_api.h:187
MXNET_DLL int MXGetBranch(const char **out)
get the MXNet library branch at build time, usually provided by cmake
MXNET_DLL int MXSymbolGrad(SymbolHandle sym, uint32_t num_wrt, const char **wrt, SymbolHandle *out)
Get the gradient graph of the symbol.
MXNET_DLL int MXGetGPUMemoryInformation64(int dev, uint64_t *free_mem, uint64_t *total_mem)
get the free and total available memory on a GPU
MXNET_DLL int MXCachedOpGetOptimizedSymbol(CachedOpHandle handle, SymbolHandle *out)
get optimized graph from the cached op
void * KVStoreHandle
handle to KVStore
Definition: c_api.h:100
MXNET_DLL int MXListBatchifyFunctions(uint32_t *out_size, BatchifyFunctionCreator **out_array)
List all the available batchify function entries.
MXNET_DLL int MXRtcFree(RtcHandle handle)
Delete a MXRtc object.
MXNET_DLL int MXNDArraySetDeferredComputeVariable(NDArrayHandle *arrays, SymbolHandle *variables, int num)
Associate variables with deferred compute arrays.
MXNET_DLL int MXProfileCreateTask(ProfileHandle domain, const char *task_name, ProfileHandle *out)
Create profile task.
void * DataIterHandle
handle to a DataIterator
Definition: c_api.h:90
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...
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....
MXNET_DLL int MXNDArraySave(const char *fname, uint32_t num_args, NDArrayHandle *args, const char **keys)
Save list of narray into the file.
MXNET_DLL int MXAutogradIsTraining(bool *curr)
get whether training mode is on
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_...
MXNET_DLL int MXSymbolListAuxiliaryStates(SymbolHandle symbol, uint32_t *out_size, const char ***out_str_array)
List auxiliary states in the symbol.
@ kCustomOpPropListAuxiliaryStates
Definition: c_api.h:178
@ kCustomOpPropInferType
Definition: c_api.h:182
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.
MXNET_DLL int MXStorageEmptyCache(int dev_type, int dev_id)
Release all unreferenced memory from the devices storage managers memory pool.
MXNET_DLL int MXNDArraySyncCopyFromCPU(NDArrayHandle handle, const void *data, size_t size)
Perform a synchronize copy from a contiguous CPU memory region.
@ kCustomOpPropInferStorageType
Definition: c_api.h:183
int64_t dim_t
data type to store dim size
Definition: c_api.h:69
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.
@ kCustomOpPropDelete
Definition: c_api.h:175
MXNET_DLL int MXBatchifyFunctionFree(BatchifyFunctionHandle handle)
Free the handle to the IO module.
MXNET_DLL int MXRecordIOWriterCreate(const char *uri, RecordIOHandle *out)
Create a RecordIO writer object.
MXNET_DLL int MXDataIterGetIndex(DataIterHandle handle, uint64_t **out_index, uint64_t *out_size)
Get the image index by array.
MXNET_DLL int MXSymbolGetAtomicSymbolName(AtomicSymbolCreator creator, const char **name)
Get the name of an atomic symbol.
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.
MXNET_DLL int MXSymbolListAttr(SymbolHandle symbol, uint32_t *out_size, const char ***out)
Get all attributes from symbol, including all descendents.
MXNET_DLL int MXIsNumpyShape(int *curr)
get whether numpy compatibility is on
MXNET_DLL int MXRtcPush(RtcHandle handle, uint32_t num_input, uint32_t num_output, NDArrayHandle *inputs, NDArrayHandle *outputs, uint32_t gridDimX, uint32_t gridDimY, uint32_t gridDimZ, uint32_t blockDimX, uint32_t blockDimY, uint32_t blockDimZ)
Run cuda kernel.
MXNET_DLL int MXGetCurrentStream(int device_id, int *stream)
Get current stream pointer based on current device type and id.
MXNET_DLL int MXNVTXRangePush(const char *name, mx_uint color)
Push a new NVTX range. Requires building with CUDA and NVTX.
MXNET_DLL int MXShallowCopySymbol(SymbolHandle src, SymbolHandle *out)
Create an Symbol from source sharing the same graph structure.
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.
void * p_infer_shape
Definition: c_api.h:153
MXNET_DLL int MXNDArraySyncCheckFormat(NDArrayHandle handle, const bool full_check)
check whether the NDArray format is valid
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_INT6...
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.
MXNET_DLL int MXNDArrayLegacySave(const char *fname, uint32_t num_args, NDArrayHandle *args, const char **keys)
Save list of narray into the file.
MXNET_DLL int MXInitPSEnv(uint32_t num_vars, const char **keys, const char **vals)
Initialized ps-lite environment variables.
void * DataIterCreator
handle a dataiter creator
Definition: c_api.h:88
MXNET_DLL int MXRtcCreate(char *name, uint32_t num_input, uint32_t num_output, char **input_names, char **output_names, NDArrayHandle *inputs, NDArrayHandle *outputs, char *kernel, RtcHandle *out)
Create a MXRtc object.
MXNET_DLL int 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
int(* CustomOpDelFunc)(void *)
Definition: c_api.h:193
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.
const char * name
Definition: c_api.h:168
MXNET_DLL int MXProfileSetCounter(ProfileHandle counter_handle, uint64_t value)
Set a counter, given its handle.
float mx_float
manually define float
Definition: c_api.h:67
MXNET_DLL int MXProfileCreateDomain(const char *domain, ProfileHandle *out)
Create profiling domain.
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.
@ kCustomFunctionDelete
Definition: c_api.h:224
MXNET_DLL int MXProfileDurationStart(ProfileHandle duration_handle)
Start timing the duration of a profile duration object such as an event, task or frame.
CustomFunctionCallbacks
Definition: c_api.h:224
MXNET_DLL int MXRecordIOReaderTell(RecordIOHandle handle, size_t *pos)
Get the current writer pointer position.
bool(* backward)(int, void **, int *, void *)
Definition: c_api.h:145
void * p_forward
Definition: c_api.h:136
MXNET_DLL int MXSymbolCreateGroup(uint32_t num_symbols, SymbolHandle *symbols, SymbolHandle *out)
Create a Symbol by grouping list of symbols together.
MXNET_DLL int MXKVStoreIsServerNode(int *ret)
return whether or not this process is a server node.
MXNET_DLL int MXSetProfilerConfig(int num_params, const char *const *keys, const char *const *vals)
Set up configuration of profiler for worker/current process.
MXNET_DLL int MXFreeCachedOp(CachedOpHandle handle)
free cached operator
#define MXNET_DLL
MXNET_DLL prefix for windows.
Definition: c_api.h:53
void * AtomicSymbolCreator
handle to a function that takes param and creates symbol
Definition: c_api.h:78
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.
MXNET_DLL int MXSetProfilerState(int state)
Set up state of profiler for current process.
MXNET_DLL int MXListDataIters(uint32_t *out_size, DataIterCreator **out_array)
List all the available iterator entries.
MXNET_DLL int MXDumpProcessProfile(int finished, int profile_process, KVStoreHandle kvStoreHandle)
Save profile and stop profiler.
MXNET_DLL int MXNDArrayFree(NDArrayHandle handle)
free the narray handle
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.
void * p_backward
Definition: c_api.h:152
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 represe...
MXNET_DLL int MXSymbolCreateAtomicSymbol(AtomicSymbolCreator creator, uint32_t num_param, const char **keys, const char **vals, SymbolHandle *out)
Create an AtomicSymbol.
void(* forward)(int, float **, int *, unsigned **, int *, void *)
Definition: c_api.h:130
MXNET_DLL int MXProfileCreateFrame(ProfileHandle domain, const char *frame_name, ProfileHandle *out)
Create profile frame.
MXNET_DLL int MXAutogradComputeGradient(uint32_t num_output, NDArrayHandle *output_handles)
compute the gradient of outputs w.r.t variabels
MXNET_DLL int MXListDatasets(uint32_t *out_size, DatasetCreator **out_array)
List all the available dataset entries.
PaddingExp< SrcExp, DType, ExpInfo< SrcExp >::kDim > pad(const Exp< SrcExp, DType, etype > &src, index_t pad)
padding expression, pad a image with zeros on boundaries, padding affects shape[0],...
Definition: pad.h:71
MXNET_DLL int MXProfileCreateEvent(const char *event_name, ProfileHandle *out)
Create profile event.
@ kCustomOpDelete
Definition: c_api.h:172
MXNET_DLL int MXNDArrayGetDeferredComputeSymbol(NDArrayHandle *output_handles, int num_outputs, SymbolHandle *out)
Convert the graph constructed during deferred computation mode to a Symbol.
const typedef void * ContextHandle
handle to Context
Definition: c_api.h:114
MXNET_DLL int MXSymbolPrint(SymbolHandle symbol, const char **out_str)
Print the content of symbol, used for debug.
MXNET_DLL int MXSymbolCompose(SymbolHandle sym, const char *name, uint32_t num_args, const char **keys, SymbolHandle *args)
Compose the symbol on other symbols.
MXNET_DLL int MXSymbolGetNumOutputs(SymbolHandle symbol, uint32_t *output_count)
Get number of outputs of the symbol.
MXNET_DLL int MXNDArraySetGradState(NDArrayHandle handle, int state)
set the flag for gradient array state.
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
MXNET_DLL int MXNDArrayGetData(NDArrayHandle handle, void **out_pdata)
get the content of the data in NDArray
int(* MXGenericCallback)(void)
Definition: c_api.h:159
MXNET_DLL int MXNDArrayGetGrad(NDArrayHandle handle, NDArrayHandle *out)
return gradient buffer attached to this NDArray
int(* CustomOpBwdDepFunc)(const int *, const int *, const int *, int *, int **, void *)
Definition: c_api.h:205
void() MXKVStoreServerController(int head, const char *body, void *controller_handle)
the prototype of a server controller
Definition: c_api.h:2761
MXNET_DLL int MXProfilePause(int paused)
Pause profiler tuning collection for worker/current process.
MXNET_DLL int MXNDArrayCreateNone(NDArrayHandle *out)
Load TVM operator from the binary library.
MXNET_DLL int MXDataIterGetPadNum(DataIterHandle handle, int *pad)
Get the padding number in current data batch.
MXNET_DLL int MXDataIterNext(DataIterHandle handle, int *out)
Move iterator to next position.
MXNET_DLL int MXGetOptimizeLayout(bool *val)
Get current Layout Optimization status.
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.
MXNET_DLL int MXKVStoreBarrier(KVStoreHandle handle)
global barrier among all worker machines
MXNET_DLL int MXNDArrayGetDType(NDArrayHandle handle, int *out_dtype)
get the type of the data in NDArray
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 ba...
MXNET_DLL int MXGetFunction(const char *name, FunctionHandle *out)
get the function handle by name
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.
MXNET_DLL int MXNDArraySaveRawBytes(NDArrayHandle handle, size_t *out_size, const char **out_buf)
save the NDArray into raw bytes.
MXNET_DLL int MXSymbolGetOutput(SymbolHandle symbol, uint32_t index, SymbolHandle *out)
Get index-th outputs of the symbol.
MXNET_DLL int MXCheckDynamicShapeOp(SymbolHandle sym_handle, bool *has_dynamic_shape)
This function checks if any dynamic shape op is present in the symbol.
void * EngineVarHandle
handle to Engine VarHandle
Definition: c_api.h:118
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
MXNET_DLL int MXRtcCudaModuleCreate(const char *source, int num_options, const char **options, int num_exports, const char **exports, CudaModuleHandle *out)
MXNET_DLL int MXNDArrayLoadFromRawBytes(const void *buf, size_t size, NDArrayHandle *out)
create a NDArray handle that is loaded from raw bytes.
MXNET_DLL int MXSetIsNumpyShape(int is_np_shape, int *prev)
set numpy compatibility switch
void(* infer_shape)(int, int *, unsigned **, void *)
Definition: c_api.h:132
void * SymbolHandle
handle to a symbol that can be bind as operator
Definition: c_api.h:82
int(* CustomOpInferStorageTypeFunc)(int, int *, void *)
Definition: c_api.h:199
MXNET_DLL int MXSymbolGetInputSymbols(SymbolHandle sym, SymbolHandle **inputs, int *input_size)
Get the input symbols of the graph.
MXNET_DLL int MXRecordIOWriterWriteRecord(RecordIOHandle handle, const char *buf, size_t size)
Write a record to a RecordIO object.
void * p_list_outputs
Definition: c_api.h:154
MXNET_DLL int MXDataIterGetLenHint(DataIterHandle handle, int64_t *len)
Call iterator.GetLenHint. Note that some iterators don't provide length.
MXNET_DLL int MXNDArrayWaitToWrite(NDArrayHandle handle)
Wait until all the pending read/write with respect NDArray are finished. Always call this before writ...
MXNET_DLL int MXAutogradDropGrads(uint32_t num_var, NDArrayHandle *var_handles)
unmark nonleaf NDArrays to free the memory
MXNET_DLL int MXNDArrayWaitAll()
wait until all delayed operations in the system is completed
MXNET_DLL int MXLibInfoCompiledWithCXX11ABI(int *result)
return whether the mxnet library is compiled with cxx11 abi
const typedef void * FunctionHandle
handle to a mxnet narray function that changes NDArray
Definition: c_api.h:76
int(* CustomOpInferShapeFunc)(int, int *, int **, void *)
Definition: c_api.h:195
MXNET_DLL int MXCUDAProfilerStop()
End CUDA profiling session. Requires building with CUDA and NVTX.
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
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
MXNET_DLL int MXSymbolGetChildren(SymbolHandle symbol, SymbolHandle *out)
Get a symbol that contains only direct children.
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.
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_I...
MXNET_DLL int MXRecordIOReaderSeek(RecordIOHandle handle, size_t pos)
Set the current reader pointer position.
MXNET_DLL int MXNDArrayGetGradState(NDArrayHandle handle, int *out)
set the flag for gradient array state.
void * NDArrayHandle
handle to NDArray
Definition: c_api.h:74
int num_callbacks
Definition: c_api.h:162
void(* backward)(int, float **, int *, unsigned **, int *, void *)
Definition: c_api.h:131
MXNET_DLL int MXDatasetGetLen(DatasetHandle handle, uint64_t *out)
Get dataset overal length(size)
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}.
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.
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
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)
void * RecordIOHandle
handle to RecordIO
Definition: c_api.h:102
MXNET_DLL int MXNDArrayDetach(NDArrayHandle handle, NDArrayHandle *out)
detach and ndarray from computation graph by clearing entry_
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_...
MXNET_DLL int MXShallowCopyNDArray(NDArrayHandle src, NDArrayHandle *out)
Create an NDArray from source sharing the same data chunk.
bool(* declare_backward_dependency)(const int *, const int *, const int *, int *, int **, void *)
Definition: c_api.h:149
@ kCustomOpPropListOutputs
Definition: c_api.h:177
void(* list_outputs)(char ***, void *)
Definition: c_api.h:133
int(* CustomFunctionDelFunc)(void *)
Definition: c_api.h:232
MXNET_DLL int MXSymbolListAttrShallow(SymbolHandle symbol, uint32_t *out_size, const char ***out)
Get all attributes from symbol, excluding descendents.
MXNET_DLL int MXSetIsNumpyDefaultDtype(bool dtype_flag, bool *prev)
set numpy default data type
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.
MXNET_DLL int MXNDArrayReshape64(NDArrayHandle handle, int ndim, dim_t *dims, bool reverse, NDArrayHandle *out)
Reshape the NDArray.
int(* CustomOpListFunc)(char ***, void *)
Definition: c_api.h:194
MXNET_DLL int MXListAllOpNames(uint32_t *out_size, const char ***out_array)
list all the available operator names, include entries.
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 ...
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=...
MXNET_DLL int MXNotifyShutdown()
Notify the engine about a shutdown, This can help engine to print less messages into display.
MXNET_DLL int MXProfileDurationStop(ProfileHandle duration_handle)
Stop timing the duration of a profile duration object such as an event, task or frame.
void * p_infer_shape
Definition: c_api.h:138
MXNET_DLL int MXGetOptimizationConstraints(unsigned int *curr)
get current optimization constraints
MXNET_DLL int MXRecordIOWriterFree(RecordIOHandle handle)
Delete a RecordIO writer object.
MXNET_DLL int MXAutogradSetIsRecording(int is_recording, int *prev)
set whether to record operator for autograd
CustomOpCallbacks
Definition: c_api.h:172
MXNET_DLL int MXRandomSeed(int seed)
Seed all global random number generators in mxnet.
MXNET_DLL int MXDataIterFree(DataIterHandle handle)
Free the handle to the IO module.
void * DatasetCreator
handle a dataset creator
Definition: c_api.h:92
void * ExecutorHandle
handle to an Executor
Definition: c_api.h:86
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 repr...
MXNET_DLL int MXRecordIOReaderFree(RecordIOHandle handle)
Delete a RecordIO reader object.
MXNET_DLL int MXGetVersion(int *out)
get the MXNet library version as an integer
MXNET_DLL int MXLibInfoFeatures(const struct LibFeature **libFeature, size_t *size)
Get list of features supported on the runtime.
@ kCustomOpPropInferShape
Definition: c_api.h:179
MXNET_DLL int MXKVStoreFree(KVStoreHandle handle)
Delete a KVStore handle.
MXNET_DLL int MXKVStoreSetBarrierBeforeExit(KVStoreHandle handle, const int barrier_before_exit)
whether to do barrier when finalize
MXNET_DLL int MXKVStoreGetGroupSize(KVStoreHandle handle, int *ret)
return The number of nodes in this group, which is
MXNET_DLL int MXCUDAProfilerStart()
Start CUDA profiling session. Requires building with CUDA and NVTX.
int(* CustomOpBackwardInferStorageTypeFunc)(int, int *, int *, void *)
Definition: c_api.h:200
MXNET_DLL int MXAutogradIsRecording(bool *curr)
get whether autograd recording is on
void * p_declare_backward_dependency
Definition: c_api.h:156
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 repr...
uint32_t mx_uint
manually define unsigned int
Definition: c_api.h:65
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.
MXNET_DLL int MXKVStoreGetRank(KVStoreHandle handle, int *ret)
return The rank of this node in its group, which is in [0, GroupSize).
MXNET_DLL int MXBatchifyFunctionInvoke(BatchifyFunctionHandle handle, int batch_size, int num_output, NDArrayHandle *inputs, NDArrayHandle **outputs)
Invoke the Batchify Function.
const typedef void * EngineFnPropertyHandle
handle to Engine FnProperty
Definition: c_api.h:116
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....
MXNET_DLL int MXNDArrayWaitToRead(NDArrayHandle handle)
Wait until all the pending writes with respect NDArray are finished. Always call this before read dat...
MXNET_DLL int MXNDArrayIsDeferredCompute(int *curr)
Get current status of deferred compute mode.
void * p_forward
Definition: c_api.h:151
#define DEFAULT(x)
Inhibit C++ name-mangling for MXNet functions.
Definition: c_api.h:36
MXNET_DLL int MXRtcCudaModuleFree(CudaModuleHandle handle)
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.
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
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 ndar...
MXNET_DLL int MXNDArraySyncCopyToCPU(NDArrayHandle handle, void *data, size_t size)
Perform a synchronize copyto a contiguous CPU memory region.
bool(* list_outputs)(char ***, void *)
Definition: c_api.h:147
MXNET_DLL int MXIsNumpyDefaultDtype(bool *curr)
get numpy default data type
MXNET_DLL int MXRtcCudaKernelFree(CudaKernelHandle handle)
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
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 fl...
MXNET_DLL int MXNVTXRangePop()
End the NVTX range. Requires building with CUDA and NVTX.