code: def _find_int8_quantized_inputs_outputs(model):
      """Validate that model input is quantized and output is dequantized."""
      main_subgraph = model.subgraphs[0]  # the main subgraph has ID 0
      tensors = main_subgraph.tensors
      operators = main_subgraph.operators
  
      # Ensure model has atleast one quantize and dequantize operator
      quant_opcode_idx, dequant_opcode_idx = None, None
      for idx, opcode in enumerate(model.operatorCodes):
          if (
              opcode.builtinCode
              == tflite_schema.BuiltinOperator.QUANTIZE
          ):
              quant_opcode_idx = idx
          elif (
              opcode.builtinCode
              == tflite_schema.BuiltinOperator.DEQUANTIZE
          ):
              dequant_opcode_idx = idx
          if (
              quant_opcode_idx is not None
              and dequant_opcode_idx is not None
          ):
              break
      if quant_opcode_idx is None and dequant_opcode_idx is None:
          raise ValueError(
              "Model is not integer quantized as it does not "
              "contain quantize/dequantize operators."
          )
  
      # Ensure model inputs and outputs are integer quantized
      input_quant_ops, output_dequant_ops = [], []
      for op in operators:
          # Find input quantize operator
          if (
              op.opcodeIndex == quant_opcode_idx
              and op.inputs[0] in main_subgraph.inputs
          ):
              pos, float_tensor, int_tensor = (
                  "input",
                  tensors[op.inputs[0]],
                  tensors[op.outputs[0]],
              )
              input_quant_ops.append(op)
          # Find output dequantize operator
          elif (
              op.opcodeIndex == dequant_opcode_idx
              and op.outputs[0] in main_subgraph.outputs
          ):
              pos, float_tensor, int_tensor = (
                  "output",
                  tensors[op.outputs[0]],
                  tensors[op.inputs[0]],
              )
              output_dequant_ops.append(op)
          # Otherwise, ignore
          else:
              continue
          # If found, validate the input/output tensor type
          if float_tensor.type != tflite_schema.TensorType.FLOAT32:
              raise ValueError(
                  "Model {} type must be tf.float32. Expected type for tensor with "
                  "name '{}' is tf.float32, instead type is tf.{}".format(
                      pos,
                      float_tensor.name,
                      _convert_tflite_enum_type_to_tf_type(
                          float_tensor.type
                      ).name,
                  )
              )
          if int_tensor.type != tflite_schema.TensorType.INT8:
              raise ValueError(
                  "Model is not integer quantized. Expected type for tensor with "
                  "name '{}' is tf.int8, instead type is tf.{}".format(
                      int_tensor.name,
                      _convert_tflite_enum_type_to_tf_type(
                          int_tensor.type
                      ).name,
                  )
              )
  
      return input_quant_ops, output_dequant_ops
  
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 6 for calling a global function with example usage: _find_int8_quantized_inputs_outputs(model) and returns: input_quant_ops,  output_dequant_ops