class_docstr: Interpreter interface for running TensorFlow Lite models.
  
  Models obtained from `TfLiteConverter` can be run in Python with
  `Interpreter`.
  
  As an example, lets generate a simple Keras model and convert it to TFLite
  (`TfLiteConverter` also supports other input formats with `from_saved_model`
  and `from_concrete_function`)
  
  >>> x = np.array([[1.], [2.]])
  >>> y = np.array([[2.], [4.]])
  >>> model = tf.keras.models.Sequential([
  ...           tf.keras.layers.Dropout(0.2),
  ...           tf.keras.layers.Dense(units=1, input_shape=[1])
  ...         ])
  >>> model.compile(optimizer='sgd', loss='mean_squared_error')
  >>> model.fit(x, y, epochs=1)
  >>> converter = tf.lite.TFLiteConverter.from_keras_model(model)
  >>> tflite_model = converter.convert()
  
  `tflite_model` can be saved to a file and loaded later, or directly into the
  `Interpreter`. Since TensorFlow Lite pre-plans tensor allocations to optimize
  inference, the user needs to call `allocate_tensors()` before any inference.
  
  >>> interpreter = tf.lite.Interpreter(model_content=tflite_model)
  >>> interpreter.allocate_tensors()  # Needed before execution!
  
  Sample execution:
  
  >>> output = interpreter.get_output_details()[0]  # Model has single output.
  >>> input = interpreter.get_input_details()[0]  # Model has single input.
  >>> input_data = tf.constant(1., shape=[1, 1])
  >>> interpreter.set_tensor(input['index'], input_data)
  >>> interpreter.invoke()
  >>> interpreter.get_tensor(output['index']).shape
  (1, 1)
  
  Use `get_signature_runner()` for a more user-friendly inference API.
class_docstr_tok: ["Interpreter","interface","for","running","TensorFlow","Lite","models",".","Models","obtained","from","`","TfLiteConverter","`","can","be","run","in","Python","with","`","Interpreter","`",".","As","an","example",",","lets","generate","a","simple","Keras","model","and","convert","it","to","TFLite","(","`","TfLiteConverter","`","also","supports","other","input","formats","with","`","from_saved_model","`","and","`","from_concrete_function","`",")",">",">",">","x","=","np.array","(","[","[","1",".","]",",","[","2",".","]","]",")",">",">",">","y","=","np.array","(","[","[","2",".","]",",","[","4",".","]","]",")",">",">",">","model","=","tf.keras.models.Sequential","(","[","...","tf.keras.layers.Dropout","(","0.2",")",",","...","tf.keras.layers.Dense","(","units=1",",","input_shape=","[","1","]",")","...","]",")",">",">",">","model.compile","(","optimizer='sgd","'",",","loss='mean_squared_error","'",")",">",">",">","model.fit","(","x",",","y",",","epochs=1",")",">",">",">","converter","=","tf.lite.TFLiteConverter.from_keras_model","(","model",")",">",">",">","tflite_model","=","converter.convert","(",")","`","tflite_model","`","can","be","saved","to","a","file","and","loaded","later",",","or","directly","into","the","`","Interpreter","`",".","Since","TensorFlow","Lite","pre-plans","tensor","allocations","to","optimize","inference",",","the","user","needs","to","call","`","allocate_tensors","(",")","`","before","any","inference",".",">",">",">","interpreter","=","tf.lite.Interpreter","(","model_content=tflite_model",")",">",">",">","interpreter.allocate_tensors","(",")","#","Needed","before","execution","!","Sample","execution",":",">",">",">","output","=","interpreter.get_output_details","(",")","[","0","]","#","Model","has","single","output",".",">",">",">","input","=","interpreter.get_input_details","(",")","[","0","]","#","Model","has","single","input",".",">",">",">","input_data","=","tf.constant","(","1.",",","shape=","[","1",",","1","]",")",">",">",">","interpreter.set_tensor","(","input","[","'index","'","]",",","input_data",")",">",">",">","interpreter.invoke","(",")",">",">",">","interpreter.get_tensor","(","output","[","'index","'","]",")",".shape","(","1",",","1",")","Use","`","get_signature_runner","(",")","`","for","a","more","user-friendly","inference","API","."]
docstr: Gets callable for inference of specific SignatureDef.
  
  Example usage,
  ```
  interpreter = tf.lite.Interpreter(model_content=tflite_model)
  interpreter.allocate_tensors()
  fn = interpreter.get_signature_runner('div_with_remainder')
  output = fn(x=np.array([3]), y=np.array([2]))
  print(output)
  # {
  #   'quotient': array([1.], dtype=float32)
  #   'remainder': array([1.], dtype=float32)
  # }
  ```
  
  None can be passed for signature_key if the model has a single Signature
  only.
  
  All names used are this specific SignatureDef names.
  
  
  Args:
    signature_key: Signature key for the SignatureDef, it can be None if and
      only if the model has a single SignatureDef. Default value is None.
  
  Returns:
    This returns a callable that can run inference for SignatureDef defined
    by argument 'signature_key'.
    The callable will take key arguments corresponding to the arguments of the
    SignatureDef, that should have numpy values.
    The callable will returns dictionary that maps from output names to numpy
    values of the computed results.
  
  Raises:
    ValueError: If passed signature_key is invalid.
code: def get_signature_runner(self, signature_key=None):
      """Gets callable for inference of specific SignatureDef.
  
      Example usage,
      ```
      interpreter = tf.lite.Interpreter(model_content=tflite_model)
      interpreter.allocate_tensors()
      fn = interpreter.get_signature_runner('div_with_remainder')
      output = fn(x=np.array([3]), y=np.array([2]))
      print(output)
      # {
      #   'quotient': array([1.], dtype=float32)
      #   'remainder': array([1.], dtype=float32)
      # }
      ```
  
      None can be passed for signature_key if the model has a single Signature
      only.
  
      All names used are this specific SignatureDef names.
  
  
      Args:
        signature_key: Signature key for the SignatureDef, it can be None if and
          only if the model has a single SignatureDef. Default value is None.
  
      Returns:
        This returns a callable that can run inference for SignatureDef defined
        by argument 'signature_key'.
        The callable will take key arguments corresponding to the arguments of the
        SignatureDef, that should have numpy values.
        The callable will returns dictionary that maps from output names to numpy
        values of the computed results.
  
      Raises:
        ValueError: If passed signature_key is invalid.
      """
      if signature_key is None:
          if len(self._signature_defs) != 1:
              raise ValueError(
                  "SignatureDef signature_key is None and model has {0} Signatures. "
                  "None is only allowed when the model has 1 SignatureDef".format(
                      len(self._signature_defs)
                  )
              )
          else:
              signature_key = next(iter(self._signature_defs))
      return SignatureRunner(
          interpreter=self, signature_key=signature_key
      )
  
imports: import ctypes
  import enum
  import os
  import platform
  import sys
  import numpy
label_desc: Use image node_id 16 for calling the Interpreter obj's underlying member method code with example usage: obj.get_signature_runner(signature_key) and returns: SignatureRunner