Warn if tf.lite.interpreter is used instead of ai-edge-litert.interpreter

PiperOrigin-RevId: 696217271
This commit is contained in:
Laura Pak 2024-11-13 11:48:34 -08:00 committed by TensorFlower Gardener
parent 0ad73f5790
commit 21dce87276
3 changed files with 11 additions and 0 deletions

View File

@ -74,6 +74,8 @@ This release contains contributions from many people at Google, as well as:
### Breaking Changes
* `tf.lite`
* Interpreter:
* `tf.lite.Interpreter` gives a deprecation warning and a redirection notice to its new location at `ai_edge_litert.interpreter`. See the [migration guide](https://ai.google.dev/edge/litert/migration) for details.
* C API:
* An optional, fourth parameter was added `TfLiteOperatorCreate` as a step forward towards a cleaner API for `TfLiteOperator`. Function `TfLiteOperatorCreate` was added recently, in TensorFlow Lite version 2.17.0, released on 7/11/2024, and we do not expect there will be much code using this function yet. Any code breakages can be easily resolved by passing nullptr as the new, 4th parameter.

View File

@ -18,6 +18,7 @@ import enum
import os
import platform
import sys
import warnings
import numpy as np
@ -40,6 +41,12 @@ else:
# pylint: enable=g-import-not-at-top
_INTERPRETER_DEPRECATION_WARNING = """\
Warning: Please use the LiteRT interpreter from the ai_edge_litert package.
See the [migration guide](https://ai.google.dev/edge/litert/migration)
for details.
"""
class Delegate:
"""Python wrapper class to manage TfLiteDelegate objects.
@ -441,6 +448,7 @@ class Interpreter:
Raises:
ValueError: If the interpreter was unable to create.
"""
warnings.warn(_INTERPRETER_DEPRECATION_WARNING)
if not hasattr(self, '_custom_op_registerers'):
self._custom_op_registerers = []

View File

@ -118,6 +118,7 @@ tf_staging/tensorflow/lite/lib_package/BUILD:
tf_staging/tensorflow/lite/model.h:
tf_staging/tensorflow/lite/model_builder.h:
tf_staging/tensorflow/lite/namespace.h:
tf_staging/tensorflow/lite/python/interpreter.py:
tf_staging/tensorflow/lite/schema/conversion_metadata_generated.h:
tf_staging/tensorflow/lite/schema/schema_generated.h:
tf_staging/tensorflow/lite/signature_runner.h: