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 
24 #ifndef MXNET_C_API_H_
25 #define MXNET_C_API_H_
26 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif // __cplusplus
31 
33 #ifdef __cplusplus
34 #define DEFAULT(x) = x
35 #else
36 #define DEFAULT(x)
37 #endif // __cplusplus
38 
39 #include <stdint.h>
40 
41 #include <stdint.h>
42 #include <stddef.h>
43 #include <stdbool.h>
44 
46 #ifdef _WIN32
47 #ifdef MXNET_EXPORTS
48 #define MXNET_DLL __declspec(dllexport)
49 #else
50 #define MXNET_DLL __declspec(dllimport)
51 #endif
52 #else
53 #define MXNET_DLL
54 #endif
55 
56 #ifndef MXNET_BRANCH
57 #define MXNET_BRANCH "NotProvided"
58 #endif
59 
60 #ifndef MXNET_COMMIT_HASH
61 #define MXNET_COMMIT_HASH "NotProvided"
62 #endif
63 
65 typedef uint32_t mx_uint;
67 typedef float mx_float;
69 typedef int64_t dim_t;
70 // all the handles are simply void *
71 // will be casted internally to specific pointers types
72 // these typedefs are mainly used for readablity reasons
74 typedef void* NDArrayHandle;
76 typedef const void* FunctionHandle;
78 typedef void* AtomicSymbolCreator;
80 typedef void* CachedOpHandle;
82 typedef void* SymbolHandle;
84 typedef void* AtomicSymbolHandle;
86 typedef void* ExecutorHandle;
88 typedef void* DataIterCreator;
90 typedef void* DataIterHandle;
92 typedef void* DatasetCreator;
94 typedef void* DatasetHandle;
98 typedef void* BatchifyFunctionHandle;
100 typedef void* KVStoreHandle;
102 typedef void* RecordIOHandle;
104 typedef void* RtcHandle;
106 typedef void* CudaModuleHandle;
108 typedef void* CudaKernelHandle;
110 typedef void* ProfileHandle;
112 typedef void* DLManagedTensorHandle;
114 typedef const void* ContextHandle;
116 typedef const void* EngineFnPropertyHandle;
118 typedef void* EngineVarHandle;
119 
121 typedef void (*EngineAsyncFunc)(void*, void*, void*, void*);
123 typedef void (*EngineSyncFunc)(void*, void*);
125 typedef void (*EngineFuncParamDeleter)(void*);
127 typedef void (*CachedOpMonitorCallback)(const char*, const char*, NDArrayHandle);
128 
129 struct NativeOpInfo {
130  void (*forward)(int, float**, int*, unsigned**, int*, void*);
131  void (*backward)(int, float**, int*, unsigned**, int*, void*);
132  void (*infer_shape)(int, int*, unsigned**, void*);
133  void (*list_outputs)(char***, void*);
134  void (*list_arguments)(char***, void*);
135  // all functions also pass a payload void* pointer
136  void* p_forward;
137  void* p_backward;
141 };
142 
144  bool (*forward)(int, void**, int*, void*);
145  bool (*backward)(int, void**, int*, void*);
146  bool (*infer_shape)(int, int*, unsigned**, void*);
147  bool (*list_outputs)(char***, void*);
148  bool (*list_arguments)(char***, void*);
149  bool (*declare_backward_dependency)(const int*, const int*, const int*, int*, int**, void*);
150  // all functions also pass a payload void* pointer
151  void* p_forward;
152  void* p_backward;
157 };
158 
159 typedef int (*MXGenericCallback)(void);
160 
163  int (**callbacks)(void);
164  void** contexts;
165 };
166 
167 struct LibFeature {
168  const char* name;
169  bool enabled;
170 };
171 
173 
185 };
186 
187 typedef int (*CustomOpFBFunc)(int /*size*/,
188  void** /*ptrs*/,
189  int* /*tags*/,
190  const int* /*reqs*/,
191  const int /*is_train*/,
192  void* /*state*/);
193 typedef int (*CustomOpDelFunc)(void* /*state*/);
194 typedef int (*CustomOpListFunc)(char*** /*args*/, void* /*state*/);
195 typedef int (*CustomOpInferShapeFunc)(int /*num_input*/,
196  int* /*ndims*/,
197  int** /*shapes*/,
198  void* /*state*/);
199 typedef int (*CustomOpInferStorageTypeFunc)(int /*num_input*/, int* /*stypes*/, void* /*state*/);
200 typedef int (*CustomOpBackwardInferStorageTypeFunc)(int /*num_input*/,
201  int* /*stypes*/,
202  int* /*tags*/,
203  void* /*state*/);
204 typedef int (*CustomOpInferTypeFunc)(int /*num_input*/, int* /*types*/, void* /*state*/);
205 typedef int (*CustomOpBwdDepFunc)(const int* /*out_grad*/,
206  const int* /*in_data*/,
207  const int* /*out_data*/,
208  int* /*num_deps*/,
209  int** /*rdeps*/,
210  void* /*state*/);
211 typedef int (*CustomOpCreateFunc)(const char* /*ctx*/,
212  int /*num_inputs*/,
213  unsigned** /*shapes*/,
214  const int* /*ndims*/,
215  const int* /*dtypes*/,
216  struct MXCallbackList* /*ret*/,
217  void* /*state*/);
218 typedef int (*CustomOpPropCreator)(const char* /*op_type*/,
219  const int /*num_kwargs*/,
220  const char** /*keys*/,
221  const char** /*values*/,
222  struct MXCallbackList* /*ret*/);
223 
225 
226 typedef int (*CustomFunctionBwdFunc)(int /*num_ograds*/,
227  int /*num_igrads*/,
228  void** /*ptrs*/,
229  const int* /*reqs*/,
230  const int /*is_train*/,
231  void* /*state*/);
232 typedef int (*CustomFunctionDelFunc)(void* /*state*/);
233 
243 MXNET_DLL const char* MXGetLastError();
244 
245 //-------------------------------------
246 // Part 0: Global State setups
247 //-------------------------------------
248 
255 MXNET_DLL int MXLoadLib(const char* path, unsigned verbose, void** lib);
256 
263 MXNET_DLL int MXLibInfoFeatures(const struct LibFeature** libFeature, size_t* size);
264 
270 
276 MXNET_DLL int MXRandomSeed(int seed);
277 
283 MXNET_DLL int MXRandomSeedContext(int seed, int dev_type, int dev_id);
284 
294 MXNET_DLL int MXSetFlushDenorms(bool value, bool* prev_state);
295 
304 
313 MXNET_DLL int MXSetProcessProfilerConfig(int num_params,
314  const char* const* keys,
315  const char* const* vals,
316  KVStoreHandle kvstoreHandle);
317 
325 MXNET_DLL int MXSetProfilerConfig(int num_params, const char* const* keys, const char* const* vals);
326 
339  int profile_process,
340  KVStoreHandle kvStoreHandle);
341 
349 MXNET_DLL int MXSetProfilerState(int state);
350 
356 MXNET_DLL int MXSetProfilerScope(const char* scope);
357 
367 MXNET_DLL int MXDumpProcessProfile(int finished, int profile_process, KVStoreHandle kvStoreHandle);
368 
374 MXNET_DLL int MXDumpProfile(int finished);
375 
387 MXNET_DLL int MXAggregateProfileStatsPrint(const char** out_str,
388  int reset,
389  int format,
390  int sort_by,
391  int ascending);
392 
401 MXNET_DLL int MXProcessProfilePause(int paused, int profile_process, KVStoreHandle kvStoreHandle);
402 
409 MXNET_DLL int MXProfilePause(int paused);
410 
417 MXNET_DLL int MXProfileCreateDomain(const char* domain, ProfileHandle* out);
418 
426 MXNET_DLL int MXProfileCreateTask(ProfileHandle domain, const char* task_name, ProfileHandle* out);
427 
436  const char* frame_name,
437  ProfileHandle* out);
438 
445 MXNET_DLL int MXProfileCreateEvent(const char* event_name, ProfileHandle* out);
446 
455  const char* counter_name,
456  ProfileHandle* out);
457 
464 
470 MXNET_DLL int MXProfileDurationStart(ProfileHandle duration_handle);
471 
477 MXNET_DLL int MXProfileDurationStop(ProfileHandle duration_handle);
478 
485 MXNET_DLL int MXProfileSetCounter(ProfileHandle counter_handle, uint64_t value);
486 
493 MXNET_DLL int MXProfileAdjustCounter(ProfileHandle counter_handle, int64_t value);
494 
503  const char* instant_marker_name,
504  const char* scope);
505 
511 MXNET_DLL int MXSetNumOMPThreads(int thread_num);
512 
518 MXNET_DLL int MXEngineSetBulkSize(int bulk_size, int* prev_bulk_size);
519 
525 MXNET_DLL int MXGetGPUCount(int* out);
526 
535 MXNET_DLL int MXGetGPUMemoryInformation(int dev, int* free_mem, int* total_mem);
536 
544 MXNET_DLL int MXGetGPUMemoryInformation64(int dev, uint64_t* free_mem, uint64_t* total_mem);
545 
551 MXNET_DLL int MXGetVersion(int* out);
552 
558 MXNET_DLL int MXGetBranch(const char** out);
559 
565 MXNET_DLL int MXGetCommitHash(const char** out);
566 
572 #if MXNET_USE_TVM_OP
573 MXNET_DLL int MXLoadTVMOp(const char* libpath);
574 
575 struct OtherOptionEntity {
576  int val;
577 };
578 
579 struct OtherOptionSpace {
580  OtherOptionEntity* entities;
581  int entities_size;
582 };
583 
584 struct ConfigSpace {
585  int entity_map_size;
586  char** entity_map_key;
587  OtherOptionEntity* entity_map_val;
588  int space_map_size;
589  char** space_map_key;
590  OtherOptionSpace* space_map_val;
591 };
592 
593 typedef struct ConfigSpaces {
594  int spaces_size;
595  char** spaces_key;
596  ConfigSpace* spaces_val;
597 } ConfigSpaces;
598 
599 MXNET_DLL int MXLoadTVMConfig(ConfigSpaces config);
600 #endif // MXNET_USE_TVM_OP
601 
602 //-------------------------------------
603 // Part 1: NDArray creation and deletion
604 //-------------------------------------
613 
628 MXNET_DLL int MXNDArrayCreate(const uint32_t* shape,
629  uint32_t ndim,
630  int dev_type,
631  int dev_id,
632  int delay_alloc,
633  int dtype,
634  NDArrayHandle* out);
635 #define MXNDArrayCreateEx MXNDArrayCreate // backward compatibility for external deps
636 
651 MXNET_DLL int MXNDArrayCreate64(const int64_t* shape,
652  int ndim,
653  int dev_type,
654  int dev_id,
655  int delay_alloc,
656  int dtype,
657  NDArrayHandle* out);
658 
678 MXNET_DLL int MXNDArrayCreateSparseEx(int storage_type,
679  const uint32_t* shape,
680  uint32_t ndim,
681  int dev_type,
682  int dev_id,
683  int delay_alloc,
684  int dtype,
685  uint32_t num_aux,
686  int* aux_type,
687  uint32_t* aux_ndims,
688  const uint32_t* aux_shape,
689  NDArrayHandle* out);
690 
710 MXNET_DLL int MXNDArrayCreateSparseEx64(int storage_type,
711  const int64_t* shape,
712  int ndim,
713  int dev_type,
714  int dev_id,
715  int delay_alloc,
716  int dtype,
717  uint32_t num_aux,
718  int* aux_type,
719  int* aux_ndims,
720  const int64_t* aux_shape,
721  NDArrayHandle* out);
722 
730 MXNET_DLL int MXNDArrayLoadFromRawBytes(const void* buf, size_t size, NDArrayHandle* out);
738 MXNET_DLL int MXNDArraySaveRawBytes(NDArrayHandle handle, size_t* out_size, const char** out_buf);
747 MXNET_DLL int MXNDArrayLegacySave(const char* fname,
748  uint32_t num_args,
749  NDArrayHandle* args,
750  const char** keys);
759 MXNET_DLL int MXNDArraySave(const char* fname,
760  uint32_t num_args,
761  NDArrayHandle* args,
762  const char** keys);
772 MXNET_DLL int MXNDArrayLoad(const char* fname,
773  uint32_t* out_size,
774  NDArrayHandle** out_arr,
775  uint32_t* out_name_size,
776  const char*** out_names);
777 
792 MXNET_DLL int MXNDArrayLoadFromBuffer(const void* ndarray_buffer,
793  size_t size,
794  uint32_t* out_size,
795  NDArrayHandle** out_arr,
796  uint32_t* out_name_size,
797  const char*** out_names);
798 
810 MXNET_DLL int MXNDArraySyncCopyFromCPU(NDArrayHandle handle, const void* data, size_t size);
822 MXNET_DLL int MXNDArraySyncCopyToCPU(NDArrayHandle handle, void* data, size_t size);
823 
832  const NDArrayHandle handle_src,
833  const int i);
834 
840 MXNET_DLL int MXNDArraySyncCheckFormat(NDArrayHandle handle, const bool full_check);
841 
849 
857 
864 
871 
883  uint32_t slice_begin,
884  uint32_t slice_end,
885  NDArrayHandle* out);
886 
898  int64_t slice_begin,
899  int64_t slice_end,
900  NDArrayHandle* out);
901 
911 MXNET_DLL int MXNDArrayAt(NDArrayHandle handle, uint32_t idx, NDArrayHandle* out);
912 
922 MXNET_DLL int MXNDArrayAt64(NDArrayHandle handle, int64_t idx, NDArrayHandle* out);
923 
927 MXNET_DLL int MXNDArrayGetStorageType(NDArrayHandle handle, int* out_storage_type);
928 
937 MXNET_DLL int MXNDArrayReshape(NDArrayHandle handle, int ndim, int* dims, NDArrayHandle* out);
938 
948  int ndim,
949  dim_t* dims,
950  bool reverse,
951  NDArrayHandle* out);
952 
962 MXNET_DLL int MXNDArrayGetShape(NDArrayHandle handle, int* out_dim, const int** out_pdata);
963 
973 MXNET_DLL int MXNDArrayGetShape64(NDArrayHandle handle, int* out_dim, const int64_t** out_pdata);
974 
981 MXNET_DLL int MXNDArrayGetData(NDArrayHandle handle, void** out_pdata);
992 
1008  const bool transient_handle,
1009  NDArrayHandle* out_handle);
1010 
1017 
1024 MXNET_DLL int MXNDArrayGetDType(NDArrayHandle handle, int* out_dtype);
1025 
1035 MXNET_DLL int MXNDArrayGetAuxType(NDArrayHandle handle, uint32_t i, int* out_type);
1036 
1046 MXNET_DLL int MXNDArrayGetAuxType64(NDArrayHandle handle, int64_t i, int* out_type);
1047 
1055 MXNET_DLL int MXNDArrayGetAuxNDArray(NDArrayHandle handle, uint32_t i, NDArrayHandle* out);
1056 
1064 MXNET_DLL int MXNDArrayGetAuxNDArray64(NDArrayHandle handle, int64_t i, NDArrayHandle* out);
1065 
1079 MXNET_DLL int MXNDArrayGetContext(NDArrayHandle handle, int* out_dev_type, int* out_dev_id);
1098 MXNET_DLL int MXNDArraySetGradState(NDArrayHandle handle, int state);
1105 MXNET_DLL int MXNDArrayGetGradState(NDArrayHandle handle, int* out);
1106 //--------------------------------
1107 // Part 2: functions on NDArray
1108 //--------------------------------
1116 MXNET_DLL int MXListFunctions(uint32_t* out_size, FunctionHandle** out_array);
1117 
1124 MXNET_DLL int MXGetFunction(const char* name, FunctionHandle* out);
1138  const char** name,
1139  const char** description,
1140  uint32_t* num_args,
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,
1159  int* type_mask);
1174  NDArrayHandle* use_vars,
1175  float* scalar_args,
1176  NDArrayHandle* mutate_vars,
1177  int num_params,
1178  char** param_keys,
1179  char** param_vals);
1194  int num_inputs,
1195  NDArrayHandle* inputs,
1196  int* num_outputs,
1197  NDArrayHandle** outputs,
1198  int num_params,
1199  const char** param_keys,
1200  const char** param_vals,
1201  const int** out_stypes);
1208 MXNET_DLL int MXAutogradSetIsRecording(int is_recording, int* prev);
1215 MXNET_DLL int MXAutogradSetIsTraining(int is_training, int* prev);
1221 MXNET_DLL int MXAutogradIsRecording(bool* curr);
1227 MXNET_DLL int MXAutogradIsTraining(bool* curr);
1234 MXNET_DLL int MXSetOptimizationConstraints(unsigned int constraints, unsigned int* prev);
1240 MXNET_DLL int MXGetOptimizationConstraints(unsigned int* curr);
1246 MXNET_DLL int MXIsNumpyShape(int* curr);
1254 MXNET_DLL int MXSetIsNumpyShape(int is_np_shape, int* prev);
1260 MXNET_DLL int MXIsNumpyDefaultDtype(bool* curr);
1268 MXNET_DLL int MXSetIsNumpyDefaultDtype(bool dtype_flag, bool* prev);
1275 MXNET_DLL int MXAutogradMarkVariables(uint32_t num_var,
1276  NDArrayHandle* var_handles,
1277  uint32_t* reqs_array,
1278  NDArrayHandle* grad_handles);
1285 MXNET_DLL int MXAutogradDropGrads(uint32_t num_var, NDArrayHandle* var_handles);
1292 MXNET_DLL int MXAutogradComputeGradient(uint32_t num_output, NDArrayHandle* output_handles);
1301 MXNET_DLL int MXAutogradBackward(uint32_t num_output,
1302  NDArrayHandle* output_handles,
1303  NDArrayHandle* ograd_handles,
1304  int retain_graph);
1316 MXNET_DLL int MXAutogradBackwardEx(uint32_t num_output,
1317  NDArrayHandle* output_handles,
1318  NDArrayHandle* ograd_handles,
1319  uint32_t num_variables,
1320  NDArrayHandle* var_handles,
1321  int retain_graph,
1322  int create_graph,
1323  int is_train,
1324  NDArrayHandle** grad_handles,
1325  int** grad_stypes);
1326 /*
1327  * \brief get the graph constructed by autograd.
1328  * \param handle ndarray handle
1329  * \param out output symbol handle
1330  */
1332 
1338  int num_flags,
1339  const char** keys,
1340  const char** vals,
1341  CachedOpHandle* out,
1342  bool thread_safe DEFAULT(false));
1343 
1348 
1353 
1367  int num_inputs,
1368  NDArrayHandle* inputs,
1369  int default_dev_type,
1370  int default_dev_id,
1371  int* num_outputs,
1372  NDArrayHandle** outputs,
1373  const int** out_stypes);
1374 
1379  CachedOpMonitorCallback callback,
1380  bool monitor_all);
1381 
1387 MXNET_DLL int MXNDArrayIsDeferredCompute(int* curr);
1388 
1395 MXNET_DLL int MXNDArraySetIsDeferredCompute(int deferred_compute_enabled, int* prev);
1396 
1405  SymbolHandle* variables,
1406  int num);
1407 
1417  int num_outputs,
1418  SymbolHandle* out);
1419 
1427 
1428 //--------------------------------------------
1429 // Part 3: symbolic configuration generation
1430 //--------------------------------------------
1437 MXNET_DLL int MXListAllOpNames(uint32_t* out_size, const char*** out_array);
1438 
1445 MXNET_DLL int MXSymbolListAtomicSymbolCreators(uint32_t* out_size, AtomicSymbolCreator** out_array);
1446 
1452 MXNET_DLL int MXSymbolGetAtomicSymbolName(AtomicSymbolCreator creator, const char** name);
1453 
1460 MXNET_DLL int MXSymbolGetInputSymbols(SymbolHandle sym, SymbolHandle** inputs, int* input_size);
1461 
1471 MXNET_DLL int MXSymbolCutSubgraph(SymbolHandle sym, SymbolHandle** inputs, int* input_size);
1472 
1491  const char** name,
1492  const char** description,
1493  uint32_t* num_args,
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));
1513  uint32_t num_param,
1514  const char** keys,
1515  const char** vals,
1516  SymbolHandle* out);
1523 MXNET_DLL int MXSymbolCreateVariable(const char* name, SymbolHandle* out);
1531 MXNET_DLL int MXSymbolCreateGroup(uint32_t num_symbols, SymbolHandle* symbols, SymbolHandle* out);
1538 MXNET_DLL int MXSymbolCreateFromFile(const char* fname, SymbolHandle* out);
1545 MXNET_DLL int MXSymbolCreateFromJSON(const char* json, SymbolHandle* out);
1552 MXNET_DLL int MXSymbolRemoveAmpCast(SymbolHandle sym_handle, SymbolHandle* ret_sym_handle);
1559 MXNET_DLL int MXSymbolSaveToFile(SymbolHandle symbol, const char* fname);
1566 MXNET_DLL int MXSymbolSaveToJSON(SymbolHandle symbol, const char** out_json);
1572 MXNET_DLL int MXSymbolFree(SymbolHandle symbol);
1586 MXNET_DLL int MXSymbolPrint(SymbolHandle symbol, const char** out_str);
1594 MXNET_DLL int MXSymbolGetName(SymbolHandle symbol, const char** out, int* success);
1603 MXNET_DLL int MXSymbolGetAttr(SymbolHandle symbol, const char* key, const char** out, int* success);
1621 MXNET_DLL int MXSymbolSetAttr(SymbolHandle symbol, const char* key, const char* value);
1629 MXNET_DLL int MXSymbolListAttr(SymbolHandle symbol, uint32_t* out_size, const char*** out);
1637 MXNET_DLL int MXSymbolListAttrShallow(SymbolHandle symbol, uint32_t* out_size, const char*** out);
1646  uint32_t* out_size,
1647  const char*** out_str_array);
1648 
1657  uint32_t* out_size,
1658  const char*** out_str_array);
1659 
1666 MXNET_DLL int MXSymbolGetNumOutputs(SymbolHandle symbol, uint32_t* output_count);
1667 
1696 MXNET_DLL int MXSymbolGetOutput(SymbolHandle symbol, uint32_t index, SymbolHandle* out);
1697 
1706  uint32_t* out_size,
1707  const char*** out_str_array);
1708 
1724  const char* name,
1725  uint32_t num_args,
1726  const char** keys,
1727  SymbolHandle* args);
1737 MXNET_DLL int MXSymbolGrad(SymbolHandle sym, uint32_t num_wrt, const char** wrt, SymbolHandle* out);
1738 
1764  uint32_t num_args,
1765  const char** keys,
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,
1777  int* complete);
1778 
1805  uint32_t num_args,
1806  const char** keys,
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,
1818  int* complete);
1819 
1847  uint32_t num_args,
1848  const char** keys,
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,
1860  int* complete);
1861 
1889  uint32_t num_args,
1890  const char** keys,
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,
1902  int* complete);
1903 
1924  uint32_t num_args,
1925  const char** keys,
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,
1933  int* complete);
1934 
1957  uint32_t num_args,
1958  const char** keys,
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,
1966  int* complete);
1967 
1987 MXNET_DLL int MXQuantizeSymbol(SymbolHandle sym_handle,
1988  SymbolHandle* ret_sym_handle,
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);
2002 
2027  SymbolHandle* ret_sym_handle,
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);
2042 
2053  const uint32_t num_layers,
2054  const char** layer_names,
2055  const float* low_quantiles,
2056  const float* high_quantiles,
2057  SymbolHandle* ret_sym_handle);
2058 
2066  const char* backend,
2067  SymbolHandle* ret_sym_handle);
2068 
2074 MXNET_DLL int MXGenAtomicSymbolFromSymbol(SymbolHandle sym_handle, SymbolHandle* ret_sym_handle);
2107  const char* backend_name,
2108  const int dev_type,
2109  SymbolHandle* ret_sym_handle,
2110  const mx_uint args_len,
2111  NDArrayHandle* in_args_handle,
2112  const mx_uint aux_len,
2113  NDArrayHandle* in_aux_handle,
2114  const mx_uint num_options,
2115  const char** keys,
2116  const char** vals,
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,
2127  bool skip_infer,
2128  int* new_args_cnt,
2129  NDArrayHandle** new_args_handle,
2130  char*** new_arg_names_handle,
2131  int* new_aux_cnt,
2132  NDArrayHandle** new_aux_handle,
2133  char*** new_aux_names_handle);
2134 
2135 //--------------------------------------------
2136 // Part 5: IO Interface
2137 //--------------------------------------------
2144 MXNET_DLL int MXListDataIters(uint32_t* out_size, DataIterCreator** out_array);
2156  uint32_t num_param,
2157  const char** keys,
2158  const char** vals,
2159  DataIterHandle* out);
2172  const char** name,
2173  const char** description,
2174  uint32_t* num_args,
2175  const char*** arg_names,
2176  const char*** arg_type_infos,
2177  const char*** arg_descriptions);
2190 MXNET_DLL int MXDataIterNext(DataIterHandle handle, int* out);
2197 
2203 MXNET_DLL int MXDataIterGetLenHint(DataIterHandle handle, int64_t* len);
2218 MXNET_DLL int MXDataIterGetIndex(DataIterHandle handle, uint64_t** out_index, uint64_t* out_size);
2226 
2241 MXNET_DLL int MXDataIterGetItems(DataIterHandle handle, int* num_outputs, NDArrayHandle** outputs);
2242 
2249 MXNET_DLL int MXListDatasets(uint32_t* out_size, DatasetCreator** out_array);
2261  uint32_t num_param,
2262  const char** keys,
2263  const char** vals,
2264  DatasetHandle* out);
2277  const char** name,
2278  const char** description,
2279  uint32_t* num_args,
2280  const char*** arg_names,
2281  const char*** arg_type_infos,
2282  const char*** arg_descriptions);
2295 MXNET_DLL int MXDatasetGetLen(DatasetHandle handle, uint64_t* out);
2306  uint64_t index,
2307  int* num_outputs,
2308  NDArrayHandle** outputs);
2309 
2316 MXNET_DLL int MXListBatchifyFunctions(uint32_t* out_size, BatchifyFunctionCreator** out_array);
2328  uint32_t num_param,
2329  const char** keys,
2330  const char** vals,
2331  BatchifyFunctionHandle* out);
2344  const char** name,
2345  const char** description,
2346  uint32_t* num_args,
2347  const char*** arg_names,
2348  const char*** arg_type_infos,
2349  const char*** arg_descriptions);
2360  int batch_size,
2361  int num_output,
2362  NDArrayHandle* inputs,
2363  NDArrayHandle** outputs);
2370 //--------------------------------------------
2371 // Part 6: basic KVStore interface
2372 //--------------------------------------------
2379 MXNET_DLL int MXInitPSEnv(uint32_t num_vars, const char** keys, const char** vals);
2380 
2387 MXNET_DLL int MXKVStoreCreate(const char* type, KVStoreHandle* out);
2388 
2397  uint32_t num_params,
2398  const char** keys,
2399  const char** vals);
2400 
2416  uint32_t num,
2417  const int* keys,
2418  NDArrayHandle* vals);
2419 
2429  uint32_t num,
2430  const char** keys,
2431  NDArrayHandle* vals);
2432 
2443  uint32_t num,
2444  const int* keys,
2445  NDArrayHandle* vals,
2446  int priority);
2457  uint32_t num,
2458  const char** keys,
2459  NDArrayHandle* vals,
2460  int priority);
2472  uint32_t num,
2473  const int* keys,
2474  NDArrayHandle* vals,
2475  int priority,
2476  bool ignore_sparse);
2488  uint32_t num,
2489  const char** keys,
2490  NDArrayHandle* vals,
2491  int priority,
2492  bool ignore_sparse);
2503  uint32_t num,
2504  const int* keys,
2505  NDArrayHandle* vals,
2506  int priority);
2517  uint32_t num,
2518  const char** keys,
2519  NDArrayHandle* vals,
2520  int priority);
2521 
2535  uint32_t num,
2536  const int* keys,
2537  NDArrayHandle* vals,
2538  const NDArrayHandle* row_ids,
2539  int priority);
2553  uint32_t num,
2554  const char** keys,
2555  NDArrayHandle* vals,
2556  const NDArrayHandle* row_ids,
2557  int priority);
2558 
2572  mx_uint vnum,
2573  const int* vkeys,
2574  mx_uint onum,
2575  const int* okeys,
2576  NDArrayHandle* vals,
2577  NDArrayHandle* outs,
2578  int priority);
2593  mx_uint vnum,
2594  const char** vkeys,
2595  mx_uint onum,
2596  const char** okeys,
2597  NDArrayHandle* vals,
2598  NDArrayHandle* outs,
2599  int priority);
2600 
2614  mx_uint vnum,
2615  const int* vkeys,
2616  mx_uint onum,
2617  const int* okeys,
2618  NDArrayHandle* vals,
2619  NDArrayHandle* outs,
2620  int priority);
2635  mx_uint vnum,
2636  const char** vkeys,
2637  mx_uint onum,
2638  const char** okeys,
2639  NDArrayHandle* vals,
2640  NDArrayHandle* outs,
2641  int priority);
2642 
2651 typedef void(MXKVStoreUpdater)(int key, NDArrayHandle recv, NDArrayHandle local, void* handle);
2660 typedef void(MXKVStoreStrUpdater)(const char* key,
2661  NDArrayHandle recv,
2662  NDArrayHandle local,
2663  void* handle);
2672  MXKVStoreUpdater updater,
2673  void* updater_handle);
2683  MXKVStoreUpdater updater,
2684  MXKVStoreStrUpdater str_updater,
2685  void* updater_handle);
2692 MXNET_DLL int MXKVStoreGetType(KVStoreHandle handle, const char** type);
2693 //--------------------------------------------
2694 // Part 6: advanced KVStore for multi-machines
2695 //--------------------------------------------
2696 
2704 MXNET_DLL int MXKVStoreGetRank(KVStoreHandle handle, int* ret);
2705 
2715 MXNET_DLL int MXKVStoreGetGroupSize(KVStoreHandle handle, int* ret);
2716 
2722 MXNET_DLL int MXKVStoreIsWorkerNode(int* ret);
2723 
2729 MXNET_DLL int MXKVStoreIsServerNode(int* ret);
2730 
2736 MXNET_DLL int MXKVStoreIsSchedulerNode(int* ret);
2737 
2745 
2753 MXNET_DLL int MXKVStoreSetBarrierBeforeExit(KVStoreHandle handle, const int barrier_before_exit);
2754 
2761 typedef void(MXKVStoreServerController)(int head, const char* body, void* controller_handle);
2762 
2771  MXKVStoreServerController controller,
2772  void* controller_handle);
2773 
2782  int cmd_id,
2783  const char* cmd_body);
2784 
2796  const int node_id,
2797  int* number,
2798  const int timeout_sec DEFAULT(60));
2799 
2806 MXNET_DLL int MXRecordIOWriterCreate(const char* uri, RecordIOHandle* out);
2807 
2814 
2822 MXNET_DLL int MXRecordIOWriterWriteRecord(RecordIOHandle handle, const char* buf, size_t size);
2823 
2830 MXNET_DLL int MXRecordIOWriterTell(RecordIOHandle handle, size_t* pos);
2831 
2838 MXNET_DLL int MXRecordIOReaderCreate(const char* uri, RecordIOHandle* out);
2839 
2846 
2854 MXNET_DLL int MXRecordIOReaderReadRecord(RecordIOHandle handle, char const** buf, size_t* size);
2855 
2862 MXNET_DLL int MXRecordIOReaderSeek(RecordIOHandle handle, size_t pos);
2863 
2870 MXNET_DLL int MXRecordIOReaderTell(RecordIOHandle handle, size_t* pos);
2871 
2875 MXNET_DLL int MXRtcCreate(char* name,
2876  uint32_t num_input,
2877  uint32_t num_output,
2878  char** input_names,
2879  char** output_names,
2880  NDArrayHandle* inputs,
2881  NDArrayHandle* outputs,
2882  char* kernel,
2883  RtcHandle* out);
2884 
2888 MXNET_DLL int MXRtcPush(RtcHandle handle,
2889  uint32_t num_input,
2890  uint32_t num_output,
2891  NDArrayHandle* inputs,
2892  NDArrayHandle* outputs,
2893  uint32_t gridDimX,
2894  uint32_t gridDimY,
2895  uint32_t gridDimZ,
2896  uint32_t blockDimX,
2897  uint32_t blockDimY,
2898  uint32_t blockDimZ);
2899 
2903 MXNET_DLL int MXRtcFree(RtcHandle handle);
2904 /*
2905  * \brief register custom operators from frontend.
2906  * \param op_type name of custom op
2907  * \param creator
2908  */
2909 MXNET_DLL int MXCustomOpRegister(const char* op_type, CustomOpPropCreator creator);
2910 /*
2911  * \brief record custom function for backward later.
2912  * \param num_inputs number of input NDArrays.
2913  * \param inputs handle to input NDArrays.
2914  * \param num_outputs number of output NDArrays.
2915  * \param outputs handle to output NDArrays.
2916  * \param callbacks callbacks for backward function.
2917  */
2918 MXNET_DLL int MXCustomFunctionRecord(int num_inputs,
2919  NDArrayHandle* inputs,
2920  int num_outputs,
2921  NDArrayHandle* outputs,
2922  struct MXCallbackList* callbacks);
2923 /*
2924  * \brief create cuda rtc module
2925  * \param source cuda source code
2926  * \param num_options number of compiler flags
2927  * \param options compiler flags
2928  * \param num_exports number of exported function names
2929  * \param exported function names
2930  * \param out handle to created module
2931  */
2932 MXNET_DLL int MXRtcCudaModuleCreate(const char* source,
2933  int num_options,
2934  const char** options,
2935  int num_exports,
2936  const char** exports,
2937  CudaModuleHandle* out);
2938 /*
2939  * \brief delete cuda rtc module
2940  * \param handle handle to cuda module
2941  */
2943 /*
2944  * \brief get kernel from module
2945  * \param handle handle to cuda module
2946  * \param name name of kernel function
2947  * \param num_args number of arguments
2948  * \param is_ndarray whether argument is ndarray
2949  * \param is_const whether argument is constant
2950  * \param arg_types data type of arguments
2951  * \param out created kernel
2952  */
2954  const char* name,
2955  int num_args,
2956  int* is_ndarray,
2957  int* is_const,
2958  int* arg_types,
2959  CudaKernelHandle* out);
2960 /*
2961  * \brief delete kernel
2962  * \param handle handle to previously created kernel
2963  */
2965 /*
2966  * \brief launch cuda kernel
2967  * \param handle handle to kernel
2968  * \param dev_id (GPU) device id
2969  * \param args pointer to arguments
2970  * \param grid_dim_x grid dimension x
2971  * \param grid_dim_y grid dimension y
2972  * \param grid_dim_z grid dimension z
2973  * \param block_dim_x block dimension x
2974  * \param block_dim_y block dimension y
2975  * \param block_dim_z block dimension z
2976  * \param shared_mem size of dynamically allocated shared memory
2977  */
2979  int dev_id,
2980  void** args,
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);
2994 MXNET_DLL int MXNDArrayGetSharedMemHandle(NDArrayHandle handle, int* shared_pid, int* shared_id);
2995 
3001 MXNET_DLL int MXStorageEmptyCache(int dev_type, int dev_id);
3002 
3012 MXNET_DLL int MXNDArrayCreateFromSharedMem(int shared_pid,
3013  int shared_id,
3014  const int* shape,
3015  int ndim,
3016  int dtype,
3017  NDArrayHandle* out);
3018 
3037  void* func_param,
3038  EngineFuncParamDeleter deleter,
3039  ContextHandle ctx_handle,
3040  EngineVarHandle const_vars_handle,
3041  int num_const_vars,
3042  EngineVarHandle mutable_vars_handle,
3043  int num_mutable_vars,
3044  EngineFnPropertyHandle prop_handle DEFAULT(NULL),
3045  int priority DEFAULT(0),
3046  const char* opr_name DEFAULT(NULL),
3047  bool wait DEFAULT(false));
3048 
3065  void* func_param,
3066  EngineFuncParamDeleter deleter,
3067  ContextHandle ctx_handle,
3068  EngineVarHandle const_vars_handle,
3069  int num_const_vars,
3070  EngineVarHandle mutable_vars_handle,
3071  int num_mutable_vars,
3072  EngineFnPropertyHandle prop_handle DEFAULT(NULL),
3073  int priority DEFAULT(0),
3074  const char* opr_name DEFAULT(NULL));
3087 
3106  void* func_param,
3107  EngineFuncParamDeleter deleter,
3108  ContextHandle ctx_handle,
3109  NDArrayHandle* const_nds_handle,
3110  int num_const_nds,
3111  NDArrayHandle* mutable_nds_handle,
3112  int num_mutable_nds,
3113  EngineFnPropertyHandle prop_handle DEFAULT(NULL),
3114  int priority DEFAULT(0),
3115  const char* opr_name DEFAULT(NULL),
3116  bool wait DEFAULT(false));
3117 
3134  void* func_param,
3135  EngineFuncParamDeleter deleter,
3136  ContextHandle ctx_handle,
3137  NDArrayHandle* const_nds_handle,
3138  int num_const_nds,
3139  NDArrayHandle* mutable_nds_handle,
3140  int num_mutable_nds,
3141  EngineFnPropertyHandle prop_handle DEFAULT(NULL),
3142  int priority DEFAULT(0),
3143  const char* opr_name DEFAULT(NULL));
3144 
3150 MXNET_DLL int MXCheckDynamicShapeOp(SymbolHandle sym_handle, bool* has_dynamic_shape);
3151 
3157 MXNET_DLL int MXPushStreamDep(NDArrayHandle handle, int stream);
3158 
3164 MXNET_DLL int MXGetCurrentStream(int device_id, int* stream);
3165 
3172 MXNET_DLL int MXNVTXRangePush(const char* name, mx_uint color);
3173 
3178 
3183 
3188 
3192 MXNET_DLL int MXSetOptimizeLayout(bool val);
3193 
3197 MXNET_DLL int MXGetOptimizeLayout(bool* val);
3198 
3199 #ifdef __cplusplus
3200 }
3201 #endif // __cplusplus
3202 
3203 #endif // MXNET_C_API_H_
MXKVStoreBroadcast
MXNET_DLL int MXKVStoreBroadcast(KVStoreHandle handle, mx_uint vnum, const int *vkeys, mx_uint onum, const int *okeys, NDArrayHandle *vals, NDArrayHandle *outs, int priority)
broadcast a list of (key, value) pairs from the kvstore
MXDatasetFree
MXNET_DLL int MXDatasetFree(DatasetHandle handle)
Free the handle to the IO module.
MXPushStreamDep
MXNET_DLL int MXPushStreamDep(NDArrayHandle handle, int stream)
Synchronize the consumer stream with the producer stream where the NDArray lives.
MXKVStoreSetUpdater
MXNET_DLL int MXKVStoreSetUpdater(KVStoreHandle handle, MXKVStoreUpdater updater, void *updater_handle)
register a push updater
NDArrayOpInfo::infer_shape
bool(* infer_shape)(int, int *, unsigned **, void *)
Definition: c_api.h:146
EngineFuncParamDeleter
void(* EngineFuncParamDeleter)(void *)
Callback to free the param for EngineAsyncFunc/EngineSyncFunc.
Definition: c_api.h:125
CustomOpInferTypeFunc
int(* CustomOpInferTypeFunc)(int, int *, void *)
Definition: c_api.h:204
MXCallbackList::contexts
void ** contexts
Definition: c_api.h:164
MXCustomOpRegister
MXNET_DLL int MXCustomOpRegister(const char *op_type, CustomOpPropCreator creator)
MXCustomFunctionRecord
MXNET_DLL int MXCustomFunctionRecord(int num_inputs, NDArrayHandle *inputs, int num_outputs, NDArrayHandle *outputs, struct MXCallbackList *callbacks)
MXBatchifyFunctionGetFunctionInfo
MXNET_DLL int MXBatchifyFunctionGetFunctionInfo(BatchifyFunctionCreator creator, const char **name, const char **description, uint32_t *num_args, const char ***arg_names, const char ***arg_type_infos, const char ***arg_descriptions)
Get the detailed information about batchify function.
MXNDArrayCreate64
MXNET_DLL int MXNDArrayCreate64(const int64_t *shape, int ndim, int dev_type, int dev_id, int delay_alloc, int dtype, NDArrayHandle *out)
create a NDArray with specified shape and data type This api is available when MXNet is built with fl...
kCustomOpPropListArguments
@ kCustomOpPropListArguments
Definition: c_api.h:176
MXCreateCachedOp
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
MXNDArraySetIsDeferredCompute
MXNET_DLL int MXNDArraySetIsDeferredCompute(int deferred_compute_enabled, int *prev)
set whether to enable deferred compute mode
NDArrayOpInfo::list_arguments
bool(* list_arguments)(char ***, void *)
Definition: c_api.h:148
MXSetProfilerScope
MXNET_DLL int MXSetProfilerScope(const char *scope)
Set the scope of profiler for current process.
MXEngineSetBulkSize
MXNET_DLL int MXEngineSetBulkSize(int bulk_size, int *prev_bulk_size)
set bulk execution limit
MXNDArrayGetContext
MXNET_DLL int MXNDArrayGetContext(NDArrayHandle handle, int *out_dev_type, int *out_dev_id)
get the context of the NDArray
MXAutogradSetIsTraining
MXNET_DLL int MXAutogradSetIsTraining(int is_training, int *prev)
set whether to record operator for autograd
MXCallbackList::callbacks
int(** callbacks)(void)
Definition: c_api.h:163
MXSymbolCreateFromFile
MXNET_DLL int MXSymbolCreateFromFile(const char *fname, SymbolHandle *out)
Load a symbol from a json file.
CachedOpHandle
void * CachedOpHandle
handle to cached operator
Definition: c_api.h:80
MXNDArrayClearDeferredCompute
MXNET_DLL int MXNDArrayClearDeferredCompute(NDArrayHandle *arrays, int num)
Clear the deferred compute info associated with the ndarrays.
MXKVStorePullWithSparse
MXNET_DLL int MXKVStorePullWithSparse(KVStoreHandle handle, uint32_t num, const int *keys, NDArrayHandle *vals, int priority, bool ignore_sparse)
pull a list of (key, value) pairs from the kvstore
DatasetHandle
void * DatasetHandle
handle to a Dataset
Definition: c_api.h:94
kCustomOpForward
@ kCustomOpForward
Definition: c_api.h:172
MXNDArrayGetStorageType
MXNET_DLL int MXNDArrayGetStorageType(NDArrayHandle handle, int *out_storage_type)
get the storage type of the array
MXRecordIOReaderCreate
MXNET_DLL int MXRecordIOReaderCreate(const char *uri, RecordIOHandle *out)
Create a RecordIO reader object.
EngineAsyncFunc
void(* EngineAsyncFunc)(void *, void *, void *, void *)
Engine asynchronous operation.
Definition: c_api.h:121
kCustomOpPropBackwardInferStorageType
@ kCustomOpPropBackwardInferStorageType
Definition: c_api.h:184
MXNDArrayLoad
MXNET_DLL int MXNDArrayLoad(const char *fname, uint32_t *out_size, NDArrayHandle **out_arr, uint32_t *out_name_size, const char ***out_names)
Load list of narray from the file.
MXSymbolCreateFromJSON
MXNET_DLL int MXSymbolCreateFromJSON(const char *json, SymbolHandle *out)
Load a symbol from a json string.
MXSetOptimizeLayout
MXNET_DLL int MXSetOptimizeLayout(bool val)
Turns on or off Layout Optimization.
MXKVStoreRunServer
MXNET_DLL int MXKVStoreRunServer(KVStoreHandle handle, MXKVStoreServerController controller, void *controller_handle)
Run as server (or scheduler)
MXNDArrayReshape
MXNET_DLL int MXNDArrayReshape(NDArrayHandle handle, int ndim, int *dims, NDArrayHandle *out)
Reshape the NDArray.
MXEnginePushSync
MXNET_DLL int MXEnginePushSync(EngineSyncFunc sync_func, void *func_param, EngineFuncParamDeleter deleter, ContextHandle ctx_handle, EngineVarHandle const_vars_handle, int num_const_vars, EngineVarHandle mutable_vars_handle, int num_mutable_vars, EngineFnPropertyHandle prop_handle DEFAULT(NULL), int priority DEFAULT(0), const char *opr_name DEFAULT(NULL))
Push a synchronous operation to the engine.
MXDataIterBeforeFirst
MXNET_DLL int MXDataIterBeforeFirst(DataIterHandle handle)
Call iterator.Reset.
MXSymbolGetInternals
MXNET_DLL int MXSymbolGetInternals(SymbolHandle symbol, SymbolHandle *out)
Get a symbol that contains all the internals.
NativeOpInfo::p_list_outputs
void * p_list_outputs
Definition: c_api.h:139
kCustomOpPropCreateOperator
@ kCustomOpPropCreateOperator
Definition: c_api.h:181
MXNDArrayToDLPack
MXNET_DLL int MXNDArrayToDLPack(NDArrayHandle handle, DLManagedTensorHandle *out_dlpack)
Create a reference view of NDArray that represents as DLManagedTensor Notice: MXNet uses asynchronous...
MXSymbolFree
MXNET_DLL int MXSymbolFree(SymbolHandle symbol)
Free the symbol handle.
MXKVStoreGetType
MXNET_DLL int MXKVStoreGetType(KVStoreHandle handle, const char **type)
get the type of the kvstore
MXGetGPUCount
MXNET_DLL int MXGetGPUCount(int *out)
Get the number of GPUs.
MXSymbolGetName
MXNET_DLL int MXSymbolGetName(SymbolHandle symbol, const char **out, int *success)
Get string name from symbol.
MXLoadLib
MXNET_DLL int MXLoadLib(const char *path, unsigned verbose, void **lib)
Load library dynamically.
MXKVStoreSetGradientCompression
MXNET_DLL int MXKVStoreSetGradientCompression(KVStoreHandle handle, uint32_t num_params, const char **keys, const char **vals)
Set parameters to use low-bit compressed gradients.
CachedOpMonitorCallback
void(* CachedOpMonitorCallback)(const char *, const char *, NDArrayHandle)
Monitor callback called at operator level for cached op.
Definition: c_api.h:127
MXSymbolInferShapePartial
MXNET_DLL int MXSymbolInferShapePartial(SymbolHandle sym, uint32_t num_args, const char **keys, const uint32_t *arg_ind_ptr, const int *arg_shape_data, uint32_t *in_shape_size, const int **in_shape_ndim, const int ***in_shape_data, uint32_t *out_shape_size, const int **out_shape_ndim, const int ***out_shape_data, uint32_t *aux_shape_size, const int **aux_shape_ndim, const int ***aux_shape_data, int *complete)
partially infer shape of unknown input shapes given the known one.
NativeOpInfo::list_arguments
void(* list_arguments)(char ***, void *)
Definition: c_api.h:134
MXProfileCreateCounter
MXNET_DLL int MXProfileCreateCounter(ProfileHandle domain, const char *counter_name, ProfileHandle *out)
Create profile counter.
MXProfileDestroyHandle
MXNET_DLL int MXProfileDestroyHandle(ProfileHandle frame_handle)
Destroy a frame.
MXSymbolListOutputs
MXNET_DLL int MXSymbolListOutputs(SymbolHandle symbol, uint32_t *out_size, const char ***out_str_array)
List returns in the symbol.
MXSymbolSaveToFile
MXNET_DLL int MXSymbolSaveToFile(SymbolHandle symbol, const char *fname)
Save a symbol into a json file.
MXSymbolListArguments
MXNET_DLL int MXSymbolListArguments(SymbolHandle symbol, uint32_t *out_size, const char ***out_str_array)
List arguments in the symbol.
AtomicSymbolHandle
void * AtomicSymbolHandle
handle to a AtomicSymbol
Definition: c_api.h:84
BatchifyFunctionHandle
void * BatchifyFunctionHandle
handle to a BatchifyFunction
Definition: c_api.h:98
MXRecordIOWriterTell
MXNET_DLL int MXRecordIOWriterTell(RecordIOHandle handle, size_t *pos)
Get the current writer pointer position.
MXRecordIOReaderReadRecord
MXNET_DLL int MXRecordIOReaderReadRecord(RecordIOHandle handle, char const **buf, size_t *size)
Write a record to a RecordIO object.
MXKVStoreSendCommmandToServers
MXNET_DLL int MXKVStoreSendCommmandToServers(KVStoreHandle handle, int cmd_id, const char *cmd_body)
Send a command to all server nodes.
MXGenBackendSubgraph
MXNET_DLL int MXGenBackendSubgraph(SymbolHandle sym_handle, const char *backend, SymbolHandle *ret_sym_handle)
Run subgraph pass based on the backend provided.
MXKVStorePushPullEx
MXNET_DLL int MXKVStorePushPullEx(KVStoreHandle handle, mx_uint vnum, const char **vkeys, mx_uint onum, const char **okeys, NDArrayHandle *vals, NDArrayHandle *outs, int priority)
push and pull a list of (key, value) pairs from the kvstore, where each key is a string
LibFeature::enabled
bool enabled
Definition: c_api.h:169
MXNDArrayGetAuxNDArray
MXNET_DLL int MXNDArrayGetAuxNDArray(NDArrayHandle handle, uint32_t i, NDArrayHandle *out)
Get a deep copy of the ith aux data blob This api is available when MXNet is built with flag USE_INT6...
kCustomOpPropDeclareBackwardDependency
@ kCustomOpPropDeclareBackwardDependency
Definition: c_api.h:180
MXQuantizeSymbol
MXNET_DLL int MXQuantizeSymbol(SymbolHandle sym_handle, SymbolHandle *ret_sym_handle, const int *dev_type, const uint32_t num_excluded_sym_names, const char **excluded_sym_names, const uint32_t num_excluded_op_names, const char **excluded_op_names, const uint32_t num_offline, const char **offline_params, const char *quantized_dtype, const bool calib_quantize, const char *quantize_mode, const char *quantize_granularity, uint32_t *out_num_calib_names, const char ***out_calib_names)
Convert a symbol into a quantized symbol where FP32 operators are replaced with INT8.
MXKVStoreCreate
MXNET_DLL int MXKVStoreCreate(const char *type, KVStoreHandle *out)
Create a kvstore.
MXDataIterGetIterInfo
MXNET_DLL int MXDataIterGetIterInfo(DataIterCreator creator, const char **name, const char **description, uint32_t *num_args, const char ***arg_names, const char ***arg_type_infos, const char ***arg_descriptions)
Get the detailed information about data iterator.
MXListFunctions
MXNET_DLL int MXListFunctions(uint32_t *out_size, FunctionHandle **out_array)
list all the available functions handles most user can use it to list all the needed functions
CustomOpCreateFunc
int(* CustomOpCreateFunc)(const char *, int, unsigned **, const int *, const int *, struct MXCallbackList *, void *)
Definition: c_api.h:211
MXGenAtomicSymbolFromSymbol
MXNET_DLL int MXGenAtomicSymbolFromSymbol(SymbolHandle sym_handle, SymbolHandle *ret_sym_handle)
Generate atomic symbol (able to be composed) from a source symbol.
MXSymbolSetAttr
MXNET_DLL int MXSymbolSetAttr(SymbolHandle symbol, const char *key, const char *value)
Set string attribute from symbol. NOTE: Setting attribute to a symbol can affect the semantics(mutabl...
MXFuncInvoke
MXNET_DLL int MXFuncInvoke(FunctionHandle fun, NDArrayHandle *use_vars, float *scalar_args, NDArrayHandle *mutate_vars, int num_params, char **param_keys, char **param_vals)
invoke a function, the array size of passed in arguments must match the values in the
MXReducePrecisionSymbol
MXNET_DLL int MXReducePrecisionSymbol(SymbolHandle sym_handle, SymbolHandle *ret_sym_handle, const int target_dtype, const int cast_params_offline, const char *const offline_param_cast_attr_p, const uint32_t num_inputs, const char **const input_names_p, const uint32_t num_all_args, const char **const all_arg_names_p, const int *all_arg_types_p, const uint32_t num_target_dtype_ops, const char **const target_dtype_ops_p, const uint32_t num_fp32_ops, const char **const fp32_ops_p, const uint32_t num_widest_dtype_ops, const char **const widest_dtype_ops_p)
Convert a symbol into a mixed precision symbol with cast operators for target dtype casting.
NDArrayOpInfo::p_list_arguments
void * p_list_arguments
Definition: c_api.h:155
MXAutogradBackwardEx
MXNET_DLL int MXAutogradBackwardEx(uint32_t num_output, NDArrayHandle *output_handles, NDArrayHandle *ograd_handles, uint32_t num_variables, NDArrayHandle *var_handles, int retain_graph, int create_graph, int is_train, NDArrayHandle **grad_handles, int **grad_stypes)
compute the gradient of outputs w.r.t variabels
MXSetNumOMPThreads
MXNET_DLL int MXSetNumOMPThreads(int thread_num)
Set the number of OMP threads to use.
MXNDArrayCreateSparseEx
MXNET_DLL int MXNDArrayCreateSparseEx(int storage_type, const uint32_t *shape, uint32_t ndim, int dev_type, int dev_id, int delay_alloc, int dtype, uint32_t num_aux, int *aux_type, uint32_t *aux_ndims, const uint32_t *aux_shape, NDArrayHandle *out)
create an empty sparse NDArray with specified shape and data type This api is available when MXNet is...
MXNDArrayGetDataNDArray
MXNET_DLL int MXNDArrayGetDataNDArray(NDArrayHandle handle, NDArrayHandle *out)
Get a deep copy of the data blob in the form of an NDArray of default storage type....
MXKVStoreInit
MXNET_DLL int MXKVStoreInit(KVStoreHandle handle, uint32_t num, const int *keys, NDArrayHandle *vals)
Init a list of (key,value) pairs in kvstore.
MXNDArrayCallDLPackDeleter
MXNET_DLL int MXNDArrayCallDLPackDeleter(DLManagedTensorHandle dlpack)
Delete a dlpack tensor.
MXSymbolGetAtomicSymbolInfo
MXNET_DLL int MXSymbolGetAtomicSymbolInfo(AtomicSymbolCreator creator, const char **name, const char **description, uint32_t *num_args, const char ***arg_names, const char ***arg_type_infos, const char ***arg_descriptions, const char **key_var_num_args, const char **return_type DEFAULT(NULL))
Get the detailed information about atomic symbol.
MXGetCommitHash
MXNET_DLL int MXGetCommitHash(const char **out)
get the MXNet library commit hash at build time, usually provided by cmake
CustomFunctionBwdFunc
int(* CustomFunctionBwdFunc)(int, int, void **, const int *, const int, void *)
Definition: c_api.h:226
MXNDArrayAt
MXNET_DLL int MXNDArrayAt(NDArrayHandle handle, uint32_t idx, NDArrayHandle *out)
Index the NDArray along axis 0. This api is available when MXNet is built with flag USE_INT64_TENSOR_...
NDArrayOpInfo::forward
bool(* forward)(int, void **, int *, void *)
Definition: c_api.h:144
DLManagedTensorHandle
void * DLManagedTensorHandle
handle to DLManagedTensor
Definition: c_api.h:112
CustomOpPropCreator
int(* CustomOpPropCreator)(const char *, const int, const char **, const char **, struct MXCallbackList *)
Definition: c_api.h:218
MXNDArraySlice
MXNET_DLL int MXNDArraySlice(NDArrayHandle handle, uint32_t slice_begin, uint32_t slice_end, NDArrayHandle *out)
Slice the NDArray along axis 0. This api is available when MXNet is built with flag USE_INT64_TENSOR_...
EngineSyncFunc
void(* EngineSyncFunc)(void *, void *)
Engine synchronous operation.
Definition: c_api.h:123
MXKVStorePullWithSparseEx
MXNET_DLL int MXKVStorePullWithSparseEx(KVStoreHandle handle, uint32_t num, const char **keys, NDArrayHandle *vals, int priority, bool ignore_sparse)
pull a list of (key, value) pairs from the kvstore, where each key is a string
NativeOpInfo::p_backward
void * p_backward
Definition: c_api.h:137
CudaKernelHandle
void * CudaKernelHandle
handle to rtc cuda kernel
Definition: c_api.h:108
MXRandomSeedContext
MXNET_DLL int MXRandomSeedContext(int seed, int dev_type, int dev_id)
Seed the global random number generator of the given device.
MXSetFlushDenorms
MXNET_DLL int MXSetFlushDenorms(bool value, bool *prev_state)
Change floating-point calculations when dealing with denormalized values. Currently this option is on...
MXSetProcessProfilerState
MXNET_DLL int MXSetProcessProfilerState(int state, int profile_process, KVStoreHandle kvStoreHandle)
Set up state of profiler for either worker or server process.
MXKVStoreIsWorkerNode
MXNET_DLL int MXKVStoreIsWorkerNode(int *ret)
return whether or not this process is a worker node.
MXDataIterGetItems
MXNET_DLL int MXDataIterGetItems(DataIterHandle handle, int *num_outputs, NDArrayHandle **outputs)
Get the handles to specified underlying ndarrays of index.
MXGetLastError
const MXNET_DLL char * MXGetLastError()
return str message of the last error all function in this file will return 0 when success and -1 when...
MXCachedOpRegisterOpHook
MXNET_DLL int MXCachedOpRegisterOpHook(CachedOpHandle handle, CachedOpMonitorCallback callback, bool monitor_all)
cached op set monitor callback
MXNDArrayFromDLPack
MXNET_DLL int MXNDArrayFromDLPack(DLManagedTensorHandle dlpack, const bool transient_handle, NDArrayHandle *out_handle)
Create a NDArray backed by a dlpack tensor.
kCustomFunctionBackward
@ kCustomFunctionBackward
Definition: c_api.h:224
MXKVStoreUpdater
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
MXKVStorePullEx
MXNET_DLL int MXKVStorePullEx(KVStoreHandle handle, uint32_t num, const char **keys, NDArrayHandle *vals, int priority)
pull a list of (key, value) pairs from the kvstore, where each key is a string
MXRtcCudaKernelCreate
MXNET_DLL int MXRtcCudaKernelCreate(CudaModuleHandle handle, const char *name, int num_args, int *is_ndarray, int *is_const, int *arg_types, CudaKernelHandle *out)
MXKVStoreStrUpdater
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
MXProfileSetMarker
MXNET_DLL int MXProfileSetMarker(ProfileHandle domain, const char *instant_marker_name, const char *scope)
Mark a single instant in time.
MXSymbolCreateVariable
MXNET_DLL int MXSymbolCreateVariable(const char *name, SymbolHandle *out)
Create a Variable Symbol.
CustomOpPropCallbacks
CustomOpPropCallbacks
Definition: c_api.h:174
MXSymbolGetAttr
MXNET_DLL int MXSymbolGetAttr(SymbolHandle symbol, const char *key, const char **out, int *success)
Get string attribute from symbol.
MXSymbolRemoveAmpCast
MXNET_DLL int MXSymbolRemoveAmpCast(SymbolHandle sym_handle, SymbolHandle *ret_sym_handle)
Remove the operators amp_cast and amp_multicast.
MXSymbolSaveToJSON
MXNET_DLL int MXSymbolSaveToJSON(SymbolHandle symbol, const char **out_json)
Save a symbol into a json string.
CudaModuleHandle
void * CudaModuleHandle
handle to rtc cuda module
Definition: c_api.h:106
BatchifyFunctionCreator
void * BatchifyFunctionCreator
handle to a BatchifyFunction creator
Definition: c_api.h:96
MXProfileAdjustCounter
MXNET_DLL int MXProfileAdjustCounter(ProfileHandle counter_handle, int64_t value)
Adjust a counter by the given amount, given its handle.
MXNDArrayGetShape
MXNET_DLL int MXNDArrayGetShape(NDArrayHandle handle, int *out_dim, const int **out_pdata)
get the shape of the array This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=...
MXDataIterGetLabel
MXNET_DLL int MXDataIterGetLabel(DataIterHandle handle, NDArrayHandle *out)
Get the handle to the NDArray of underlying label.
MXKVStorePush
MXNET_DLL int MXKVStorePush(KVStoreHandle handle, uint32_t num, const int *keys, NDArrayHandle *vals, int priority)
Push a list of (key,value) pairs to kvstore.
MXDataIterGetData
MXNET_DLL int MXDataIterGetData(DataIterHandle handle, NDArrayHandle *out)
Get the handle to the NDArray of underlying data.
MXSymbolGetInputs
MXNET_DLL int MXSymbolGetInputs(SymbolHandle symbol, SymbolHandle *out)
Get a symbol that contains all the inputs.
kCustomOpBackward
@ kCustomOpBackward
Definition: c_api.h:172
MXSymbolCopy
MXNET_DLL int MXSymbolCopy(SymbolHandle symbol, SymbolHandle *out)
Copy the symbol to another handle.
MXProcessProfilePause
MXNET_DLL int MXProcessProfilePause(int paused, int profile_process, KVStoreHandle kvStoreHandle)
Pause profiler tuning collection.
MXAutogradGetSymbol
MXNET_DLL int MXAutogradGetSymbol(NDArrayHandle handle, SymbolHandle *out)
MXNDArrayGetSharedMemHandle
MXNET_DLL int MXNDArrayGetSharedMemHandle(NDArrayHandle handle, int *shared_pid, int *shared_id)
Get shared memory handle from NDArray.
MXSymbolListAtomicSymbolCreators
MXNET_DLL int MXSymbolListAtomicSymbolCreators(uint32_t *out_size, AtomicSymbolCreator **out_array)
list all the available AtomicSymbolEntry
ProfileHandle
void * ProfileHandle
handle to a Profile object (domain, duration, counter, etc.)
Definition: c_api.h:110
MXAggregateProfileStatsPrint
MXNET_DLL int MXAggregateProfileStatsPrint(const char **out_str, int reset, int format, int sort_by, int ascending)
Print sorted aggregate stats to the a string How aggregate stats are stored will not change.
RtcHandle
void * RtcHandle
handle to MXRtc
Definition: c_api.h:104
MXKVStorePull
MXNET_DLL int MXKVStorePull(KVStoreHandle handle, uint32_t num, const int *keys, NDArrayHandle *vals, int priority)
pull a list of (key, value) pairs from the kvstore
MXKVStoreIsSchedulerNode
MXNET_DLL int MXKVStoreIsSchedulerNode(int *ret)
return whether or not this process is a scheduler node.
MXGetGPUMemoryInformation
MXNET_DLL int MXGetGPUMemoryInformation(int dev, int *free_mem, int *total_mem)
get the free and total available memory on a GPU Note: Deprecated, use MXGetGPUMemoryInformation64 in...
MXNDArrayGetAuxType64
MXNET_DLL int MXNDArrayGetAuxType64(NDArrayHandle handle, int64_t i, int *out_type)
get the type of the ith aux data in NDArray This api is available when MXNet is built with flag USE_I...
NativeOpInfo::p_list_arguments
void * p_list_arguments
Definition: c_api.h:140
MXDumpProfile
MXNET_DLL int MXDumpProfile(int finished)
Save profile and stop profiler for worker/current process.
MXSetOptimizationConstraints
MXNET_DLL int MXSetOptimizationConstraints(unsigned int constraints, unsigned int *prev)
set what optimization constraints to apply
MXDatasetGetItems
MXNET_DLL int MXDatasetGetItems(DatasetHandle handle, uint64_t index, int *num_outputs, NDArrayHandle **outputs)
Get Output NDArray given specified indices.
CustomOpFBFunc
int(* CustomOpFBFunc)(int, void **, int *, const int *, const int, void *)
Definition: c_api.h:187
MXGetBranch
MXNET_DLL int MXGetBranch(const char **out)
get the MXNet library branch at build time, usually provided by cmake
MXSymbolGrad
MXNET_DLL int MXSymbolGrad(SymbolHandle sym, uint32_t num_wrt, const char **wrt, SymbolHandle *out)
Get the gradient graph of the symbol.
MXGetGPUMemoryInformation64
MXNET_DLL int MXGetGPUMemoryInformation64(int dev, uint64_t *free_mem, uint64_t *total_mem)
get the free and total available memory on a GPU
MXCachedOpGetOptimizedSymbol
MXNET_DLL int MXCachedOpGetOptimizedSymbol(CachedOpHandle handle, SymbolHandle *out)
get optimized graph from the cached op
KVStoreHandle
void * KVStoreHandle
handle to KVStore
Definition: c_api.h:100
MXListBatchifyFunctions
MXNET_DLL int MXListBatchifyFunctions(uint32_t *out_size, BatchifyFunctionCreator **out_array)
List all the available batchify function entries.
MXRtcFree
MXNET_DLL int MXRtcFree(RtcHandle handle)
Delete a MXRtc object.
MXNDArraySetDeferredComputeVariable
MXNET_DLL int MXNDArraySetDeferredComputeVariable(NDArrayHandle *arrays, SymbolHandle *variables, int num)
Associate variables with deferred compute arrays.
MXProfileCreateTask
MXNET_DLL int MXProfileCreateTask(ProfileHandle domain, const char *task_name, ProfileHandle *out)
Create profile task.
DataIterHandle
void * DataIterHandle
handle to a DataIterator
Definition: c_api.h:90
MXNDArrayCreateSparseEx64
MXNET_DLL int MXNDArrayCreateSparseEx64(int storage_type, const int64_t *shape, int ndim, int dev_type, int dev_id, int delay_alloc, int dtype, uint32_t num_aux, int *aux_type, int *aux_ndims, const int64_t *aux_shape, NDArrayHandle *out)
create an empty sparse NDArray with specified shape and data type This api is available when MXNet is...
MXNDArraySyncCopyFromNDArray
MXNET_DLL int MXNDArraySyncCopyFromNDArray(NDArrayHandle handle_dst, const NDArrayHandle handle_src, const int i)
Copy src.data() to dst.data() if i = -1, else dst.aux_data(i) if i >= 0 This function blocks....
MXNDArraySave
MXNET_DLL int MXNDArraySave(const char *fname, uint32_t num_args, NDArrayHandle *args, const char **keys)
Save list of narray into the file.
MXAutogradIsTraining
MXNET_DLL int MXAutogradIsTraining(bool *curr)
get whether training mode is on
MXNDArrayAt64
MXNET_DLL int MXNDArrayAt64(NDArrayHandle handle, int64_t idx, NDArrayHandle *out)
Index the NDArray along axis 0. This api is available when MXNet is built with flag USE_INT64_TENSOR_...
MXSymbolListAuxiliaryStates
MXNET_DLL int MXSymbolListAuxiliaryStates(SymbolHandle symbol, uint32_t *out_size, const char ***out_str_array)
List auxiliary states in the symbol.
kCustomOpPropListAuxiliaryStates
@ kCustomOpPropListAuxiliaryStates
Definition: c_api.h:178
kCustomOpPropInferType
@ kCustomOpPropInferType
Definition: c_api.h:182
MXDatasetCreateDataset
MXNET_DLL int MXDatasetCreateDataset(DatasetCreator handle, uint32_t num_param, const char **keys, const char **vals, DatasetHandle *out)
Init an dataset, init with parameters the array size of passed in arguments.
MXStorageEmptyCache
MXNET_DLL int MXStorageEmptyCache(int dev_type, int dev_id)
Release all unreferenced memory from the devices storage managers memory pool.
MXNDArraySyncCopyFromCPU
MXNET_DLL int MXNDArraySyncCopyFromCPU(NDArrayHandle handle, const void *data, size_t size)
Perform a synchronize copy from a contiguous CPU memory region.
kCustomOpPropInferStorageType
@ kCustomOpPropInferStorageType
Definition: c_api.h:183
dim_t
int64_t dim_t
data type to store dim size
Definition: c_api.h:69
MXEnginePushSyncND
MXNET_DLL int MXEnginePushSyncND(EngineSyncFunc sync_func, void *func_param, EngineFuncParamDeleter deleter, ContextHandle ctx_handle, NDArrayHandle *const_nds_handle, int num_const_nds, NDArrayHandle *mutable_nds_handle, int num_mutable_nds, EngineFnPropertyHandle prop_handle DEFAULT(NULL), int priority DEFAULT(0), const char *opr_name DEFAULT(NULL))
Push a synchronous operation to the engine.
kCustomOpPropDelete
@ kCustomOpPropDelete
Definition: c_api.h:175
MXBatchifyFunctionFree
MXNET_DLL int MXBatchifyFunctionFree(BatchifyFunctionHandle handle)
Free the handle to the IO module.
MXRecordIOWriterCreate
MXNET_DLL int MXRecordIOWriterCreate(const char *uri, RecordIOHandle *out)
Create a RecordIO writer object.
MXDataIterGetIndex
MXNET_DLL int MXDataIterGetIndex(DataIterHandle handle, uint64_t **out_index, uint64_t *out_size)
Get the image index by array.
MXSymbolGetAtomicSymbolName
MXNET_DLL int MXSymbolGetAtomicSymbolName(AtomicSymbolCreator creator, const char **name)
Get the name of an atomic symbol.
MXDataIterCreateIter
MXNET_DLL int MXDataIterCreateIter(DataIterCreator handle, uint32_t num_param, const char **keys, const char **vals, DataIterHandle *out)
Init an iterator, init with parameters the array size of passed in arguments.
MXSymbolListAttr
MXNET_DLL int MXSymbolListAttr(SymbolHandle symbol, uint32_t *out_size, const char ***out)
Get all attributes from symbol, including all descendents.
MXIsNumpyShape
MXNET_DLL int MXIsNumpyShape(int *curr)
get whether numpy compatibility is on
MXRtcPush
MXNET_DLL int MXRtcPush(RtcHandle handle, uint32_t num_input, uint32_t num_output, NDArrayHandle *inputs, NDArrayHandle *outputs, uint32_t gridDimX, uint32_t gridDimY, uint32_t gridDimZ, uint32_t blockDimX, uint32_t blockDimY, uint32_t blockDimZ)
Run cuda kernel.
MXGetCurrentStream
MXNET_DLL int MXGetCurrentStream(int device_id, int *stream)
Get current stream pointer based on current device type and id.
MXNVTXRangePush
MXNET_DLL int MXNVTXRangePush(const char *name, mx_uint color)
Push a new NVTX range. Requires building with CUDA and NVTX.
MXShallowCopySymbol
MXNET_DLL int MXShallowCopySymbol(SymbolHandle src, SymbolHandle *out)
Create an Symbol from source sharing the same graph structure.
MXSetProcessProfilerConfig
MXNET_DLL int MXSetProcessProfilerConfig(int num_params, const char *const *keys, const char *const *vals, KVStoreHandle kvstoreHandle)
Set up configuration of profiler for the process passed as profile_process in keys.
NDArrayOpInfo::p_infer_shape
void * p_infer_shape
Definition: c_api.h:153
MXNDArraySyncCheckFormat
MXNET_DLL int MXNDArraySyncCheckFormat(NDArrayHandle handle, const bool full_check)
check whether the NDArray format is valid
MXNDArrayGetAuxNDArray64
MXNET_DLL int MXNDArrayGetAuxNDArray64(NDArrayHandle handle, int64_t i, NDArrayHandle *out)
Get a deep copy of the ith aux data blob This api is available when MXNet is built with flag USE_INT6...
MXEnginePushAsyncND
MXNET_DLL int MXEnginePushAsyncND(EngineAsyncFunc async_func, void *func_param, EngineFuncParamDeleter deleter, ContextHandle ctx_handle, NDArrayHandle *const_nds_handle, int num_const_nds, NDArrayHandle *mutable_nds_handle, int num_mutable_nds, EngineFnPropertyHandle prop_handle DEFAULT(NULL), int priority DEFAULT(0), const char *opr_name DEFAULT(NULL), bool wait DEFAULT(false))
Push an asynchronous operation to the engine.
MXNDArrayLegacySave
MXNET_DLL int MXNDArrayLegacySave(const char *fname, uint32_t num_args, NDArrayHandle *args, const char **keys)
Save list of narray into the file.
MXInitPSEnv
MXNET_DLL int MXInitPSEnv(uint32_t num_vars, const char **keys, const char **vals)
Initialized ps-lite environment variables.
DataIterCreator
void * DataIterCreator
handle a dataiter creator
Definition: c_api.h:88
MXRtcCreate
MXNET_DLL int MXRtcCreate(char *name, uint32_t num_input, uint32_t num_output, char **input_names, char **output_names, NDArrayHandle *inputs, NDArrayHandle *outputs, char *kernel, RtcHandle *out)
Create a MXRtc object.
MXKVStoreBroadcastEx
MXNET_DLL int MXKVStoreBroadcastEx(KVStoreHandle handle, mx_uint vnum, const char **vkeys, mx_uint onum, const char **okeys, NDArrayHandle *vals, NDArrayHandle *outs, int priority)
broadcast a list of (key, value) pairs from the kvstore, where each key is a string
CustomOpDelFunc
int(* CustomOpDelFunc)(void *)
Definition: c_api.h:193
MXBatchifyFunctionCreateFunction
MXNET_DLL int MXBatchifyFunctionCreateFunction(BatchifyFunctionCreator handle, uint32_t num_param, const char **keys, const char **vals, BatchifyFunctionHandle *out)
Init an batchify function, init with parameters the array size of passed in arguments.
LibFeature::name
const char * name
Definition: c_api.h:168
MXProfileSetCounter
MXNET_DLL int MXProfileSetCounter(ProfileHandle counter_handle, uint64_t value)
Set a counter, given its handle.
mx_float
float mx_float
manually define float
Definition: c_api.h:67
MXProfileCreateDomain
MXNET_DLL int MXProfileCreateDomain(const char *domain, ProfileHandle *out)
Create profiling domain.
MXSymbolInferShapePartial64
MXNET_DLL int MXSymbolInferShapePartial64(SymbolHandle sym, uint32_t num_args, const char **keys, const int64_t *arg_ind_ptr, const int64_t *arg_shape_data, size_t *in_shape_size, const int **in_shape_ndim, const int64_t ***in_shape_data, size_t *out_shape_size, const int **out_shape_ndim, const int64_t ***out_shape_data, size_t *aux_shape_size, const int **aux_shape_ndim, const int64_t ***aux_shape_data, int *complete)
partially infer shape of unknown input shapes given the known one.
kCustomFunctionDelete
@ kCustomFunctionDelete
Definition: c_api.h:224
MXProfileDurationStart
MXNET_DLL int MXProfileDurationStart(ProfileHandle duration_handle)
Start timing the duration of a profile duration object such as an event, task or frame.
CustomFunctionCallbacks
CustomFunctionCallbacks
Definition: c_api.h:224
MXRecordIOReaderTell
MXNET_DLL int MXRecordIOReaderTell(RecordIOHandle handle, size_t *pos)
Get the current writer pointer position.
NDArrayOpInfo::backward
bool(* backward)(int, void **, int *, void *)
Definition: c_api.h:145
NativeOpInfo::p_forward
void * p_forward
Definition: c_api.h:136
MXSymbolCreateGroup
MXNET_DLL int MXSymbolCreateGroup(uint32_t num_symbols, SymbolHandle *symbols, SymbolHandle *out)
Create a Symbol by grouping list of symbols together.
MXKVStoreIsServerNode
MXNET_DLL int MXKVStoreIsServerNode(int *ret)
return whether or not this process is a server node.
MXSetProfilerConfig
MXNET_DLL int MXSetProfilerConfig(int num_params, const char *const *keys, const char *const *vals)
Set up configuration of profiler for worker/current process.
MXFreeCachedOp
MXNET_DLL int MXFreeCachedOp(CachedOpHandle handle)
free cached operator
MXNET_DLL
#define MXNET_DLL
MXNET_DLL prefix for windows.
Definition: c_api.h:53
AtomicSymbolCreator
void * AtomicSymbolCreator
handle to a function that takes param and creates symbol
Definition: c_api.h:78
MXNDArrayCreateFromSharedMem
MXNET_DLL int MXNDArrayCreateFromSharedMem(int shared_pid, int shared_id, const int *shape, int ndim, int dtype, NDArrayHandle *out)
Reconstruct NDArray from shared memory handle.
MXSetProfilerState
MXNET_DLL int MXSetProfilerState(int state)
Set up state of profiler for current process.
MXListDataIters
MXNET_DLL int MXListDataIters(uint32_t *out_size, DataIterCreator **out_array)
List all the available iterator entries.
MXDumpProcessProfile
MXNET_DLL int MXDumpProcessProfile(int finished, int profile_process, KVStoreHandle kvStoreHandle)
Save profile and stop profiler.
MXNDArrayFree
MXNET_DLL int MXNDArrayFree(NDArrayHandle handle)
free the narray handle
MXSetCalibTableToQuantizedSymbol
MXNET_DLL int MXSetCalibTableToQuantizedSymbol(SymbolHandle qsym_handle, const uint32_t num_layers, const char **layer_names, const float *low_quantiles, const float *high_quantiles, SymbolHandle *ret_sym_handle)
Set calibration table to node attributes in the sym.
NDArrayOpInfo::p_backward
void * p_backward
Definition: c_api.h:152
MXSymbolInferType
MXNET_DLL int MXSymbolInferType(SymbolHandle sym, uint32_t num_args, const char **keys, const int *arg_type_data, uint32_t *in_type_size, const int **in_type_data, uint32_t *out_type_size, const int **out_type_data, uint32_t *aux_type_size, const int **aux_type_data, int *complete)
infer type of unknown input types given the known one. The types are packed into a CSR matrix represe...
MXSymbolCreateAtomicSymbol
MXNET_DLL int MXSymbolCreateAtomicSymbol(AtomicSymbolCreator creator, uint32_t num_param, const char **keys, const char **vals, SymbolHandle *out)
Create an AtomicSymbol.
NativeOpInfo::forward
void(* forward)(int, float **, int *, unsigned **, int *, void *)
Definition: c_api.h:130
MXProfileCreateFrame
MXNET_DLL int MXProfileCreateFrame(ProfileHandle domain, const char *frame_name, ProfileHandle *out)
Create profile frame.
MXAutogradComputeGradient
MXNET_DLL int MXAutogradComputeGradient(uint32_t num_output, NDArrayHandle *output_handles)
compute the gradient of outputs w.r.t variabels
MXListDatasets
MXNET_DLL int MXListDatasets(uint32_t *out_size, DatasetCreator **out_array)
List all the available dataset entries.
mshadow::expr::pad
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
MXProfileCreateEvent
MXNET_DLL int MXProfileCreateEvent(const char *event_name, ProfileHandle *out)
Create profile event.
kCustomOpDelete
@ kCustomOpDelete
Definition: c_api.h:172
MXNDArrayGetDeferredComputeSymbol
MXNET_DLL int MXNDArrayGetDeferredComputeSymbol(NDArrayHandle *output_handles, int num_outputs, SymbolHandle *out)
Convert the graph constructed during deferred computation mode to a Symbol.
ContextHandle
const typedef void * ContextHandle
handle to Context
Definition: c_api.h:114
MXSymbolPrint
MXNET_DLL int MXSymbolPrint(SymbolHandle symbol, const char **out_str)
Print the content of symbol, used for debug.
MXSymbolCompose
MXNET_DLL int MXSymbolCompose(SymbolHandle sym, const char *name, uint32_t num_args, const char **keys, SymbolHandle *args)
Compose the symbol on other symbols.
MXSymbolGetNumOutputs
MXNET_DLL int MXSymbolGetNumOutputs(SymbolHandle symbol, uint32_t *output_count)
Get number of outputs of the symbol.
MXNDArraySetGradState
MXNET_DLL int MXNDArraySetGradState(NDArrayHandle handle, int state)
set the flag for gradient array state.
LibFeature
Definition: c_api.h:167
MXImperativeInvoke
MXNET_DLL int MXImperativeInvoke(AtomicSymbolCreator creator, int num_inputs, NDArrayHandle *inputs, int *num_outputs, NDArrayHandle **outputs, int num_params, const char **param_keys, const char **param_vals, const int **out_stypes)
invoke a nnvm op and imperative function
MXNDArrayGetData
MXNET_DLL int MXNDArrayGetData(NDArrayHandle handle, void **out_pdata)
get the content of the data in NDArray
MXGenericCallback
int(* MXGenericCallback)(void)
Definition: c_api.h:159
MXNDArrayGetGrad
MXNET_DLL int MXNDArrayGetGrad(NDArrayHandle handle, NDArrayHandle *out)
return gradient buffer attached to this NDArray
CustomOpBwdDepFunc
int(* CustomOpBwdDepFunc)(const int *, const int *, const int *, int *, int **, void *)
Definition: c_api.h:205
MXKVStoreServerController
void() MXKVStoreServerController(int head, const char *body, void *controller_handle)
the prototype of a server controller
Definition: c_api.h:2761
MXProfilePause
MXNET_DLL int MXProfilePause(int paused)
Pause profiler tuning collection for worker/current process.
MXNDArrayCreateNone
MXNET_DLL int MXNDArrayCreateNone(NDArrayHandle *out)
Load TVM operator from the binary library.
MXDataIterGetPadNum
MXNET_DLL int MXDataIterGetPadNum(DataIterHandle handle, int *pad)
Get the padding number in current data batch.
MXDataIterNext
MXNET_DLL int MXDataIterNext(DataIterHandle handle, int *out)
Move iterator to next position.
MXGetOptimizeLayout
MXNET_DLL int MXGetOptimizeLayout(bool *val)
Get current Layout Optimization status.
MXDatasetGetDatasetInfo
MXNET_DLL int MXDatasetGetDatasetInfo(DatasetCreator creator, const char **name, const char **description, uint32_t *num_args, const char ***arg_names, const char ***arg_type_infos, const char ***arg_descriptions)
Get the detailed information about dataset.
MXKVStoreBarrier
MXNET_DLL int MXKVStoreBarrier(KVStoreHandle handle)
global barrier among all worker machines
MXNDArrayGetDType
MXNET_DLL int MXNDArrayGetDType(NDArrayHandle handle, int *out_dtype)
get the type of the data in NDArray
MXKVStorePullRowSparseEx
MXNET_DLL int MXKVStorePullRowSparseEx(KVStoreHandle handle, uint32_t num, const char **keys, NDArrayHandle *vals, const NDArrayHandle *row_ids, int priority)
pull a list of (key, value) pairs from the kvstore, where each key is a string. The NDArray pulled ba...
MXGetFunction
MXNET_DLL int MXGetFunction(const char *name, FunctionHandle *out)
get the function handle by name
MXEnginePushAsync
MXNET_DLL int MXEnginePushAsync(EngineAsyncFunc async_func, void *func_param, EngineFuncParamDeleter deleter, ContextHandle ctx_handle, EngineVarHandle const_vars_handle, int num_const_vars, EngineVarHandle mutable_vars_handle, int num_mutable_vars, EngineFnPropertyHandle prop_handle DEFAULT(NULL), int priority DEFAULT(0), const char *opr_name DEFAULT(NULL), bool wait DEFAULT(false))
Push an asynchronous operation to the engine.
MXNDArraySaveRawBytes
MXNET_DLL int MXNDArraySaveRawBytes(NDArrayHandle handle, size_t *out_size, const char **out_buf)
save the NDArray into raw bytes.
MXSymbolGetOutput
MXNET_DLL int MXSymbolGetOutput(SymbolHandle symbol, uint32_t index, SymbolHandle *out)
Get index-th outputs of the symbol.
MXCheckDynamicShapeOp
MXNET_DLL int MXCheckDynamicShapeOp(SymbolHandle sym_handle, bool *has_dynamic_shape)
This function checks if any dynamic shape op is present in the symbol.
EngineVarHandle
void * EngineVarHandle
handle to Engine VarHandle
Definition: c_api.h:118
MXFuncDescribe
MXNET_DLL int MXFuncDescribe(FunctionHandle fun, uint32_t *num_use_vars, uint32_t *num_scalars, uint32_t *num_mutate_vars, int *type_mask)
get the argument requirements of the function
MXRtcCudaModuleCreate
MXNET_DLL int MXRtcCudaModuleCreate(const char *source, int num_options, const char **options, int num_exports, const char **exports, CudaModuleHandle *out)
MXNDArrayLoadFromRawBytes
MXNET_DLL int MXNDArrayLoadFromRawBytes(const void *buf, size_t size, NDArrayHandle *out)
create a NDArray handle that is loaded from raw bytes.
MXSetIsNumpyShape
MXNET_DLL int MXSetIsNumpyShape(int is_np_shape, int *prev)
set numpy compatibility switch
NativeOpInfo
Definition: c_api.h:129
NativeOpInfo::infer_shape
void(* infer_shape)(int, int *, unsigned **, void *)
Definition: c_api.h:132
SymbolHandle
void * SymbolHandle
handle to a symbol that can be bind as operator
Definition: c_api.h:82
CustomOpInferStorageTypeFunc
int(* CustomOpInferStorageTypeFunc)(int, int *, void *)
Definition: c_api.h:199
MXSymbolGetInputSymbols
MXNET_DLL int MXSymbolGetInputSymbols(SymbolHandle sym, SymbolHandle **inputs, int *input_size)
Get the input symbols of the graph.
MXRecordIOWriterWriteRecord
MXNET_DLL int MXRecordIOWriterWriteRecord(RecordIOHandle handle, const char *buf, size_t size)
Write a record to a RecordIO object.
NDArrayOpInfo::p_list_outputs
void * p_list_outputs
Definition: c_api.h:154
MXDataIterGetLenHint
MXNET_DLL int MXDataIterGetLenHint(DataIterHandle handle, int64_t *len)
Call iterator.GetLenHint. Note that some iterators don't provide length.
MXNDArrayWaitToWrite
MXNET_DLL int MXNDArrayWaitToWrite(NDArrayHandle handle)
Wait until all the pending read/write with respect NDArray are finished. Always call this before writ...
MXAutogradDropGrads
MXNET_DLL int MXAutogradDropGrads(uint32_t num_var, NDArrayHandle *var_handles)
unmark nonleaf NDArrays to free the memory
MXNDArrayWaitAll
MXNET_DLL int MXNDArrayWaitAll()
wait until all delayed operations in the system is completed
MXLibInfoCompiledWithCXX11ABI
MXNET_DLL int MXLibInfoCompiledWithCXX11ABI(int *result)
return whether the mxnet library is compiled with cxx11 abi
FunctionHandle
const typedef void * FunctionHandle
handle to a mxnet narray function that changes NDArray
Definition: c_api.h:76
CustomOpInferShapeFunc
int(* CustomOpInferShapeFunc)(int, int *, int **, void *)
Definition: c_api.h:195
MXCUDAProfilerStop
MXNET_DLL int MXCUDAProfilerStop()
End CUDA profiling session. Requires building with CUDA and NVTX.
MXAutogradMarkVariables
MXNET_DLL int MXAutogradMarkVariables(uint32_t num_var, NDArrayHandle *var_handles, uint32_t *reqs_array, NDArrayHandle *grad_handles)
mark NDArrays as variables to compute gradient for autograd
MXAutogradBackward
MXNET_DLL int MXAutogradBackward(uint32_t num_output, NDArrayHandle *output_handles, NDArrayHandle *ograd_handles, int retain_graph)
compute the gradient of outputs w.r.t variabels
MXSymbolGetChildren
MXNET_DLL int MXSymbolGetChildren(SymbolHandle symbol, SymbolHandle *out)
Get a symbol that contains only direct children.
MXKVStoreInitEx
MXNET_DLL int MXKVStoreInitEx(KVStoreHandle handle, uint32_t num, const char **keys, NDArrayHandle *vals)
Init a list of (key,value) pairs in kvstore, where each key is a string.
MXNDArrayGetAuxType
MXNET_DLL int MXNDArrayGetAuxType(NDArrayHandle handle, uint32_t i, int *out_type)
get the type of the ith aux data in NDArray This api is available when MXNet is built with flag USE_I...
MXRecordIOReaderSeek
MXNET_DLL int MXRecordIOReaderSeek(RecordIOHandle handle, size_t pos)
Set the current reader pointer position.
MXNDArrayGetGradState
MXNET_DLL int MXNDArrayGetGradState(NDArrayHandle handle, int *out)
set the flag for gradient array state.
NDArrayHandle
void * NDArrayHandle
handle to NDArray
Definition: c_api.h:74
MXCallbackList::num_callbacks
int num_callbacks
Definition: c_api.h:162
NativeOpInfo::backward
void(* backward)(int, float **, int *, unsigned **, int *, void *)
Definition: c_api.h:131
MXDatasetGetLen
MXNET_DLL int MXDatasetGetLen(DatasetHandle handle, uint64_t *out)
Get dataset overal length(size)
MXKVStoreGetNumDeadNode
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}.
MXKVStorePushEx
MXNET_DLL int MXKVStorePushEx(KVStoreHandle handle, uint32_t num, const char **keys, NDArrayHandle *vals, int priority)
Push a list of (key,value) pairs to kvstore, where each key is a string.
MXInvokeCachedOp
MXNET_DLL int MXInvokeCachedOp(CachedOpHandle handle, int num_inputs, NDArrayHandle *inputs, int default_dev_type, int default_dev_id, int *num_outputs, NDArrayHandle **outputs, const int **out_stypes)
invoke a cached op
MXRtcCudaKernelCall
MXNET_DLL int MXRtcCudaKernelCall(CudaKernelHandle handle, int dev_id, void **args, uint32_t grid_dim_x, uint32_t grid_dim_y, uint32_t grid_dim_z, uint32_t block_dim_x, uint32_t block_dim_y, uint32_t block_dim_z, uint32_t shared_mem)
RecordIOHandle
void * RecordIOHandle
handle to RecordIO
Definition: c_api.h:102
MXNDArrayDetach
MXNET_DLL int MXNDArrayDetach(NDArrayHandle handle, NDArrayHandle *out)
detach and ndarray from computation graph by clearing entry_
MXNDArraySlice64
MXNET_DLL int MXNDArraySlice64(NDArrayHandle handle, int64_t slice_begin, int64_t slice_end, NDArrayHandle *out)
Slice the NDArray along axis 0. This api is available when MXNet is built with flag USE_INT64_TENSOR_...
MXShallowCopyNDArray
MXNET_DLL int MXShallowCopyNDArray(NDArrayHandle src, NDArrayHandle *out)
Create an NDArray from source sharing the same data chunk.
NDArrayOpInfo::declare_backward_dependency
bool(* declare_backward_dependency)(const int *, const int *, const int *, int *, int **, void *)
Definition: c_api.h:149
kCustomOpPropListOutputs
@ kCustomOpPropListOutputs
Definition: c_api.h:177
NativeOpInfo::list_outputs
void(* list_outputs)(char ***, void *)
Definition: c_api.h:133
CustomFunctionDelFunc
int(* CustomFunctionDelFunc)(void *)
Definition: c_api.h:232
MXSymbolListAttrShallow
MXNET_DLL int MXSymbolListAttrShallow(SymbolHandle symbol, uint32_t *out_size, const char ***out)
Get all attributes from symbol, excluding descendents.
MXSetIsNumpyDefaultDtype
MXNET_DLL int MXSetIsNumpyDefaultDtype(bool dtype_flag, bool *prev)
set numpy default data type
MXFuncGetInfo
MXNET_DLL int MXFuncGetInfo(FunctionHandle fun, const char **name, const char **description, uint32_t *num_args, const char ***arg_names, const char ***arg_type_infos, const char ***arg_descriptions, const char **return_type DEFAULT(NULL))
Get the information of the function handle.
MXNDArrayReshape64
MXNET_DLL int MXNDArrayReshape64(NDArrayHandle handle, int ndim, dim_t *dims, bool reverse, NDArrayHandle *out)
Reshape the NDArray.
CustomOpListFunc
int(* CustomOpListFunc)(char ***, void *)
Definition: c_api.h:194
MXListAllOpNames
MXNET_DLL int MXListAllOpNames(uint32_t *out_size, const char ***out_array)
list all the available operator names, include entries.
MXKVStorePullRowSparse
MXNET_DLL int MXKVStorePullRowSparse(KVStoreHandle handle, uint32_t num, const int *keys, NDArrayHandle *vals, const NDArrayHandle *row_ids, int priority)
pull a list of (key, value) pairs from the kvstore, where each key is an integer. The NDArray pulled ...
MXNDArrayGetShape64
MXNET_DLL int MXNDArrayGetShape64(NDArrayHandle handle, int *out_dim, const int64_t **out_pdata)
get the shape of the array This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=...
MXNotifyShutdown
MXNET_DLL int MXNotifyShutdown()
Notify the engine about a shutdown, This can help engine to print less messages into display.
MXProfileDurationStop
MXNET_DLL int MXProfileDurationStop(ProfileHandle duration_handle)
Stop timing the duration of a profile duration object such as an event, task or frame.
NativeOpInfo::p_infer_shape
void * p_infer_shape
Definition: c_api.h:138
MXGetOptimizationConstraints
MXNET_DLL int MXGetOptimizationConstraints(unsigned int *curr)
get current optimization constraints
NDArrayOpInfo
Definition: c_api.h:143
MXRecordIOWriterFree
MXNET_DLL int MXRecordIOWriterFree(RecordIOHandle handle)
Delete a RecordIO writer object.
MXAutogradSetIsRecording
MXNET_DLL int MXAutogradSetIsRecording(int is_recording, int *prev)
set whether to record operator for autograd
CustomOpCallbacks
CustomOpCallbacks
Definition: c_api.h:172
MXRandomSeed
MXNET_DLL int MXRandomSeed(int seed)
Seed all global random number generators in mxnet.
MXDataIterFree
MXNET_DLL int MXDataIterFree(DataIterHandle handle)
Free the handle to the IO module.
DatasetCreator
void * DatasetCreator
handle a dataset creator
Definition: c_api.h:92
ExecutorHandle
void * ExecutorHandle
handle to an Executor
Definition: c_api.h:86
MXSymbolInferShape64
MXNET_DLL int MXSymbolInferShape64(SymbolHandle sym, uint32_t num_args, const char **keys, const int64_t *arg_ind_ptr, const int64_t *arg_shape_data, size_t *in_shape_size, const int **in_shape_ndim, const int64_t ***in_shape_data, size_t *out_shape_size, const int **out_shape_ndim, const int64_t ***out_shape_data, size_t *aux_shape_size, const int **aux_shape_ndim, const int64_t ***aux_shape_data, int *complete)
infer shape of unknown input shapes given the known one. The shapes are packed into a CSR matrix repr...
MXRecordIOReaderFree
MXNET_DLL int MXRecordIOReaderFree(RecordIOHandle handle)
Delete a RecordIO reader object.
MXGetVersion
MXNET_DLL int MXGetVersion(int *out)
get the MXNet library version as an integer
MXLibInfoFeatures
MXNET_DLL int MXLibInfoFeatures(const struct LibFeature **libFeature, size_t *size)
Get list of features supported on the runtime.
kCustomOpPropInferShape
@ kCustomOpPropInferShape
Definition: c_api.h:179
MXKVStoreFree
MXNET_DLL int MXKVStoreFree(KVStoreHandle handle)
Delete a KVStore handle.
MXKVStoreSetBarrierBeforeExit
MXNET_DLL int MXKVStoreSetBarrierBeforeExit(KVStoreHandle handle, const int barrier_before_exit)
whether to do barrier when finalize
MXKVStoreGetGroupSize
MXNET_DLL int MXKVStoreGetGroupSize(KVStoreHandle handle, int *ret)
return The number of nodes in this group, which is
MXCUDAProfilerStart
MXNET_DLL int MXCUDAProfilerStart()
Start CUDA profiling session. Requires building with CUDA and NVTX.
CustomOpBackwardInferStorageTypeFunc
int(* CustomOpBackwardInferStorageTypeFunc)(int, int *, int *, void *)
Definition: c_api.h:200
MXAutogradIsRecording
MXNET_DLL int MXAutogradIsRecording(bool *curr)
get whether autograd recording is on
NDArrayOpInfo::p_declare_backward_dependency
void * p_declare_backward_dependency
Definition: c_api.h:156
MXSymbolInferShape
MXNET_DLL int MXSymbolInferShape(SymbolHandle sym, uint32_t num_args, const char **keys, const uint32_t *arg_ind_ptr, const int *arg_shape_data, uint32_t *in_shape_size, const int **in_shape_ndim, const int ***in_shape_data, uint32_t *out_shape_size, const int **out_shape_ndim, const int ***out_shape_data, uint32_t *aux_shape_size, const int **aux_shape_ndim, const int ***aux_shape_data, int *complete)
infer shape of unknown input shapes given the known one. The shapes are packed into a CSR matrix repr...
mx_uint
uint32_t mx_uint
manually define unsigned int
Definition: c_api.h:65
MXOptimizeForBackend
MXNET_DLL int MXOptimizeForBackend(SymbolHandle sym_handle, const char *backend_name, const int dev_type, SymbolHandle *ret_sym_handle, const mx_uint args_len, NDArrayHandle *in_args_handle, const mx_uint aux_len, NDArrayHandle *in_aux_handle, const mx_uint num_options, const char **keys, const char **vals, const uint32_t num_input_shapes, const char **input_shape_names, const int64_t *input_shape_data, const uint32_t *input_shape_idx, const uint32_t num_input_dtypes, const char **input_dtype_names, const int *input_dtypes, const uint32_t num_input_stypes, const char **input_stype_names, const int *input_stypes, bool skip_infer, int *new_args_cnt, NDArrayHandle **new_args_handle, char ***new_arg_names_handle, int *new_aux_cnt, NDArrayHandle **new_aux_handle, char ***new_aux_names_handle)
Partitions symbol for given backend, potentially creating subgraphs.
MXKVStoreGetRank
MXNET_DLL int MXKVStoreGetRank(KVStoreHandle handle, int *ret)
return The rank of this node in its group, which is in [0, GroupSize).
MXBatchifyFunctionInvoke
MXNET_DLL int MXBatchifyFunctionInvoke(BatchifyFunctionHandle handle, int batch_size, int num_output, NDArrayHandle *inputs, NDArrayHandle **outputs)
Invoke the Batchify Function.
EngineFnPropertyHandle
const typedef void * EngineFnPropertyHandle
handle to Engine FnProperty
Definition: c_api.h:116
MXSymbolCutSubgraph
MXNET_DLL int MXSymbolCutSubgraph(SymbolHandle sym, SymbolHandle **inputs, int *input_size)
Cut a subgraph whose nodes are marked with a subgraph attribute. The input graph will be modified....
MXCallbackList
Definition: c_api.h:161
MXNDArrayWaitToRead
MXNET_DLL int MXNDArrayWaitToRead(NDArrayHandle handle)
Wait until all the pending writes with respect NDArray are finished. Always call this before read dat...
MXNDArrayIsDeferredCompute
MXNET_DLL int MXNDArrayIsDeferredCompute(int *curr)
Get current status of deferred compute mode.
NDArrayOpInfo::p_forward
void * p_forward
Definition: c_api.h:151
DEFAULT
#define DEFAULT(x)
Inhibit C++ name-mangling for MXNet functions.
Definition: c_api.h:36
MXRtcCudaModuleFree
MXNET_DLL int MXRtcCudaModuleFree(CudaModuleHandle handle)
MXSymbolInferTypePartial
MXNET_DLL int MXSymbolInferTypePartial(SymbolHandle sym, uint32_t num_args, const char **keys, const int *arg_type_data, uint32_t *in_type_size, const int **in_type_data, uint32_t *out_type_size, const int **out_type_data, uint32_t *aux_type_size, const int **aux_type_data, int *complete)
partially infer type of unknown input types given the known one.
MXKVStoreSetUpdaterEx
MXNET_DLL int MXKVStoreSetUpdaterEx(KVStoreHandle handle, MXKVStoreUpdater updater, MXKVStoreStrUpdater str_updater, void *updater_handle)
register a push updater with int keys and one with string keys
MXNDArrayLoadFromBuffer
MXNET_DLL int MXNDArrayLoadFromBuffer(const void *ndarray_buffer, size_t size, uint32_t *out_size, NDArrayHandle **out_arr, uint32_t *out_name_size, const char ***out_names)
Load list / dictionary of narrays from file content loaded into memory. This will load a list of ndar...
MXNDArraySyncCopyToCPU
MXNET_DLL int MXNDArraySyncCopyToCPU(NDArrayHandle handle, void *data, size_t size)
Perform a synchronize copyto a contiguous CPU memory region.
NDArrayOpInfo::list_outputs
bool(* list_outputs)(char ***, void *)
Definition: c_api.h:147
MXIsNumpyDefaultDtype
MXNET_DLL int MXIsNumpyDefaultDtype(bool *curr)
get numpy default data type
MXRtcCudaKernelFree
MXNET_DLL int MXRtcCudaKernelFree(CudaKernelHandle handle)
MXKVStorePushPull
MXNET_DLL int MXKVStorePushPull(KVStoreHandle handle, mx_uint vnum, const int *vkeys, mx_uint onum, const int *okeys, NDArrayHandle *vals, NDArrayHandle *outs, int priority)
push and pull a list of (key, value) pairs from the kvstore
MXNDArrayCreate
MXNET_DLL int MXNDArrayCreate(const uint32_t *shape, uint32_t ndim, int dev_type, int dev_id, int delay_alloc, int dtype, NDArrayHandle *out)
create a NDArray with specified shape and data type This api is available when MXNet is built with fl...
MXNVTXRangePop
MXNET_DLL int MXNVTXRangePop()
End the NVTX range. Requires building with CUDA and NVTX.