Expand description
FFI Rust bindings for the Android Neural Networks API.
Structs§
- AHardware
Buffer - ANeural
Networks Burst - ANeural
Networks Compilation - ANeural
Networks Device - ANeural
Networks Event - ANeural
Networks Execution - ANeural
Networks Memory - ANeural
Networks Memory Desc - ANeural
Networks Model - ANeural
Networks Operand Type - ANeuralNetworksOperandType describes the type of an operand.
- ANeural
Networks Symm PerChannel Quant Params - 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§
- Operand
Code - Operand types.
- Operation
Code - Operation types.
- Result
Code - 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.
- Duration
Code_ ANEURALNETWORKS_ DURATION_ IN_ DRIVER - Duration
Code_ ANEURALNETWORKS_ DURATION_ ON_ HARDWARE - Duration
Code_ ANEURALNETWORKS_ FENCED_ DURATION_ IN_ DRIVER - Duration
Code_ 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_
LEAS T8_ MAX - INT_
LEAS T8_ MIN - INT_
LEAS T16_ MAX - INT_
LEAS T16_ MIN - INT_
LEAS T32_ MAX - INT_
LEAS T32_ MIN - INT_
LEAS T64_ MAX - INT_
LEAS T64_ MIN - Priority
Code_ ANEURALNETWORKS_ PRIORITY_ DEFAULT - Priority
Code_ ANEURALNETWORKS_ PRIORITY_ HIGH - Priority
Code_ ANEURALNETWORKS_ PRIORITY_ LOW - Priority
Code_ 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_
LEAS T8_ MAX - UINT_
LEAS T16_ MAX - UINT_
LEAS T32_ MAX - UINT_
LEAS T64_ 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§
- ANeural
Networks ⚠Burst_ 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}.
- ANeural
Networks ⚠Burst_ free - Destroys the burst object.
- ANeural
Networks ⚠Compilation_ create - Create a {@link ANeuralNetworksCompilation} to compile the given model.
- ANeural
Networks ⚠Compilation_ create ForDevices - 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.
- ANeural
Networks ⚠Compilation_ finish - Indicate that we have finished modifying a compilation. Required before calling {@link ANeuralNetworksBurst_create} or {@link ANeuralNetworksExecution_create}.
- ANeural
Networks ⚠Compilation_ free - Destroy a compilation.
- ANeural
Networks ⚠Compilation_ setCaching - Sets the compilation caching signature and the cache directory.
- ANeural
Networks ⚠Compilation_ setPreference - Sets the execution preference.
- ANeural
Networks ⚠Compilation_ setPriority - Set the execution priority.
- ANeural
Networks ⚠Compilation_ setTimeout - Set the maximum expected duration for compiling the model.
- ANeural
Networks ⚠Device_ getFeature Level - Get the supported NNAPI version of the specified device.
- ANeural
Networks ⚠Device_ getName - Get the name of the specified device.
- ANeural
Networks ⚠Device_ getType - Get the type of a given device.
- ANeural
Networks ⚠Device_ getVersion - Get the version of the driver implementation of the specified device.
- ANeural
Networks ⚠Device_ wait - Wait until the device is in a live state.
- ANeural
Networks ⚠Event_ create From Sync Fence Fd - Create a {@link ANeuralNetworksEvent} from a sync_fence file descriptor.
- ANeural
Networks ⚠Event_ free - Destroys the event.
- ANeural
Networks ⚠Event_ getSync Fence Fd - Get sync_fence file descriptor from the event.
- ANeural
Networks ⚠Event_ wait - Waits until the execution completes.
- ANeural
Networks ⚠Execution_ burst Compute - Schedule synchronous evaluation of the execution on a burst object.
- ANeural
Networks ⚠Execution_ compute - Schedule synchronous evaluation of the execution.
- ANeural
Networks ⚠Execution_ 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.
- ANeural
Networks ⚠Execution_ free - Destroy an execution.
- ANeural
Networks ⚠Execution_ getDuration - Get the time spent in the specified {@link ANeuralNetworksExecution}, in nanoseconds.
- ANeural
Networks ⚠Execution_ getOutput Operand Dimensions - Get the dimensional information of the specified output operand of the model of the {@link ANeuralNetworksExecution}. The target output operand cannot be a scalar.
- ANeural
Networks ⚠Execution_ getOutput Operand Rank - Get the dimensional information of the specified output operand of the model of the {@link ANeuralNetworksExecution}.
- ANeural
Networks ⚠Execution_ 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.
- ANeural
Networks ⚠Execution_ setInput From Memory - 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.
- ANeural
Networks ⚠Execution_ setLoop Timeout - Set the maximum duration of WHILE loops in the specified execution.
- ANeural
Networks ⚠Execution_ setMeasure Timing - Specifies whether duration of the {@link ANeuralNetworksExecution} is to be measured. Evaluation of the execution must not have been scheduled.
- ANeural
Networks ⚠Execution_ 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.
- ANeural
Networks ⚠Execution_ setOutput From Memory - 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.
- ANeural
Networks ⚠Execution_ setTimeout - Set the maximum expected duration of the specified execution.
- ANeural
Networks ⚠Execution_ start Compute - Schedule asynchronous evaluation of the execution.
- ANeural
Networks ⚠Execution_ start Compute With Dependencies - Schedule asynchronous evaluation of the execution with dependencies.
- ANeural
Networks ⚠Memory Desc_ addInput Role - Specify that a memory object will be playing the role of an input to an execution created from a particular compilation.
- ANeural
Networks ⚠Memory Desc_ addOutput Role - Specify that a memory object will be playing the role of an output to an execution created from a particular compilation.
- ANeural
Networks ⚠Memory Desc_ create - Create a {@link ANeuralNetworksMemoryDesc} with no properties.
- ANeural
Networks ⚠Memory Desc_ finish - Indicate that we have finished modifying a memory descriptor. Required before calling {@link ANeuralNetworksMemory_createFromDesc}.
- ANeural
Networks ⚠Memory Desc_ free - Destroy a memory descriptor.
- ANeural
Networks ⚠Memory Desc_ setDimensions - Set the dimensional information of the memory descriptor.
- ANeural
Networks ⚠Memory_ copy - Copies data from one memory object to another.
- ANeural
Networks ⚠Memory_ create FromA Hardware Buffer - Creates a shared memory object from an AHardwareBuffer handle.
- ANeural
Networks ⚠Memory_ create From Desc - Creates a memory object from a memory descriptor.
- ANeural
Networks ⚠Memory_ create From Fd - Creates a shared memory object from a file descriptor.
- ANeural
Networks ⚠Memory_ free - Delete a memory object.
- ANeural
Networks ⚠Model_ addOperand - Add an operand to a model.
- ANeural
Networks ⚠Model_ addOperation - Add an operation to a model.
- ANeural
Networks ⚠Model_ create - Create an empty {@link ANeuralNetworksModel}.
- ANeural
Networks ⚠Model_ finish - Indicate that we have finished modifying a model. Required before calling {@link ANeuralNetworksCompilation_create} and {@link ANeuralNetworksCompilation_createForDevices}.
- ANeural
Networks ⚠Model_ free - Destroy a model.
- ANeural
Networks ⚠Model_ getSupported Operations ForDevices - 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.
- ANeural
Networks ⚠Model_ identify Inputs AndOutputs - Specifies which operands will be the model’s inputs and outputs. Every model must have at least one input and one output.
- ANeural
Networks ⚠Model_ relax Computation Float32to Float16 - 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.
- ANeural
Networks ⚠Model_ setOperand Symm PerChannel Quant Params - Sets an operand’s per channel quantization parameters.
- ANeural
Networks ⚠Model_ setOperand Value - Sets an operand to a constant value.
- ANeural
Networks ⚠Model_ setOperand Value From Memory - Sets an operand to a value stored in a memory object.
- ANeural
Networks ⚠Model_ setOperand Value From Model - Sets an operand to a value that is a reference to another NNAPI model.
- ANeural
Networks_ ⚠getDefault Loop Timeout - Get the default timeout value for WHILE loops.
- ANeural
Networks_ ⚠getDevice - Get the representation of the specified device.
- ANeural
Networks_ ⚠getDevice Count - Get the number of available devices.
- ANeural
Networks_ ⚠getMaximum Loop Timeout - Get the maximum timeout value for WHILE loops.
- ANeural
Networks_ ⚠getRuntime Feature Level
Type Aliases§
- ANeural
Networks Operation Type - Device
Type Code - Device types.
- Duration
Code - Different duration measurements.
- Fuse
Code - Fused activation function types.
- Padding
Code - Implicit padding algorithms.
- Preference
Code - Execution preferences.
- Priority
Code - 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