code: def _parse_predict_log(
      predict_log: prediction_log_pb2.PredictLog,
      predict_output_spec: _PredictOutputType,
  ) -> Tuple[tf.train.Example, _FeatureListType]:
      """Parses PredictLog."""
      _, input_tensor_proto = next(
          iter(predict_log.request.inputs.items())
      )
      example = tf.train.Example.FromString(
          input_tensor_proto.string_val[0]
      )
      outputs = predict_log.response.outputs
      output_features = []
      for col in predict_output_spec.output_columns:
          output_tensor_proto = outputs.get(col.output_key)
          output_values = np.squeeze(
              tf.make_ndarray(output_tensor_proto)
          )
          if output_values.ndim > 1:
              raise ValueError(
                  "All output values must be convertible to 1D arrays, but %s was "
                  "not. value was %s." % (col.output_key, output_values)
              )
          if output_values.ndim == 1:
              # Convert the output_values to a list.
              output_values = output_values.tolist()
          else:  # output_values.ndim == 0
              # Get a scalar for output_values.
              output_values = [output_values.item()]
          output_features.append((col.output_column, output_values))
      return example, output_features
  
file_path: tfx/tfx/components/bulk_inferrer/prediction_to_example_utils.py
imports: from typing import Any, List, Tuple, Union
  import numpy
  import tensorflow
  from tfx.proto import bulk_inferrer_pb2
  from tensorflow_serving.apis import classification_pb2
  from tensorflow_serving.apis import prediction_log_pb2
label_desc: Use image node_id 5 for calling a global function with example usage: _parse_predict_log(predict_log, predict_output_spec) and returns: example,  output_features