class_docstr: Defines signatures to support regress and predict serving.
  
  This wraps the trained Keras model in two serving functions that can be saved
  with `tf.saved_model.save` or `model.save`, and loaded with corresponding
  signature names. The regress serving signature takes a batch of serialized
  `tf.Example`s as input, whereas the predict serving signature takes a batch of
  serialized `ExampleListWithContext` as input.
  
  Example usage:
  
  A ranking model can be saved with signatures as follows:
  
  ```python
  tf.saved_model.save(model, path, signatures=Signatures(model, ...)())
  ```
  
  For regress serving, scores can be generated using `REGRESS` signature as
  follows:
  
  ```python
  loaded_model = tf.saved_model.load(path)
  predictor = loaded_model.signatures[tf.saved_model.REGRESS_METHOD_NAME]
  scores = predictor(serialized_examples)[tf.saved_model.REGRESS_OUTPUTS]
  ```
  
  For predict serving, scores can be generated using `PREDICT` signature as
  follows:
  
  ```python
  loaded_model = tf.saved_model.load(path)
  predictor = loaded_model.signatures[tf.saved_model.PREDICT_METHOD_NAME]
  scores = predictor(serialized_elwcs)[tf.saved_model.PREDICT_OUTPUTS]
  ```
class_docstr_tok: ["Defines","signatures","to","support","regress","and","predict","serving",".","This","wraps","the","trained","Keras","model","in","two","serving","functions","that","can","be","saved","with","`","tf.saved_model.save","`","or","`","model.save","`",",","and","loaded","with","corresponding","signature","names",".","The","regress","serving","signature","takes","a","batch","of","serialized","`","tf.Example","`","s","as","input",",","whereas","the","predict","serving","signature","takes","a","batch","of","serialized","`","ExampleListWithContext","`","as","input",".","Example","usage",":","A","ranking","model","can","be","saved","with","signatures","as","follows",":","``","`","python","tf.saved_model.save","(","model",",","path",",","signatures=Signatures","(","model",",","...",")","(",")",")","``","`","For","regress","serving",",","scores","can","be","generated","using","`","REGRESS","`","signature","as","follows",":","``","`","python","loaded_model","=","tf.saved_model.load","(","path",")","predictor","=","loaded_model.signatures","[","tf.saved_model.REGRESS_METHOD_NAME","]","scores","=","predictor","(","serialized_examples",")","[","tf.saved_model.REGRESS_OUTPUTS","]","``","`","For","predict","serving",",","scores","can","be","generated","using","`","PREDICT","`","signature","as","follows",":","``","`","python","loaded_model","=","tf.saved_model.load","(","path",")","predictor","=","loaded_model.signatures","[","tf.saved_model.PREDICT_METHOD_NAME","]","scores","=","predictor","(","serialized_elwcs",")","[","tf.saved_model.PREDICT_OUTPUTS","]","``","`"]
docstr: Returns a dict of signatures.
  
  Args:
    serving_default: Specifies "regress" or "predict" as the serving_default
      signature.
  
  Returns:
    A dict of signatures.
docstr_tok: ["Returns","a","dict","of","signatures",".","Args",":","serving_default",":","Specifies","``","regress","''","or","``","predict","''","as","the","serving_default","signature",".","Returns",":","A","dict","of","signatures","."]
code: def __call__(
      self, serving_default: str = "regress"
  ) -> Dict[str, Callable[[tf.Tensor], Dict[str, tf.Tensor]]]:
      """Returns a dict of signatures.
  
      Args:
        serving_default: Specifies "regress" or "predict" as the serving_default
          signature.
  
      Returns:
        A dict of signatures.
      """
      if serving_default not in ["regress", "predict"]:
          raise ValueError(
              "serving_default should be 'regress' or 'predict', "
              "but got {}".format(serving_default)
          )
      serving_default_function = (
          self.regress_tf_function()
          if serving_default == "regress"
          else self.predict_tf_function()
      )
  
      signatures = {
          tf.saved_model.DEFAULT_SERVING_SIGNATURE_DEF_KEY: serving_default_function,
          tf.saved_model.REGRESS_METHOD_NAME: self.regress_tf_function(),
          tf.saved_model.PREDICT_METHOD_NAME: self.predict_tf_function(),
      }
      return signatures
  
file_path: ranking/tensorflow_ranking/python/keras/saved_model.py
imports: import functools
  from typing import Callable, Dict, Union
  import tensorflow
  from tensorflow_ranking.python import data
label_desc: Use image node_id 5 for calling the Signatures obj's underlying member method code with example usage: obj.__call__(serving_default) and returns: signatures