Snap for 11526283 from ee8f5ffd3e2d42fcf8105b9a2ff0d9312f646b2d to 24Q2-release Change-Id: I2cfa9d89668119381d578119dd02ea14db4c0a88
diff --git a/runtime/include/NeuralNetworks.h b/runtime/include/NeuralNetworks.h index 4e54f85..b986e09 100644 --- a/runtime/include/NeuralNetworks.h +++ b/runtime/include/NeuralNetworks.h
@@ -51,15 +51,22 @@ #ifdef __ANDROID__ #include <android/hardware_buffer.h> +#else #endif // __ANDROID__ +#if !defined(__DEPRECATED_IN) +#define __DEPRECATED_IN(api_level) __attribute__((annotate("deprecated_in=" #api_level))) +#endif + // This is required for building libneuralnetworks_cl, // the symbols have same names as in NDK, but // they are not bounded by API availability. #ifdef NN_COMPATIBILITY_LIBRARY_BUILD #define __NNAPI_INTRODUCED_IN(x) +#define __NNAPI_DEPRECATED_IN(x) #else #define __NNAPI_INTRODUCED_IN(x) __INTRODUCED_IN(x) +#define __NNAPI_DEPRECATED_IN(x) __DEPRECATED_IN(x) #endif #ifndef __NNAPI_FL5_MIN_ANDROID_API__ @@ -87,8 +94,12 @@ * Set to NULL if unsuccessful. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -int ANeuralNetworksMemoryDesc_create(ANeuralNetworksMemoryDesc** desc) __NNAPI_INTRODUCED_IN(30); +int ANeuralNetworksMemoryDesc_create(ANeuralNetworksMemoryDesc** desc) __NNAPI_INTRODUCED_IN(30) + __NNAPI_DEPRECATED_IN(35); /** * Destroy a memory descriptor. @@ -102,8 +113,12 @@ * * @param desc The memory descriptor to be destroyed. Passing NULL is acceptable and * results in no operation. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -void ANeuralNetworksMemoryDesc_free(ANeuralNetworksMemoryDesc* desc) __NNAPI_INTRODUCED_IN(30); +void ANeuralNetworksMemoryDesc_free(ANeuralNetworksMemoryDesc* desc) __NNAPI_INTRODUCED_IN(30) + __NNAPI_DEPRECATED_IN(35); /** * Specify that a memory object will be playing the role of an input to an execution created from a @@ -146,11 +161,14 @@ * layouts. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksMemoryDesc_addInputRole(ANeuralNetworksMemoryDesc* desc, const ANeuralNetworksCompilation* compilation, uint32_t index, float frequency) - __NNAPI_INTRODUCED_IN(30); + __NNAPI_INTRODUCED_IN(30) __NNAPI_DEPRECATED_IN(35); /** * Specify that a memory object will be playing the role of an output to an execution created from a @@ -193,11 +211,14 @@ * layouts. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksMemoryDesc_addOutputRole(ANeuralNetworksMemoryDesc* desc, const ANeuralNetworksCompilation* compilation, uint32_t index, float frequency) - __NNAPI_INTRODUCED_IN(30); + __NNAPI_INTRODUCED_IN(30) __NNAPI_DEPRECATED_IN(35); /** * Set the dimensional information of the memory descriptor. @@ -221,9 +242,13 @@ * corresponding axis has an unknown size. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksMemoryDesc_setDimensions(ANeuralNetworksMemoryDesc* desc, uint32_t rank, - const uint32_t* dimensions) __NNAPI_INTRODUCED_IN(30); + const uint32_t* dimensions) __NNAPI_INTRODUCED_IN(30) + __NNAPI_DEPRECATED_IN(35); /** * Indicate that we have finished modifying a memory descriptor. Required before calling @@ -238,8 +263,12 @@ * @param desc The memory descriptor to be finished. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -int ANeuralNetworksMemoryDesc_finish(ANeuralNetworksMemoryDesc* desc) __NNAPI_INTRODUCED_IN(30); +int ANeuralNetworksMemoryDesc_finish(ANeuralNetworksMemoryDesc* desc) __NNAPI_INTRODUCED_IN(30) + __NNAPI_DEPRECATED_IN(35); /** * Creates a memory object from a memory descriptor. @@ -293,9 +322,13 @@ * @return ANEURALNETWORKS_NO_ERROR if successful; ANEURALNETWORKS_OP_FAILED if the memory is * created with unspecified dimensions or rank and it is not supported for this set of * roles. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksMemory_createFromDesc(const ANeuralNetworksMemoryDesc* desc, - ANeuralNetworksMemory** memory) __NNAPI_INTRODUCED_IN(30); + ANeuralNetworksMemory** memory) __NNAPI_INTRODUCED_IN(30) + __NNAPI_DEPRECATED_IN(35); /** * Copies data from one memory object to another. @@ -332,9 +365,12 @@ * @param dst The destination memory object. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksMemory_copy(const ANeuralNetworksMemory* src, const ANeuralNetworksMemory* dst) - __NNAPI_INTRODUCED_IN(30); + __NNAPI_INTRODUCED_IN(30) __NNAPI_DEPRECATED_IN(35); /** * Get the number of available devices. @@ -344,8 +380,12 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 3. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -int ANeuralNetworks_getDeviceCount(uint32_t* numDevices) __NNAPI_INTRODUCED_IN(29); +int ANeuralNetworks_getDeviceCount(uint32_t* numDevices) __NNAPI_INTRODUCED_IN(29) + __NNAPI_DEPRECATED_IN(35); /** * Get the representation of the specified device. @@ -359,9 +399,12 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 3. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworks_getDevice(uint32_t devIndex, ANeuralNetworksDevice** device) - __NNAPI_INTRODUCED_IN(29); + __NNAPI_INTRODUCED_IN(29) __NNAPI_DEPRECATED_IN(35); /** * Get the name of the specified device. @@ -379,9 +422,12 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 3. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksDevice_getName(const ANeuralNetworksDevice* device, const char** name) - __NNAPI_INTRODUCED_IN(29); + __NNAPI_INTRODUCED_IN(29) __NNAPI_DEPRECATED_IN(35); /** * Get the type of a given device. @@ -398,9 +444,12 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 3. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksDevice_getType(const ANeuralNetworksDevice* device, int32_t* type) - __NNAPI_INTRODUCED_IN(29); + __NNAPI_INTRODUCED_IN(29) __NNAPI_DEPRECATED_IN(35); /** * Get the version of the driver implementation of the specified device. @@ -428,9 +477,12 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 3. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksDevice_getVersion(const ANeuralNetworksDevice* device, const char** version) - __NNAPI_INTRODUCED_IN(29); + __NNAPI_INTRODUCED_IN(29) __NNAPI_DEPRECATED_IN(35); /** * Get the NNAPI feature level of the specified NNAPI device. @@ -455,9 +507,13 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 3. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksDevice_getFeatureLevel(const ANeuralNetworksDevice* device, - int64_t* featureLevel) __NNAPI_INTRODUCED_IN(29); + int64_t* featureLevel) __NNAPI_INTRODUCED_IN(29) + __NNAPI_DEPRECATED_IN(35); /** * Wait until the device is in a live state. @@ -472,8 +528,12 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 4. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -int ANeuralNetworksDevice_wait(const ANeuralNetworksDevice* device) __NNAPI_INTRODUCED_IN(30); +int ANeuralNetworksDevice_wait(const ANeuralNetworksDevice* device) __NNAPI_INTRODUCED_IN(30) + __NNAPI_DEPRECATED_IN(35); /** * Get the supported operations for a specified set of devices. If multiple devices @@ -491,10 +551,14 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 3. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksModel_getSupportedOperationsForDevices( const ANeuralNetworksModel* model, const ANeuralNetworksDevice* const* devices, - uint32_t numDevices, bool* supportedOps) __NNAPI_INTRODUCED_IN(29); + uint32_t numDevices, bool* supportedOps) __NNAPI_INTRODUCED_IN(29) + __NNAPI_DEPRECATED_IN(35); /** * Create a {@link ANeuralNetworksCompilation} to compile the given model for a specified set @@ -522,12 +586,15 @@ * if the model is invalid. * * Available since NNAPI feature level 3. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksCompilation_createForDevices(ANeuralNetworksModel* model, const ANeuralNetworksDevice* const* devices, uint32_t numDevices, ANeuralNetworksCompilation** compilation) - __NNAPI_INTRODUCED_IN(29); + __NNAPI_INTRODUCED_IN(29) __NNAPI_DEPRECATED_IN(35); /** * Sets the compilation caching signature and the cache directory. @@ -553,10 +620,13 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 3. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksCompilation_setCaching(ANeuralNetworksCompilation* compilation, const char* cacheDir, const uint8_t* token) - __NNAPI_INTRODUCED_IN(29); + __NNAPI_INTRODUCED_IN(29) __NNAPI_DEPRECATED_IN(35); /** * Schedule synchronous evaluation of the execution. @@ -596,8 +666,12 @@ * @return ANEURALNETWORKS_NO_ERROR if the execution completed normally. * ANEURALNETWORKS_UNMAPPABLE if the execution input or output memory cannot * be properly mapped. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -int ANeuralNetworksExecution_compute(ANeuralNetworksExecution* execution) __NNAPI_INTRODUCED_IN(29); +int ANeuralNetworksExecution_compute(ANeuralNetworksExecution* execution) __NNAPI_INTRODUCED_IN(29) + __NNAPI_DEPRECATED_IN(35); /** * Get the dimensional information of the specified output operand of the model of the @@ -619,10 +693,13 @@ * ANEURALNETWORKS_BAD_DATA if the index is invalid. * * Available since NNAPI feature level 3. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_getOutputOperandRank(ANeuralNetworksExecution* execution, int32_t index, uint32_t* rank) - __NNAPI_INTRODUCED_IN(29); + __NNAPI_INTRODUCED_IN(29) __NNAPI_DEPRECATED_IN(35); /** * Get the dimensional information of the specified output operand of the model of the @@ -645,10 +722,13 @@ * ANEURALNETWORKS_BAD_DATA if the index is invalid or if the target is a scalar. * * Available since NNAPI feature level 3. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_getOutputOperandDimensions(ANeuralNetworksExecution* execution, int32_t index, uint32_t* dimensions) - __NNAPI_INTRODUCED_IN(29); + __NNAPI_INTRODUCED_IN(29) __NNAPI_DEPRECATED_IN(35); /** * Create a {@link ANeuralNetworksBurst} to apply the given compilation. @@ -665,9 +745,13 @@ * * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA * if the compilation is invalid. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksBurst_create(ANeuralNetworksCompilation* compilation, - ANeuralNetworksBurst** burst) __NNAPI_INTRODUCED_IN(29); + ANeuralNetworksBurst** burst) __NNAPI_INTRODUCED_IN(29) + __NNAPI_DEPRECATED_IN(35); /** * Destroys the burst object. @@ -676,8 +760,12 @@ * * @param burst The burst object to be destroyed. Passing NULL is acceptable and * results in no operation. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -void ANeuralNetworksBurst_free(ANeuralNetworksBurst* burst) __NNAPI_INTRODUCED_IN(29); +void ANeuralNetworksBurst_free(ANeuralNetworksBurst* burst) __NNAPI_INTRODUCED_IN(29) + __NNAPI_DEPRECATED_IN(35); /** * Schedule synchronous evaluation of the execution on a burst object. @@ -722,9 +810,13 @@ * ANeuralNetworksCompilation} as the burst object. * * @return ANEURALNETWORKS_NO_ERROR if the execution completed normally. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_burstCompute(ANeuralNetworksExecution* execution, - ANeuralNetworksBurst* burst) __NNAPI_INTRODUCED_IN(29); + ANeuralNetworksBurst* burst) __NNAPI_INTRODUCED_IN(29) + __NNAPI_DEPRECATED_IN(35); /** * Creates a shared memory object from an AHardwareBuffer handle. @@ -758,11 +850,14 @@ * @return ANEURALNETWORKS_NO_ERROR if the request completed normally. * * @see AHardwareBuffer + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ #ifdef __ANDROID__ int ANeuralNetworksMemory_createFromAHardwareBuffer(const AHardwareBuffer* ahwb, ANeuralNetworksMemory** memory) - __NNAPI_INTRODUCED_IN(29); + __NNAPI_INTRODUCED_IN(29) __NNAPI_DEPRECATED_IN(35); #endif // __ANDROID__ /** @@ -789,9 +884,12 @@ * @param measure 'true' if duration is to be measured, 'false' if not. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_setMeasureTiming(ANeuralNetworksExecution* execution, bool measure) - __NNAPI_INTRODUCED_IN(29); + __NNAPI_INTRODUCED_IN(29) __NNAPI_DEPRECATED_IN(35); /** * Get the time spent in the latest computation evaluated on the specified @@ -814,10 +912,13 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 3. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_getDuration(const ANeuralNetworksExecution* execution, int32_t durationCode, uint64_t* duration) - __NNAPI_INTRODUCED_IN(29); + __NNAPI_INTRODUCED_IN(29) __NNAPI_DEPRECATED_IN(35); /** * Creates a shared memory object from a file descriptor. @@ -842,9 +943,13 @@ * Set to NULL if unsuccessful. * * @return ANEURALNETWORKS_NO_ERROR if the request completed normally. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksMemory_createFromFd(size_t size, int protect, int fd, size_t offset, - ANeuralNetworksMemory** memory) __NNAPI_INTRODUCED_IN(27); + ANeuralNetworksMemory** memory) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Delete a memory object. @@ -857,8 +962,12 @@ * * @param memory The memory object to be freed. Passing NULL is acceptable and * results in no operation. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -void ANeuralNetworksMemory_free(ANeuralNetworksMemory* memory) __NNAPI_INTRODUCED_IN(27); +void ANeuralNetworksMemory_free(ANeuralNetworksMemory* memory) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Create an empty {@link ANeuralNetworksModel}. @@ -885,8 +994,12 @@ * Set to NULL if unsuccessful. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -int ANeuralNetworksModel_create(ANeuralNetworksModel** model) __NNAPI_INTRODUCED_IN(27); +int ANeuralNetworksModel_create(ANeuralNetworksModel** model) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Destroy a model. @@ -900,8 +1013,12 @@ * * @param model The model to be destroyed. Passing NULL is acceptable and * results in no operation. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -void ANeuralNetworksModel_free(ANeuralNetworksModel* model) __NNAPI_INTRODUCED_IN(27); +void ANeuralNetworksModel_free(ANeuralNetworksModel* model) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Indicate that we have finished modifying a model. Required before @@ -920,8 +1037,12 @@ * @param model The model to be finished. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -int ANeuralNetworksModel_finish(ANeuralNetworksModel* model) __NNAPI_INTRODUCED_IN(27); +int ANeuralNetworksModel_finish(ANeuralNetworksModel* model) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Add an operand to a model. @@ -972,10 +1093,13 @@ * {@link ANeuralNetworksModel_addOperand}. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksModel_addOperand(ANeuralNetworksModel* model, const ANeuralNetworksOperandType* type) - __NNAPI_INTRODUCED_IN(27); + __NNAPI_INTRODUCED_IN(27) __NNAPI_DEPRECATED_IN(35); /** * Sets an operand to a constant value. @@ -1011,10 +1135,13 @@ * @param length The size in bytes of the data value. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksModel_setOperandValue(ANeuralNetworksModel* model, int32_t index, const void* buffer, size_t length) - __NNAPI_INTRODUCED_IN(27); + __NNAPI_INTRODUCED_IN(27) __NNAPI_DEPRECATED_IN(35); /** * Sets an operand's per channel quantization parameters. @@ -1034,10 +1161,14 @@ * this function. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksModel_setOperandSymmPerChannelQuantParams( ANeuralNetworksModel* model, int32_t index, - const ANeuralNetworksSymmPerChannelQuantParams* channelQuant) __NNAPI_INTRODUCED_IN(29); + const ANeuralNetworksSymmPerChannelQuantParams* channelQuant) __NNAPI_INTRODUCED_IN(29) + __NNAPI_DEPRECATED_IN(35); /** * Sets an operand to a value stored in a memory object. @@ -1076,11 +1207,14 @@ * @param length The size in bytes of the data value. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksModel_setOperandValueFromMemory(ANeuralNetworksModel* model, int32_t index, const ANeuralNetworksMemory* memory, size_t offset, size_t length) - __NNAPI_INTRODUCED_IN(27); + __NNAPI_INTRODUCED_IN(27) __NNAPI_DEPRECATED_IN(35); /** * Sets an operand to a value that is a reference to another NNAPI model. @@ -1106,10 +1240,13 @@ * @param value The model to be referenced. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksModel_setOperandValueFromModel(ANeuralNetworksModel* model, int32_t index, const ANeuralNetworksModel* value) - __NNAPI_INTRODUCED_IN(30); + __NNAPI_INTRODUCED_IN(30) __NNAPI_DEPRECATED_IN(35); /** * Add an operation to a model. @@ -1132,11 +1269,15 @@ * Available since NNAPI feature level 1. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksModel_addOperation(ANeuralNetworksModel* model, ANeuralNetworksOperationType type, uint32_t inputCount, const uint32_t* inputs, uint32_t outputCount, - const uint32_t* outputs) __NNAPI_INTRODUCED_IN(27); + const uint32_t* outputs) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Specifies which operands will be the model's inputs and @@ -1161,11 +1302,14 @@ * * Available since NNAPI feature level 1. * + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksModel_identifyInputsAndOutputs(ANeuralNetworksModel* model, uint32_t inputCount, const uint32_t* inputs, uint32_t outputCount, - const uint32_t* outputs) - __NNAPI_INTRODUCED_IN(27); + const uint32_t* outputs) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Specifies whether {@link ANEURALNETWORKS_TENSOR_FLOAT32} is allowed to be @@ -1191,9 +1335,12 @@ * Available since NNAPI feature level 2. * * See {@link ANeuralNetworksModel} for information on multithreaded usage. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksModel_relaxComputationFloat32toFloat16(ANeuralNetworksModel* model, bool allow) - __NNAPI_INTRODUCED_IN(28); + __NNAPI_INTRODUCED_IN(28) __NNAPI_DEPRECATED_IN(35); /** * Create a {@link ANeuralNetworksCompilation} to compile the given model. @@ -1225,10 +1372,13 @@ * * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA * if the model is invalid. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksCompilation_create(ANeuralNetworksModel* model, ANeuralNetworksCompilation** compilation) - __NNAPI_INTRODUCED_IN(27); + __NNAPI_INTRODUCED_IN(27) __NNAPI_DEPRECATED_IN(35); /** * Destroy a compilation. @@ -1242,9 +1392,12 @@ * * @param compilation The compilation to be destroyed. Passing NULL is acceptable and * results in no operation. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ void ANeuralNetworksCompilation_free(ANeuralNetworksCompilation* compilation) - __NNAPI_INTRODUCED_IN(27); + __NNAPI_INTRODUCED_IN(27) __NNAPI_DEPRECATED_IN(35); /** * Sets the execution preference. @@ -1262,9 +1415,13 @@ * {@link ANEURALNETWORKS_PREFER_SUSTAINED_SPEED}. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksCompilation_setPreference(ANeuralNetworksCompilation* compilation, - int32_t preference) __NNAPI_INTRODUCED_IN(27); + int32_t preference) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Indicate that we have finished modifying a compilation. Required before @@ -1288,9 +1445,12 @@ * @param compilation The compilation to be finished. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksCompilation_finish(ANeuralNetworksCompilation* compilation) - __NNAPI_INTRODUCED_IN(27); + __NNAPI_INTRODUCED_IN(27) __NNAPI_DEPRECATED_IN(35); /** * Set the execution priority. @@ -1314,9 +1474,12 @@ * ANEURALNETWORKS_PRIORITY_*. * * @return ANEURALNETWORKS_NO_ERROR if successful. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksCompilation_setPriority(ANeuralNetworksCompilation* compilation, int priority) - __NNAPI_INTRODUCED_IN(30); + __NNAPI_INTRODUCED_IN(30) __NNAPI_DEPRECATED_IN(35); /** * Set the maximum expected duration for compiling the model. @@ -1357,9 +1520,13 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 4. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksCompilation_setTimeout(ANeuralNetworksCompilation* compilation, - uint64_t duration) __NNAPI_INTRODUCED_IN(30); + uint64_t duration) __NNAPI_INTRODUCED_IN(30) + __NNAPI_DEPRECATED_IN(35); /** * Create a {@link ANeuralNetworksExecution} to apply the given compilation. @@ -1380,9 +1547,13 @@ * * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA * if the compilation is invalid. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_create(ANeuralNetworksCompilation* compilation, - ANeuralNetworksExecution** execution) __NNAPI_INTRODUCED_IN(27); + ANeuralNetworksExecution** execution) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Destroy an execution. @@ -1404,8 +1575,12 @@ * * @param execution The execution to be destroyed. Passing NULL is acceptable and * results in no operation. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -void ANeuralNetworksExecution_free(ANeuralNetworksExecution* execution) __NNAPI_INTRODUCED_IN(27); +void ANeuralNetworksExecution_free(ANeuralNetworksExecution* execution) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Associate a user buffer with an input of the model of the @@ -1462,10 +1637,14 @@ * * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if the * name is not recognized or the buffer is too small for the input. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_setInput(ANeuralNetworksExecution* execution, int32_t index, const ANeuralNetworksOperandType* type, const void* buffer, - size_t length) __NNAPI_INTRODUCED_IN(27); + size_t length) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Associate a region of a memory object with an input of the model of the @@ -1532,11 +1711,15 @@ * * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if the * name is not recognized or the buffer is too small for the input. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_setInputFromMemory(ANeuralNetworksExecution* execution, int32_t index, const ANeuralNetworksOperandType* type, const ANeuralNetworksMemory* memory, size_t offset, - size_t length) __NNAPI_INTRODUCED_IN(27); + size_t length) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Associate a user buffer with an output of the model of the @@ -1597,10 +1780,14 @@ * * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if the * name is not recognized or the buffer is too small for the output. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_setOutput(ANeuralNetworksExecution* execution, int32_t index, const ANeuralNetworksOperandType* type, void* buffer, - size_t length) __NNAPI_INTRODUCED_IN(27); + size_t length) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Associate a region of a memory object with an output of the model of the @@ -1672,11 +1859,15 @@ * * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if the * name is not recognized or the buffer is too small for the output. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_setOutputFromMemory(ANeuralNetworksExecution* execution, int32_t index, const ANeuralNetworksOperandType* type, const ANeuralNetworksMemory* memory, size_t offset, - size_t length) __NNAPI_INTRODUCED_IN(27); + size_t length) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Schedule asynchronous evaluation of the execution. @@ -1729,9 +1920,13 @@ * NULL if there's an error. * * @return ANEURALNETWORKS_NO_ERROR if the evaluation is successfully scheduled. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_startCompute(ANeuralNetworksExecution* execution, - ANeuralNetworksEvent** event) __NNAPI_INTRODUCED_IN(27); + ANeuralNetworksEvent** event) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Set the maximum expected duration of the specified execution. @@ -1778,9 +1973,12 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 4. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_setTimeout(ANeuralNetworksExecution* execution, uint64_t duration) - __NNAPI_INTRODUCED_IN(30); + __NNAPI_INTRODUCED_IN(30) __NNAPI_DEPRECATED_IN(35); /** * Set the maximum duration of WHILE loops in the specified execution. @@ -1809,9 +2007,12 @@ * ANEURALNETWORKS_UNEXPECTED_NULL if execution is NULL. * * Available since NNAPI feature level 4. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_setLoopTimeout(ANeuralNetworksExecution* execution, uint64_t duration) - __NNAPI_INTRODUCED_IN(30); + __NNAPI_INTRODUCED_IN(30) __NNAPI_DEPRECATED_IN(35); /** * Get the default timeout value for WHILE loops. @@ -1819,8 +2020,12 @@ * @return The default timeout value in nanoseconds. * * Available since NNAPI feature level 4. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -uint64_t ANeuralNetworks_getDefaultLoopTimeout() __NNAPI_INTRODUCED_IN(30); +uint64_t ANeuralNetworks_getDefaultLoopTimeout() __NNAPI_INTRODUCED_IN(30) + __NNAPI_DEPRECATED_IN(35); /** * Get the maximum timeout value for WHILE loops. @@ -1828,8 +2033,12 @@ * @return The maximum timeout value in nanoseconds. * * Available since NNAPI feature level 4. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -uint64_t ANeuralNetworks_getMaximumLoopTimeout() __NNAPI_INTRODUCED_IN(30); +uint64_t ANeuralNetworks_getMaximumLoopTimeout() __NNAPI_INTRODUCED_IN(30) + __NNAPI_DEPRECATED_IN(35); /** * Waits until the execution completes. @@ -1855,8 +2064,12 @@ * @return ANEURALNETWORKS_NO_ERROR if the execution completed normally. * ANEURALNETWORKS_UNMAPPABLE if the execution input or output memory cannot * be properly mapped. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -int ANeuralNetworksEvent_wait(ANeuralNetworksEvent* event) __NNAPI_INTRODUCED_IN(27); +int ANeuralNetworksEvent_wait(ANeuralNetworksEvent* event) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Destroys the event. @@ -1867,8 +2080,12 @@ * * @param event The event object to be destroyed. Passing NULL is acceptable and * results in no operation. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -void ANeuralNetworksEvent_free(ANeuralNetworksEvent* event) __NNAPI_INTRODUCED_IN(27); +void ANeuralNetworksEvent_free(ANeuralNetworksEvent* event) __NNAPI_INTRODUCED_IN(27) + __NNAPI_DEPRECATED_IN(35); /** * Create a {@link ANeuralNetworksEvent} from a sync_fence file descriptor. @@ -1882,9 +2099,12 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 4. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksEvent_createFromSyncFenceFd(int sync_fence_fd, ANeuralNetworksEvent** event) - __NNAPI_INTRODUCED_IN(30); + __NNAPI_INTRODUCED_IN(30) __NNAPI_DEPRECATED_IN(35); /** * Get sync_fence file descriptor from the event. @@ -1906,9 +2126,12 @@ * @return ANEURALNETWORKS_NO_ERROR if successful. * * Available since NNAPI feature level 4. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksEvent_getSyncFenceFd(const ANeuralNetworksEvent* event, int* sync_fence_fd) - __NNAPI_INTRODUCED_IN(30); + __NNAPI_INTRODUCED_IN(30) __NNAPI_DEPRECATED_IN(35); /** * Schedule asynchronous evaluation of the execution with dependencies. @@ -1985,11 +2208,14 @@ * @return ANEURALNETWORKS_NO_ERROR if the evaluation is successfully scheduled. * * Available since NNAPI feature level 4. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_startComputeWithDependencies( ANeuralNetworksExecution* execution, const ANeuralNetworksEvent* const* dependencies, uint32_t num_dependencies, uint64_t duration, ANeuralNetworksEvent** event) - __NNAPI_INTRODUCED_IN(30); + __NNAPI_INTRODUCED_IN(30) __NNAPI_DEPRECATED_IN(35); /** * Get the NNAPI runtime feature level. @@ -2025,8 +2251,12 @@ * It is NOT an Android API level. * * Available since NNAPI feature level 5. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ -int64_t ANeuralNetworks_getRuntimeFeatureLevel() __NNAPI_INTRODUCED_IN(31); +int64_t ANeuralNetworks_getRuntimeFeatureLevel() __NNAPI_INTRODUCED_IN(31) + __NNAPI_DEPRECATED_IN(35); /** * Specifies whether the {@link ANeuralNetworksExecution} is able to accept padded input and output @@ -2061,9 +2291,13 @@ * {@link ANeuralNetworksExecution_setOutputFromMemory} has been called on the execution. * * Available since NNAPI feature level 5. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_enableInputAndOutputPadding(ANeuralNetworksExecution* execution, - bool enable) __NNAPI_INTRODUCED_IN(31); + bool enable) __NNAPI_INTRODUCED_IN(31) + __NNAPI_DEPRECATED_IN(35); /** * Get the preferred buffer and memory alignment of an input to an execution created from a @@ -2092,10 +2326,13 @@ * ANEURALNETWORKS_BAD_DATA if the index is out of range. * * Available since NNAPI feature level 5. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksCompilation_getPreferredMemoryAlignmentForInput( const ANeuralNetworksCompilation* compilation, uint32_t index, uint32_t* alignment) - __NNAPI_INTRODUCED_IN(31); + __NNAPI_INTRODUCED_IN(31) __NNAPI_DEPRECATED_IN(35); /** * Get the preferred buffer and memory end padding of an input to an execution created from a @@ -2130,10 +2367,13 @@ * ANEURALNETWORKS_BAD_DATA if the index is out of range. * * Available since NNAPI feature level 5. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksCompilation_getPreferredMemoryPaddingForInput( const ANeuralNetworksCompilation* compilation, uint32_t index, uint32_t* padding) - __NNAPI_INTRODUCED_IN(31); + __NNAPI_INTRODUCED_IN(31) __NNAPI_DEPRECATED_IN(35); /** * Get the preferred buffer and memory alignment of an output to an execution created from a @@ -2162,10 +2402,13 @@ * ANEURALNETWORKS_BAD_DATA if the index is out of range. * * Available since NNAPI feature level 5. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksCompilation_getPreferredMemoryAlignmentForOutput( const ANeuralNetworksCompilation* compilation, uint32_t index, uint32_t* alignment) - __NNAPI_INTRODUCED_IN(31); + __NNAPI_INTRODUCED_IN(31) __NNAPI_DEPRECATED_IN(35); /** * Get the preferred memory end padding of an output to an execution created from a particular @@ -2200,10 +2443,13 @@ * ANEURALNETWORKS_BAD_DATA if the index is out of range. * * Available since NNAPI feature level 5. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksCompilation_getPreferredMemoryPaddingForOutput( const ANeuralNetworksCompilation* compilation, uint32_t index, uint32_t* padding) - __NNAPI_INTRODUCED_IN(31); + __NNAPI_INTRODUCED_IN(31) __NNAPI_DEPRECATED_IN(35); /** * Specifies whether the {@link ANeuralNetworksExecution} can be reused for multiple computations. @@ -2229,9 +2475,12 @@ * ANEURALNETWORKS_BAD_STATE if the execution is not in the preparation state. * * Available since NNAPI feature level 5. + * @deprecated NNAPI is deprecated. See + * <a href="https://developer.android.com/ndk/guides/neuralnetworks">this webpage</a> + * for more details. */ int ANeuralNetworksExecution_setReusable(ANeuralNetworksExecution* execution, bool reusable) - __NNAPI_INTRODUCED_IN(31); + __NNAPI_INTRODUCED_IN(31) __NNAPI_DEPRECATED_IN(35); __END_DECLS