Skip to content

Commit f65419f

Browse files
authored
Update TFLite concrete function conversion codes to have the associated (#2607)
* Update TFLite concrete function conversion codes to have the associated trackable object. Providing trackable objects is now recommended for the users. This makes the concrete function conversion API be based on the new SavedModel importer, which will enable new TensorFlow Lite features including variable support, resources and variant tensor, and signature concept.
1 parent a3602ca commit f65419f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tensorflow_addons/seq2seq/tests/decoder_test.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,12 @@ def _decode(start_tokens, end_token):
113113
concrete_function = _decode.get_concrete_function(
114114
tf.TensorSpec([1], dtype=tf.int32), tf.TensorSpec([], dtype=tf.int32)
115115
)
116-
converter = tf.lite.TFLiteConverter.from_concrete_functions([concrete_function])
116+
if tf.__version__[:3] >= "2.7":
117+
converter = tf.lite.TFLiteConverter.from_concrete_functions(
118+
[concrete_function], _decode
119+
)
120+
else:
121+
converter = tf.lite.TFLiteConverter.from_concrete_functions([concrete_function])
117122
converter.target_spec.supported_ops = [
118123
tf.lite.OpsSet.TFLITE_BUILTINS,
119124
tf.lite.OpsSet.SELECT_TF_OPS,

0 commit comments

Comments
 (0)