TensorFlow Lite Micro Init#

The TensorFlow Lite Micro Init functions are autogenerated from the flatbuffer file provided in the configuration, which includes an opsResolver generated according to the included operators in the flatbuffer.

Helper functions to access the input and output tensors are also provided.

Functions#

sl_status_t
sl_tflite_micro_estimate_arena_size(const tflite::Model *model, const tflite::MicroOpResolver &opcode_resolver, size_t *estimated_size)

Estimate the arena size for a given model.

uint8_t *
sl_tflite_micro_allocate_tensor_arena(size_t arena_size, uint8_t **tensor_arena)

Dynamically allocate a buffer that can be used for the tensor arena.

tflite::ErrorReporter *

Get a pointer to the TensorFlow Lite Micro error reporter created by the init function.

tflite::MicroInterpreter *

Get a pointer to the TensorFlow Lite Micro interpreter created by the init function.

TfLiteTensor *

Get a pointer to the input tensor, set by the init function.

TfLiteTensor *

Get a pointer to the output tensor, set by the init function.

tflite::MicroOpResolver &

Get a pointer to the opcode resolver for the flatbuffer given by the configuration.

void

Create the error reporter and opcode resolver and initialize variables for the flatbuffer given by the configuration.

Function Documentation#

sl_tflite_micro_estimate_arena_size#

sl_status_t sl_tflite_micro_estimate_arena_size (const tflite::Model *model, const tflite::MicroOpResolver &opcode_resolver, size_t *estimated_size)

Estimate the arena size for a given model.

Parameters
[in]model

Pointer to the model to estimate the arena size for.

[in]opcode_resolver

The opcode resolver to use for the model.

[out]estimated_size

The estimated size of the arena, as output.

Returns

  • SL_STATUS_OK if the estimation was successful.


Definition at line 58 of file util/third_party/tensorflow_extra/inc/sl_tflite_micro_init.h

sl_tflite_micro_allocate_tensor_arena#

uint8_t * sl_tflite_micro_allocate_tensor_arena (size_t arena_size, uint8_t **tensor_arena)

Dynamically allocate a buffer that can be used for the tensor arena.

Parameters
[in]arena_size

The size of the arena to allocate.

[out]tensor_arena

Pointer to the allocated tensor arena buffer.

Returns

  • A pointer to the allocated base buffer. Returns nullptr if the allocation failed. The base buffer is used for freeing the allocated memory.


Definition at line 68 of file util/third_party/tensorflow_extra/inc/sl_tflite_micro_init.h

sl_tflite_micro_get_error_reporter#

tflite::ErrorReporter * sl_tflite_micro_get_error_reporter ()

Get a pointer to the TensorFlow Lite Micro error reporter created by the init function.

Returns

  • A pointer to the error reporter.


Definition at line 77 of file util/third_party/tensorflow_extra/inc/sl_tflite_micro_init.h

sl_tflite_micro_get_interpreter#

tflite::MicroInterpreter * sl_tflite_micro_get_interpreter ()

Get a pointer to the TensorFlow Lite Micro interpreter created by the init function.

Returns

  • A pointer to the interpreter.


Definition at line 87 of file util/third_party/tensorflow_extra/inc/sl_tflite_micro_init.h

sl_tflite_micro_get_input_tensor#

TfLiteTensor * sl_tflite_micro_get_input_tensor ()

Get a pointer to the input tensor, set by the init function.

Returns

  • A pointer to the input tensor.


Definition at line 96 of file util/third_party/tensorflow_extra/inc/sl_tflite_micro_init.h

sl_tflite_micro_get_output_tensor#

TfLiteTensor * sl_tflite_micro_get_output_tensor ()

Get a pointer to the output tensor, set by the init function.

Returns

  • A pointer to the output tensor.


Definition at line 105 of file util/third_party/tensorflow_extra/inc/sl_tflite_micro_init.h

sl_tflite_micro_opcode_resolver#

tflite::MicroOpResolver & sl_tflite_micro_opcode_resolver ()

Get a pointer to the opcode resolver for the flatbuffer given by the configuration.

Returns

  • The address to the opcode resolver.


Definition at line 114 of file util/third_party/tensorflow_extra/inc/sl_tflite_micro_init.h

sl_tflite_micro_init#

void sl_tflite_micro_init (void)

Create the error reporter and opcode resolver and initialize variables for the flatbuffer given by the configuration.

Parameters
N/A

Definition at line 126 of file util/third_party/tensorflow_extra/inc/sl_tflite_micro_init.h