Stop support of --use_legacy_nnapi in the benchmark tool as Interpreter:UseNNAPI(bool) is marked deprecated now. Instead, use "--use_nnapi" and other NNAPI options.

PiperOrigin-RevId: 325748539
Change-Id: Ie2c1c4ac3054239e9355b85092020ed36f06f0ff
This commit is contained in:
Chao Mei 2020-08-09 23:59:01 -07:00 committed by TensorFlower Gardener
parent fc11ea4eec
commit fe968502a9
3 changed files with 2 additions and 17 deletions

View File

@ -113,7 +113,7 @@ Interpreter::Interpreter(ErrorReporter* error_reporter)
external_contexts_[kTfLiteCpuBackendContext] =
own_external_cpu_backend_context_.get();
UseNNAPI(false);
primary_subgraph().UseNNAPI(false);
}
Interpreter::~Interpreter() {

View File

@ -34,13 +34,6 @@ and the following optional parameters:
* `run_delay`: `float` (default=-1.0) \
The delay in seconds between subsequent benchmark runs. Non-positive values
mean use no delay.
* `use_legacy_nnapi`: `bool` (default=false) \
Whether to use the legacy
[Android NNAPI](https://developer.android.com/ndk/guides/neuralnetworks/)
TFLite path, which requires the graph to be fully compatible with NNAPI.
This is available on recent Android devices. Note that some Android P
devices will fail to use NNAPI for models in `/data/local/tmp/` and this
benchmark tool will not correctly use NNAPI.
* `enable_op_profiling`: `bool` (default=false) \
Whether to enable per-operator profiling measurement.
* `enable_platform_tracing`: `bool` (default=false) \
@ -65,8 +58,7 @@ The following simply lists the names of these parameters and additional notes
where applicable. For details about each parameter, please refer to
[this page](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/tools/delegates/README.md#tflite-delegate-registrar).
#### Common parameters
* `max_delegated_partitions`: `int` (default=0) \
Note when `use_legacy_nnapi` is selected, this parameter won't work.
* `max_delegated_partitions`: `int` (default=0)
* `min_nodes_per_partition`:`int` (default=0)
#### GPU delegate

View File

@ -259,8 +259,6 @@ BenchmarkParams BenchmarkTfLiteModel::DefaultParams() {
BenchmarkParam::Create<std::string>(""));
default_params.AddParam("input_layer_value_files",
BenchmarkParam::Create<std::string>(""));
default_params.AddParam("use_legacy_nnapi",
BenchmarkParam::Create<bool>(false));
default_params.AddParam("allow_fp16", BenchmarkParam::Create<bool>(false));
default_params.AddParam("require_full_delegation",
BenchmarkParam::Create<bool>(false));
@ -324,7 +322,6 @@ std::vector<Flag> BenchmarkTfLiteModel::GetFlags() {
"input_layer_value_range of the input_name will be ignored. The file "
"format is binary and it should be array format or null separated "
"strings format."),
CreateFlag<bool>("use_legacy_nnapi", &params_, "use legacy nnapi api"),
CreateFlag<bool>("allow_fp16", &params_, "allow fp16"),
CreateFlag<bool>("require_full_delegation", &params_,
"require delegate to run the entire graph"),
@ -363,9 +360,6 @@ void BenchmarkTfLiteModel::LogParams() {
LOG_BENCHMARK_PARAM(std::string, "input_layer_value_files",
"Input value files", verbose);
#if defined(__ANDROID__)
LOG_BENCHMARK_PARAM(bool, "use_legacy_nnapi", "Use legacy nnapi", verbose);
#endif
LOG_BENCHMARK_PARAM(bool, "allow_fp16", "Allow fp16", verbose);
LOG_BENCHMARK_PARAM(bool, "require_full_delegation",
"Require full delegation", verbose);
@ -635,7 +629,6 @@ TfLiteStatus BenchmarkTfLiteModel::Init() {
profiling_listener_ = MayCreateProfilingListener();
if (profiling_listener_) AddListener(profiling_listener_.get());
interpreter_->UseNNAPI(params_.Get<bool>("use_legacy_nnapi"));
interpreter_->SetAllowFp16PrecisionForFp32(params_.Get<bool>("allow_fp16"));
owned_delegates_.clear();