Hint at the problem in the "Didn't find op for builtin opcode ... version ..." error.

PiperOrigin-RevId: 350545885
Change-Id: I18528ab009bbb6e6a30e67e683ebdb1fe3ba00d0
This commit is contained in:
A. Unique TensorFlower 2021-01-07 06:15:41 -08:00 committed by TensorFlower Gardener
parent 7fa2309477
commit 89dd5837aa
2 changed files with 8 additions and 4 deletions

View File

@ -20,6 +20,7 @@ limitations under the License.
#include <memory>
#include <vector>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "tensorflow/lite/builtin_ops.h"
#include "tensorflow/lite/c/c_api.h"
@ -27,6 +28,7 @@ limitations under the License.
#include "tensorflow/lite/delegates/delegate_test_util.h"
#include "tensorflow/lite/testing/util.h"
using testing::HasSubstr;
using tflite::delegates::test_utils::TestDelegate;
namespace {
@ -108,9 +110,9 @@ TEST(CApiExperimentalTest, MissingBuiltin) {
// Check that interpreter creation failed, because the model contain a buitin
// op that wasn't supported, and that we got the expected error messages.
ASSERT_EQ(interpreter, nullptr);
EXPECT_EQ(reporter.error_messages(),
"Didn't find op for builtin opcode 'ADD' version '1'\n"
"Registration failed.\n");
EXPECT_THAT(
reporter.error_messages(),
HasSubstr("Didn't find op for builtin opcode 'ADD' version '1'."));
EXPECT_EQ(reporter.num_calls(), 2);
TfLiteInterpreterDelete(interpreter);

View File

@ -43,7 +43,9 @@ TfLiteStatus GetRegistrationFromOpCode(
if (*registration == nullptr) {
TF_LITE_REPORT_ERROR(
error_reporter,
"Didn't find op for builtin opcode '%s' version '%d'\n",
"Didn't find op for builtin opcode '%s' version '%d'. "
"An older version of this builtin might be supported. "
"Are you using an old TFLite binary with a newer model?\n",
EnumNameBuiltinOperator(builtin_code), version);
status = kTfLiteError;
}