Shim tflm_runtime.py to not break existing code after #2030 (#2032) BUG=http://b/286456378
diff --git a/tensorflow/lite/micro/examples/recipes/resource_variables_test.py b/tensorflow/lite/micro/examples/recipes/resource_variables_test.py index c2ec582..ad8c79e 100644 --- a/tensorflow/lite/micro/examples/recipes/resource_variables_test.py +++ b/tensorflow/lite/micro/examples/recipes/resource_variables_test.py
@@ -17,7 +17,10 @@ from tensorflow.python.framework import test_util from tensorflow.python.platform import test from tflite_micro.tensorflow.lite.micro.examples.recipes import resource_variables_lib -from tflite_micro.tensorflow.lite.micro.python.interpreter.src import runtime + +# TODO(b/286456378): change tflm_runtime to runtime when we all other usage has +# been updated. +from tflite_micro.tensorflow.lite.micro.python.interpreter.src import tflm_runtime class ResourceVariablesTest(test_util.TensorFlowTestCase): @@ -27,7 +30,7 @@ # (variable value), to be accumulated by 5.0 each invoke. def test_resource_variables_model(self): model_keras = resource_variables_lib.get_model_from_keras() - tflm_interpreter = runtime.Interpreter.from_bytes(model_keras) + tflm_interpreter = tflm_runtime.Interpreter.from_bytes(model_keras) tflm_interpreter.set_input([[True]], 0) tflm_interpreter.set_input([np.full((100,), 15.0, dtype=np.float32)], 1)
diff --git a/tensorflow/lite/micro/python/interpreter/src/BUILD b/tensorflow/lite/micro/python/interpreter/src/BUILD index 6b698c3..3fc77d0 100644 --- a/tensorflow/lite/micro/python/interpreter/src/BUILD +++ b/tensorflow/lite/micro/python/interpreter/src/BUILD
@@ -64,12 +64,12 @@ ) # tflm_runtime is deprecated, please use runtime instead. -# TODO(b/286456378): remove the alias once all usage is change to the runtime -# target. -alias( +# TODO(b/286456378): remove once all usage is changed to the runtime target. +py_library( name = "tflm_runtime", - actual = ":runtime", + srcs = ["tflm_runtime.py"], visibility = ["//visibility:public"], + deps = [":runtime"], ) py_library(
diff --git a/tensorflow/lite/micro/python/interpreter/src/tflm_runtime.py b/tensorflow/lite/micro/python/interpreter/src/tflm_runtime.py new file mode 100644 index 0000000..114a321 --- /dev/null +++ b/tensorflow/lite/micro/python/interpreter/src/tflm_runtime.py
@@ -0,0 +1,17 @@ +# Copyright 2023 The TensorFlow Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# ============================================================================== + +# TODO(b/286456378): remove once all usage is switched to runtime +from tflite_micro.tensorflow.lite.micro.python.interpreter.src.runtime import *