|View source on GitHub|
Base decoder object.
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
Initialize self. See help(type(self)) for accurate signature.
dtype after decoding.
Decode the example feature field (eg: image).
tf.Tensoras decoded, the dtype/shape should be identical to
example: Decoded example.
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.
tfds.features.FeatureConnector, the feature to which is applied this transformation.