|View source on GitHub|
Base decoder object.
tfds.decode.Decoder allows for overriding the default decoding by
implementing a subclass, or skipping it entirely with
Instead of subclassing, you can also create a
Decoder from a function
All decoders must derive from this base class. The implementation can
self.feature property which will correspond to the
FeatureConnector to which this decoder is applied.
To implement a decoder, the main method to override is
which takes the serialized feature as input and returns the decoded feature.
decode_example changes the output dtype, you must also override
dtype property. This enables compatibility with
decode_batch_example( serialized_example )
FeatureConnector.decode_batch_example for details.
decode_example( serialized_example )
Decode the example feature field (eg: image).
setup( *, feature )
The initialization of decode object is deferred because the objects only know the builder/features on which it is used after it has been constructed, the initialization is done in this function.