tfds.decode.make_decoder  |  TensorFlow Datasets (original) (raw)

tfds.decode.make_decoder

Decorator to create a decoder.

tfds.decode.make_decoder(
    output_dtype=None
)

The decorated function should have the signature (example, feature, *args, **kwargs) -> decoded_example.

Example:

@tfds.decode.make_decoder(output_dtype=tf.string)
def no_op_decoder(example, feature):
  """Decoder simply decoding feature normally."""
  return feature.decode_example(example)

tfds.load('mnist', split='train', decoders: {
    'image': no_op_decoder(),
})
Args
output_dtype The output dtype after decoding. Required only if the decoded example has a different type than the FeatureConnector.dtype and is used to decode features inside sequences (ex: videos)
Returns
The decoder object

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-04-26 UTC.