mxnet
c_api.h
Go to the documentation of this file.
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
25 #ifndef MXNET_C_API_H_
26 #define MXNET_C_API_H_
27 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif // __cplusplus
32 
34 #ifdef __cplusplus
35 #define DEFAULT(x) = x
36 #else
37 #define DEFAULT(x)
38 #endif // __cplusplus
39 
40 #include <stdint.h>
41 
42 #include <stdint.h>
43 #include <stddef.h>
44 #include <stdbool.h>
45 
47 #ifdef _WIN32
48 #ifdef MXNET_EXPORTS
49 #define MXNET_DLL __declspec(dllexport)
50 #else
51 #define MXNET_DLL __declspec(dllimport)
52 #endif
53 #else
54 #define MXNET_DLL
55 #endif
56 
58 typedef unsigned int mx_uint;
60 typedef float mx_float;
62 typedef int64_t dim_t;
63 // all the handles are simply void *
64 // will be casted internally to specific pointers types
65 // these typedefs are mainly used for readablity reasons
67 typedef void *NDArrayHandle;
69 typedef const void *FunctionHandle;
71 typedef void *AtomicSymbolCreator;
73 typedef void *CachedOpHandle;
75 typedef void *SymbolHandle;
77 typedef void *AtomicSymbolHandle;
79 typedef void *ExecutorHandle;
81 typedef void *DataIterCreator;
83 typedef void *DataIterHandle;
85 typedef void *KVStoreHandle;
87 typedef void *RecordIOHandle;
89 typedef void *RtcHandle;
91 typedef void *CudaModuleHandle;
93 typedef void *CudaKernelHandle;
95 typedef void *ProfileHandle;
97 typedef void *DLManagedTensorHandle;
99 typedef const void *ContextHandle;
101 typedef const void *EngineFnPropertyHandle;
103 typedef void *EngineVarHandle;
104 
106 typedef void (*EngineAsyncFunc)(void*, void*, void*);
108 typedef void (*EngineSyncFunc)(void*, void*);
110 typedef void (*EngineFuncParamDeleter)(void*);
111 typedef void (*ExecutorMonitorCallback)(const char*,
113  void*);
114 
115 struct NativeOpInfo {
116  void (*forward)(int, float**, int*, unsigned**, int*, void*);
117  void (*backward)(int, float**, int*, unsigned**, int*, void*);
118  void (*infer_shape)(int, int*, unsigned**, void*);
119  void (*list_outputs)(char***, void*);
120  void (*list_arguments)(char***, void*);
121  // all functions also pass a payload void* pointer
122  void* p_forward;
123  void* p_backward;
127 };
128 
130  bool (*forward)(int, void**, int*, void*);
131  bool (*backward)(int, void**, int*, void*);
132  bool (*infer_shape)(int, int*, unsigned**, void*);
133  bool (*list_outputs)(char***, void*);
134  bool (*list_arguments)(char***, void*);
135  bool (*declare_backward_dependency)(const int*, const int*, const int*,
136  int*, int**, void*);
137  // all functions also pass a payload void* pointer
138  void* p_forward;
139  void* p_backward;
144 };
145 
146 typedef int (*MXGenericCallback)(void);
147 
150  int (**callbacks)(void);
151  void **contexts;
152 };
153 
154 struct LibFeature {
155  const char* name;
156  bool enabled;
157 };
158 
163 };
164 
176 };
177 
178 
179 typedef int (*CustomOpFBFunc)(int /*size*/, void** /*ptrs*/, int* /*tags*/,
180  const int* /*reqs*/, const int /*is_train*/,
181  void* /*state*/);
182 typedef int (*CustomOpDelFunc)(void* /*state*/);
183 typedef int (*CustomOpListFunc)(char*** /*args*/, void* /*state*/);
184 typedef int (*CustomOpInferShapeFunc)(int /*num_input*/, int* /*ndims*/,
185  int** /*shapes*/, void* /*state*/);
186 typedef int (*CustomOpInferStorageTypeFunc)(int /*num_input*/, int* /*stypes*/, void* /*state*/);
187 typedef int (*CustomOpBackwardInferStorageTypeFunc)(int /*num_input*/,
188  int * /*stypes*/,
189  int * /*tags*/,
190  void * /*state*/);
191 typedef int (*CustomOpInferTypeFunc)(int /*num_input*/, int* /*types*/, void* /*state*/);
192 typedef int (*CustomOpBwdDepFunc)(const int* /*out_grad*/, const int* /*in_data*/,
193  const int* /*out_data*/, int* /*num_deps*/,
194  int** /*rdeps*/, void* /*state*/);
195 typedef int (*CustomOpCreateFunc)(const char* /*ctx*/, int /*num_inputs*/,
196  unsigned** /*shapes*/, const int* /*ndims*/,
197  const int* /*dtypes*/, struct MXCallbackList* /*ret*/,
198  void* /*state*/);
199 typedef int (*CustomOpPropCreator)(const char* /*op_type*/, const int /*num_kwargs*/,
200  const char** /*keys*/, const char** /*values*/,
201  struct MXCallbackList* /*ret*/);
202 
203 
207 };
208 
209 typedef int (*CustomFunctionBwdFunc)(int /*num_ograds*/, int /*num_igrads*/, void** /*ptrs*/,
210  const int* /*reqs*/, const int /*is_train*/,
211  void* /*state*/);
212 typedef int (*CustomFunctionDelFunc)(void* /*state*/);
213 
223 MXNET_DLL const char *MXGetLastError();
224 
225 //-------------------------------------
226 // Part 0: Global State setups
227 //-------------------------------------
228 
235 MXNET_DLL int MXLibInfoFeatures(const struct LibFeature **libFeature, size_t *size);
236 
242 MXNET_DLL int MXRandomSeed(int seed);
243 
249 MXNET_DLL int MXRandomSeedContext(int seed, int dev_type, int dev_id);
250 
259 
268 MXNET_DLL int MXSetProcessProfilerConfig(int num_params, const char* const* keys,
269  const char* const* vals,
270  KVStoreHandle kvstoreHandle);
271 
279 MXNET_DLL int MXSetProfilerConfig(int num_params, const char* const* keys, const char* const* vals);
280 
292 MXNET_DLL int MXSetProcessProfilerState(int state, int profile_process,
293  KVStoreHandle kvStoreHandle);
294 
302 MXNET_DLL int MXSetProfilerState(int state);
303 
313 MXNET_DLL int MXDumpProcessProfile(int finished, int profile_process, KVStoreHandle kvStoreHandle);
314 
315 
321 MXNET_DLL int MXDumpProfile(int finished);
322 
323 
331 MXNET_DLL int MXAggregateProfileStatsPrint(const char **out_str, int reset);
332 
344 MXNET_DLL int MXAggregateProfileStatsPrintEx(const char **out_str, int reset, int format,
345  int sort_by, int ascending);
346 
355 MXNET_DLL int MXProcessProfilePause(int paused, int profile_process, KVStoreHandle kvStoreHandle);
356 
363 MXNET_DLL int MXProfilePause(int paused);
364 
371 MXNET_DLL int MXProfileCreateDomain(const char *domain, ProfileHandle *out);
372 
380 MXNET_DLL int MXProfileCreateTask(ProfileHandle domain,
381  const char *task_name,
382  ProfileHandle *out);
383 
391 MXNET_DLL int MXProfileCreateFrame(ProfileHandle domain,
392  const char *frame_name,
393  ProfileHandle *out);
394 
401 MXNET_DLL int MXProfileCreateEvent(const char *event_name, ProfileHandle *out);
402 
410 MXNET_DLL int MXProfileCreateCounter(ProfileHandle domain,
411  const char *counter_name,
412  ProfileHandle *out);
413 
419 MXNET_DLL int MXProfileDestroyHandle(ProfileHandle frame_handle);
420 
426 MXNET_DLL int MXProfileDurationStart(ProfileHandle duration_handle);
427 
433 MXNET_DLL int MXProfileDurationStop(ProfileHandle duration_handle);
434 
441 MXNET_DLL int MXProfileSetCounter(ProfileHandle counter_handle, uint64_t value);
442 
449 MXNET_DLL int MXProfileAdjustCounter(ProfileHandle counter_handle, int64_t value);
450 
458 MXNET_DLL int MXProfileSetMarker(ProfileHandle domain,
459  const char *instant_marker_name,
460  const char *scope);
461 
467 MXNET_DLL int MXSetNumOMPThreads(int thread_num);
468 
474 MXNET_DLL int MXEngineSetBulkSize(int bulk_size, int* prev_bulk_size);
475 
481 MXNET_DLL int MXGetGPUCount(int* out);
482 
491 MXNET_DLL int MXGetGPUMemoryInformation(int dev, int *free_mem, int *total_mem);
492 
500 MXNET_DLL int MXGetGPUMemoryInformation64(int dev, uint64_t *free_mem, uint64_t *total_mem);
501 
507 MXNET_DLL int MXGetVersion(int *out);
508 
509 
510 //-------------------------------------
511 // Part 1: NDArray creation and deletion
512 //-------------------------------------
520 MXNET_DLL int MXNDArrayCreateNone(NDArrayHandle *out);
532 MXNET_DLL int MXNDArrayCreate(const mx_uint *shape,
533  mx_uint ndim,
534  int dev_type,
535  int dev_id,
536  int delay_alloc,
537  NDArrayHandle *out);
538 
551 MXNET_DLL int MXNDArrayCreateEx(const mx_uint *shape,
552  mx_uint ndim,
553  int dev_type,
554  int dev_id,
555  int delay_alloc,
556  int dtype,
557  NDArrayHandle *out);
558 
559 
577 MXNET_DLL int MXNDArrayCreateSparseEx(int storage_type,
578  const mx_uint *shape,
579  mx_uint ndim,
580  int dev_type,
581  int dev_id,
582  int delay_alloc,
583  int dtype,
584  mx_uint num_aux,
585  int *aux_type,
586  mx_uint *aux_ndims,
587  const mx_uint *aux_shape,
588  NDArrayHandle *out);
589 
597 MXNET_DLL int MXNDArrayLoadFromRawBytes(const void *buf,
598  size_t size,
599  NDArrayHandle *out);
607 MXNET_DLL int MXNDArraySaveRawBytes(NDArrayHandle handle,
608  size_t *out_size,
609  const char **out_buf);
618 MXNET_DLL int MXNDArraySave(const char* fname,
619  mx_uint num_args,
620  NDArrayHandle* args,
621  const char** keys);
631 MXNET_DLL int MXNDArrayLoad(const char* fname,
632  mx_uint *out_size,
633  NDArrayHandle** out_arr,
634  mx_uint *out_name_size,
635  const char*** out_names);
636 
651 MXNET_DLL int MXNDArrayLoadFromBuffer(const void *ndarray_buffer,
652  size_t size,
653  mx_uint *out_size,
654  NDArrayHandle** out_arr,
655  mx_uint *out_name_size,
656  const char*** out_names);
657 
669 MXNET_DLL int MXNDArraySyncCopyFromCPU(NDArrayHandle handle,
670  const void *data,
671  size_t size);
683 MXNET_DLL int MXNDArraySyncCopyToCPU(NDArrayHandle handle,
684  void *data,
685  size_t size);
693 MXNET_DLL int MXNDArraySyncCopyFromNDArray(NDArrayHandle handle_dst,
694  const NDArrayHandle handle_src,
695  const int i);
696 
702 MXNET_DLL int MXNDArraySyncCheckFormat(NDArrayHandle handle, const bool full_check);
709 MXNET_DLL int MXNDArrayWaitToRead(NDArrayHandle handle);
716 MXNET_DLL int MXNDArrayWaitToWrite(NDArrayHandle handle);
728 MXNET_DLL int MXNDArrayFree(NDArrayHandle handle);
737 MXNET_DLL int MXNDArraySlice(NDArrayHandle handle,
738  mx_uint slice_begin,
739  mx_uint slice_end,
740  NDArrayHandle *out);
741 
749 MXNET_DLL int MXNDArrayAt(NDArrayHandle handle,
750  mx_uint idx,
751  NDArrayHandle *out);
752 
756 MXNET_DLL int MXNDArrayGetStorageType(NDArrayHandle handle,
757  int *out_storage_type);
758 
767 MXNET_DLL int MXNDArrayReshape(NDArrayHandle handle,
768  int ndim,
769  int *dims,
770  NDArrayHandle *out);
771 
780 MXNET_DLL int MXNDArrayReshape64(NDArrayHandle handle,
781  int ndim,
782  dim_t *dims,
783  bool reverse,
784  NDArrayHandle *out);
793 MXNET_DLL int MXNDArrayGetShape(NDArrayHandle handle,
794  mx_uint *out_dim,
795  const mx_uint **out_pdata);
803 MXNET_DLL int MXNDArrayGetShapeEx(NDArrayHandle handle,
804  int *out_dim,
805  const int **out_pdata);
812 MXNET_DLL int MXNDArrayGetData(NDArrayHandle handle,
813  void **out_pdata);
823 MXNET_DLL int MXNDArrayToDLPack(NDArrayHandle handle,
824  DLManagedTensorHandle *out_dlpack);
825 
841 MXNET_DLL int MXNDArrayFromDLPack(DLManagedTensorHandle dlpack,
842  NDArrayHandle *out_handle);
843 
858 MXNET_DLL int MXNDArrayFromDLPackEx(DLManagedTensorHandle dlpack,
859  const bool transient_handle,
860  NDArrayHandle *out_handle);
861 
867 MXNET_DLL int MXNDArrayCallDLPackDeleter(DLManagedTensorHandle dlpack);
868 
875 MXNET_DLL int MXNDArrayGetDType(NDArrayHandle handle,
876  int *out_dtype);
877 
885 MXNET_DLL int MXNDArrayGetAuxType(NDArrayHandle handle,
886  mx_uint i,
887  int *out_type);
888 
894 MXNET_DLL int MXNDArrayGetAuxNDArray(NDArrayHandle handle,
895  mx_uint i,
896  NDArrayHandle *out);
897 
903 MXNET_DLL int MXNDArrayGetDataNDArray(NDArrayHandle handle,
904  NDArrayHandle *out);
912 MXNET_DLL int MXNDArrayGetContext(NDArrayHandle handle,
913  int *out_dev_type,
914  int *out_dev_id);
920 MXNET_DLL int MXNDArrayGetGrad(NDArrayHandle handle, NDArrayHandle *out);
926 MXNET_DLL int MXNDArrayDetach(NDArrayHandle handle, NDArrayHandle *out);
933 MXNET_DLL int MXNDArraySetGradState(NDArrayHandle handle, int state);
940 MXNET_DLL int MXNDArrayGetGradState(NDArrayHandle handle, int *out);
941 //--------------------------------
942 // Part 2: functions on NDArray
943 //--------------------------------
951 MXNET_DLL int MXListFunctions(mx_uint *out_size,
952  FunctionHandle **out_array);
959 MXNET_DLL int MXGetFunction(const char *name,
960  FunctionHandle *out);
973 MXNET_DLL int MXFuncGetInfo(FunctionHandle fun,
974  const char **name,
975  const char **description,
976  mx_uint *num_args,
977  const char ***arg_names,
978  const char ***arg_type_infos,
979  const char ***arg_descriptions,
980  const char **return_type DEFAULT(NULL));
991 MXNET_DLL int MXFuncDescribe(FunctionHandle fun,
992  mx_uint *num_use_vars,
993  mx_uint *num_scalars,
994  mx_uint *num_mutate_vars,
995  int *type_mask);
1006 MXNET_DLL int MXFuncInvoke(FunctionHandle fun,
1007  NDArrayHandle *use_vars,
1008  mx_float *scalar_args,
1009  NDArrayHandle *mutate_vars);
1023 MXNET_DLL int MXFuncInvokeEx(FunctionHandle fun,
1024  NDArrayHandle *use_vars,
1025  mx_float *scalar_args,
1026  NDArrayHandle *mutate_vars,
1027  int num_params,
1028  char **param_keys,
1029  char **param_vals);
1042 MXNET_DLL int MXImperativeInvoke(AtomicSymbolCreator creator,
1043  int num_inputs,
1044  NDArrayHandle *inputs,
1045  int *num_outputs,
1046  NDArrayHandle **outputs,
1047  int num_params,
1048  const char **param_keys,
1049  const char **param_vals);
1063 MXNET_DLL int MXImperativeInvokeEx(AtomicSymbolCreator creator,
1064  int num_inputs,
1065  NDArrayHandle *inputs,
1066  int *num_outputs,
1067  NDArrayHandle **outputs,
1068  int num_params,
1069  const char **param_keys,
1070  const char **param_vals,
1071  const int **out_stypes);
1078 MXNET_DLL int MXAutogradSetIsRecording(int is_recording, int* prev);
1085 MXNET_DLL int MXAutogradSetIsTraining(int is_training, int* prev);
1091 MXNET_DLL int MXAutogradIsRecording(bool* curr);
1097 MXNET_DLL int MXAutogradIsTraining(bool* curr);
1103 MXNET_DLL int MXIsNumpyShape(bool* curr);
1110 MXNET_DLL int MXSetIsNumpyShape(int is_np_shape, int* prev);
1117 MXNET_DLL int MXAutogradMarkVariables(mx_uint num_var,
1118  NDArrayHandle *var_handles,
1119  mx_uint *reqs_array,
1120  NDArrayHandle *grad_handles);
1127 MXNET_DLL int MXAutogradComputeGradient(mx_uint num_output,
1128  NDArrayHandle* output_handles);
1137 MXNET_DLL int MXAutogradBackward(mx_uint num_output,
1138  NDArrayHandle* output_handles,
1139  NDArrayHandle* ograd_handles,
1140  int retain_graph);
1152 MXNET_DLL int MXAutogradBackwardEx(mx_uint num_output,
1153  NDArrayHandle *output_handles,
1154  NDArrayHandle *ograd_handles,
1155  mx_uint num_variables,
1156  NDArrayHandle *var_handles,
1157  int retain_graph,
1158  int create_graph,
1159  int is_train,
1160  NDArrayHandle **grad_handles,
1161  int **grad_stypes);
1162 /*
1163  * \brief get the graph constructed by autograd.
1164  * \param handle ndarray handle
1165  * \param out output symbol handle
1166  */
1167 MXNET_DLL int MXAutogradGetSymbol(NDArrayHandle handle, SymbolHandle *out);
1171 MXNET_DLL int MXCreateCachedOp(SymbolHandle handle, CachedOpHandle *out);
1175 MXNET_DLL int MXCreateCachedOpEx(SymbolHandle handle,
1176  int num_flags,
1177  const char** keys,
1178  const char** vals,
1179  CachedOpHandle *out);
1183 MXNET_DLL int MXFreeCachedOp(CachedOpHandle handle);
1187 MXNET_DLL int MXInvokeCachedOp(CachedOpHandle handle,
1188  int num_inputs,
1189  NDArrayHandle *inputs,
1190  int *num_outputs,
1191  NDArrayHandle **outputs);
1202 MXNET_DLL int MXInvokeCachedOpEx(CachedOpHandle handle,
1203  int num_inputs,
1204  NDArrayHandle *inputs,
1205  int *num_outputs,
1206  NDArrayHandle **outputs,
1207  const int** out_stypes);
1208 
1209 //--------------------------------------------
1210 // Part 3: symbolic configuration generation
1211 //--------------------------------------------
1218 MXNET_DLL int MXListAllOpNames(mx_uint *out_size,
1219  const char ***out_array);
1226 MXNET_DLL int MXSymbolListAtomicSymbolCreators(mx_uint *out_size,
1227  AtomicSymbolCreator **out_array);
1228 
1234 MXNET_DLL int MXSymbolGetAtomicSymbolName(AtomicSymbolCreator creator,
1235  const char **name);
1236 
1243 MXNET_DLL int MXSymbolGetInputSymbols(SymbolHandle sym, SymbolHandle **inputs,
1244  int *input_size);
1245 
1255 MXNET_DLL int MXSymbolCutSubgraph(SymbolHandle sym, SymbolHandle **inputs,
1256  int *input_size);
1257 
1275 MXNET_DLL int MXSymbolGetAtomicSymbolInfo(AtomicSymbolCreator creator,
1276  const char **name,
1277  const char **description,
1278  mx_uint *num_args,
1279  const char ***arg_names,
1280  const char ***arg_type_infos,
1281  const char ***arg_descriptions,
1282  const char **key_var_num_args,
1283  const char **return_type DEFAULT(NULL));
1293 MXNET_DLL int MXSymbolCreateAtomicSymbol(AtomicSymbolCreator creator,
1294  mx_uint num_param,
1295  const char **keys,
1296  const char **vals,
1297  SymbolHandle *out);
1304 MXNET_DLL int MXSymbolCreateVariable(const char *name, SymbolHandle *out);
1312 MXNET_DLL int MXSymbolCreateGroup(mx_uint num_symbols,
1313  SymbolHandle *symbols,
1314  SymbolHandle *out);
1321 MXNET_DLL int MXSymbolCreateFromFile(const char *fname, SymbolHandle *out);
1328 MXNET_DLL int MXSymbolCreateFromJSON(const char *json, SymbolHandle *out);
1335 MXNET_DLL int MXSymbolRemoveAmpCast(SymbolHandle sym_handle, SymbolHandle* ret_sym_handle);
1342 MXNET_DLL int MXSymbolSaveToFile(SymbolHandle symbol, const char *fname);
1349 MXNET_DLL int MXSymbolSaveToJSON(SymbolHandle symbol, const char **out_json);
1355 MXNET_DLL int MXSymbolFree(SymbolHandle symbol);
1362 MXNET_DLL int MXSymbolCopy(SymbolHandle symbol, SymbolHandle *out);
1369 MXNET_DLL int MXSymbolPrint(SymbolHandle symbol, const char **out_str);
1377 MXNET_DLL int MXSymbolGetName(SymbolHandle symbol,
1378  const char** out,
1379  int *success);
1388 MXNET_DLL int MXSymbolGetAttr(SymbolHandle symbol,
1389  const char* key,
1390  const char** out,
1391  int *success);
1408 MXNET_DLL int MXSymbolSetAttr(SymbolHandle symbol,
1409  const char* key,
1410  const char* value);
1418 MXNET_DLL int MXSymbolListAttr(SymbolHandle symbol,
1419  mx_uint *out_size,
1420  const char*** out);
1428 MXNET_DLL int MXSymbolListAttrShallow(SymbolHandle symbol,
1429  mx_uint *out_size,
1430  const char*** out);
1438 MXNET_DLL int MXSymbolListArguments(SymbolHandle symbol,
1439  mx_uint *out_size,
1440  const char ***out_str_array);
1448 MXNET_DLL int MXSymbolListOutputs(SymbolHandle symbol,
1449  mx_uint *out_size,
1450  const char ***out_str_array);
1451 
1458 MXNET_DLL int MXSymbolGetNumOutputs(SymbolHandle symbol,
1459  mx_uint *output_count);
1460 
1467 MXNET_DLL int MXSymbolGetInternals(SymbolHandle symbol,
1468  SymbolHandle *out);
1475 MXNET_DLL int MXSymbolGetChildren(SymbolHandle symbol,
1476  SymbolHandle *out);
1484 MXNET_DLL int MXSymbolGetOutput(SymbolHandle symbol,
1485  mx_uint index,
1486  SymbolHandle *out);
1487 
1495 MXNET_DLL int MXSymbolListAuxiliaryStates(SymbolHandle symbol,
1496  mx_uint *out_size,
1497  const char ***out_str_array);
1512 MXNET_DLL int MXSymbolCompose(SymbolHandle sym,
1513  const char *name,
1514  mx_uint num_args,
1515  const char** keys,
1516  SymbolHandle* args);
1526 MXNET_DLL int MXSymbolGrad(SymbolHandle sym,
1527  mx_uint num_wrt,
1528  const char** wrt,
1529  SymbolHandle* out);
1553 MXNET_DLL int MXSymbolInferShape(SymbolHandle sym,
1554  mx_uint num_args,
1555  const char** keys,
1556  const mx_uint *arg_ind_ptr,
1557  const mx_uint *arg_shape_data,
1558  mx_uint *in_shape_size,
1559  const mx_uint **in_shape_ndim,
1560  const mx_uint ***in_shape_data,
1561  mx_uint *out_shape_size,
1562  const mx_uint **out_shape_ndim,
1563  const mx_uint ***out_shape_data,
1564  mx_uint *aux_shape_size,
1565  const mx_uint **aux_shape_ndim,
1566  const mx_uint ***aux_shape_data,
1567  int *complete);
1568 
1591 MXNET_DLL int MXSymbolInferShapeEx(SymbolHandle sym,
1592  mx_uint num_args,
1593  const char** keys,
1594  const mx_uint *arg_ind_ptr,
1595  const int *arg_shape_data,
1596  mx_uint *in_shape_size,
1597  const int **in_shape_ndim,
1598  const int ***in_shape_data,
1599  mx_uint *out_shape_size,
1600  const int **out_shape_ndim,
1601  const int ***out_shape_data,
1602  mx_uint *aux_shape_size,
1603  const int **aux_shape_ndim,
1604  const int ***aux_shape_data,
1605  int *complete);
1631 MXNET_DLL int MXSymbolInferShapePartial(SymbolHandle sym,
1632  mx_uint num_args,
1633  const char** keys,
1634  const mx_uint *arg_ind_ptr,
1635  const mx_uint *arg_shape_data,
1636  mx_uint *in_shape_size,
1637  const mx_uint **in_shape_ndim,
1638  const mx_uint ***in_shape_data,
1639  mx_uint *out_shape_size,
1640  const mx_uint **out_shape_ndim,
1641  const mx_uint ***out_shape_data,
1642  mx_uint *aux_shape_size,
1643  const mx_uint **aux_shape_ndim,
1644  const mx_uint ***aux_shape_data,
1645  int *complete);
1646 
1647 
1672 MXNET_DLL int MXSymbolInferShapePartialEx(SymbolHandle sym,
1673  mx_uint num_args,
1674  const char** keys,
1675  const mx_uint *arg_ind_ptr,
1676  const int *arg_shape_data,
1677  mx_uint *in_shape_size,
1678  const int **in_shape_ndim,
1679  const int ***in_shape_data,
1680  mx_uint *out_shape_size,
1681  const int **out_shape_ndim,
1682  const int ***out_shape_data,
1683  mx_uint *aux_shape_size,
1684  const int **aux_shape_ndim,
1685  const int ***aux_shape_data,
1686  int *complete);
1687 
1706 MXNET_DLL int MXSymbolInferType(SymbolHandle sym,
1707  mx_uint num_args,
1708  const char** keys,
1709  const int *arg_type_data,
1710  mx_uint *in_type_size,
1711  const int **in_type_data,
1712  mx_uint *out_type_size,
1713  const int **out_type_data,
1714  mx_uint *aux_type_size,
1715  const int **aux_type_data,
1716  int *complete);
1717 
1738 MXNET_DLL int MXSymbolInferTypePartial(SymbolHandle sym,
1739  mx_uint num_args,
1740  const char** keys,
1741  const int *arg_type_data,
1742  mx_uint *in_type_size,
1743  const int **in_type_data,
1744  mx_uint *out_type_size,
1745  const int **out_type_data,
1746  mx_uint *aux_type_size,
1747  const int **aux_type_data,
1748  int *complete);
1749 
1761 MXNET_DLL int MXQuantizeSymbol(SymbolHandle sym_handle, SymbolHandle *ret_sym_handle,
1762  const mx_uint num_excluded_symbols,
1763  const char **excluded_symbols,
1764  const mx_uint num_offline, const char **offline_params,
1765  const char *quantized_dtype, const bool calib_quantize);
1766 
1776 MXNET_DLL int MXSetCalibTableToQuantizedSymbol(SymbolHandle qsym_handle,
1777  const mx_uint num_layers,
1778  const char** layer_names,
1779  const float* low_quantiles,
1780  const float* high_quantiles,
1781  SymbolHandle* ret_sym_handle);
1782 
1789 MXNET_DLL int MXGenBackendSubgraph(SymbolHandle sym_handle, const char *backend,
1790  SymbolHandle *ret_sym_handle);
1791 
1797 MXNET_DLL int MXGenAtomicSymbolFromSymbol(SymbolHandle sym_handle, SymbolHandle *ret_sym_handle);
1798 
1799 
1800 //--------------------------------------------
1801 // Part 4: Executor interface
1802 //--------------------------------------------
1808 MXNET_DLL int MXExecutorFree(ExecutorHandle handle);
1815 MXNET_DLL int MXExecutorPrint(ExecutorHandle handle, const char **out_str);
1823 MXNET_DLL int MXExecutorForward(ExecutorHandle handle, int is_train);
1833 MXNET_DLL int MXExecutorBackward(ExecutorHandle handle,
1834  mx_uint len,
1835  NDArrayHandle *head_grads);
1846 MXNET_DLL int MXExecutorBackwardEx(ExecutorHandle handle,
1847  mx_uint len,
1848  NDArrayHandle *head_grads,
1849  int is_train);
1858 MXNET_DLL int MXExecutorOutputs(ExecutorHandle handle,
1859  mx_uint *out_size,
1860  NDArrayHandle **out);
1861 
1877 MXNET_DLL int MXExecutorBind(SymbolHandle symbol_handle,
1878  int dev_type,
1879  int dev_id,
1880  mx_uint len,
1881  NDArrayHandle *in_args,
1882  NDArrayHandle *arg_grad_store,
1883  mx_uint *grad_req_type,
1884  mx_uint aux_states_len,
1885  NDArrayHandle *aux_states,
1886  ExecutorHandle *out);
1908 MXNET_DLL int MXExecutorBindX(SymbolHandle symbol_handle,
1909  int dev_type,
1910  int dev_id,
1911  mx_uint num_map_keys,
1912  const char** map_keys,
1913  const int* map_dev_types,
1914  const int* map_dev_ids,
1915  mx_uint len,
1916  NDArrayHandle *in_args,
1917  NDArrayHandle *arg_grad_store,
1918  mx_uint *grad_req_type,
1919  mx_uint aux_states_len,
1920  NDArrayHandle *aux_states,
1921  ExecutorHandle *out);
1944 MXNET_DLL int MXExecutorBindEX(SymbolHandle symbol_handle,
1945  int dev_type,
1946  int dev_id,
1947  mx_uint num_map_keys,
1948  const char** map_keys,
1949  const int* map_dev_types,
1950  const int* map_dev_ids,
1951  mx_uint len,
1952  NDArrayHandle *in_args,
1953  NDArrayHandle *arg_grad_store,
1954  mx_uint *grad_req_type,
1955  mx_uint aux_states_len,
1956  NDArrayHandle *aux_states,
1957  ExecutorHandle shared_exec,
1958  ExecutorHandle *out);
1961 MXNET_DLL int MXExecutorSimpleBind(SymbolHandle symbol_handle,
1962  int dev_type,
1963  int dev_id,
1964  const mx_uint num_g2c_keys,
1965  const char** g2c_keys,
1966  const int* g2c_dev_types,
1967  const int* g2c_dev_ids,
1968  const mx_uint provided_grad_req_list_len,
1969  const char** provided_grad_req_names,
1970  const char** provided_grad_req_types,
1971  const mx_uint num_provided_arg_shapes,
1972  const char** provided_arg_shape_names,
1973  const mx_uint* provided_arg_shape_data,
1974  const mx_uint* provided_arg_shape_idx,
1975  const mx_uint num_provided_arg_dtypes,
1976  const char** provided_arg_dtype_names,
1977  const int* provided_arg_dtypes,
1978  const mx_uint num_provided_arg_stypes,
1979  const char** provided_arg_stype_names,
1980  const int* provided_arg_stypes,
1981  const mx_uint num_shared_arg_names,
1982  const char** shared_arg_name_list,
1983  int* shared_buffer_len,
1984  const char** shared_buffer_name_list,
1985  NDArrayHandle* shared_buffer_handle_list,
1986  const char*** updated_shared_buffer_name_list,
1987  NDArrayHandle** updated_shared_buffer_handle_list,
1988  mx_uint* num_in_args,
1989  NDArrayHandle** in_args,
1990  NDArrayHandle** arg_grads,
1991  mx_uint* num_aux_states,
1992  NDArrayHandle** aux_states,
1993  ExecutorHandle shared_exec_handle,
1994  ExecutorHandle* out);
1995 
1996 
1997 MXNET_DLL int MXExecutorSimpleBindEx(SymbolHandle symbol_handle,
1998  int dev_type,
1999  int dev_id,
2000  const mx_uint num_g2c_keys,
2001  const char** g2c_keys,
2002  const int* g2c_dev_types,
2003  const int* g2c_dev_ids,
2004  const mx_uint provided_grad_req_list_len,
2005  const char** provided_grad_req_names,
2006  const char** provided_grad_req_types,
2007  const mx_uint num_provided_arg_shapes,
2008  const char** provided_arg_shape_names,
2009  const int* provided_arg_shape_data,
2010  const mx_uint* provided_arg_shape_idx,
2011  const mx_uint num_provided_arg_dtypes,
2012  const char** provided_arg_dtype_names,
2013  const int* provided_arg_dtypes,
2014  const mx_uint num_provided_arg_stypes,
2015  const char** provided_arg_stype_names,
2016  const int* provided_arg_stypes,
2017  const mx_uint num_shared_arg_names,
2018  const char** shared_arg_name_list,
2019  int* shared_buffer_len,
2020  const char** shared_buffer_name_list,
2021  NDArrayHandle* shared_buffer_handle_list,
2022  const char*** updated_shared_buffer_name_list,
2023  NDArrayHandle** updated_shared_buffer_handle_list,
2024  mx_uint* num_in_args,
2025  NDArrayHandle** in_args,
2026  NDArrayHandle** arg_grads,
2027  mx_uint* num_aux_states,
2028  NDArrayHandle** aux_states,
2029  ExecutorHandle shared_exec_handle,
2030  ExecutorHandle* out);
2053 MXNET_DLL int MXExecutorReshape(int partial_shaping,
2054  int allow_up_sizing,
2055  int dev_type,
2056  int dev_id,
2057  mx_uint num_map_keys,
2058  const char** map_keys,
2059  const int* map_dev_types,
2060  const int* map_dev_ids,
2061  const mx_uint num_provided_arg_shapes,
2062  const char** provided_arg_shape_names,
2063  const mx_uint* provided_arg_shape_data,
2064  const mx_uint* provided_arg_shape_idx,
2065  mx_uint* num_in_args,
2066  NDArrayHandle** in_args,
2067  NDArrayHandle** arg_grads,
2068  mx_uint* num_aux_states,
2069  NDArrayHandle** aux_states,
2070  ExecutorHandle shared_exec,
2071  ExecutorHandle *out);
2093 MXNET_DLL int MXExecutorReshapeEx(int partial_shaping,
2094  int allow_up_sizing,
2095  int dev_type,
2096  int dev_id,
2097  mx_uint num_map_keys,
2098  const char** map_keys,
2099  const int* map_dev_types,
2100  const int* map_dev_ids,
2101  const mx_uint num_provided_arg_shapes,
2102  const char** provided_arg_shape_names,
2103  const int* provided_arg_shape_data,
2104  const mx_uint* provided_arg_shape_idx,
2105  mx_uint* num_in_args,
2106  NDArrayHandle** in_args,
2107  NDArrayHandle** arg_grads,
2108  mx_uint* num_aux_states,
2109  NDArrayHandle** aux_states,
2110  ExecutorHandle shared_exec,
2111  ExecutorHandle *out);
2112 
2116 MXNET_DLL int MXExecutorGetOptimizedSymbol(ExecutorHandle handle,
2117  SymbolHandle *out);
2121 MXNET_DLL int MXExecutorSetMonitorCallback(ExecutorHandle handle,
2122  ExecutorMonitorCallback callback,
2123  void* callback_handle);
2124 
2129 MXNET_DLL int MXExecutorSetMonitorCallbackEX(ExecutorHandle handle,
2130  ExecutorMonitorCallback callback,
2131  void *callback_handle, bool monitor_all);
2132 //--------------------------------------------
2133 // Part 5: IO Interface
2134 //--------------------------------------------
2141 MXNET_DLL int MXListDataIters(mx_uint *out_size,
2142  DataIterCreator **out_array);
2153 MXNET_DLL int MXDataIterCreateIter(DataIterCreator handle,
2154  mx_uint num_param,
2155  const char **keys,
2156  const char **vals,
2157  DataIterHandle *out);
2169 MXNET_DLL int MXDataIterGetIterInfo(DataIterCreator creator,
2170  const char **name,
2171  const char **description,
2172  mx_uint *num_args,
2173  const char ***arg_names,
2174  const char ***arg_type_infos,
2175  const char ***arg_descriptions);
2181 MXNET_DLL int MXDataIterFree(DataIterHandle handle);
2188 MXNET_DLL int MXDataIterNext(DataIterHandle handle,
2189  int *out);
2195 MXNET_DLL int MXDataIterBeforeFirst(DataIterHandle handle);
2196 
2203 MXNET_DLL int MXDataIterGetData(DataIterHandle handle,
2204  NDArrayHandle *out);
2212 MXNET_DLL int MXDataIterGetIndex(DataIterHandle handle,
2213  uint64_t **out_index,
2214  uint64_t *out_size);
2221 MXNET_DLL int MXDataIterGetPadNum(DataIterHandle handle,
2222  int *pad);
2223 
2230 MXNET_DLL int MXDataIterGetLabel(DataIterHandle handle,
2231  NDArrayHandle *out);
2232 //--------------------------------------------
2233 // Part 6: basic KVStore interface
2234 //--------------------------------------------
2241 MXNET_DLL int MXInitPSEnv(mx_uint num_vars,
2242  const char **keys,
2243  const char **vals);
2244 
2245 
2252 MXNET_DLL int MXKVStoreCreate(const char *type,
2253  KVStoreHandle *out);
2254 
2262 MXNET_DLL int MXKVStoreSetGradientCompression(KVStoreHandle handle,
2263  mx_uint num_params,
2264  const char** keys,
2265  const char** vals);
2266 
2272 MXNET_DLL int MXKVStoreFree(KVStoreHandle handle);
2281 MXNET_DLL int MXKVStoreInit(KVStoreHandle handle,
2282  mx_uint num,
2283  const int* keys,
2284  NDArrayHandle* vals);
2285 
2294 MXNET_DLL int MXKVStoreInitEx(KVStoreHandle handle,
2295  mx_uint num,
2296  const char** keys,
2297  NDArrayHandle* vals);
2298 
2308 MXNET_DLL int MXKVStorePush(KVStoreHandle handle,
2309  mx_uint num,
2310  const int* keys,
2311  NDArrayHandle* vals,
2312  int priority);
2322 MXNET_DLL int MXKVStorePushEx(KVStoreHandle handle,
2323  mx_uint num,
2324  const char** keys,
2325  NDArrayHandle* vals,
2326  int priority);
2337 MXNET_DLL int MXKVStorePullWithSparse(KVStoreHandle handle,
2338  mx_uint num,
2339  const int* keys,
2340  NDArrayHandle* vals,
2341  int priority,
2342  bool ignore_sparse);
2353 MXNET_DLL int MXKVStorePullWithSparseEx(KVStoreHandle handle,
2354  mx_uint num,
2355  const char** keys,
2356  NDArrayHandle* vals,
2357  int priority,
2358  bool ignore_sparse);
2368 MXNET_DLL int MXKVStorePull(KVStoreHandle handle,
2369  mx_uint num,
2370  const int* keys,
2371  NDArrayHandle* vals,
2372  int priority);
2382 MXNET_DLL int MXKVStorePullEx(KVStoreHandle handle,
2383  mx_uint num,
2384  const char** keys,
2385  NDArrayHandle* vals,
2386  int priority);
2387 
2400 MXNET_DLL int MXKVStorePullRowSparse(KVStoreHandle handle,
2401  mx_uint num,
2402  const int* keys,
2403  NDArrayHandle* vals,
2404  const NDArrayHandle* row_ids,
2405  int priority);
2418 MXNET_DLL int MXKVStorePullRowSparseEx(KVStoreHandle handle,
2419  mx_uint num,
2420  const char** keys,
2421  NDArrayHandle* vals,
2422  const NDArrayHandle* row_ids,
2423  int priority);
2424 
2433 typedef void (MXKVStoreUpdater)(int key,
2434  NDArrayHandle recv,
2435  NDArrayHandle local,
2436  void *handle);
2445 typedef void (MXKVStoreStrUpdater)(const char* key,
2446  NDArrayHandle recv,
2447  NDArrayHandle local,
2448  void *handle);
2456 MXNET_DLL int MXKVStoreSetUpdater(KVStoreHandle handle,
2457  MXKVStoreUpdater updater,
2458  void *updater_handle);
2467 MXNET_DLL int MXKVStoreSetUpdaterEx(KVStoreHandle handle,
2468  MXKVStoreUpdater updater,
2469  MXKVStoreStrUpdater str_updater,
2470  void *updater_handle);
2477 MXNET_DLL int MXKVStoreGetType(KVStoreHandle handle,
2478  const char** type);
2479 //--------------------------------------------
2480 // Part 6: advanced KVStore for multi-machines
2481 //--------------------------------------------
2482 
2490 MXNET_DLL int MXKVStoreGetRank(KVStoreHandle handle,
2491  int *ret);
2492 
2502 MXNET_DLL int MXKVStoreGetGroupSize(KVStoreHandle handle,
2503  int *ret);
2504 
2510 MXNET_DLL int MXKVStoreIsWorkerNode(int *ret);
2511 
2512 
2518 MXNET_DLL int MXKVStoreIsServerNode(int *ret);
2519 
2520 
2526 MXNET_DLL int MXKVStoreIsSchedulerNode(int *ret);
2527 
2534 MXNET_DLL int MXKVStoreBarrier(KVStoreHandle handle);
2535 
2543 MXNET_DLL int MXKVStoreSetBarrierBeforeExit(KVStoreHandle handle,
2544  const int barrier_before_exit);
2545 
2552 typedef void (MXKVStoreServerController)(int head,
2553  const char *body,
2554  void *controller_handle);
2555 
2563 MXNET_DLL int MXKVStoreRunServer(KVStoreHandle handle,
2564  MXKVStoreServerController controller,
2565  void *controller_handle);
2566 
2574 MXNET_DLL int MXKVStoreSendCommmandToServers(KVStoreHandle handle,
2575  int cmd_id,
2576  const char* cmd_body);
2577 
2588 MXNET_DLL int MXKVStoreGetNumDeadNode(KVStoreHandle handle,
2589  const int node_id,
2590  int *number,
2591  const int timeout_sec DEFAULT(60));
2592 
2599 MXNET_DLL int MXRecordIOWriterCreate(const char *uri, RecordIOHandle *out);
2600 
2606 MXNET_DLL int MXRecordIOWriterFree(RecordIOHandle handle);
2607 
2615 MXNET_DLL int MXRecordIOWriterWriteRecord(RecordIOHandle handle,
2616  const char *buf, size_t size);
2617 
2624 MXNET_DLL int MXRecordIOWriterTell(RecordIOHandle handle, size_t *pos);
2625 
2632 MXNET_DLL int MXRecordIOReaderCreate(const char *uri, RecordIOHandle *out);
2633 
2639 MXNET_DLL int MXRecordIOReaderFree(RecordIOHandle handle);
2640 
2648 MXNET_DLL int MXRecordIOReaderReadRecord(RecordIOHandle handle,
2649  char const **buf, size_t *size);
2650 
2657 MXNET_DLL int MXRecordIOReaderSeek(RecordIOHandle handle, size_t pos);
2658 
2665 MXNET_DLL int MXRecordIOReaderTell(RecordIOHandle handle, size_t *pos);
2666 
2670 MXNET_DLL int MXRtcCreate(char* name, mx_uint num_input, mx_uint num_output,
2671  char** input_names, char** output_names,
2672  NDArrayHandle* inputs, NDArrayHandle* outputs,
2673  char* kernel, RtcHandle *out);
2674 
2678 MXNET_DLL int MXRtcPush(RtcHandle handle, mx_uint num_input, mx_uint num_output,
2679  NDArrayHandle* inputs, NDArrayHandle* outputs,
2680  mx_uint gridDimX,
2681  mx_uint gridDimY,
2682  mx_uint gridDimZ,
2683  mx_uint blockDimX,
2684  mx_uint blockDimY,
2685  mx_uint blockDimZ);
2686 
2690 MXNET_DLL int MXRtcFree(RtcHandle handle);
2691 /*
2692  * \brief register custom operators from frontend.
2693  * \param op_type name of custom op
2694  * \param creator
2695  */
2696 MXNET_DLL int MXCustomOpRegister(const char* op_type, CustomOpPropCreator creator);
2697 /*
2698  * \brief record custom function for backward later.
2699  * \param num_inputs number of input NDArrays.
2700  * \param inputs handle to input NDArrays.
2701  * \param num_outputs number of output NDArrays.
2702  * \param outputs handle to output NDArrays.
2703  * \param callbacks callbacks for backward function.
2704  */
2705 MXNET_DLL int MXCustomFunctionRecord(int num_inputs, NDArrayHandle *inputs,
2706  int num_outputs, NDArrayHandle *outputs,
2707  struct MXCallbackList *callbacks);
2708 /*
2709  * \brief create cuda rtc module
2710  * \param source cuda source code
2711  * \param num_options number of compiler flags
2712  * \param options compiler flags
2713  * \param num_exports number of exported function names
2714  * \param exported function names
2715  * \param out handle to created module
2716  */
2717 MXNET_DLL int MXRtcCudaModuleCreate(const char* source, int num_options,
2718  const char** options, int num_exports,
2719  const char** exports, CudaModuleHandle *out);
2720 /*
2721  * \brief delete cuda rtc module
2722  * \param handle handle to cuda module
2723  */
2724 MXNET_DLL int MXRtcCudaModuleFree(CudaModuleHandle handle);
2725 /*
2726  * \brief get kernel from module
2727  * \param handle handle to cuda module
2728  * \param name name of kernel function
2729  * \param num_args number of arguments
2730  * \param is_ndarray whether argument is ndarray
2731  * \param is_const whether argument is constant
2732  * \param arg_types data type of arguments
2733  * \param out created kernel
2734  */
2735 MXNET_DLL int MXRtcCudaKernelCreate(CudaModuleHandle handle, const char* name,
2736  int num_args, int* is_ndarray, int* is_const,
2737  int* arg_types, CudaKernelHandle *out);
2738 /*
2739  * \brief delete kernel
2740  * \param handle handle to previously created kernel
2741  */
2742 MXNET_DLL int MXRtcCudaKernelFree(CudaKernelHandle handle);
2743 /*
2744  * \brief launch cuda kernel
2745  * \param handle handle to kernel
2746  * \param dev_id (GPU) device id
2747  * \param args pointer to arguments
2748  * \param grid_dim_x grid dimension x
2749  * \param grid_dim_y grid dimension y
2750  * \param grid_dim_z grid dimension z
2751  * \param block_dim_x block dimension x
2752  * \param block_dim_y block dimension y
2753  * \param block_dim_z block dimension z
2754  * \param shared_mem size of dynamically allocated shared memory
2755  */
2756 MXNET_DLL int MXRtcCudaKernelCall(CudaKernelHandle handle, int dev_id, void** args,
2757  mx_uint grid_dim_x, mx_uint grid_dim_y,
2758  mx_uint grid_dim_z, mx_uint block_dim_x,
2759  mx_uint block_dim_y, mx_uint block_dim_z,
2760  mx_uint shared_mem);
2767 MXNET_DLL int MXNDArrayGetSharedMemHandle(NDArrayHandle handle, int* shared_pid,
2768  int* shared_id);
2779 MXNET_DLL int MXNDArrayCreateFromSharedMem(int shared_pid, int shared_id, const mx_uint *shape,
2780  mx_uint ndim, int dtype, NDArrayHandle *out);
2781 
2787 MXNET_DLL int MXStorageEmptyCache(int dev_type, int dev_id);
2788 
2798 MXNET_DLL int MXNDArrayCreateFromSharedMemEx(int shared_pid, int shared_id, const int *shape,
2799  int ndim, int dtype, NDArrayHandle *out);
2800 
2818 MXNET_DLL int MXEnginePushAsync(EngineAsyncFunc async_func, void* func_param,
2819  EngineFuncParamDeleter deleter, ContextHandle ctx_handle,
2820  EngineVarHandle const_vars_handle, int num_const_vars,
2821  EngineVarHandle mutable_vars_handle, int num_mutable_vars,
2822  EngineFnPropertyHandle prop_handle DEFAULT(NULL),
2823  int priority DEFAULT(0), const char* opr_name DEFAULT(NULL),
2824  bool wait DEFAULT(false));
2825 
2841 MXNET_DLL int MXEnginePushSync(EngineSyncFunc sync_func, void* func_param,
2842  EngineFuncParamDeleter deleter, ContextHandle ctx_handle,
2843  EngineVarHandle const_vars_handle, int num_const_vars,
2844  EngineVarHandle mutable_vars_handle, int num_mutable_vars,
2845  EngineFnPropertyHandle prop_handle DEFAULT(NULL),
2846  int priority DEFAULT(0), const char* opr_name DEFAULT(NULL));
2847 
2865 MXNET_DLL int MXEnginePushAsyncND(EngineAsyncFunc async_func, void* func_param,
2866  EngineFuncParamDeleter deleter, ContextHandle ctx_handle,
2867  NDArrayHandle* const_nds_handle, int num_const_nds,
2868  NDArrayHandle* mutable_nds_handle, int num_mutable_nds,
2869  EngineFnPropertyHandle prop_handle DEFAULT(NULL),
2870  int priority DEFAULT(0), const char* opr_name DEFAULT(NULL),
2871  bool wait DEFAULT(false));
2872 
2888 MXNET_DLL int MXEnginePushSyncND(EngineSyncFunc sync_func, void* func_param,
2889  EngineFuncParamDeleter deleter, ContextHandle ctx_handle,
2890  NDArrayHandle* const_nds_handle, int num_const_nds,
2891  NDArrayHandle* mutable_nds_handle, int num_mutable_nds,
2892  EngineFnPropertyHandle prop_handle DEFAULT(NULL),
2893  int priority DEFAULT(0), const char* opr_name DEFAULT(NULL));
2894 
2895 #ifdef __cplusplus
2896 }
2897 #endif // __cplusplus
2898 
2899 #endif // MXNET_C_API_H_
MXNET_DLL int MXKVStoreSendCommmandToServers(KVStoreHandle handle, int cmd_id, const char *cmd_body)
Send a command to all server nodes.
int(* CustomFunctionDelFunc)(void *)
Definition: c_api.h:212
MXNET_DLL int MXNDArrayDetach(NDArrayHandle handle, NDArrayHandle *out)
detach and ndarray from computation graph by clearing entry_
MXNET_DLL int MXListAllOpNames(mx_uint *out_size, const char ***out_array)
list all the available operator names, include entries.
MXNET_DLL int MXNDArrayCreateFromSharedMem(int shared_pid, int shared_id, const mx_uint *shape, mx_uint ndim, int dtype, NDArrayHandle *out)
DEPRECATED. Use MXNDArrayCreateFromSharedMemEx instead. Reconstruct NDArray from shared memory handle...
MXNET_DLL int MXNDArrayGetAuxType(NDArrayHandle handle, mx_uint i, int *out_type)
get the type of the ith aux data in NDArray
MXNET_DLL int MXNDArrayCallDLPackDeleter(DLManagedTensorHandle dlpack)
Delete a dlpack tensor.
MXNET_DLL int MXGetGPUCount(int *out)
Get the number of GPUs.
MXNET_DLL int MXKVStoreSetUpdater(KVStoreHandle handle, MXKVStoreUpdater updater, void *updater_handle)
register a push updater
MXNET_DLL int MXKVStoreBarrier(KVStoreHandle handle)
global barrier among all worker machines
MXNET_DLL int MXSymbolGetNumOutputs(SymbolHandle symbol, mx_uint *output_count)
Get number of outputs of the symbol.
void * DataIterHandle
handle to a DataIterator
Definition: c_api.h:83
MXNET_DLL int MXSymbolListAtomicSymbolCreators(mx_uint *out_size, AtomicSymbolCreator **out_array)
list all the available AtomicSymbolEntry
const void * EngineFnPropertyHandle
handle to Engine FnProperty
Definition: c_api.h:101
Definition: c_api.h:160
MXNET_DLL int MXDataIterCreateIter(DataIterCreator handle, mx_uint num_param, const char **keys, const char **vals, DataIterHandle *out)
Init an iterator, init with parameters the array size of passed in arguments.
MXNET_DLL int MXProfileSetCounter(ProfileHandle counter_handle, uint64_t value)
Set a counter, given its handle.
MXNET_DLL int MXDataIterNext(DataIterHandle handle, int *out)
Move iterator to next position.
MXNET_DLL int MXNDArrayReshape(NDArrayHandle handle, int ndim, int *dims, NDArrayHandle *out)
Reshape the NDArray.
void * p_infer_shape
Definition: c_api.h:140
MXNET_DLL int MXAutogradMarkVariables(mx_uint num_var, NDArrayHandle *var_handles, mx_uint *reqs_array, NDArrayHandle *grad_handles)
mark NDArrays as variables to compute gradient for autograd
Definition: c_api.h:170
MXNET_DLL int MXExecutorPrint(ExecutorHandle handle, const char **out_str)
Print the content of execution plan, used for debug.
MXNET_DLL int MXKVStoreRunServer(KVStoreHandle handle, MXKVStoreServerController controller, void *controller_handle)
Run as server (or scheduler)
MXNET_DLL int MXSetProfilerConfig(int num_params, const char *const *keys, const char *const *vals)
Set up configuration of profiler for worker/current process.
void(* list_arguments)(char ***, void *)
Definition: c_api.h:120
MXNET_DLL int MXSymbolSaveToJSON(SymbolHandle symbol, const char **out_json)
Save a symbol into a json string.
MXNET_DLL int MXSymbolInferShape(SymbolHandle sym, mx_uint num_args, const char **keys, const mx_uint *arg_ind_ptr, const mx_uint *arg_shape_data, mx_uint *in_shape_size, const mx_uint **in_shape_ndim, const mx_uint ***in_shape_data, mx_uint *out_shape_size, const mx_uint **out_shape_ndim, const mx_uint ***out_shape_data, mx_uint *aux_shape_size, const mx_uint **aux_shape_ndim, const mx_uint ***aux_shape_data, int *complete)
DEPRECATED. Use MXSymbolInferShapeEx instead. infer shape of unknown input shapes given the known one...
MXNET_DLL int MXSymbolGetAttr(SymbolHandle symbol, const char *key, const char **out, int *success)
Get string attribute from symbol.
MXNET_DLL int MXRtcCreate(char *name, mx_uint num_input, mx_uint num_output, char **input_names, char **output_names, NDArrayHandle *inputs, NDArrayHandle *outputs, char *kernel, RtcHandle *out)
Create a MXRtc object.
MXNET_DLL int MXSymbolGetAtomicSymbolName(AtomicSymbolCreator creator, const char **name)
Get the name of an atomic symbol.
MXNET_DLL int MXExecutorGetOptimizedSymbol(ExecutorHandle handle, SymbolHandle *out)
get optimized graph from graph executor
MXNET_DLL int MXProfileCreateEvent(const char *event_name, ProfileHandle *out)
Create profile event.
MXNET_DLL int MXKVStorePull(KVStoreHandle handle, mx_uint num, const int *keys, NDArrayHandle *vals, int priority)
pull a list of (key, value) pairs from the kvstore
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 MXExecutorBind(SymbolHandle symbol_handle, int dev_type, int dev_id, mx_uint len, NDArrayHandle *in_args, NDArrayHandle *arg_grad_store, mx_uint *grad_req_type, mx_uint aux_states_len, NDArrayHandle *aux_states, ExecutorHandle *out)
Generate Executor from symbol.
void * p_forward
Definition: c_api.h:138
MXNET_DLL int MXKVStorePullRowSparse(KVStoreHandle handle, mx_uint 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 MXDumpProfile(int finished)
Save profile and stop profiler for worker/current process.
MXNET_DLL int MXDataIterFree(DataIterHandle handle)
Free the handle to the IO module.
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 MXInvokeCachedOp(CachedOpHandle handle, int num_inputs, NDArrayHandle *inputs, int *num_outputs, NDArrayHandle **outputs)
invoke cached operator
MXNET_DLL int MXFreeCachedOp(CachedOpHandle handle)
free cached operator
void * RecordIOHandle
handle to RecordIO
Definition: c_api.h:87
CustomOpCallbacks
Definition: c_api.h:159
MXNET_DLL int MXSymbolGetChildren(SymbolHandle symbol, SymbolHandle *out)
Get a symbol that contains only direct children.
MXNET_DLL int MXRecordIOReaderFree(RecordIOHandle handle)
Delete a RecordIO reader object.
MXNET_DLL int MXExecutorOutputs(ExecutorHandle handle, mx_uint *out_size, NDArrayHandle **out)
Get executor&#39;s head NDArray.
MXNET_DLL int MXNDArrayGetContext(NDArrayHandle handle, int *out_dev_type, int *out_dev_id)
get the context of the NDArray
MXNET_DLL int MXFuncDescribe(FunctionHandle fun, mx_uint *num_use_vars, mx_uint *num_scalars, mx_uint *num_mutate_vars, int *type_mask)
get the argument requirements of the function
MXNET_DLL int MXProfileCreateTask(ProfileHandle domain, const char *task_name, ProfileHandle *out)
Create profile task.
MXNET_DLL int MXKVStoreIsServerNode(int *ret)
return whether or not this process is a server node.
MXNET_DLL int MXNDArraySlice(NDArrayHandle handle, mx_uint slice_begin, mx_uint slice_end, NDArrayHandle *out)
Slice the NDArray along axis 0.
void * ExecutorHandle
handle to an Executor
Definition: c_api.h:79
CustomFunctionCallbacks
Definition: c_api.h:204
MXNET_DLL int MXSymbolSaveToFile(SymbolHandle symbol, const char *fname)
Save a symbol into a json file.
void * AtomicSymbolHandle
handle to a AtomicSymbol
Definition: c_api.h:77
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 MXProfilePause(int paused)
Pause profiler tuning collection for worker/current process.
void * p_backward
Definition: c_api.h:123
MXNET_DLL int MXFuncGetInfo(FunctionHandle fun, const char **name, const char **description, mx_uint *num_args, const char ***arg_names, const char ***arg_type_infos, const char ***arg_descriptions, const char **return_type DEFAULT(NULL))
Get the information of the function handle.
MXNET_DLL int MXLibInfoFeatures(const struct LibFeature **libFeature, size_t *size)
Get list of features supported on the runtime.
MXNET_DLL int MXAutogradSetIsTraining(int is_training, int *prev)
set whether to record operator for autograd
MXNET_DLL int MXNDArrayFree(NDArrayHandle handle)
free the narray handle
MXNET_DLL int MXSymbolCreateFromJSON(const char *json, SymbolHandle *out)
Load a symbol from a json string.
CustomOpPropCallbacks
Definition: c_api.h:165
int(* CustomOpInferTypeFunc)(int, int *, void *)
Definition: c_api.h:191
MXNET_DLL int MXKVStoreIsSchedulerNode(int *ret)
return whether or not this process is a scheduler node.
MXNET_DLL int MXInvokeCachedOpEx(CachedOpHandle handle, int num_inputs, NDArrayHandle *inputs, int *num_outputs, NDArrayHandle **outputs, const int **out_stypes)
invoke a cached op
MXNET_DLL int MXSymbolGetAtomicSymbolInfo(AtomicSymbolCreator creator, const char **name, const char **description, mx_uint *num_args, const char ***arg_names, const char ***arg_type_infos, const char ***arg_descriptions, const char **key_var_num_args, const char **return_type DEFAULT(NULL))
Get the detailed information about atomic symbol.
bool enabled
Definition: c_api.h:156
#define DEFAULT(x)
Inhibit C++ name-mangling for MXNet functions.
Definition: c_api.h:37
Symbol reverse(const std::string &symbol_name, Symbol data, Shape axis)
Reverses the order of elements along given axis while preserving array shape.
Definition: op.h:820
MXNET_DLL int MXNDArrayLoadFromBuffer(const void *ndarray_buffer, size_t size, mx_uint *out_size, NDArrayHandle **out_arr, mx_uint *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 MXSetProfilerState(int state)
Set up state of profiler for current process.
MXNET_DLL int MXImperativeInvoke(AtomicSymbolCreator creator, int num_inputs, NDArrayHandle *inputs, int *num_outputs, NDArrayHandle **outputs, int num_params, const char **param_keys, const char **param_vals)
invoke a nnvm op and imperative function
MXNET_DLL int MXProfileDestroyHandle(ProfileHandle frame_handle)
Destroy a frame.
MXNET_DLL int MXNDArrayReshape64(NDArrayHandle handle, int ndim, dim_t *dims, bool reverse, NDArrayHandle *out)
Reshape the NDArray.
MXNET_DLL int MXSymbolListAttr(SymbolHandle symbol, mx_uint *out_size, const char ***out)
Get all attributes from symbol, including all descendents.
MXNET_DLL int MXRtcCudaKernelFree(CudaKernelHandle handle)
MXNET_DLL int MXExecutorReshape(int partial_shaping, int allow_up_sizing, int dev_type, int dev_id, mx_uint num_map_keys, const char **map_keys, const int *map_dev_types, const int *map_dev_ids, const mx_uint num_provided_arg_shapes, const char **provided_arg_shape_names, const mx_uint *provided_arg_shape_data, const mx_uint *provided_arg_shape_idx, mx_uint *num_in_args, NDArrayHandle **in_args, NDArrayHandle **arg_grads, mx_uint *num_aux_states, NDArrayHandle **aux_states, ExecutorHandle shared_exec, ExecutorHandle *out)
DEPRECATED. Use MXExecutorReshapeEx instead. Return a new executor with the same symbol and shared me...
MXNET_DLL int MXNDArrayAt(NDArrayHandle handle, mx_uint idx, NDArrayHandle *out)
Index the NDArray along axis 0.
MXNET_DLL int MXNDArrayGetAuxNDArray(NDArrayHandle handle, mx_uint i, NDArrayHandle *out)
Get a deep copy of the ith aux data blob in the form of an NDArray of default storage type...
MXNET_DLL int MXProfileCreateCounter(ProfileHandle domain, const char *counter_name, ProfileHandle *out)
Create profile counter.
MXNET_DLL int MXNDArrayLoad(const char *fname, mx_uint *out_size, NDArrayHandle **out_arr, mx_uint *out_name_size, const char ***out_names)
Load list of narray from the file.
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 MXNDArraySyncCopyFromCPU(NDArrayHandle handle, const void *data, size_t size)
Perform a synchronize copy from a continugous CPU memory region.
MXNET_DLL int MXSymbolCreateFromFile(const char *fname, SymbolHandle *out)
Load a symbol from a json file.
MXNET_DLL int MXQuantizeSymbol(SymbolHandle sym_handle, SymbolHandle *ret_sym_handle, const mx_uint num_excluded_symbols, const char **excluded_symbols, const mx_uint num_offline, const char **offline_params, const char *quantized_dtype, const bool calib_quantize)
Convert a symbol into a quantized symbol where FP32 operators are replaced with INT8.
MXNET_DLL int MXKVStorePushEx(KVStoreHandle handle, mx_uint num, const char **keys, NDArrayHandle *vals, int priority)
Push a list of (key,value) pairs to kvstore, where each key is a string.
void( MXKVStoreStrUpdater)(const char *key, NDArrayHandle recv, NDArrayHandle local, void *handle)
user-defined updater for the kvstore with string keys It&#39;s this updater&#39;s responsibility to delete re...
Definition: c_api.h:2445
Definition: c_api.h:129
MXNET_DLL int MXNDArrayCreateSparseEx(int storage_type, const mx_uint *shape, mx_uint ndim, int dev_type, int dev_id, int delay_alloc, int dtype, mx_uint num_aux, int *aux_type, mx_uint *aux_ndims, const mx_uint *aux_shape, NDArrayHandle *out)
create an empty sparse NDArray with specified shape and data type
MXNET_DLL int MXExecutorSimpleBind(SymbolHandle symbol_handle, int dev_type, int dev_id, const mx_uint num_g2c_keys, const char **g2c_keys, const int *g2c_dev_types, const int *g2c_dev_ids, const mx_uint provided_grad_req_list_len, const char **provided_grad_req_names, const char **provided_grad_req_types, const mx_uint num_provided_arg_shapes, const char **provided_arg_shape_names, const mx_uint *provided_arg_shape_data, const mx_uint *provided_arg_shape_idx, const mx_uint num_provided_arg_dtypes, const char **provided_arg_dtype_names, const int *provided_arg_dtypes, const mx_uint num_provided_arg_stypes, const char **provided_arg_stype_names, const int *provided_arg_stypes, const mx_uint num_shared_arg_names, const char **shared_arg_name_list, int *shared_buffer_len, const char **shared_buffer_name_list, NDArrayHandle *shared_buffer_handle_list, const char ***updated_shared_buffer_name_list, NDArrayHandle **updated_shared_buffer_handle_list, mx_uint *num_in_args, NDArrayHandle **in_args, NDArrayHandle **arg_grads, mx_uint *num_aux_states, NDArrayHandle **aux_states, ExecutorHandle shared_exec_handle, ExecutorHandle *out)
DEPRECATED. Use MXExecutorSimpleBindEx instead.
void(* ExecutorMonitorCallback)(const char *, NDArrayHandle, void *)
Definition: c_api.h:111
void * p_forward
Definition: c_api.h:122
MXNET_DLL int MXNDArrayCreateEx(const mx_uint *shape, mx_uint ndim, int dev_type, int dev_id, int delay_alloc, int dtype, NDArrayHandle *out)
create a NDArray with specified shape and data type
MXNET_DLL int MXEngineSetBulkSize(int bulk_size, int *prev_bulk_size)
set bulk execution limit
int(* CustomOpBackwardInferStorageTypeFunc)(int, int *, int *, void *)
Definition: c_api.h:187
void * p_list_arguments
Definition: c_api.h:126
MXNET_DLL int MXKVStoreCreate(const char *type, KVStoreHandle *out)
Create a kvstore.
int(* CustomOpDelFunc)(void *)
Definition: c_api.h:182
void * p_declare_backward_dependency
Definition: c_api.h:143
MXNET_DLL int MXNDArrayCreateNone(NDArrayHandle *out)
create a NDArray handle that is not initialized can be used to pass in as mutate variables to hold th...
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 MXGenBackendSubgraph(SymbolHandle sym_handle, const char *backend, SymbolHandle *ret_sym_handle)
Run subgraph pass based on the backend provided.
MXNET_DLL int MXKVStoreFree(KVStoreHandle handle)
Delete a KVStore handle.
void * DLManagedTensorHandle
handle to DLManagedTensor
Definition: c_api.h:97
void * p_list_arguments
Definition: c_api.h:142
MXNET_DLL int MXCustomOpRegister(const char *op_type, CustomOpPropCreator creator)
MXNET_DLL int MXExecutorBackwardEx(ExecutorHandle handle, mx_uint len, NDArrayHandle *head_grads, int is_train)
Excecutor run backward.
void * SymbolHandle
handle to a symbol that can be bind as operator
Definition: c_api.h:75
MXNET_DLL int MXProfileCreateDomain(const char *domain, ProfileHandle *out)
Create profiling domain.
void * CudaModuleHandle
handle to rtc cuda module
Definition: c_api.h:91
MXNET_DLL int MXSymbolCopy(SymbolHandle symbol, SymbolHandle *out)
Copy the symbol to another handle.
MXNET_DLL int MXGetVersion(int *out)
get the MXNet library version as an integer
int(** callbacks)(void)
Definition: c_api.h:150
void * CachedOpHandle
handle to cached operator
Definition: c_api.h:73
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 MXNDArrayFromDLPackEx(DLManagedTensorHandle dlpack, const bool transient_handle, NDArrayHandle *out_handle)
Create a NDArray backed by a dlpack tensor.
MXNET_DLL int MXSetNumOMPThreads(int thread_num)
Set the number of OMP threads to use.
MXNET_DLL int MXDumpProcessProfile(int finished, int profile_process, KVStoreHandle kvStoreHandle)
Save profile and stop profiler.
MXNET_DLL int MXDataIterBeforeFirst(DataIterHandle handle)
Call iterator.Reset.
MXNET_DLL int MXSymbolInferShapePartial(SymbolHandle sym, mx_uint num_args, const char **keys, const mx_uint *arg_ind_ptr, const mx_uint *arg_shape_data, mx_uint *in_shape_size, const mx_uint **in_shape_ndim, const mx_uint ***in_shape_data, mx_uint *out_shape_size, const mx_uint **out_shape_ndim, const mx_uint ***out_shape_data, mx_uint *aux_shape_size, const mx_uint **aux_shape_ndim, const mx_uint ***aux_shape_data, int *complete)
DEPRECATED. Use MXSymbolInferShapePartialEx instead. partially infer shape of unknown input shapes gi...
MXNET_DLL int MXSymbolListOutputs(SymbolHandle symbol, mx_uint *out_size, const char ***out_str_array)
List returns in the symbol.
MXNET_DLL int MXListDataIters(mx_uint *out_size, DataIterCreator **out_array)
List all the available iterator entries.
MXNET_DLL int MXProfileSetMarker(ProfileHandle domain, const char *instant_marker_name, const char *scope)
Mark a single instant in time.
MXNET_DLL int MXNDArrayGetShape(NDArrayHandle handle, mx_uint *out_dim, const mx_uint **out_pdata)
DEPRECATED. Use MXNDArrayGetShapeEx instead. get the shape of the array.
MXNET_DLL int MXCreateCachedOpEx(SymbolHandle handle, int num_flags, const char **keys, const char **vals, CachedOpHandle *out)
create cached operator
MXNET_DLL int MXDataIterGetPadNum(DataIterHandle handle, int *pad)
Get the padding number in current data batch.
MXNET_DLL int MXExecutorSetMonitorCallbackEX(ExecutorHandle handle, ExecutorMonitorCallback callback, void *callback_handle, bool monitor_all)
set a call back to notify the completion of operation
MXNET_DLL int MXAutogradComputeGradient(mx_uint num_output, NDArrayHandle *output_handles)
compute the gradient of outputs w.r.t variabels
MXNET_DLL int MXNDArrayGetSharedMemHandle(NDArrayHandle handle, int *shared_pid, int *shared_id)
Get shared memory handle from NDArray.
MXNET_DLL int MXFuncInvokeEx(FunctionHandle fun, NDArrayHandle *use_vars, mx_float *scalar_args, NDArrayHandle *mutate_vars, int num_params, char **param_keys, char **param_vals)
invoke a function, the array size of passed in arguments must match the values in the ...
MXNET_DLL int MXRtcCudaModuleCreate(const char *source, int num_options, const char **options, int num_exports, const char **exports, CudaModuleHandle *out)
int num_callbacks
Definition: c_api.h:149
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.
const void * ContextHandle
handle to Context
Definition: c_api.h:99
MXNET_DLL int MXRandomSeed(int seed)
Seed all global random number generators in mxnet.
Definition: c_api.h:174
MXNET_DLL int MXSymbolGetOutput(SymbolHandle symbol, mx_uint index, SymbolHandle *out)
Get index-th outputs of the symbol.
MXNET_DLL int MXNDArrayGetDType(NDArrayHandle handle, int *out_dtype)
get the type of the data in NDArray
MXNET_DLL int MXAutogradIsTraining(bool *curr)
get whether training mode is on
MXNET_DLL int MXAutogradBackwardEx(mx_uint num_output, NDArrayHandle *output_handles, NDArrayHandle *ograd_handles, mx_uint 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
void(* forward)(int, float **, int *, unsigned **, int *, void *)
Definition: c_api.h:116
int(* MXGenericCallback)(void)
Definition: c_api.h:146
MXNET_DLL int MXSetCalibTableToQuantizedSymbol(SymbolHandle qsym_handle, const mx_uint 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.
MXNET_DLL int MXSymbolGetInputSymbols(SymbolHandle sym, SymbolHandle **inputs, int *input_size)
Get the input symbols of the graph.
MXNET_DLL int MXSetIsNumpyShape(int is_np_shape, int *prev)
set numpy compatibility switch
MXNET_DLL int MXAggregateProfileStatsPrintEx(const char **out_str, int reset, int format, int sort_by, int ascending)
Print sorted aggregate stats to the a string How aggregate stats are stored will not change...
Definition: c_api.h:205
const char * name
Definition: c_api.h:155
MXNET_DLL int MXSymbolGetInternals(SymbolHandle symbol, SymbolHandle *out)
Get a symbol that contains all the internals.
MXNET_DLL int MXNDArrayGetDataNDArray(NDArrayHandle handle, NDArrayHandle *out)
Get a deep copy of the data blob in the form of an NDArray of default storage type. This function blocks. Do not use it in performance critical code.
MXNET_DLL int MXInitPSEnv(mx_uint num_vars, const char **keys, const char **vals)
Initialized ps-lite environment variables.
MXNET_DLL int MXSymbolInferShapeEx(SymbolHandle sym, mx_uint num_args, const char **keys, const mx_uint *arg_ind_ptr, const int *arg_shape_data, mx_uint *in_shape_size, const int **in_shape_ndim, const int ***in_shape_data, mx_uint *out_shape_size, const int **out_shape_ndim, const int ***out_shape_data, mx_uint *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...
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 MXDataIterGetData(DataIterHandle handle, NDArrayHandle *out)
Get the handle to the NDArray of underlying data.
MXNET_DLL int MXStorageEmptyCache(int dev_type, int dev_id)
Release all unreferenced memory from the devices storage managers memory pool.
MXNET_DLL int MXNDArrayCreateFromSharedMemEx(int shared_pid, int shared_id, const int *shape, int ndim, int dtype, NDArrayHandle *out)
Reconstruct NDArray from shared memory handle.
MXNET_DLL int MXRtcFree(RtcHandle handle)
Delete a MXRtc object.
MXNET_DLL int MXNDArrayFromDLPack(DLManagedTensorHandle dlpack, NDArrayHandle *out_handle)
DEPRECATED. Use MXNDArrayFromDLPackEx instead.
MXNET_DLL int MXNDArraySyncCopyToCPU(NDArrayHandle handle, void *data, size_t size)
Perform a synchronize copyto a continugous CPU memory region.
MXNET_DLL int MXAutogradSetIsRecording(int is_recording, int *prev)
set whether to record operator for autograd
void( MXKVStoreServerController)(int head, const char *body, void *controller_handle)
the prototype of a server controller
Definition: c_api.h:2552
MXNET_DLL int MXIsNumpyShape(bool *curr)
get whether numpy compatibility is on
Definition: c_api.h:161
void * KVStoreHandle
handle to KVStore
Definition: c_api.h:85
MXNET_DLL int MXSymbolInferTypePartial(SymbolHandle sym, mx_uint num_args, const char **keys, const int *arg_type_data, mx_uint *in_type_size, const int **in_type_data, mx_uint *out_type_size, const int **out_type_data, mx_uint *aux_type_size, const int **aux_type_data, int *complete)
partially infer type of unknown input types given the known one.
void * NDArrayHandle
handle to NDArray
Definition: c_api.h:67
MXNET_DLL int MXNotifyShutdown()
Notify the engine about a shutdown, This can help engine to print less messages into display...
void * p_list_outputs
Definition: c_api.h:141
MXNET_DLL int MXDataIterGetIndex(DataIterHandle handle, uint64_t **out_index, uint64_t *out_size)
Get the image index by array.
MXNET_DLL int MXDataIterGetLabel(DataIterHandle handle, NDArrayHandle *out)
Get the handle to the NDArray of underlying label.
Definition: c_api.h:167
int(* CustomOpCreateFunc)(const char *, int, unsigned **, const int *, const int *, struct MXCallbackList *, void *)
Definition: c_api.h:195
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.
int(* CustomOpFBFunc)(int, void **, int *, const int *, const int, void *)
Definition: c_api.h:179
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 MXSymbolCreateGroup(mx_uint num_symbols, SymbolHandle *symbols, SymbolHandle *out)
Create a Symbol by grouping list of symbols together.
MXNET_DLL int MXNDArrayCreate(const mx_uint *shape, mx_uint ndim, int dev_type, int dev_id, int delay_alloc, NDArrayHandle *out)
create a NDArray with specified shape
MXNET_DLL int MXKVStoreSetBarrierBeforeExit(KVStoreHandle handle, const int barrier_before_exit)
whether to do barrier when finalize
MXNET_DLL int MXFuncInvoke(FunctionHandle fun, NDArrayHandle *use_vars, mx_float *scalar_args, NDArrayHandle *mutate_vars)
invoke a function, the array size of passed in arguments must match the values in the ...
MXNET_DLL int MXSymbolListArguments(SymbolHandle symbol, mx_uint *out_size, const char ***out_str_array)
List arguments in the symbol.
MXNET_DLL int MXNDArrayGetStorageType(NDArrayHandle handle, int *out_storage_type)
get the storage type of the array
MXNET_DLL int MXRecordIOWriterCreate(const char *uri, RecordIOHandle *out)
Create a RecordIO writer object.
void * p_infer_shape
Definition: c_api.h:124
MXNET_DLL int MXKVStorePullRowSparseEx(KVStoreHandle handle, mx_uint 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 MXNDArrayWaitAll()
wait until all delayed operations in the system is completed
MXNET_DLL int MXKVStorePullEx(KVStoreHandle handle, mx_uint num, const char **keys, NDArrayHandle *vals, int priority)
pull a list of (key, value) pairs from the kvstore, where each key is a string
MXNET_DLL int MXRecordIOReaderCreate(const char *uri, RecordIOHandle *out)
Create a RecordIO reader object.
MXNET_DLL int MXExecutorReshapeEx(int partial_shaping, int allow_up_sizing, int dev_type, int dev_id, mx_uint num_map_keys, const char **map_keys, const int *map_dev_types, const int *map_dev_ids, const mx_uint num_provided_arg_shapes, const char **provided_arg_shape_names, const int *provided_arg_shape_data, const mx_uint *provided_arg_shape_idx, mx_uint *num_in_args, NDArrayHandle **in_args, NDArrayHandle **arg_grads, mx_uint *num_aux_states, NDArrayHandle **aux_states, ExecutorHandle shared_exec, ExecutorHandle *out)
Return a new executor with the same symbol and shared memory, but different input/output shapes...
MXNET_DLL int MXProfileDurationStop(ProfileHandle duration_handle)
Stop timing the duration of a profile duration object such as an event, task or frame.
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 MXProfileAdjustCounter(ProfileHandle counter_handle, int64_t value)
Adjust a counter by the given amount, given its handle.
unsigned int mx_uint
manually define unsigned int
Definition: c_api.h:58
Definition: c_api.h:162
MXNET_DLL int MXAggregateProfileStatsPrint(const char **out_str, int reset)
Deprecated, use MXAggregateProfileStatsPrintEx instead.
MXNET_DLL int MXRecordIOWriterTell(RecordIOHandle handle, size_t *pos)
Get the current writer pointer position.
Definition: c_api.h:173
MXNET_DLL int MXRecordIOReaderTell(RecordIOHandle handle, size_t *pos)
Get the current writer pointer position.
MXNET_DLL int MXNDArraySaveRawBytes(NDArrayHandle handle, size_t *out_size, const char **out_buf)
save the NDArray into raw bytes.
MXNET_DLL int MXSymbolGetName(SymbolHandle symbol, const char **out, int *success)
Get string name from symbol.
MXNET_DLL int MXKVStoreSetGradientCompression(KVStoreHandle handle, mx_uint num_params, const char **keys, const char **vals)
Set parameters to use low-bit compressed gradients.
void * p_backward
Definition: c_api.h:139
Definition: c_api.h:166
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 MXExecutorBindEX(SymbolHandle symbol_handle, int dev_type, int dev_id, mx_uint num_map_keys, const char **map_keys, const int *map_dev_types, const int *map_dev_ids, mx_uint len, NDArrayHandle *in_args, NDArrayHandle *arg_grad_store, mx_uint *grad_req_type, mx_uint aux_states_len, NDArrayHandle *aux_states, ExecutorHandle shared_exec, ExecutorHandle *out)
Generate Executor from symbol, This is advanced function, allow specify group2ctx map...
MXNET_DLL int MXKVStorePullWithSparse(KVStoreHandle handle, mx_uint num, const int *keys, NDArrayHandle *vals, int priority, bool ignore_sparse)
pull a list of (key, value) pairs from the kvstore
void(* EngineSyncFunc)(void *, void *)
Engine synchronous operation.
Definition: c_api.h:108
MXNET_DLL int MXAutogradIsRecording(bool *curr)
get whether autograd recording is on
Definition: c_api.h:206
Definition: c_api.h:154
MXNET_DLL int MXRecordIOWriterFree(RecordIOHandle handle)
Delete a RecordIO writer object.
MXNET_DLL int MXExecutorBackward(ExecutorHandle handle, mx_uint len, NDArrayHandle *head_grads)
Excecutor run backward.
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 MXCustomFunctionRecord(int num_inputs, NDArrayHandle *inputs, int num_outputs, NDArrayHandle *outputs, struct MXCallbackList *callbacks)
int64_t dim_t
data type to store dim size
Definition: c_api.h:62
MXNET_DLL int MXKVStoreGetGroupSize(KVStoreHandle handle, int *ret)
return The number of nodes in this group, which is
MXNET_DLL int MXRecordIOWriterWriteRecord(RecordIOHandle handle, const char *buf, size_t size)
Write a record to a RecordIO object.
int(* CustomOpPropCreator)(const char *, const int, const char **, const char **, struct MXCallbackList *)
Definition: c_api.h:199
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 MXSymbolCreateVariable(const char *name, SymbolHandle *out)
Create a Variable Symbol.
MXNET_DLL int MXProfileDurationStart(ProfileHandle duration_handle)
Start timing the duration of a profile duration object such as an event, task or frame.
MXNET_DLL int MXExecutorSetMonitorCallback(ExecutorHandle handle, ExecutorMonitorCallback callback, void *callback_handle)
set a call back to notify the completion of operation
int(* CustomFunctionBwdFunc)(int, int, void **, const int *, const int, void *)
Definition: c_api.h:209
MXNET_DLL int MXAutogradBackward(mx_uint num_output, NDArrayHandle *output_handles, NDArrayHandle *ograd_handles, int retain_graph)
compute the gradient of outputs w.r.t variabels
void * CudaKernelHandle
handle to rtc cuda kernel
Definition: c_api.h:93
MXNET_DLL int MXKVStoreIsWorkerNode(int *ret)
return whether or not this process is a worker node.
MXNET_DLL int MXSymbolInferShapePartialEx(SymbolHandle sym, mx_uint num_args, const char **keys, const mx_uint *arg_ind_ptr, const int *arg_shape_data, mx_uint *in_shape_size, const int **in_shape_ndim, const int ***in_shape_data, mx_uint *out_shape_size, const int **out_shape_ndim, const int ***out_shape_data, mx_uint *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.
MXNET_DLL int MXExecutorSimpleBindEx(SymbolHandle symbol_handle, int dev_type, int dev_id, const mx_uint num_g2c_keys, const char **g2c_keys, const int *g2c_dev_types, const int *g2c_dev_ids, const mx_uint provided_grad_req_list_len, const char **provided_grad_req_names, const char **provided_grad_req_types, const mx_uint num_provided_arg_shapes, const char **provided_arg_shape_names, const int *provided_arg_shape_data, const mx_uint *provided_arg_shape_idx, const mx_uint num_provided_arg_dtypes, const char **provided_arg_dtype_names, const int *provided_arg_dtypes, const mx_uint num_provided_arg_stypes, const char **provided_arg_stype_names, const int *provided_arg_stypes, const mx_uint num_shared_arg_names, const char **shared_arg_name_list, int *shared_buffer_len, const char **shared_buffer_name_list, NDArrayHandle *shared_buffer_handle_list, const char ***updated_shared_buffer_name_list, NDArrayHandle **updated_shared_buffer_handle_list, mx_uint *num_in_args, NDArrayHandle **in_args, NDArrayHandle **arg_grads, mx_uint *num_aux_states, NDArrayHandle **aux_states, ExecutorHandle shared_exec_handle, ExecutorHandle *out)
void(* EngineAsyncFunc)(void *, void *, void *)
Engine asynchronous operation.
Definition: c_api.h:106
MXNET_DLL int MXSymbolRemoveAmpCast(SymbolHandle sym_handle, SymbolHandle *ret_sym_handle)
Remove the operators amp_cast and amp_multicast.
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, mx_uint num_args, const char **keys, SymbolHandle *args)
Compose the symbol on other symbols.
MXNET_DLL int MXSymbolGrad(SymbolHandle sym, mx_uint num_wrt, const char **wrt, SymbolHandle *out)
Get the gradient graph of the symbol.
float mx_float
manually define float
Definition: c_api.h:60
int(* CustomOpInferShapeFunc)(int, int *, int **, void *)
Definition: c_api.h:184
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 MXCreateCachedOp(SymbolHandle handle, CachedOpHandle *out)
create cached operator
MXNET_DLL int MXRecordIOReaderSeek(RecordIOHandle handle, size_t pos)
Set the current reader pointer position.
#define MXNET_DLL
MXNET_DLL prefix for windows.
Definition: c_api.h:54
MXNET_DLL int MXSymbolCreateAtomicSymbol(AtomicSymbolCreator creator, mx_uint num_param, const char **keys, const char **vals, SymbolHandle *out)
Create an AtomicSymbol.
MXNET_DLL int MXNDArraySetGradState(NDArrayHandle handle, int state)
set the flag for gradient array state.
MXNET_DLL int MXNDArraySyncCheckFormat(NDArrayHandle handle, const bool full_check)
check whether the NDArray format is valid
MXNET_DLL int MXProcessProfilePause(int paused, int profile_process, KVStoreHandle kvStoreHandle)
Pause profiler tuning collection.
MXNET_DLL const char * MXGetLastError()
return str message of the last error all function in this file will return 0 when success and -1 when...
MXNET_DLL int MXNDArrayGetGradState(NDArrayHandle handle, int *out)
set the flag for gradient array state.
void ** contexts
Definition: c_api.h:151
void * AtomicSymbolCreator
handle to a function that takes param and creates symbol
Definition: c_api.h:71
MXNET_DLL int MXKVStoreInitEx(KVStoreHandle handle, mx_uint num, const char **keys, NDArrayHandle *vals)
Init a list of (key,value) pairs in kvstore, where each key is a string.
MXNET_DLL int MXAutogradGetSymbol(NDArrayHandle handle, SymbolHandle *out)
MXNET_DLL int MXExecutorBindX(SymbolHandle symbol_handle, int dev_type, int dev_id, mx_uint num_map_keys, const char **map_keys, const int *map_dev_types, const int *map_dev_ids, mx_uint len, NDArrayHandle *in_args, NDArrayHandle *arg_grad_store, mx_uint *grad_req_type, mx_uint aux_states_len, NDArrayHandle *aux_states, ExecutorHandle *out)
Generate Executor from symbol, This is advanced function, allow specify group2ctx map...
void(* infer_shape)(int, int *, unsigned **, void *)
Definition: c_api.h:118
void * ProfileHandle
handle to a Profile object (domain, duration, counter, etc.)
Definition: c_api.h:95
void * EngineVarHandle
handle to Engine VarHandle
Definition: c_api.h:103
MXNET_DLL int MXKVStorePullWithSparseEx(KVStoreHandle handle, mx_uint 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_list_outputs
Definition: c_api.h:125
MXNET_DLL int MXNDArrayGetShapeEx(NDArrayHandle handle, int *out_dim, const int **out_pdata)
get the shape of the array
MXNET_DLL int MXNDArraySave(const char *fname, mx_uint num_args, NDArrayHandle *args, const char **keys)
Save list of narray into the file.
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 MXRtcPush(RtcHandle handle, mx_uint num_input, mx_uint num_output, NDArrayHandle *inputs, NDArrayHandle *outputs, mx_uint gridDimX, mx_uint gridDimY, mx_uint gridDimZ, mx_uint blockDimX, mx_uint blockDimY, mx_uint blockDimZ)
Run cuda kernel.
void( MXKVStoreUpdater)(int key, NDArrayHandle recv, NDArrayHandle local, void *handle)
user-defined updater for the kvstore It&#39;s this updater&#39;s responsibility to delete recv and local ...
Definition: c_api.h:2433
MXNET_DLL int MXSymbolListAuxiliaryStates(SymbolHandle symbol, mx_uint *out_size, const char ***out_str_array)
List auxiliary states in the symbol.
MXNET_DLL int MXGetFunction(const char *name, FunctionHandle *out)
get the function handle by name
MXNET_DLL int MXSymbolListAttrShallow(SymbolHandle symbol, mx_uint *out_size, const char ***out)
Get all attributes from symbol, excluding descendents.
void * DataIterCreator
handle a dataiter creator
Definition: c_api.h:81
void(* EngineFuncParamDeleter)(void *)
Callback to free the param for EngineAsyncFunc/EngineSyncFunc.
Definition: c_api.h:110
MXNET_DLL int MXDataIterGetIterInfo(DataIterCreator creator, const char **name, const char **description, mx_uint *num_args, const char ***arg_names, const char ***arg_type_infos, const char ***arg_descriptions)
Get the detailed information about data iterator.
MXNET_DLL int MXKVStoreGetType(KVStoreHandle handle, const char **type)
get the type of the kvstore
void * RtcHandle
handle to MXRtc
Definition: c_api.h:89
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:192
MXNET_DLL int MXSymbolInferType(SymbolHandle sym, mx_uint num_args, const char **keys, const int *arg_type_data, mx_uint *in_type_size, const int **in_type_data, mx_uint *out_type_size, const int **out_type_data, mx_uint *aux_type_size, const int **aux_type_data, int *complete)
infer type of unknown input types given the known one. The types are packed into a CSR matrix represe...
Definition: c_api.h:168
MXNET_DLL int MXKVStoreInit(KVStoreHandle handle, mx_uint num, const int *keys, NDArrayHandle *vals)
Init a list of (key,value) pairs in kvstore.
void(* backward)(int, float **, int *, unsigned **, int *, void *)
Definition: c_api.h:117
int(* CustomOpInferStorageTypeFunc)(int, int *, void *)
Definition: c_api.h:186
Definition: c_api.h:148
MXNET_DLL int MXImperativeInvokeEx(AtomicSymbolCreator creator, int num_inputs, NDArrayHandle *inputs, int *num_outputs, NDArrayHandle **outputs, int num_params, const char **param_keys, const char **param_vals, const int **out_stypes)
invoke a nnvm op and imperative function
MXNET_DLL int MXRtcCudaModuleFree(CudaModuleHandle handle)
const void * FunctionHandle
handle to a mxnet narray function that changes NDArray
Definition: c_api.h:69
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.
Definition: c_api.h:115
MXNET_DLL int MXRecordIOReaderReadRecord(RecordIOHandle handle, char const **buf, size_t *size)
Write a record to a RecordIO object.
MXNET_DLL int MXProfileCreateFrame(ProfileHandle domain, const char *frame_name, ProfileHandle *out)
Create profile frame.
MXNET_DLL int MXKVStorePush(KVStoreHandle handle, mx_uint num, const int *keys, NDArrayHandle *vals, int priority)
Push a list of (key,value) pairs to kvstore.
MXNET_DLL int MXListFunctions(mx_uint *out_size, FunctionHandle **out_array)
list all the available functions handles most user can use it to list all the needed functions ...
void(* list_outputs)(char ***, void *)
Definition: c_api.h:119
Definition: c_api.h:169
Definition: c_api.h:172
MXNET_DLL int MXRtcCudaKernelCall(CudaKernelHandle handle, int dev_id, void **args, mx_uint grid_dim_x, mx_uint grid_dim_y, mx_uint grid_dim_z, mx_uint block_dim_x, mx_uint block_dim_y, mx_uint block_dim_z, mx_uint shared_mem)
MXNET_DLL int MXSymbolFree(SymbolHandle symbol)
Free the symbol handle.
MXNET_DLL int MXExecutorFree(ExecutorHandle handle)
Delete the executor.
MXNET_DLL int MXNDArrayWaitToWrite(NDArrayHandle handle)
Wait until all the pending read/write with respect NDArray are finished. Always call this before writ...
int(* CustomOpListFunc)(char ***, void *)
Definition: c_api.h:183
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 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.
MXNET_DLL int MXExecutorForward(ExecutorHandle handle, int is_train)
Executor forward method.
MXNET_DLL int MXNDArrayGetData(NDArrayHandle handle, void **out_pdata)
get the content of the data in NDArray