Base class for decoders that turns a list of bytes to (composite) tensors.
Sub-classes must implement
decode_record() (see its docstring
Decoder instances can be saved as a SavedModel by
The SavedModel can be loaded back by
load_decoder(). However, the loaded
decoder will always be of the type
LoadedDecoder and only have the public
interfaces listed in this base class available.
decode_record( records: tf.Tensor ) -> Dict[str, TensorAlike]
Sub-classes should implement this.
Implementations must use TF ops to derive the result (composite) tensors, as this function will be traced and become a tf.function (thus a TF Graph). Note that autograph is not enabled in such tracing, which means any python control flow / loops will not be converted to TF cond / loops automatically.
The returned tensors must be batch-aligned (i.e. they should be at least
of rank 1, and their outer-most dimensions must be of the same size). They
do not have to be batch-aligned with the input tensor, but if that's the
case, an additional tensor must be provided among the results, to indicate
which input record a "row" in the output batch comes from. See
record_index_tensor_name for more details.
||a 1-D string tensor that contains the records to be decoded.|
|A dict of (composite) tensors.|
output_type_specs() -> Dict[str, tf.TypeSpec]
Returns the tf.TypeSpecs of the decoded tensors.
A dict whose keys are the same as keys of the dict returned by
save( path: str ) -> None
Saves this TFGraphRecordDecoder to a SavedModel at
This functions the same as
tf_graph_record_decoder.save_decoder(). This is
provided purely for convenience, and should not impact the actual saved
model, since only the
||The path to where the saved_model is saved.|