AI-MXNetCAPI
view release on metacpan or search on metacpan
* all function in this file will return 0 when success
* and -1 when an error occured,
* MXGetLastError can be called to retrieve the error
*
* this function is threadsafe and can be called by different thread
* \return error info
*/
const char *MXGetLastError();
//-------------------------------------
// Part 0: Global State setups
//-------------------------------------
/*!
* \brief Seed the global random number generators in mxnet.
* \param seed the random number seed.
* \return 0 when success, -1 when failure happens.
*/
int MXRandomSeed(int seed);
/*!
* \brief Notify the engine about a shutdown,
* This can help engine to print less messages into display.
int MXNDArrayGetGrad(NDArrayHandle handle, NDArrayHandle *out);
/*!
* \brief detach and ndarray from computation graph by clearing entry_
* \param handle NDArray handle
* \return 0 when success, -1 when failure happens
*/
int MXNDArrayDetach(NDArrayHandle handle, NDArrayHandle *out);
/*!
* \brief set the flag for gradient array state.
* \param handle NDArray handle
* \param state the new state.
* \return 0 when success, -1 when failure happens
*/
int MXNDArraySetGradState(NDArrayHandle handle, int state);
/*!
* \brief set the flag for gradient array state.
* \param handle NDArray handle
* \param state the new state.
* \return 0 when success, -1 when failure happens
*/
int MXNDArrayGetGradState(NDArrayHandle handle, int *out);
//--------------------------------
// Part 2: functions on NDArray
//--------------------------------
/*!
*/
int MXImperativeInvoke(AtomicSymbolCreator in,
int num_inputs,
NDArrayHandle *in,
int *out_size,
NDArrayHandle **out_array,
int num_params,
const char **keys,
const char **vals);
/*!
* \brief set whether to record operator for autograd
* \param is_train 1 when training, 0 when testing
* \param prev returns the previous status before this set.
* \return 0 when success, -1 when failure happens
*/
int MXAutogradSetIsTraining(int is_training, int* out);
/*!
* \brief mark NDArrays as variables to compute gradient for autograd
* \param num_var number of variable NDArrays
* \param var_handles variable NDArrays
* \return 0 when success, -1 when failure happens
*/
int MXAutogradMarkVariables(mx_uint num_var,
*/
int MXSymbolGetAttr(SymbolHandle symbol,
const char* key,
const char** out,
int *out);
/*!
* \brief Set string attribute from symbol.
* NOTE: Setting attribute to a symbol can affect the semantics(mutable/immutable) of symbolic graph.
*
* Safe recommendaton: use immutable graph
* - Only allow set attributes during creation of new symbol as optional parameter
*
* Mutable graph (be careful about the semantics):
* - Allow set attr at any point.
* - Mutating an attribute of some common node of two graphs can cause confusion from user.
*
* \param symbol the source symbol
* \param key The key of the symbol.
* \param value The value to be saved.
* \return 0 when success, -1 when failure happens
*/
int MXSymbolSetAttr(SymbolHandle symbol,
const char* in,
const char* in);
NDArrayHandle** arg_grads,
//-----------------
mx_uint* num_aux_states,
NDArrayHandle** aux_states,
//----------
ExecutorHandle shared_exec_handle,
ExecutorHandle* out
);
/*!
* \brief set a call back to notify the completion of operation
*/
int MXExecutorSetMonitorCallback(ExecutorHandle handle,
ExecutorMonitorCallback callback,
void* callback_handle);
//--------------------------------------------
// Part 5: IO Interface
//--------------------------------------------
/*!
* \brief List all the available iterator entries
* \param out_size the size of returned iterators
int MXDataIterFree(DataIterHandle handle);
/*!
* \brief Move iterator to next position
* \param handle the handle to iterator
* \param out return value of next
* \return 0 when success, -1 when failure happens
*/
int MXDataIterNext(DataIterHandle handle,
int *out);
/*!
* \brief Call iterator.Reset
* \param handle the handle to iterator
* \return 0 when success, -1 when failure happens
*/
int MXDataIterBeforeFirst(DataIterHandle handle);
/*!
* \brief Get the handle to the NDArray of underlying data
* \param handle the handle pointer to the data iterator
* \param out handle to underlying data NDArray
* \return 0 when success, -1 when failure happens
( run in 1.659 second using v1.01-cache-2.11-cpan-49f99fa48dc )