class_docstr: Abstraction for using a model agnostic evaluation.
  
  This class is an API interface to interact with the with Model Agnostic graph
  to do evaluation without needing an eval_saved_model.
  It serves two primary functions:
    1) Be able to generate an FPL given FPLs encoded in the tf.Examples input.
    2) Be able to do metric evaluations against the FPLs generated.
  
  Design Doc: go/model-agnostic-tfma
class_docstr_tok: ["Abstraction","for","using","a","model","agnostic","evaluation",".","This","class","is","an","API","interface","to","interact","with","the","with","Model","Agnostic","graph","to","do","evaluation","without","needing","an","eval_saved_model",".","It","serves","two","primary","functions",":","1",")","Be","able","to","generate","an","FPL","given","FPLs","encoded","in","the","tf.Examples","input",".","2",")","Be","able","to","do","metric","evaluations","against","the","FPLs","generated",".","Design","Doc",":","go\/model-agnostic-tfma"]
docstr: Generates FPLs from serialized examples using a ModelAgnostic graph.
  
  Args:
    input_example_bytes_list: A string representing the serialized tf.example
      protos to be parsed by the graph.
  
  Returns:
    A list of FeaturesPredictionsLabels generated from the input examples.
docstr_tok: ["Generates","FPLs","from","serialized","examples","using","a","ModelAgnostic","graph",".","Args",":","input_example_bytes_list",":","A","string","representing","the","serialized","tf.example","protos","to","be","parsed","by","the","graph",".","Returns",":","A","list","of","FeaturesPredictionsLabels","generated","from","the","input","examples","."]
code: def get_fpls_from_examples(
      self, input_example_bytes_list: List[bytes]
  ) -> List[Any]:
      """Generates FPLs from serialized examples using a ModelAgnostic graph.
  
      Args:
        input_example_bytes_list: A string representing the serialized tf.example
          protos to be parsed by the graph.
  
      Returns:
        A list of FeaturesPredictionsLabels generated from the input examples.
      """
      # Call the graph via the created session callable _get_features_fn and
      # get the tensor representation of the features.
      features = self._get_features_fn(input_example_bytes_list)
      split_features = {}
      num_examples = 0
  
      # Split the features by the example keys. Also verify all each example
      # key has the same number of total examples.
      for key in features.keys():
          split_features[key] = util.split_tensor_value(features[key])
          if num_examples == 0:
              num_examples = len(split_features[key])
          elif num_examples != len(split_features[key]):
              raise ValueError(
                  "Different keys unexpectedly had different number of "
                  "examples. Key %s unexpectedly had %s elements."
                  % key,
                  len(split_features[key]),
              )
  
      # Sort out the examples into individual FPLs: one example -> one FPL.
      # Sort them into Features, Predictions, or Labels according to the input
      # config.
      result = []
      for i in range(num_examples):
          labels = {}
          predictions = {}
          features = {}
          for key in split_features:
              if key in self._config.label_keys:
                  labels[key] = {
                      encoding.NODE_SUFFIX: split_features[key][i]
                  }
              if key in self._config.prediction_keys:
                  predictions[key] = {
                      encoding.NODE_SUFFIX: split_features[key][i]
                  }
              features[key] = {
                  encoding.NODE_SUFFIX: split_features[key][i]
              }
  
          result.append(
              types.FeaturesPredictionsLabels(
                  input_ref=i,
                  features=features,
                  predictions=predictions,
                  labels=labels,
              )
          )
  
      return result
  
file_path: model-analysis/tensorflow_model_analysis/model_agnostic_eval/model_agnostic_predict.py
imports: from typing import Any, Dict, List, NamedTuple
  import tensorflow
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.eval_saved_model import encoding
  from tensorflow_model_analysis.eval_saved_model import util
  from tensorflow_model_analysis.utils import util
label_desc: Use image node_id 3 for calling the ModelAgnosticPredict obj's underlying member method code with example usage: obj.get_fpls_from_examples(input_example_bytes_list) and returns: result