ANeuralNetworksOperandType

#include <NeuralNetworks.h>

ANeuralNetworksOperandType describes the type of an operand.

Summary

This structure is used to describe both scalars and tensors.

A tensor operand type must have a specified rank (number of dimensions) but may have any of its dimensions unspecified.

A tensor operand type with all dimensions specified is "fully specified". Whenever possible (i.e., whenever the dimensions are known at model construction time), a tensor operand type should be (but is not required to be) fully specified, in order to enable the best possible performance.

If a tensor operand's type is not fully specified, the dimensions of the operand are deduced from the operand types and values of the operation for which that operand is an output.

In the following situations, a tensor operand type must be fully specified:

A tensor operand type with some number of unspecified dimensions is represented by setting each unspecified dimension to 0.

Available since API level 27.

Public attributes

dimensionCount
uint32_t
The number of dimensions (rank).
dimensions
const uint32_t *
The dimensions of the tensor.
scale
float
These two fields are only used for quantized tensors.
type
int32_t
The data type, e.g ANEURALNETWORKS_INT8.
zeroPoint
int32_t

Public attributes

dimensionCount

uint32_t ANeuralNetworksOperandType::dimensionCount

The number of dimensions (rank).

It should be 0 for scalars.

dimensions

const uint32_t * ANeuralNetworksOperandType::dimensions

The dimensions of the tensor.

It should be nullptr for scalars.

scale

float ANeuralNetworksOperandType::scale

These two fields are only used for quantized tensors.

They should be zero for scalars and non-fixed point tensors. The dequantized value of each entry is (value - zeroPoint) * scale.

type

int32_t ANeuralNetworksOperandType::type

The data type, e.g ANEURALNETWORKS_INT8.

zeroPoint

int32_t ANeuralNetworksOperandType::zeroPoint