Edge AI Add-on API 3.0.0
Loading...
Searching...
No Matches
nrf_axon_nn_infer.h File Reference
#include <stdarg.h>
#include <stdint.h>
#include "nrf_axon_driver.h"

Go to the source code of this file.

Data Structures

struct  nrf_axon_nn_model_layer_dimensions_s
 
struct  nrf_axon_nn_compiled_model_input_tag_s
 
struct  nrf_axon_nn_model_persistent_var_s
 
struct  nrf_axon_compiled_model_output_tag_s
 
struct  nrf_axon_nn_compiled_model_tag_s
 
struct  nrf_axon_nn_model_async_inference_wrapper_s
 Combines the compiled model info with other structures to support asynchronous inferencing. Users should not access these fields directly; they are managed by the driver. More...
 

Macros

#define NRF_AXON_MODEL_APP_STORAGE
 

Typedefs

typedef struct nrf_axon_nn_compiled_model_input_tag_s nrf_axon_nn_compiled_model_input_s
 
typedef struct nrf_axon_compiled_model_output_tag_s nrf_axon_compiled_model_output_s
 
typedef struct nrf_axon_nn_compiled_model_tag_s nrf_axon_nn_compiled_model_s
 

Enumerations

enum  nrf_axon_nn_async_inference_status_e { NRF_AXON_NN_ASYNC_INFERENCE_STATUS_IDLE , NRF_AXON_NN_ASYNC_INFERENCE_STATUS_ACTIVE , NRF_AXON_NN_ASYNC_INFERENCE_STATUS_COMPLETE }
 Asynchronous inference states. More...
 

Functions

static void nrf_axon_nn_set_input_vector (const nrf_axon_nn_compiled_model_s *compiled_model, uint16_t input_no, const int8_t *input_vector)
 Populates input_vector_list[input_no] with input_vector.
 
nrf_axon_result_e nrf_axon_nn_model_validate (const nrf_axon_nn_compiled_model_s *compiled_model)
 Sanity check of a compiled model.
 
int nrf_axon_nn_model_init_vars (const nrf_axon_nn_compiled_model_s *compiled_model)
 Initialize all the persistent var buffers in a streaming-style model (with VarHandle/ReadVariable/AssignVariable). Should be called at the start of each streaming session. Harmless to call for non-streaming style models.
 
nrf_axon_result_e nrf_axon_nn_model_infer_sync (const nrf_axon_nn_compiled_model_s *compiled_model, const int8_t *input_vector, int8_t *output_buffer)
 Blocking inference function of a compiled model that has only one input.
 
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.
 
nrf_axon_result_e nrf_axon_nn_model_async_init (nrf_axon_nn_model_async_inference_wrapper_s *model_wrapper, const nrf_axon_nn_compiled_model_s *compiled_model)
 Initialize a model for asynchronous inference. Calls nrf_axon_nn_model_validate then binds the model wrapper structure to its compiled model and performs some data initialization. Model is ready to be inferred upon completion. Called once per model at start-up.
 
nrf_axon_nn_async_inference_status_e nrf_axon_nn_get_model_async_infer_status (const nrf_axon_nn_model_async_inference_wrapper_s *model_wrapper)
 Returns the model inference status of an asynchronous inference.
 
nrf_axon_result_e nrf_axon_nn_model_infer_async (nrf_axon_nn_model_async_inference_wrapper_s *model_wrapper, const int8_t *input_vector, int8_t *output_buffer, void(*inference_callback)(nrf_axon_result_e result, void *callback_context), void *callback_context)
 
nrf_axon_result_e nrf_axon_nn_model_infer_async_multi_inputs (nrf_axon_nn_model_async_inference_wrapper_s *model_wrapper, const int8_t **input_vector_list, int8_t *output_buffer, void(*inference_callback)(nrf_axon_result_e result, void *callback_context), void *callback_context)
 
int16_t nrf_axon_nn_get_classification (const nrf_axon_nn_compiled_model_s *compiled_model, const int8_t *packed_output, const char **label, int32_t *score)
 Gets the inference results for a classification model.
 
nrf_axon_result_e nrf_axon_nn_populate_input_vectors (const nrf_axon_nn_compiled_model_s *compiled_model)
 Copies model input from input_vector to the location in the interlayer buffer the model expects.
 
int nrf_axon_nn_offset_to_output_ndx (const nrf_axon_nn_compiled_model_s *compiled_model, uint8_t output_ndx)
 Returns the offset into the packed output buffer filled for the start of a particular output node index.
 
void nrf_axon_nn_copy_output_to_packed_buffer (const nrf_axon_nn_compiled_model_s *compiled_model, int8_t *to_buffer)
 Copies and packs the model inference output from the common interlayer buffer to the user's dedicated buffer to_buffer.