docstr: Checks TFLite conversion and inference.
docstr_tok: ["Checks","TFLite","conversion","and","inference","."]
code: def testUtf8BinarizeTfLite(self):
      """Checks TFLite conversion and inference."""
  
      class Model(tf.keras.Model):
          @tf.function(
              input_signature=[
                  tf.TensorSpec(
                      shape=[None], dtype=tf.string, name="input"
                  )
              ]
          )
          def call(self, input_tensor):
              return {
                  "result": tf_text.utf8_binarize(
                      input_tensor, word_length=3, bits_per_char=4
                  )
              }
  
      # Test input data.
      input_data = np.array(["爱上一个不回"])
  
      # Define a model.
      model = Model()
      # Do TF inference.
      tf_result = model(tf.constant(input_data))["result"]
  
      # Convert to TFLite.
      converter = tf.lite.TFLiteConverter.from_keras_model(model)
      converter.target_spec.supported_ops = [
          tf.lite.OpsSet.TFLITE_BUILTINS
      ]
      converter.allow_custom_ops = True
      tflite_model = converter.convert()
  
      # Do TFLite inference.
      interp = interpreter.InterpreterWithCustomOps(
          model_content=tflite_model,
          custom_op_registerers=tf_text.tflite_registrar.SELECT_TFTEXT_OPS,
      )
      print(interp.get_signature_list())
      split = interp.get_signature_runner("serving_default")
      output = split(input=input_data)
      if tf.executing_eagerly():
          tflite_result = output["result"]
      else:
          tflite_result = output["output_1"]
  
      # Assert the results are identical.
      self.assertAllEqual(tflite_result, tf_result)
  
file_path: text/tensorflow_text/python/ops/utf8_binarize_op_test.py
imports: import numpy
  import tensorflow
  import tensorflow_text
  from tensorflow.lite.python import interpreter
  from tensorflow.python.framework import test_util
  from tensorflow.python.platform import test
label_desc: Use image node_id 5 for calling the Utf8BinarizeTest obj's underlying member method code with example usage: obj.testUtf8BinarizeTfLite() and returns: dict