Decorator to create a decoder.

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

  • example: Serialized example before decoding
  • feature: FeatureConnector associated with the example
  • *args, **kwargs: Optional additional kwargs forwarded to the function


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(),

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)

The decoder object