Skip to content
heliaRT
API reference
HELIA HUB

TfLiteTensor

Tensor data, dimensions, quantization and allocation metadata for static-memory builds.

Machine-readable model

struct

A tensor in the interpreter system which is a wrapper around a buffer of data including a dimensionality (or NULL if not currently defined).

tensorflow/lite/core/c/common.h:678

struct TfLiteTensor

A tensor in the interpreter system which is a wrapper around a buffer of data including a dimensionality (or NULL if not currently defined). NOTE: This flag is opt-in only at compile time.

Specific reduced TfLiteTensor struct for TF Micro runtime. This struct contains only the minimum fields required to initialize and prepare a micro inference graph. The fields in this struct have been ordered from largest-to-smallest for optimal struct sizeof.

This struct does not use:

  • allocation
  • buffer_handle
  • data_is_stale
  • delegate
  • dims_signature
  • name
  • sparsity
attribute

TODO(b/155784997): Consider consolidating these quantization fields: Quantization information.

tensorflow/lite/core/c/common.h:681

TfLiteQuantization quantization

TODO(b/155784997): Consider consolidating these quantization fields: Quantization information. Replaces params field above.

attribute

dims

C++

A pointer to a structure representing the dimensionality interpretation that the buffer should have.

tensorflow/lite/core/c/common.h:693

TfLiteIntArray * dims

A pointer to a structure representing the dimensionality interpretation that the buffer should have. NOTE: the product of elements of dims and the element datatype size should be equal to bytes below.

attribute

The number of bytes required to store the data of this Tensor.

tensorflow/lite/core/c/common.h:699

size_t bytes

The number of bytes required to store the data of this Tensor. I.e. (bytes of each element) * dims[0] * … * dims[n-1]. For example, if type is kTfLiteFloat32 and dims = {3, 2} then bytes = sizeof(float) * 3 * 2 = 4 * 3 * 2 = 24.

attribute

type

C++

The data type specification for data stored in data.

tensorflow/lite/core/c/common.h:703

TfLiteType type

The data type specification for data stored in data. This affects what member of data union should be used.

attribute

How memory is mapped kTfLiteMmapRo: Memory mapped read only.

tensorflow/lite/core/c/common.h:710

TfLiteAllocationType allocation_type

How memory is mapped kTfLiteMmapRo: Memory mapped read only. i.e. weights kTfLiteArenaRw: Arena allocated read write memory (i.e. temporaries, outputs).