Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SchemaGen Executor to natively handle SequenceExample #5689

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tfx/components/schema_gen/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
from tfx.types import standard_component_specs
from tfx.utils import io_utils
from tfx.utils import json_utils
from tfx_bsl.tfxio.tensor_representation_util import (InferTensorRepresentationsFromSchema,
SetTensorRepresentationsInSchema)


# Default file name for generated schema file.
Expand Down Expand Up @@ -89,5 +91,12 @@ def Do(self, input_dict: Dict[str, List[types.Artifact]],
artifact_utils.get_single_uri(
output_dict[standard_component_specs.SCHEMA_KEY]),
DEFAULT_FILE_NAME)

# Add tensor representations to handle SequenceExamples downstream.
# Still need correct Payload Format.
tensor_representations = InferTensorRepresentationsFromSchema(schema)
SetTensorRepresentationsInSchema(schema, tensor_representations)


io_utils.write_pbtxt_file(output_uri, schema)
logging.info('Schema written to %s.', output_uri)