Edge AI Add-on API 2.3.0
Loading...
Searching...
No Matches

◆ nrf_axon_nn_model_infer_sync_multi_inputs()

nrf_axon_result_e nrf_axon_nn_model_infer_sync_multi_inputs ( const nrf_axon_nn_compiled_model_s * compiled_model,
int8_t * output_buffer )

Blocking inference function of a compiled model with multiple inputs.

  • Reserves Axon for its exclusive access (using nrf_axon_platform_reserve_for_user()).
  • Copies the input_vector to its location in the interlayer buffer. This input_vector is assumed to be packed in memory.
  • Performs the inference.
  • copies and packs unpacked output from interlayer buffer to output_buffer (optional)
  • Frees Axon for other users.
  • Returns to user.

The compiled_model->input_vector_list must be populated with the addresses of the various inputs. Use nrf_axon_nn_set_input_vector to populate input_vector_list.

If input_vector_list or any of its entries is NULL, the user has to copy the model input to the correct location in the interlayer buffer (specified by the compiled_model). In a dynamic system where there are other threads utilizing axon and/or asynchronous inference is occurring, the user must 1st call nrf_axon_platform_reserve_for_user() prior to accessing the interlayer_buffer, then invoke this function.

Similarly, output_buffer cannot be NULL in a dynamic system as there is no way to retain control of axon after inference completes.

Cannot be called from interrupt context.

Parameters
[in]compiled_modelThe compiled model to perform inference on that has been validated by calling nrf_axon_nn_model_validate(compiled_model).
[out]output_bufferbuffer to hold the packed output results. Can be NULL (see above). Must be sized to hold all the output layers of the model. The offset into output_buffer for each output is returned by nrf_axon_nn_offset_to_output_ndx()
Return values
0on success, are a negative error code.