Skip to content

Commit 2e17e3f

Browse files
ecalubaquibcopybara-github
authored andcommitted
Update tensorflow_models usage of tf.lite.interpreter to run ai-edge-litert.interpreter
PiperOrigin-RevId: 682467705
1 parent 8f60a93 commit 2e17e3f

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ OpenEXR >= 1.3.2
1212
termcolor >= 1.1.0
1313
trimesh >= 2.37.22
1414
# Required by trimesh.
15-
networkx
15+
networkx

tensorflow_graphics/util/test_case.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@
3131
import tensorflow as tf
3232

3333
from tensorflow_graphics.util import tfg_flags
34+
# pylint: disable=g-direct-tensorflow-import
35+
from ai-edge-litert import interpreter as tfl_interpreter
36+
# pylint: enable=g-direct-tensorflow-import
37+
3438

3539
FLAGS = flags.FLAGS
3640

@@ -98,6 +102,7 @@ def _compute_gradient_error(self, x, y, x_init, delta=1e-6):
98102
error = 0
99103
row_max_error = 0
100104
column_max_error = 0
105+
max_error = 0
101106
for j_t, j_n in grad:
102107
if j_t.size or j_n.size: # Handle zero size tensors correctly
103108
diff = np.fabs(j_t - j_n)
@@ -364,7 +369,7 @@ def assert_tf_lite_convertible(self,
364369
sess, in_tensors, out_tensors)
365370
tflite_model = converter.convert()
366371
# Load TFLite model and allocate tensors.
367-
interpreter = tf.lite.Interpreter(model_content=tflite_model)
372+
interpreter = tfl_interpreter.Interpreter(model_content=tflite_model)
368373
interpreter.allocate_tensors()
369374
# If no test inputs provided then randomly generate inputs.
370375
if test_inputs is None:

0 commit comments

Comments
 (0)