From: Andrew Selle Date: Tue, 13 Feb 2018 20:24:02 +0000 (-0800) Subject: Fix bug in populating the execution plan sent to the delegate. X-Git-Tag: upstream/v1.7.0~31^2~738 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a3496e14f7ca0f77b804b5be87cd43f919a7c09f;p=platform%2Fupstream%2Ftensorflow.git Fix bug in populating the execution plan sent to the delegate. - memcpy was missing the array size. - modified the unit test to verify that the execution plan is trivial on first delegate invocation. PiperOrigin-RevId: 185569606 --- diff --git a/tensorflow/contrib/lite/interpreter.cc b/tensorflow/contrib/lite/interpreter.cc index 6dea4e5..0284492 100644 --- a/tensorflow/contrib/lite/interpreter.cc +++ b/tensorflow/contrib/lite/interpreter.cc @@ -166,7 +166,7 @@ TfLiteStatus Interpreter::GetExecutionPlan(TfLiteIntArray** execution_plan) { static_assert(sizeof(plan_cache_->data[0]) == sizeof(execution_plan_[0]), "TfLiteIntArray and execution_plan do not contain same type."); memcpy(plan_cache_->data, execution_plan_.data(), - sizeof(plan_cache_->data[0])); + sizeof(plan_cache_->data[0]) * execution_plan_.size()); return kTfLiteOk; } diff --git a/tensorflow/contrib/lite/interpreter_test.cc b/tensorflow/contrib/lite/interpreter_test.cc index 4b30974..28c96e5 100644 --- a/tensorflow/contrib/lite/interpreter_test.cc +++ b/tensorflow/contrib/lite/interpreter_test.cc @@ -773,6 +773,8 @@ class TestDelegate : public ::testing::Test { for (int exec_index = 0; exec_index < execution_plan->size; exec_index++) { int node_index = execution_plan->data[exec_index]; + // Check that we are an identity map to start. + TFLITE_CHECK_EQ(exec_index, node_index); TfLiteNode* node; TfLiteRegistration* reg; context->GetNodeAndRegistration(context, node_index, &node, ®);