code: def modify_integer_quantized_model_io_type(
      model,
      inference_input_type=tf.float32,
      inference_output_type=tf.float32,
  ):
      """Modify the float input/output type of an integer quantized model."""
      # Convert the model to an object
      model = _convert_model_from_bytearray_to_object(model)
  
      # Validate the integer quantized model
      (
          input_quant_ops,
          output_dequant_ops,
      ) = _find_int8_quantized_inputs_outputs(model)
  
      subgraph = model.subgraphs[0]
      operators = subgraph.operators
      remove_tensors_idxs = set()
  
      # Modify model input type
      if inference_input_type == tf.int8:
          # Remove the inputs and the quant operator
          for op in input_quant_ops:
              subgraph.inputs[
                  subgraph.inputs == op.inputs[0]
              ] = op.outputs[0]
              if model.signatureDefs:
                  signature_def = model.signatureDefs[0]
                  for i in range(len(signature_def.inputs)):
                      if (
                          signature_def.inputs[i].tensorIndex
                          == op.inputs[0]
                      ):
                          signature_def.inputs[
                              i
                          ].tensorIndex = op.outputs[0]
              remove_tensors_idxs.add(op.inputs[0])
              operators.remove(op)
  
      # Modify model output type
      if inference_output_type == tf.int8:
          # Remove the outputs and the dequant operator
          for op in output_dequant_ops:
              subgraph.outputs[
                  subgraph.outputs == op.outputs[0]
              ] = op.inputs[0]
              if model.signatureDefs:
                  signature_def = model.signatureDefs[0]
                  for i in range(len(signature_def.outputs)):
                      if (
                          signature_def.outputs[i].tensorIndex
                          == op.outputs[0]
                      ):
                          signature_def.outputs[
                              i
                          ].tensorIndex = op.inputs[0]
              remove_tensors_idxs.add(op.outputs[0])
              operators.remove(op)
  
      # Remove tensors marked for deletion.
      _remove_tensors_from_model(model, subgraph, remove_tensors_idxs)
  
      # Convert the model to a bytearray
      return _convert_model_from_object_to_bytearray(model)
  
file_path: compute-engine/larq_compute_engine/mlir/python/util.py
imports: import copy
  import flatbuffers
  import tensorflow
  from larq_compute_engine.mlir.python import tflite_schema
label_desc: Use image node_id 7 for calling a global function with example usage: modify_integer_quantized_model_io_type(model, inference_input_type, inference_output_type) and returns: _convert_model_from_object_to_bytearray