Edge AI Add-on API 2.2.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_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_NN_MAX_MODEL_INPUTS   2
 
#define NRF_AXON_COMPILED_MODEL_EXTRA_OUTPUT_CNT(compiled_model)
 

Typedefs

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

int8_t nrf_axon_nn_model_1st_external_input_ndx (const nrf_axon_nn_compiled_model_s *the_model)
 returns the nrf_axon_nn_compiled_model_input_s instance of the model's input that is external.
 
const nrf_axon_nn_compiled_model_input_snrf_axon_nn_model_1st_external_input (const nrf_axon_nn_compiled_model_s *the_model)
 returns the index of the model's input that is external.
 
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.
 
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)
 
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_vector (const nrf_axon_nn_compiled_model_s *compiled_model, const int8_t *input_vector)
 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, void *to_buffer)
 Copies and packs the model inference output from the common interlayer buffer to the users dedicated buffer to_buffer.