Commit Graph

87 Commits

Author SHA1 Message Date
A. Unique TensorFlower
976ed7aa4a Added dlerror() error message to log.
This can provide more information when libneuralnetworks.so cannot be loaded successfully.

PiperOrigin-RevId: 336185850
Change-Id: I3cd03e2d96ff1eb216e89346f7e0186fd231cee5
2020-10-08 16:26:53 -07:00
Fergus Henderson
80035c4f25 Document the meaning of the return values for
ANeuralNetworksModel_relaxComputationFloat32toFloat16 and
ANeuralNetworksModel_identifyInputsAndOutputs.

PiperOrigin-RevId: 333756261
Change-Id: I41d409d80f7abe3bb50a271f6d0853775404a142
2020-09-25 10:15:48 -07:00
A. Unique TensorFlower
f5cb94eae2 Changes excluded by Copybara
PiperOrigin-RevId: 328408665
Change-Id: I86fb74f6eac377afeca2b65df067352dc17e0168
2020-08-25 14:55:59 -07:00
A. Unique TensorFlower
5713534484 add 1.3 NNAPI DurationCode.
PiperOrigin-RevId: 323643227
Change-Id: Ic1bb76e5ed9aab3318451ff99915b250b9742841
2020-07-28 13:48:26 -07:00
A. Unique TensorFlower
8d4711c52d Ensure each call to ASharedMemory_create produces a unique memory space.
The non-android ASharedMemory_create has a bug, where if two calls to create memory regions use the same 'name', they will be mapped to the to same /dev/shm file and trip over each other (particularly if they're different sizes).

PiperOrigin-RevId: 322945710
Change-Id: I103e385a2a82addf46f19188dd63baa6818db96d
2020-07-24 00:00:54 -07:00
A. Unique TensorFlower
803ce808dd The non-android ASharedMemory_create has a bug, where if two calls to create memory regions use the same 'name', they will be mapped to the to same /dev/shm file and trip over each other (particularly if they're different sizes).
This CL ensures that each created memory region is unique.

PiperOrigin-RevId: 322628204
Change-Id: I13b3b59cd87107844dcdbb26ed86f337c761d94f
2020-07-22 12:21:58 -07:00
A. Unique TensorFlower
23f6e460f3 The non-android ASharedMemory_create has a bug, where if two calls to create memory regions use the same 'name', they will be mapped to the to same /dev/shm file and trip over each other (particularly if they're different sizes).
This CL ensures that each created memory region is unique.

PiperOrigin-RevId: 322593774
Change-Id: Ib1137045604955871dd2e33aae8205275201d4b1
2020-07-22 09:50:16 -07:00
A. Unique TensorFlower
2fd3f75f05 nnapi: set android_sdk_version for non-Android platforms
When running on Linux where libneuralnetworks.so is available, set the
android_sdk_version to match the loaded libneuralnetworks.so.

This change will allow Tensorflow to use NNAPI in ChromeOS.

PiperOrigin-RevId: 322073469
Change-Id: Ica6ee5f00ead5a547e5a19f9b7001266a4d09f70
2020-07-19 21:04:36 -07:00
A. Unique TensorFlower
a75311073d Load the sync fence / dependency functions in the neuralnetworks shim layer
PiperOrigin-RevId: 319855345
Change-Id: I6e57d9a643a18cb53024eb3b8ee1c4138324c3e5
2020-07-06 14:44:30 -07:00
Lev Proleev
e071e66f03 Add support for TENSOR_QUANT8_ASYMM_SIGNED in NNAPI delegate
PiperOrigin-RevId: 317846923
Change-Id: I1c61f53e89228cd2482435e9255e390864bd83e3
2020-06-23 05:46:05 -07:00
A. Unique TensorFlower
8019570ea0 load nnapi 1.3 memory domain functions in shim layer.
PiperOrigin-RevId: 316755954
Change-Id: If4fc4a7c1001e4b47479531914d2631ee2e31fcd
2020-06-16 14:24:22 -07:00
A. Unique TensorFlower
cfb6d217c9 Implement NNAPI QoS APIs in NNAPI delegate.
PiperOrigin-RevId: 311804298
Change-Id: Ia018050ca90fbc2cc12f363b5bc52727734e4abf
2020-05-15 14:44:31 -07:00
Lev Proleev
9cb8d45b72 Add NNAPI delegate support for Elu
PiperOrigin-RevId: 311772163
Change-Id: I94393872c9afa25aafc2fc55f688d47caa57ed14
2020-05-15 11:47:09 -07:00
A. Unique TensorFlower
9068396144 Add newly added NNAPI error codes
PiperOrigin-RevId: 307416344
Change-Id: I7504d0c53cc8004e4dc8d6100f93e1756e78b0d9
2020-04-20 09:40:38 -07:00
Stefano Galarraga
6e38f2672b Fix model delegation failure when accelerator name is specified for NNAPI version < 1.2
Before NNAPI 1.2 it was not possible to query drivers for their supported operation. thus the delegate was returning error when calling the GetNodesSupportedByAccelerator function.

With the fix the check for supported operation is done only if the current NNAPI version is at least 1.2.

PiperOrigin-RevId: 304343270
Change-Id: I090a4ec6dbb62919b2edc681fc011329eb14a668
2020-04-02 00:33:43 -07:00
Jared Duke
6860e7fb66 Disable NNAPI on nacl
Also refactor NNAPI build rules to rely on a single
gate for support checking.

PiperOrigin-RevId: 304035383
Change-Id: I9192efe27a320a4a60a05e86f4f3cad896cb9842
2020-03-31 13:36:26 -07:00
Stefano Galarraga
5fc618af50 Allow Injection of NnApi in NnApiDelegateKernel instead of referencing singleton NnApiInstance()
PiperOrigin-RevId: 293825692
Change-Id: Iefdd2eaa48df85ca3c4692bd7231ff00d3e93563
2020-02-07 09:12:59 -08:00
Stefano Galarraga
1a7cdfedc0 Limit delegated ops to actually supported ones if a device name is specified or NNAPI CPU Fallback is disabled.
PiperOrigin-RevId: 292171790
Change-Id: I2e8e75ba20b4bc1ed286543b23739c4d7f0d6561
2020-01-29 11:13:20 -08:00
Stefano Galarraga
73675deef7 Limit delegated ops to actually supported ones if a device name is specified or NNAPI CPU Fallback is disabled.
PiperOrigin-RevId: 291979150
Change-Id: I380d4a879e4ae009cafe41925334608206257e9c
2020-01-28 11:40:08 -08:00
Stefano Galarraga
8f9ecf6dd2 Limit delegated ops to actually supported ones if a device name is specified or NNAPI CPU Fallback is disabled.
PiperOrigin-RevId: 291957162
Change-Id: I3dd084818eaea0fc7f8332bd162ba30519a07c68
2020-01-28 10:13:58 -08:00
Stefano Galarraga
ca9b58dfcf Restoring change: If a target accelerator is specified, use its feature level to determine operations to delegate instead of SDK version.
PiperOrigin-RevId: 290573620
Change-Id: I4d87331932c9ff993ec65102e2ac72a68fbbed62
2020-01-20 01:14:18 -08:00
A. Unique TensorFlower
6279f81181 If a target accelerator is specified, use its feature level to determine operations to delegate instead of SDK version.
PiperOrigin-RevId: 289862790
Change-Id: I3b6c82d735fb884a1e9822f67b50fc4804462657
2020-01-15 08:23:11 -08:00
Stefano Galarraga
75e5afd100 If a target accelerator is specified, use its feature level to determine operations to delegate instead of SDK version.
PiperOrigin-RevId: 289853984
Change-Id: Ic482388cd9a15855d4347375f263213fd3e90eaf
2020-01-15 07:28:35 -08:00
A. Unique TensorFlower
ba75d7bb7a Add NNAPI Vendor Extension support in TFLite.
PiperOrigin-RevId: 288298764
Change-Id: I80a735b9912ea70521a118ca51885b7fbe86f53f
2020-01-06 07:43:59 -08:00
Stefano Galarraga
993c3f5545 Refactors NnApiMock to extract a class to be used to do failure injection on NNAPI in native tests
PiperOrigin-RevId: 285772507
Change-Id: If71fda67779695bc0dff1ef3347540c2e00c8554
2019-12-16 08:01:14 -08:00
Stefano Galarraga
d0e55241d5 Add details about failed NNAPI operation when logging NNAPI errors. It also Converts the error code into the associated NNAPI constant name.
PiperOrigin-RevId: 284149818
Change-Id: I3b6be19b93b40ada764c2edcd661c86619b9b830
2019-12-06 02:50:39 -08:00
Smit Hinsu
f155050032 Refactors NnApiMock to extract a class to be used to do failure injection on NNAPI in native tests
PiperOrigin-RevId: 283959245
Change-Id: I3210136453c025b2d09b9aa16cab86d7e424cfb7
2019-12-05 06:12:11 -08:00
Stefano Galarraga
8c34a9bd06 Refactors NnApiMock to extract a class to be used to do failure injection on NNAPI in native tests
PiperOrigin-RevId: 282951257
Change-Id: Ib6bee9bdf54c43de98b6d85fd855f786cb85c064
2019-11-28 09:08:41 -08:00
Jared Duke
4ce6a9b7a4 Rename lite/c/c_api_internal.h to lite/c/common.h
The C types in lite/c/c_api_internal.h are not actually internal,
rather, they are common types used throughout the C++ and C APIs.
Rename the header accordingly.

PiperOrigin-RevId: 282494601
Change-Id: Ia784f35724d774db256ffcbbcdc5bb00e6574417
2019-11-25 21:49:25 -08:00
Tyler Davis
a1a5f93073 Modify TF Lite benchmark to print names of available NNAPI accelerators when --use_nnapi=true
PiperOrigin-RevId: 266040746
2019-08-28 18:47:51 -07:00
A. Unique TensorFlower
33bef71947 Remove nomac tag from nnapi_implementation_test.
PiperOrigin-RevId: 262431466
2019-08-08 15:23:27 -07:00
A. Unique TensorFlower
f71f815048 Mock ASharedMemory_create on non-Android platforms only if NNAPI is loaded
This ensures identical behaviour on platforms which use full
nnapi_implementation.cc, but don't have libneuralnetworks.so library, and
platforms which use nnapi_implementation_disabled.cc stub.

PiperOrigin-RevId: 262387219
2019-08-08 11:15:39 -07:00
Anna R
eaa1efbd5f Add nomac tag to nnapi_implementation_test.
PiperOrigin-RevId: 262215144
2019-08-07 15:08:58 -07:00
A. Unique TensorFlower
34e8c0974e Exclude Android NN API-related sources and flags from iOS, Mac, and Emscripten builds
PiperOrigin-RevId: 261192756
2019-08-01 14:23:09 -07:00
Lev Proleev
4902e6bf68 Add transpose conv support to the NNAPI delegate
PiperOrigin-RevId: 260909964
2019-07-31 05:57:25 -07:00
A. Unique TensorFlower
795550490c Support new quantization scheme in NNAPI delegate
PiperOrigin-RevId: 260601716
2019-07-29 17:36:31 -07:00
Stefano Galarraga
1ffdcbe96a Add delegate support for QUANTIZED_16BIT_LSTM
PiperOrigin-RevId: 259914993
2019-07-25 03:19:35 -07:00
A. Unique TensorFlower
fa5fc003b5 Add REDUCE_* support to the NNAPI delegate
Also update LSH_PROJECTION to properly support sparse projection on Q+.
And add check for quantization parameter for MEAN.

PiperOrigin-RevId: 259842530
2019-07-24 16:50:48 -07:00
Stefano Galarraga
0b3c5ea103 Add delegate support for QUANTIZE
PiperOrigin-RevId: 258730901
2019-07-18 02:24:54 -07:00
A. Unique TensorFlower
323564b496 Add cast op support to the NNAPI delegate
PiperOrigin-RevId: 257774029
2019-07-12 03:27:12 -07:00
A. Unique TensorFlower
d20fe0b898 Add LogSoftMax support to NN API delegate
PiperOrigin-RevId: 257421456
2019-07-10 10:03:11 -07:00
A. Unique TensorFlower
8c6f59784d Add slice op support to the NNAPI delegate
PiperOrigin-RevId: 256537434
2019-07-04 06:04:42 -07:00
Jared Duke
a18d0fc601 Add split support to the NNAPI delegate
PiperOrigin-RevId: 256448757
2019-07-03 18:04:55 -07:00
A. Unique TensorFlower
82b4538721 Added support for ArgMin and ArgMax.
PiperOrigin-RevId: 256416647
2019-07-03 16:59:32 -07:00
A. Unique TensorFlower
1979135fb7 Add POW op support to the NNAPI delegate
PiperOrigin-RevId: 256183546
2019-07-02 10:02:21 -07:00
A. Unique TensorFlower
1d1a7a3425 Add unidirectional sequence LSTM support to the NNAPI delegate
PiperOrigin-RevId: 256164309
2019-07-02 08:02:06 -07:00
A. Unique TensorFlower
4bba3f261c Add NEG op support to the NNAPI delegate
PiperOrigin-RevId: 255608794
2019-06-28 08:58:20 -07:00
A. Unique TensorFlower
d97ccf68c9 Add EXPAND_DIMS support to NN API delegate
PiperOrigin-RevId: 255578517
2019-06-28 04:31:01 -07:00
Jared Duke
63a8584bee Add select support to the NNAPI delegate
PiperOrigin-RevId: 255453180
2019-06-27 14:51:42 -07:00
A. Unique TensorFlower
ff9bb17674 Add proper support for per-channel quantized operations and int8 input / output tensors.
Also Update the tests to use the correct quantization parameters.

PiperOrigin-RevId: 255265635
2019-06-26 17:31:36 -07:00