Skip to content
heliaRT
API reference
HELIA HUB

MicroResourceVariables

Allocate, read, assign and reset resource variables.

Machine-readable model

class

tensorflow/lite/micro/micro_resource_variable.h:26

class MicroResourceVariables
method

Create.

tensorflow/lite/micro/micro_resource_variable.h:29

static MicroResourceVariables * tflite::MicroResourceVariables::Create(MicroAllocator *allocator, int num_variables)

Create.

Parameters of Create
NameTypeDefaultDescription
allocatorMicroAllocator *Required
num_variablesintRequired
method

Creates a resource variable if none is available for the given container and shared name pair.

tensorflow/lite/micro/micro_resource_variable.h:37

int tflite::MicroResourceVariables::CreateIdIfNoneFound(const char *container, const char *shared_name)

Creates a resource variable if none is available for the given container and shared name pair. Returns the resource ID corresponding to the container and shared name pair. If allocation fails, the returned resource ID will be negative. The the container and shared_name must outlive this class.

Parameters of CreateIdIfNoneFound
NameTypeDefaultDescription
containerconst char *Required
shared_nameconst char *Required
method

Read

C++

Read the resource buffer associated with the given ID into the given tensor.

tensorflow/lite/micro/micro_resource_variable.h:41

TfLiteStatus tflite::MicroResourceVariables::Read(int id, const TfLiteEvalTensor *tensor)

Read the resource buffer associated with the given ID into the given tensor.

Parameters of Read
NameTypeDefaultDescription
idintRequired
tensorconst TfLiteEvalTensor *Required
method

Allocates the resource buffer if none has been allocated, based on the length of the input tensor.

tensorflow/lite/micro/micro_resource_variable.h:46

TfLiteStatus tflite::MicroResourceVariables::Allocate(int id, TfLiteContext *context, const TfLiteTensor *tensor)

Allocates the resource buffer if none has been allocated, based on the length of the input tensor. Copies input tensor contents to the resource buffer.

Parameters of Allocate
NameTypeDefaultDescription
idintRequired
contextTfLiteContext *Required
tensorconst TfLiteTensor *Required
method

Copies inputbuffer contents to the resource buffer.

tensorflow/lite/micro/micro_resource_variable.h:52

TfLiteStatus tflite::MicroResourceVariables::Assign(int id, size_t count_bytes, const void *input_buffer)

Copies input_buffer contents to the resource buffer. AllocateResourceVariable with a TFLite tensor must have been called first in order to allocate the resource buffer.

Parameters of Assign
NameTypeDefaultDescription
idintRequired
count_bytessize_tRequired
input_bufferconst void *Required