Package: android.hardware.neuralnetworks@1.1

types

Properties

OperationType

enum OperationType: @1.0::OperationType

Operation types.

The type of an operation in a model.

Details
Members
BATCH_TO_SPACE_ND = 29
BatchToSpace for N-dimensional tensors.
This operation reshapes the batch dimension(dimension 0)into M + 1 dimensions of shape block_shape +[batch], interleaves these blocks back into the grid defined by the spatial dimensions[1, ..., M], to obtain a result with the same rank as the input.
This is the reverse of SpaceToBatch.
Supported tensor{Supported tensor rank:4
Inputs:* 0:An n-D tensor, specifying the tensor to be reshaped * 1:A 1-D Tensor of{Outputs:* 0:A tensor of the same {
DIV = 30
Element-wise division of two tensors.
Takes two input tensors of identical{Two dimensions are compatible when:1.they are equal, or 2.one of them is 1
The size of the output is the maximum size along each dimension of the input operands.It starts with the trailing dimensions, and works its way forward.
Example:input1.dimension ={4, 1, 2}input2.dimension ={5, 4, 3, 1}output.dimension ={5, 4, 3, 2}
Supported tensor{Supported tensor rank:up to 4
Inputs:* 0:An n-D tensor, specifying the first input.* 1:A tensor of the same{Outputs:* 0:A tensor of the same {
MEAN = 31
Computes the mean of elements across dimensions of a tensor.
Reduces the input tensor along the given dimensions to reduce.Unless keep_dims is true, the rank of the tensor is reduced by 1 for each entry in axis.If keep_dims is true, the reduced dimensions are retained with length 1.
If dimensions to reduce have no entries, all dimensions are reduced, and a tensor with a single element is returned.
Supported tensor{Supported tensor rank:up to 4
Inputs:* 0:A tensor, specifying the input.* 1:A 1-D Tensor of{Outputs:* 0:A tensor of the same {
PAD = 32
Pads a tensor.
This operation pads a tensor according to the specified paddings.
Supported tensor{Supported tensor rank:up to 4
Inputs:* 0:An n-D tensor, specifying the tensor to be padded.* 1:A 2-D Tensor of{Outputs:* 0:A tensor of the same {
SPACE_TO_BATCH_ND = 33
SpaceToBatch for N-Dimensional tensors.
This operation divides "spatial" dimensions[1, ..., M]of the input into a grid of blocks of shape block_shape, and interleaves these blocks with the "batch" dimension(0)such that in the output, the spatial dimensions[1, ..., M]correspond to the position within the grid, and the batch dimension combines both the position within a spatial block and the original batch position.Prior to division into blocks, the spatial dimensions of the input are optionally zero padded according to paddings.
Supported tensor{Supported tensor rank:4
Inputs:* 0:An n-D tensor, specifying the input.* 1:A 1-D Tensor of{Outputs:* 0:A tensor of the same {
SQUEEZE = 34
Removes dimensions of size 1 from the shape of a tensor.
Given a tensor input, this operation returns a tensor of the same{Supported tensor{Supported tensor rank:up to 4
Inputs:* 0:An n-D tensor, the tensor to be squeezed.* 1:An optional 1-D tensor of{Outputs:* 0:A tensor of the same {
STRIDED_SLICE = 35
Extracts a strided slice of a tensor.
Roughly speaking, this op extracts a slice of size(end - begin)/ stride from the given input tensor.Starting at the location specified by begin the slice continues by adding stride to the index until all dimensions are not less than end.Note that a stride can be negative, which causes a reverse slice.
Supported tensor{Supported tensor rank:up to 4
Inputs:* 0:An n-D tensor, specifying the tensor to be sliced.* 1:A 1-D Tensor of{Outputs:* 0:A tensor of the same {
SUB = 36
Element-wise subtraction of two tensors.
Takes two input tensors of identical{Two dimensions are compatible when:1.they are equal, or 2.one of them is 1
The size of the output is the maximum size along each dimension of the input operands.It starts with the trailing dimensions, and works its way forward.
Example:input1.dimension ={4, 1, 2}input2.dimension ={5, 4, 3, 1}output.dimension ={5, 4, 3, 2}
Supported tensor{Supported tensor rank:up to 4
Inputs:* 0:An n-D tensor, specifying the first input.* 1:A tensor of the same{Outputs:* 0:A tensor of the same {
TRANSPOSE = 37
Transposes the input tensor, permuting the dimensions according to the perm tensor.
The returned tensor's dimension i corresponds to the input dimension perm[i]. If perm is not given, it is set to(n-1...0), where n is the rank of the input tensor.Hence by default, this operation performs a regular matrix transpose on 2-D input Tensors.
Supported tensor{Supported tensor rank:up to 4
Inputs:* 0:An n-D tensor, specifying the tensor to be transposed.* 1:An optional 1-D Tensor of{Outputs:* 0:A tensor of the same {

ExecutionPreference

enum ExecutionPreference: int32_t

Execution preferences.

Details
Members
LOW_POWER = 0
Prefer executing in a way that minimizes battery drain.This is desirable for compilations that will be executed often.
FAST_SINGLE_ANSWER = 1
Prefer returning a single answer as fast as possible, even if this causes more power consumption.
SUSTAINED_SPEED = 2
Prefer maximizing the throughput of successive frames, for example when processing successive frames coming from the camera.

Capabilities

struct Capabilities {PerformanceInfo float32Performance; PerformanceInfo quantized8Performance; PerformanceInfo relaxedFloat32toFloat16Performance}

The capabilities of a driver.

Details
Members
float32Performance
Driver performance when operating on float32 data.
quantized8Performance
Driver performance when operating on asymmetric 8-bit quantized data.
relaxedFloat32toFloat16Performance
Driver performance when operating on float32 data but performing calculations with range and/or precision as low as that of the IEEE 754 16-bit floating-point format.

Operation

struct Operation {OperationType type; vec inputs; vec outputs}

Describes one operation of the model's graph.

Details
Members
type
The operation type.
inputs
Describes the table that contains the indexes of the inputs of the operation.The offset is the index in the operandIndexes table.
outputs
Describes the table that contains the indexes of the outputs of the operation.The offset is the index in the operandIndexes table.

Model

struct Model {vec operands; vec operations; vec inputIndexes; vec outputIndexes; vec operandValues; vec pools; bool relaxComputationFloat32toFloat16}

A Neural Network Model.

This includes not only the execution graph, but also constant data such as weights or scalars added at construction time.The only information that may not be known is the shape of the input tensors.

Details
Members
operands
All operands included in the model.
operations
All operations included in the model.
The operations are sorted into execution order.
inputIndexes
Input indexes of the model.
Each value corresponds to the index of the operand in "operands".
outputIndexes
Output indexes of the model.
Each value corresponds to the index of the operand in "operands".
operandValues
A byte buffer containing operand data that were copied into the model.
An operand's value must be located here if and only if Operand::lifetime equals OperandLifeTime::CONSTANT_COPY.
pools
A collection of shared memory pools containing operand data that were registered by the model.
An operand's value must be located here if and only if Operand::lifetime equals OperandLifeTime::CONSTANT_REFERENCE.
relaxComputationFloat32toFloat16
'true' indicates TENSOR_FLOAT32 may be calculated with range and/or precision as low as that of the IEEE 754 16-bit floating-point format.'false' indicates TENSOR_FLOAT32 must be calculated using at least the range and precision of the IEEE 754 32-bit floating-point format.