Skip to main content

M_executeModelSync

Function M_executeModelSync 

Source
pub unsafe extern "C" fn M_executeModelSync(
    context: *const M_RuntimeContext,
    initializedModel: *mut M_AsyncModel,
    inputs: *mut M_AsyncTensorMap,
    status: *mut M_Status,
) -> *mut M_AsyncTensorMap
Expand description

Executes a model synchronously.

The inputs and outputs are M_AsyncTensorMap objects to allow chaining of inference. This operation is blocking and waits until the output results are ready.

@param context The runtime context. @param initializedModel The model to execute, from M_initModel(). Although that function is async, you can pass the M_AsyncModel here immediately. @param inputs The tensor inputs. @param status The status used to report errors in the case of failures. This includes failures encountered while running the model; there is no need for an explicit synchronization point.

@returns A pointer to an M_AsyncTensorMap that holds the output tensors. These tensors are in a resolved state. You are responsible for the memory associated with the pointer returned. You can deallocate the memory by calling M_freeAsyncTensorMap(). In the case that executing the model fails, the status parameter contains an error message.