Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tfx.types.ComponentSpec

View source on GitHub

A specification of the inputs, outputs and parameters for a component.

tfx.types.ComponentSpec(
    **kwargs
)

Components should have a corresponding ComponentSpec inheriting from this class and must override:

  • PARAMETERS (as a dict of string keys and ExecutionParameter values),
  • INPUTS (as a dict of string keys and ChannelParameter values) and
  • OUTPUTS (also a dict of string keys and ChannelParameter values).

Here is an example of how a ComponentSpec may be defined:

class MyCustomComponentSpec(ComponentSpec): PARAMETERS = { 'internal_option': ExecutionParameter(type=str), } INPUTS = { 'input_examples': ChannelParameter(type=standard_artifacts.Examples), } OUTPUTS = { 'output_examples': ChannelParameter(type=standard_artifacts.Examples), }

To create an instance of a subclass, call it directly with any execution parameters / inputs / outputs as kwargs. For example:

spec = MyCustomComponentSpec( internal_option='abc', input_examples=input_examples_channel, output_examples=output_examples_channel)

Args:

  • **kwargs: Any inputs, outputs and execution parameters for this instance of the component spec.

Attributes:

  • PARAMETERS: a dict of string keys and ExecutionParameter values.
  • INPUTS: a dict of string keys and ChannelParameter values.
  • OUTPUTS: a dict of string keys and ChannelParameter values.

Methods

INPUTS

View source

INPUTS()

OUTPUTS

View source

OUTPUTS()

PARAMETERS

View source

PARAMETERS()

__eq__

View source

__eq__(
    other
)

Return self==value.

from_json_dict

View source

@classmethod
from_json_dict(
    cls, dict_data
)

Convert from dictionary data to an object.

to_json_dict

View source

to_json_dict()

Convert from an object to a JSON serializable dictionary.