# tfx.v1.components.BulkInferrer

<br />

A TFX component to do batch inference on a model with unlabelled examples.

Inherits From: [`BaseBeamComponent`](https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/types/BaseBeamComponent), [`BaseComponent`](https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/types/BaseComponent), [`BaseNode`](https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/types/BaseNode)

    tfx.v1.components.BulkInferrer(
        examples: https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/types/BaseChannel,
        model: Optional[https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/types/BaseChannel] = None,
        model_blessing: Optional[https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/types/BaseChannel] = None,
        data_spec: Optional[Union[https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/proto/DataSpec, https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/dsl/experimental/RuntimeParameter]] = None,
        model_spec: Optional[Union[https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/proto/ModelSpec, https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/dsl/experimental/RuntimeParameter]] = None,
        output_example_spec: Optional[Union[bulk_inferrer_pb2.OutputExampleSpec, data_types.
            RuntimeParameter]] = None
    )

BulkInferrer consumes examples data and a model, and produces the inference
results to an external location as PredictionLog proto.

BulkInferrer will infer on validated model.

## Example

      # Uses BulkInferrer to inference on examples.
      bulk_inferrer = BulkInferrer(
          examples=example_gen.outputs['examples'],
          model=trainer.outputs['model'])

Component `outputs` contains:

- `inference_result`: Channel of type [`standard_artifacts.InferenceResult`](https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/types/standard_artifacts/InferenceResult) to store the inference results.
- `output_examples`: Channel of type [`standard_artifacts.Examples`](https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/types/standard_artifacts/Examples) to store the output examples. This is optional controlled by `output_example_spec`.

See [the BulkInferrer
guide](https://www.tensorflow.org/tfx/guide/bulkinferrer) for more details.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `examples` | A BaseChannel of type [`standard_artifacts.Examples`](https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/types/standard_artifacts/Examples), usually produced by an ExampleGen component. *required* |
| `model` | A BaseChannel of type [`standard_artifacts.Model`](https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/types/standard_artifacts/Model), usually produced by a Trainer component. |
| `model_blessing` | A BaseChannel of type [`standard_artifacts.ModelBlessing`](https://www.tensorflow.org/tfx/api_docs/python/tfx/v1/types/standard_artifacts/ModelBlessing), usually produced by a ModelValidator component. |
| `data_spec` | bulk_inferrer_pb2.DataSpec instance that describes data selection. |
| `model_spec` | bulk_inferrer_pb2.ModelSpec instance that describes model specification. |
| `output_example_spec` | bulk_inferrer_pb2.OutputExampleSpec instance, specify if you want BulkInferrer to output examples instead of inference result. |

<br />

<br />

<br />

<br />

| ## Attributes ||
|---|---|
| `outputs` | Component's output channel dict. |

<br />

## Methods

### `with_beam_pipeline_args`

    with_beam_pipeline_args(
        beam_pipeline_args: Iterable[Union[str, placeholder.Placeholder]]
    ) -> 'BaseBeamComponent'

Add per component Beam pipeline args.

<br />

<br />

<br />

| Args ||
|---|---|
| `beam_pipeline_args` | List of Beam pipeline args to be added to the Beam executor spec. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| the same component itself. ||

<br />

### `with_node_execution_options`

    with_node_execution_options(
        node_execution_options: utils.NodeExecutionOptions
    ) -> typing_extensions.Self

<br />

<br />

<br />

| ## Class Variables ||
|---|---|
| POST_EXECUTABLE_SPEC | `None` |
| PRE_EXECUTABLE_SPEC | `None` |

<br />