benchmark_model provides thread number to CpuBackendContext when using caching

PiperOrigin-RevId: 316135815
Change-Id: Id044cdc4a627d881b2e4b84ded696f488f7de6a8
This commit is contained in:
T.J. Alumbaugh 2020-06-12 10:59:00 -07:00 committed by TensorFlower Gardener
parent 76e45e9c05
commit b1be337088

View File

@ -613,6 +613,7 @@ TfLiteStatus BenchmarkTfLiteModel::InitInterpreter() {
std::unique_ptr<tflite::CpuBackendContext> cpu_backend_context(
new tflite::CpuBackendContext());
cpu_backend_context->SetUseCaching(true);
cpu_backend_context->SetMaxNumThreads(num_threads);
external_context_->set_internal_backend_context(
std::move(cpu_backend_context));
interpreter_->SetExternalContext(kTfLiteCpuBackendContext,