@beam.ptransform_fn
@beam.typehints.with_input_types(Union[(_INPUT_TYPE, Tuple[(_K, _INPUT_TYPE)])])
@beam.typehints.with_output_types(Union[(_OUTPUT_TYPE, Tuple[(_K, _OUTPUT_TYPE)])])
def RunInference(examples: beam.pvalue.PCollection, inference_spec_type: model_spec_pb2.InferenceSpecType) -> beam.pvalue.PCollection:
    'Run inference with a model.\n\n  There are two types of inference you can perform using this PTransform:\n    1. In-process inference from a SavedModel instance. Used when\n      `saved_model_spec` field is set in `inference_spec_type`.\n    2. Remote inference by using a service endpoint. Used when\n      `ai_platform_prediction_model_spec` field is set in\n      `inference_spec_type`.\n\n  TODO(b/131873699): Add support for the following features:\n    1. tf.train.SequenceExample as Input for RemotePredict.\n    2. beam.Shared() initialization via Fingerprint for models CSE.\n    3. Models as SideInput.\n    4. TPU models.\n\n  Args:\n    examples: A PCollection containing examples of the following possible kinds,\n      each with their corresponding return type.\n        - PCollection[Example]                   -> PCollection[PredictionLog]\n            * Works with Classify, Regress, MultiInference, Predict and\n              RemotePredict.\n\n        - PCollection[SequenceExample]           -> PCollection[PredictionLog]\n            * Works with Predict and (serialized) RemotePredict.\n\n        - PCollection[bytes]                     -> PCollection[PredictionLog]\n            * For serialized Example: Works with Classify, Regress,\n              MultiInference, Predict and RemotePredict.\n            * For everything else: Works with Predict and RemotePredict.\n\n        - PCollection[Tuple[K, Example]]         -> PCollection[\n                                                        Tuple[K, PredictionLog]]\n            * Works with Classify, Regress, MultiInference, Predict and\n              RemotePredict.\n\n        - PCollection[Tuple[K, SequenceExample]] -> PCollection[\n                                                        Tuple[K, PredictionLog]]\n            * Works with Predict and (serialized) RemotePredict.\n\n        - PCollection[Tuple[K, bytes]]           -> PCollection[\n                                                        Tuple[K, PredictionLog]]\n            * For serialized Example: Works with Classify, Regress,\n              MultiInference, Predict and RemotePredict.\n            * For everything else: Works with Predict and RemotePredict.\n\n    inference_spec_type: Model inference endpoint.\n\n  Returns:\n    A PCollection (possibly keyed) containing prediction logs.\n  '
    return (examples | ('RunInferenceImpl' >> run_inference.RunInferenceImpl(inference_spec_type)))
Run inference with a model.

There are two types of inference you can perform using this PTransform:
  1. In-process inference from a SavedModel instance. Used when
    `saved_model_spec` field is set in `inference_spec_type`.
  2. Remote inference by using a service endpoint. Used when
    `ai_platform_prediction_model_spec` field is set in
    `inference_spec_type`.

TODO(b/131873699): Add support for the following features:
  1. tf.train.SequenceExample as Input for RemotePredict.
  2. beam.Shared() initialization via Fingerprint for models CSE.
  3. Models as SideInput.
  4. TPU models.

Args:
  examples: A PCollection containing examples of the following possible kinds,
    each with their corresponding return type.
      - PCollection[Example]                   -> PCollection[PredictionLog]
          * Works with Classify, Regress, MultiInference, Predict and
            RemotePredict.

      - PCollection[SequenceExample]           -> PCollection[PredictionLog]
          * Works with Predict and (serialized) RemotePredict.

      - PCollection[bytes]                     -> PCollection[PredictionLog]
          * For serialized Example: Works with Classify, Regress,
            MultiInference, Predict and RemotePredict.
          * For everything else: Works with Predict and RemotePredict.

      - PCollection[Tuple[K, Example]]         -> PCollection[
                                                      Tuple[K, PredictionLog]]
          * Works with Classify, Regress, MultiInference, Predict and
            RemotePredict.

      - PCollection[Tuple[K, SequenceExample]] -> PCollection[
                                                      Tuple[K, PredictionLog]]
          * Works with Predict and (serialized) RemotePredict.

      - PCollection[Tuple[K, bytes]]           -> PCollection[
                                                      Tuple[K, PredictionLog]]
          * For serialized Example: Works with Classify, Regress,
            MultiInference, Predict and RemotePredict.
          * For everything else: Works with Predict and RemotePredict.

  inference_spec_type: Model inference endpoint.

Returns:
  A PCollection (possibly keyed) containing prediction logs.
@beam.ptransform_fn
@beam.typehints.with_input_types(Union[(_INPUT_TYPE, Tuple[(_K, _INPUT_TYPE)])])
@beam.typehints.with_output_types(Union[(_OUTPUT_TYPE, Tuple[(_K, _OUTPUT_TYPE)])])
def RunInference(examples: beam.pvalue.PCollection, inference_spec_type: model_spec_pb2.InferenceSpecType) -> beam.pvalue.PCollection:
    'Run inference with a model.\n\n  There are two types of inference you can perform using this PTransform:\n    1. In-process inference from a SavedModel instance. Used when\n      `saved_model_spec` field is set in `inference_spec_type`.\n    2. Remote inference by using a service endpoint. Used when\n      `ai_platform_prediction_model_spec` field is set in\n      `inference_spec_type`.\n\n  TODO(b/131873699): Add support for the following features:\n    1. tf.train.SequenceExample as Input for RemotePredict.\n    2. beam.Shared() initialization via Fingerprint for models CSE.\n    3. Models as SideInput.\n    4. TPU models.\n\n  Args:\n    examples: A PCollection containing examples of the following possible kinds,\n      each with their corresponding return type.\n        - PCollection[Example]                   -> PCollection[PredictionLog]\n            * Works with Classify, Regress, MultiInference, Predict and\n              RemotePredict.\n\n        - PCollection[SequenceExample]           -> PCollection[PredictionLog]\n            * Works with Predict and (serialized) RemotePredict.\n\n        - PCollection[bytes]                     -> PCollection[PredictionLog]\n            * For serialized Example: Works with Classify, Regress,\n              MultiInference, Predict and RemotePredict.\n            * For everything else: Works with Predict and RemotePredict.\n\n        - PCollection[Tuple[K, Example]]         -> PCollection[\n                                                        Tuple[K, PredictionLog]]\n            * Works with Classify, Regress, MultiInference, Predict and\n              RemotePredict.\n\n        - PCollection[Tuple[K, SequenceExample]] -> PCollection[\n                                                        Tuple[K, PredictionLog]]\n            * Works with Predict and (serialized) RemotePredict.\n\n        - PCollection[Tuple[K, bytes]]           -> PCollection[\n                                                        Tuple[K, PredictionLog]]\n            * For serialized Example: Works with Classify, Regress,\n              MultiInference, Predict and RemotePredict.\n            * For everything else: Works with Predict and RemotePredict.\n\n    inference_spec_type: Model inference endpoint.\n\n  Returns:\n    A PCollection (possibly keyed) containing prediction logs.\n  '
    return (examples | ('RunInferenceImpl' >> run_inference.RunInferenceImpl(inference_spec_type)))