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:
parent
7fa2309477
commit
89dd5837aa
tensorflow/lite
@ -20,6 +20,7 @@ limitations under the License.
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <gmock/gmock.h>
|
||||||
#include <gtest/gtest.h>
|
#include <gtest/gtest.h>
|
||||||
#include "tensorflow/lite/builtin_ops.h"
|
#include "tensorflow/lite/builtin_ops.h"
|
||||||
#include "tensorflow/lite/c/c_api.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/delegates/delegate_test_util.h"
|
||||||
#include "tensorflow/lite/testing/util.h"
|
#include "tensorflow/lite/testing/util.h"
|
||||||
|
|
||||||
|
using testing::HasSubstr;
|
||||||
using tflite::delegates::test_utils::TestDelegate;
|
using tflite::delegates::test_utils::TestDelegate;
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -108,9 +110,9 @@ TEST(CApiExperimentalTest, MissingBuiltin) {
|
|||||||
// Check that interpreter creation failed, because the model contain a buitin
|
// Check that interpreter creation failed, because the model contain a buitin
|
||||||
// op that wasn't supported, and that we got the expected error messages.
|
// op that wasn't supported, and that we got the expected error messages.
|
||||||
ASSERT_EQ(interpreter, nullptr);
|
ASSERT_EQ(interpreter, nullptr);
|
||||||
EXPECT_EQ(reporter.error_messages(),
|
EXPECT_THAT(
|
||||||
"Didn't find op for builtin opcode 'ADD' version '1'\n"
|
reporter.error_messages(),
|
||||||
"Registration failed.\n");
|
HasSubstr("Didn't find op for builtin opcode 'ADD' version '1'."));
|
||||||
EXPECT_EQ(reporter.num_calls(), 2);
|
EXPECT_EQ(reporter.num_calls(), 2);
|
||||||
|
|
||||||
TfLiteInterpreterDelete(interpreter);
|
TfLiteInterpreterDelete(interpreter);
|
||||||
|
@ -43,7 +43,9 @@ TfLiteStatus GetRegistrationFromOpCode(
|
|||||||
if (*registration == nullptr) {
|
if (*registration == nullptr) {
|
||||||
TF_LITE_REPORT_ERROR(
|
TF_LITE_REPORT_ERROR(
|
||||||
error_reporter,
|
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);
|
EnumNameBuiltinOperator(builtin_code), version);
|
||||||
status = kTfLiteError;
|
status = kTfLiteError;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user