diff options
author | 2018-07-09 15:51:18 -0700 | |
---|---|---|
committer | 2018-07-09 15:54:45 -0700 | |
commit | bc2674d09efbd87ae81ae41b81f1d152f37fac2a (patch) | |
tree | 03682ab97190210cb3426d0957fe1c1e76ad7648 /tensorflow/contrib/lite/nnapi_delegate.cc | |
parent | 3eb314bbcdc6e850eefc21c7ecbd91e28bd04a70 (diff) |
Add NNAPI transpose op support
PiperOrigin-RevId: 203845358
Diffstat (limited to 'tensorflow/contrib/lite/nnapi_delegate.cc')
-rw-r--r-- | tensorflow/contrib/lite/nnapi_delegate.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/tensorflow/contrib/lite/nnapi_delegate.cc b/tensorflow/contrib/lite/nnapi_delegate.cc index 905c0919cb..85279ba48e 100644 --- a/tensorflow/contrib/lite/nnapi_delegate.cc +++ b/tensorflow/contrib/lite/nnapi_delegate.cc @@ -548,6 +548,18 @@ TfLiteStatus AddOpsAndParams( add_squeeze_params(node.builtin_data); nn_op_type = ANEURALNETWORKS_SQUEEZE; break; + case tflite::BuiltinOperator_TRANSPOSE: + // The permutation input tensor value dictates the output dimensions. + // TODO(b/110888333): Support dynamically-sized tensors in delegates. + if ((node.inputs->size > 1) && + (interpreter->tensor(node.inputs->data[1])->allocation_type != + kTfLiteMmapRo)) { + logError("NNAPI does not yet support dynamic tensors."); + return kTfLiteError; + } + nnapi_version = 11; // require NNAPI 1.1 + nn_op_type = ANEURALNETWORKS_TRANSPOSE; + break; case tflite::BuiltinOperator_CONCAT_EMBEDDINGS: case tflite::BuiltinOperator_LSH_PROJECTION: case tflite::BuiltinOperator_HASHTABLE_LOOKUP: @@ -567,7 +579,6 @@ TfLiteStatus AddOpsAndParams( case tflite::BuiltinOperator_SPACE_TO_BATCH_ND: case tflite::BuiltinOperator_BATCH_TO_SPACE_ND: case tflite::BuiltinOperator_TOPK_V2: - case tflite::BuiltinOperator_TRANSPOSE: case tflite::BuiltinOperator_SPLIT: case tflite::BuiltinOperator_STRIDED_SLICE: case tflite::BuiltinOperator_EXP: |