26 #ifndef ANDROID_ML_NN_RUNTIME_NEURAL_NETWORKS_H 27 #define ANDROID_ML_NN_RUNTIME_NEURAL_NETWORKS_H 45 #if __ANDROID_API__ >= __ANDROID_API_O_MR1__ 49 #include <sys/cdefs.h> 1239 ANEURALNETWORKS_NO_ERROR = 0,
1240 ANEURALNETWORKS_OUT_OF_MEMORY = 1,
1241 ANEURALNETWORKS_INCOMPLETE = 2,
1242 ANEURALNETWORKS_UNEXPECTED_NULL = 3,
1243 ANEURALNETWORKS_BAD_DATA = 4,
1244 ANEURALNETWORKS_OP_FAILED = 5,
1245 ANEURALNETWORKS_UNMAPPABLE = 5,
1246 ANEURALNETWORKS_BAD_STATE = 6,
1255 ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES = 128
1390 typedef int32_t ANeuralNetworksOperationType;
1551 const void* buffer,
size_t length);
1582 size_t offset,
size_t length);
1605 ANeuralNetworksOperationType
type, uint32_t inputCount,
1606 const uint32_t* inputs, uint32_t outputCount,
1607 const uint32_t* outputs);
1631 const uint32_t* inputs, uint32_t outputCount,
1632 const uint32_t* outputs);
1690 int32_t preference);
1925 #endif // __ANDROID_API__ >= 27 1927 #endif // ANDROID_ML_NN_RUNTIME_NEURAL_NETWORKS_H struct ANeuralNetworksExecution ANeuralNetworksExecution
ANeuralNetworksExecution is an opaque type that can be used to apply a machine learning model to a se...
Concatenates the input tensors along the given dimension.
Computes sigmoid activation on the input tensor element-wise.
Prefer returning a single answer as fast as possible, even if this causes more power consumption...
struct ANeuralNetworksCompilation ANeuralNetworksCompilation
ANeuralNetworksCompilation is an opaque type that can be used to compile a machine learning model...
FuseCode
Fused activation function types.
Resizes images to given size using the bilinear interpretation.
Performs an 2-D convolution operation.
Dequantizes the input tensor.
The following entries are used to declare tensors.
Projects an input to a bit vector via locality senstive hashing.
Looks up sub-tensors in the input tensor using a key-value map.
int ANeuralNetworksCompilation_setPreference(ANeuralNetworksCompilation *compilation, int32_t preference)
Sets the execution preference.
An unsigned 32 bit integer scalar value.
void ANeuralNetworksModel_free(ANeuralNetworksModel *model)
Destroy a model.
int ANeuralNetworksExecution_setOutput(ANeuralNetworksExecution *execution, int32_t index, const ANeuralNetworksOperandType *type, void *buffer, size_t length)
Associate a user buffer with an output of the model of the ANeuralNetworksExecution.
int ANeuralNetworksCompilation_create(ANeuralNetworksModel *model, ANeuralNetworksCompilation **compilation)
Create a ANeuralNetworksCompilation to compile the given model.
void ANeuralNetworksMemory_free(ANeuralNetworksMemory *memory)
Delete a memory object.
Applies L2 normalization along the depth dimension.
int ANeuralNetworksModel_identifyInputsAndOutputs(ANeuralNetworksModel *model, uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs)
Specfifies which operands will be the model's inputs and outputs.
int32_t type
The data type, e.g ANEURALNETWORKS_INT8.
Fused ReLU6 activation function.
Fused ReLU1 activation function.
int ANeuralNetworksModel_finish(ANeuralNetworksModel *model)
Indicate that we have finished modifying a model.
PreferenceCode
Execution preferences.
Performs an 2-D max pooling operation.
The following entries are used to declare scalars.
Computes rectified linear 1 activation on the input tensor element-wise.
Performs a depthwise 2-D convolution operation.
Computes element-wise floor() on the input tensor.
ANeuralNetworksOperandType describes the type of an operand.
Multiplies two tensors, element-wise.
Performs a 2-D average pooling operation.
A basic recurrent neural network layer.
Computes rectified linear activation on the input tensor element-wise.
Performs an 2-D L2 pooling operation.
Fused ReLU activation function.
OperandCode
Operand types.
Long short-term memory unit (LSTM) recurrent network layer.
uint32_t dimensionCount
The number of dimensions.
Denotes a fully (densely) connected layer, which connects all elements in the input tensor with each ...
Computes the softmax activation on the input tensor element-wise, per batch, by normalizing the input...
struct ANeuralNetworksModel ANeuralNetworksModel
ANeuralNetworksModel is an opaque type that contains a description of the mathematical operations tha...
Rearranges data from depth into blocks of spatial data.
struct ANeuralNetworksEvent ANeuralNetworksEvent
ANeuralNetworksEvent is an opaque type that represents an event that will be signaled once an executi...
Prefer maximizing the throughput of successive frames, for example when processing successive frames ...
int ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution *execution, ANeuralNetworksEvent **event)
Schedule evaluation of the execution.
A signed 32 bit integer scalar value.
Adds two tensors, element-wise.
void ANeuralNetworksEvent_free(ANeuralNetworksEvent *event)
Destroys the event.
Computes hyperbolic tangent of input tensor element-wise.
A tensor of 8 bit integers that represent real numbers.
int ANeuralNetworksExecution_setInputFromMemory(ANeuralNetworksExecution *execution, int32_t index, const ANeuralNetworksOperandType *type, const ANeuralNetworksMemory *memory, size_t offset, size_t length)
Associate part of a memory object with an input of the model of the ANeuralNetworksExecution.
int ANeuralNetworksModel_addOperation(ANeuralNetworksModel *model, ANeuralNetworksOperationType type, uint32_t inputCount, const uint32_t *inputs, uint32_t outputCount, const uint32_t *outputs)
Add an operation to a model.
Applies Local Response Normalization along the depth dimension.
int ANeuralNetworksModel_addOperand(ANeuralNetworksModel *model, const ANeuralNetworksOperandType *type)
Add an operand to a model.
void ANeuralNetworksExecution_free(ANeuralNetworksExecution *execution)
Destroy an execution.
int ANeuralNetworksExecution_create(ANeuralNetworksCompilation *compilation, ANeuralNetworksExecution **execution)
Create a ANeuralNetworksExecution to apply the given compilation.
int ANeuralNetworksModel_create(ANeuralNetworksModel **model)
Create an empty ANeuralNetworksModel.
NO fused activation function.
int ANeuralNetworksExecution_setOutputFromMemory(ANeuralNetworksExecution *execution, int32_t index, const ANeuralNetworksOperandType *type, const ANeuralNetworksMemory *memory, size_t offset, size_t length)
Associate part of a memory object with an output of the model of the ANeuralNetworksExecution.
OperationCode
Operation types.
int ANeuralNetworksMemory_createFromFd(size_t size, int protect, int fd, size_t offset, ANeuralNetworksMemory **memory)
Creates a shared memory object from a file descriptor.
SVDF op is a kind of stateful layer derived from the notion that a densely connected layer that's pro...
float scale
These two fields are only used for quantized tensors.
Looks up sub-tensors in the input tensor.
PaddingCode
Implicit padding algorithms.
struct ANeuralNetworksOperandType ANeuralNetworksOperandType
ANeuralNetworksOperandType describes the type of an operand.
Computes rectified linear 6 activation on the input tensor element-wise.
int ANeuralNetworksCompilation_finish(ANeuralNetworksCompilation *compilation)
Indicate that we have finished modifying a compilation.
Prefer executing in a way that minimizes battery drain.
A tensor of 32 bit integer values.
const uint32_t * dimensions
The dimensions of the tensor.
struct ANeuralNetworksMemory ANeuralNetworksMemory
ANeuralNetworksMemory is an opaque type that represents memory.
Rearranges blocks of spatial data, into depth.
int ANeuralNetworksExecution_setInput(ANeuralNetworksExecution *execution, int32_t index, const ANeuralNetworksOperandType *type, const void *buffer, size_t length)
Associate a user buffer with an input of the model of the ANeuralNetworksExecution.
int ANeuralNetworksEvent_wait(ANeuralNetworksEvent *event)
Waits until the execution completes.
void ANeuralNetworksCompilation_free(ANeuralNetworksCompilation *compilation)
Destroy a compilation.
int ANeuralNetworksModel_setOperandValue(ANeuralNetworksModel *model, int32_t index, const void *buffer, size_t length)
Sets an operand to a constant value.
int ANeuralNetworksModel_setOperandValueFromMemory(ANeuralNetworksModel *model, int32_t index, const ANeuralNetworksMemory *memory, size_t offset, size_t length)
Sets an operand to a value stored in a memory object.