Crate nnapi_sys

Source
Expand description

FFI Rust bindings for the Android Neural Networks API.

Structs§

AHardwareBuffer
ANeuralNetworksBurst
ANeuralNetworksCompilation
ANeuralNetworksDevice
ANeuralNetworksEvent
ANeuralNetworksExecution
ANeuralNetworksMemory
ANeuralNetworksMemoryDesc
ANeuralNetworksModel
ANeuralNetworksOperandType
ANeuralNetworksOperandType describes the type of an operand.
ANeuralNetworksSymmPerChannelQuantParams
Parameters for ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL operand.
__darwin_pthread_handler_rec
_opaque_pthread_attr_t
_opaque_pthread_cond_t
_opaque_pthread_condattr_t
_opaque_pthread_mutex_t
_opaque_pthread_mutexattr_t
_opaque_pthread_once_t
_opaque_pthread_rwlock_t
_opaque_pthread_rwlockattr_t
_opaque_pthread_t

Enums§

OperandCode
Operand types.
OperationCode
Operation types.
ResultCode
Result codes.

Constants§

ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN
ANEURALNETWORKS_DEVICE_ACCELERATOR
Dedicated accelerator for Machine Learning workloads.
ANEURALNETWORKS_DEVICE_CPU
The device runs NNAPI models on single or multi-core CPU.
ANEURALNETWORKS_DEVICE_GPU
The device can run NNAPI models and also accelerate graphics APIs such as OpenGL ES and Vulkan.
ANEURALNETWORKS_DEVICE_OTHER
The device does not fall into any category below.
ANEURALNETWORKS_DEVICE_UNKNOWN
The device type cannot be provided.
ANEURALNETWORKS_FUSED_NONE
NO fused activation function.
ANEURALNETWORKS_FUSED_RELU
Fused ReLU activation function.
ANEURALNETWORKS_FUSED_RELU1
Fused ReLU1 activation function.
ANEURALNETWORKS_FUSED_RELU6
Fused ReLU6 activation function.
ANEURALNETWORKS_MAX_SIZE_OF_IMMEDIATELY_COPIED_VALUES
ANEURALNETWORKS_PADDING_SAME
SAME padding. Padding on both ends are the “same”: padding_to_beginning = total_padding / 2 padding_to_end = (total_padding + 1)/2. i.e., for even number of padding, padding to both ends are exactly the same; for odd number of padding, padding to the ending is bigger than the padding to the beginning by 1.
ANEURALNETWORKS_PADDING_VALID
VALID padding. No padding. When the input size is not evenly divisible by the filter size, the input at the end that could not fill the whole filter tile will simply be ignored.
ANEURALNETWORKS_PREFER_FAST_SINGLE_ANSWER
Prefer returning a single answer as fast as possible, even if this causes more power consumption.
ANEURALNETWORKS_PREFER_LOW_POWER
Prefer executing in a way that minimizes battery drain. This is desirable for compilations that will be executed often.
ANEURALNETWORKS_PREFER_SUSTAINED_SPEED
Prefer maximizing the throughput of successive frames, for example when processing successive frames coming from the camera.
DurationCode_ANEURALNETWORKS_DURATION_IN_DRIVER
DurationCode_ANEURALNETWORKS_DURATION_ON_HARDWARE
DurationCode_ANEURALNETWORKS_FENCED_DURATION_IN_DRIVER
DurationCode_ANEURALNETWORKS_FENCED_DURATION_ON_HARDWARE
INT8_MAX
INT8_MIN
INT16_MAX
INT16_MIN
INT32_MAX
INT32_MIN
INT64_MAX
INT64_MIN
INTPTR_MAX
INTPTR_MIN
INT_FAST8_MAX
INT_FAST8_MIN
INT_FAST16_MAX
INT_FAST16_MIN
INT_FAST32_MAX
INT_FAST32_MIN
INT_FAST64_MAX
INT_FAST64_MIN
INT_LEAST8_MAX
INT_LEAST8_MIN
INT_LEAST16_MAX
INT_LEAST16_MIN
INT_LEAST32_MAX
INT_LEAST32_MIN
INT_LEAST64_MAX
INT_LEAST64_MIN
PriorityCode_ANEURALNETWORKS_PRIORITY_DEFAULT
PriorityCode_ANEURALNETWORKS_PRIORITY_HIGH
PriorityCode_ANEURALNETWORKS_PRIORITY_LOW
PriorityCode_ANEURALNETWORKS_PRIORITY_MEDIUM
RSIZE_MAX
SIG_ATOMIC_MAX
SIG_ATOMIC_MIN
SIZE_MAX
UINT8_MAX
UINT16_MAX
UINT32_MAX
UINT64_MAX
UINTPTR_MAX
UINT_FAST8_MAX
UINT_FAST16_MAX
UINT_FAST32_MAX
UINT_FAST64_MAX
UINT_LEAST8_MAX
UINT_LEAST16_MAX
UINT_LEAST32_MAX
UINT_LEAST64_MAX
WINT_MAX
WINT_MIN
_DARWIN_FEATURE_64_BIT_INODE
_DARWIN_FEATURE_ONLY_64_BIT_INODE
_DARWIN_FEATURE_ONLY_UNIX_CONFORMANCE
_DARWIN_FEATURE_ONLY_VERS_1050
_DARWIN_FEATURE_UNIX_CONFORMANCE
__DARWIN_64_BIT_INO_T
__DARWIN_C_ANSI
__DARWIN_C_FULL
__DARWIN_C_LEVEL
__DARWIN_NON_CANCELABLE
__DARWIN_NO_LONG_LONG
__DARWIN_ONLY_64_BIT_INO_T
__DARWIN_ONLY_UNIX_CONFORMANCE
__DARWIN_ONLY_VERS_1050
__DARWIN_SUF_EXTSN
__DARWIN_UNIX03
__DARWIN_VERS_1050
__PTHREAD_ATTR_SIZE__
__PTHREAD_CONDATTR_SIZE__
__PTHREAD_COND_SIZE__
__PTHREAD_MUTEXATTR_SIZE__
__PTHREAD_MUTEX_SIZE__
__PTHREAD_ONCE_SIZE__
__PTHREAD_RWLOCKATTR_SIZE__
__PTHREAD_RWLOCK_SIZE__
__PTHREAD_SIZE__
__STDC_WANT_LIB_EXT1__
__WORDSIZE
__bool_true_false_are_defined
__has_ptrcheck
false_
true_

Functions§

ANeuralNetworksBurst_create
Create a {@link ANeuralNetworksBurst} to apply the given compilation. This only creates the burst object. Computation is only performed once {@link ANeuralNetworksExecution_burstCompute} is invoked with a valid {@link ANeuralNetworksExecution} and {@link ANeuralNetworksBurst}.
ANeuralNetworksBurst_free
Destroys the burst object.
ANeuralNetworksCompilation_create
Create a {@link ANeuralNetworksCompilation} to compile the given model.
ANeuralNetworksCompilation_createForDevices
Create a {@link ANeuralNetworksCompilation} to compile the given model for a specified set of devices. If more than one device is specified, the compilation will distribute the workload automatically across the devices. The model must be fully supported by the specified set of devices. This means that ANeuralNetworksModel_getSupportedOperationsForDevices() must have returned true for every operation for that model/devices pair.
ANeuralNetworksCompilation_finish
Indicate that we have finished modifying a compilation. Required before calling {@link ANeuralNetworksBurst_create} or {@link ANeuralNetworksExecution_create}.
ANeuralNetworksCompilation_free
Destroy a compilation.
ANeuralNetworksCompilation_setCaching
Sets the compilation caching signature and the cache directory.
ANeuralNetworksCompilation_setPreference
Sets the execution preference.
ANeuralNetworksCompilation_setPriority
Set the execution priority.
ANeuralNetworksCompilation_setTimeout
Set the maximum expected duration for compiling the model.
ANeuralNetworksDevice_getFeatureLevel
Get the supported NNAPI version of the specified device.
ANeuralNetworksDevice_getName
Get the name of the specified device.
ANeuralNetworksDevice_getType
Get the type of a given device.
ANeuralNetworksDevice_getVersion
Get the version of the driver implementation of the specified device.
ANeuralNetworksDevice_wait
Wait until the device is in a live state.
ANeuralNetworksEvent_createFromSyncFenceFd
Create a {@link ANeuralNetworksEvent} from a sync_fence file descriptor.
ANeuralNetworksEvent_free
Destroys the event.
ANeuralNetworksEvent_getSyncFenceFd
Get sync_fence file descriptor from the event.
ANeuralNetworksEvent_wait
Waits until the execution completes.
ANeuralNetworksExecution_burstCompute
Schedule synchronous evaluation of the execution on a burst object.
ANeuralNetworksExecution_compute
Schedule synchronous evaluation of the execution.
ANeuralNetworksExecution_create
Create a {@link ANeuralNetworksExecution} to apply the given compilation. This only creates the object. Computation is only performed once {@link ANeuralNetworksExecution_burstCompute}, {@link ANeuralNetworksExecution_compute}, {@link ANeuralNetworksExecution_startCompute} or {@link ANeuralNetworksExecution_startComputeWithDependencies} is invoked.
ANeuralNetworksExecution_free
Destroy an execution.
ANeuralNetworksExecution_getDuration
Get the time spent in the specified {@link ANeuralNetworksExecution}, in nanoseconds.
ANeuralNetworksExecution_getOutputOperandDimensions
Get the dimensional information of the specified output operand of the model of the {@link ANeuralNetworksExecution}. The target output operand cannot be a scalar.
ANeuralNetworksExecution_getOutputOperandRank
Get the dimensional information of the specified output operand of the model of the {@link ANeuralNetworksExecution}.
ANeuralNetworksExecution_setInput
Associate a user buffer with an input of the model of the {@link ANeuralNetworksExecution}. Evaluation of the execution must not have been scheduled. Once evaluation of the execution has been scheduled, the application must not change the content of the buffer until the execution has completed. Evaluation of the execution will not change the content of the buffer.
ANeuralNetworksExecution_setInputFromMemory
Associate a region of a memory object with an input of the model of the {@link ANeuralNetworksExecution}. Evaluation of the execution must not have been scheduled. Once evaluation of the execution has been scheduled, the application must not change the content of the region until the execution has completed. Evaluation of the execution will not change the content of the region.
ANeuralNetworksExecution_setLoopTimeout
Set the maximum duration of WHILE loops in the specified execution.
ANeuralNetworksExecution_setMeasureTiming
Specifies whether duration of the {@link ANeuralNetworksExecution} is to be measured. Evaluation of the execution must not have been scheduled.
ANeuralNetworksExecution_setOutput
Associate a user buffer with an output of the model of the {@link ANeuralNetworksExecution}. Evaluation of the execution must not have been scheduled. Once evaluation of the execution has been scheduled, the application must not change the content of the buffer until the execution has completed.
ANeuralNetworksExecution_setOutputFromMemory
Associate a region of a memory object with an output of the model of the {@link ANeuralNetworksExecution}. Evaluation of the execution must not have been scheduled. Once evaluation of the execution has been scheduled, the application must not change the content of the region until the execution has completed.
ANeuralNetworksExecution_setTimeout
Set the maximum expected duration of the specified execution.
ANeuralNetworksExecution_startCompute
Schedule asynchronous evaluation of the execution.
ANeuralNetworksExecution_startComputeWithDependencies
Schedule asynchronous evaluation of the execution with dependencies.
ANeuralNetworksMemoryDesc_addInputRole
Specify that a memory object will be playing the role of an input to an execution created from a particular compilation.
ANeuralNetworksMemoryDesc_addOutputRole
Specify that a memory object will be playing the role of an output to an execution created from a particular compilation.
ANeuralNetworksMemoryDesc_create
Create a {@link ANeuralNetworksMemoryDesc} with no properties.
ANeuralNetworksMemoryDesc_finish
Indicate that we have finished modifying a memory descriptor. Required before calling {@link ANeuralNetworksMemory_createFromDesc}.
ANeuralNetworksMemoryDesc_free
Destroy a memory descriptor.
ANeuralNetworksMemoryDesc_setDimensions
Set the dimensional information of the memory descriptor.
ANeuralNetworksMemory_copy
Copies data from one memory object to another.
ANeuralNetworksMemory_createFromAHardwareBuffer
Creates a shared memory object from an AHardwareBuffer handle.
ANeuralNetworksMemory_createFromDesc
Creates a memory object from a memory descriptor.
ANeuralNetworksMemory_createFromFd
Creates a shared memory object from a file descriptor.
ANeuralNetworksMemory_free
Delete a memory object.
ANeuralNetworksModel_addOperand
Add an operand to a model.
ANeuralNetworksModel_addOperation
Add an operation to a model.
ANeuralNetworksModel_create
Create an empty {@link ANeuralNetworksModel}.
ANeuralNetworksModel_finish
Indicate that we have finished modifying a model. Required before calling {@link ANeuralNetworksCompilation_create} and {@link ANeuralNetworksCompilation_createForDevices}.
ANeuralNetworksModel_free
Destroy a model.
ANeuralNetworksModel_getSupportedOperationsForDevices
Get the supported operations for a specified set of devices. If multiple devices are selected, the supported operation list is a union of supported operations of all selected devices.
ANeuralNetworksModel_identifyInputsAndOutputs
Specifies which operands will be the model’s inputs and outputs. Every model must have at least one input and one output.
ANeuralNetworksModel_relaxComputationFloat32toFloat16
Specifies whether {@link ANEURALNETWORKS_TENSOR_FLOAT32} is allowed to be calculated with range and/or precision as low as that of the IEEE 754 16-bit floating-point format. By default, {@link ANEURALNETWORKS_TENSOR_FLOAT32} must be calculated using at least the range and precision of the IEEE 754 32-bit floating-point format.
ANeuralNetworksModel_setOperandSymmPerChannelQuantParams
Sets an operand’s per channel quantization parameters.
ANeuralNetworksModel_setOperandValue
Sets an operand to a constant value.
ANeuralNetworksModel_setOperandValueFromMemory
Sets an operand to a value stored in a memory object.
ANeuralNetworksModel_setOperandValueFromModel
Sets an operand to a value that is a reference to another NNAPI model.
ANeuralNetworks_getDefaultLoopTimeout
Get the default timeout value for WHILE loops.
ANeuralNetworks_getDevice
Get the representation of the specified device.
ANeuralNetworks_getDeviceCount
Get the number of available devices.
ANeuralNetworks_getMaximumLoopTimeout
Get the maximum timeout value for WHILE loops.
ANeuralNetworks_getRuntimeFeatureLevel

Type Aliases§

ANeuralNetworksOperationType
DeviceTypeCode
Device types.
DurationCode
Different duration measurements.
FuseCode
Fused activation function types.
PaddingCode
Implicit padding algorithms.
PreferenceCode
Execution preferences.
PriorityCode
Relative execution priority.
__builtin_va_list
__darwin_blkcnt_t
__darwin_blksize_t
__darwin_clock_t
__darwin_ct_rune_t
__darwin_dev_t
__darwin_fsblkcnt_t
__darwin_fsfilcnt_t
__darwin_gid_t
__darwin_id_t
__darwin_ino64_t
__darwin_ino_t
__darwin_intptr_t
__darwin_mach_port_name_t
__darwin_mach_port_t
__darwin_mbstate_t
__darwin_mode_t
__darwin_natural_t
__darwin_off_t
__darwin_pid_t
__darwin_pthread_attr_t
__darwin_pthread_cond_t
__darwin_pthread_condattr_t
__darwin_pthread_key_t
__darwin_pthread_mutex_t
__darwin_pthread_mutexattr_t
__darwin_pthread_once_t
__darwin_pthread_rwlock_t
__darwin_pthread_rwlockattr_t
__darwin_pthread_t
__darwin_ptrdiff_t
__darwin_rune_t
__darwin_sigset_t
__darwin_size_t
__darwin_socklen_t
__darwin_ssize_t
__darwin_suseconds_t
__darwin_time_t
__darwin_uid_t
__darwin_useconds_t
__darwin_uuid_string_t
__darwin_uuid_t
__darwin_va_list
__darwin_wchar_t
__darwin_wint_t
__int8_t
__int16_t
__int32_t
__int64_t
__uint8_t
__uint16_t
__uint32_t
__uint64_t
_bindgen_ty_1
For {@link ANeuralNetworksModel_setOperandValue}, values with a length smaller or equal to this will be immediately copied into the model. The size is in bytes.
_bindgen_ty_2
For {@link ANeuralNetworksCompilation_setCaching}, specify the size of the cache token required from the application. The size is in bytes.
int_fast8_t
int_fast16_t
int_fast32_t
int_fast64_t
int_least8_t
int_least16_t
int_least32_t
int_least64_t
intmax_t
max_align_t
register_t
syscall_arg_t
u_int8_t
u_int16_t
u_int32_t
u_int64_t
uint_fast8_t
uint_fast16_t
uint_fast32_t
uint_fast64_t
uint_least8_t
uint_least16_t
uint_least32_t
uint_least64_t
uintmax_t
user_addr_t
user_long_t
user_off_t
user_size_t
user_ssize_t
user_time_t
user_ulong_t
wchar_t

Unions§

__mbstate_t