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: Serialized example before decodingfeature:FeatureConnectorassociated with the example*args, **kwargs: Optional additional kwargs forwarded to the function
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 |