tf.compat.v1.parse_single_example  |  TensorFlow v2.16.1 (original) (raw)

tf.compat.v1.parse_single_example

Stay organized with collections Save and categorize content based on your preferences.

Parses a single Example proto.

View aliases

Compat aliases for migration

SeeMigration guide for more details.

tf.compat.v1.io.parse_single_example

tf.compat.v1.parse_single_example(
    serialized, features, name=None, example_names=None
)

Similar to parse_example, except:

For dense tensors, the returned Tensor is identical to the output ofparse_example, except there is no batch dimension, the output shape is the same as the shape given in dense_shape.

For SparseTensors, the first (batch) column of the indices matrix is removed (the indices matrix is a column vector), the values vector is unchanged, and the first (batch_size) entry of the shape vector is removed (it is now a single element vector).

One might see performance advantages by batching Example protos withparse_example instead of using this function directly.

Args
serialized A scalar string Tensor, a single serialized Example.
features A mapping of feature keys to FixedLenFeature orVarLenFeature values.
name A name for this operation (optional).
example_names (Optional) A scalar string Tensor, the associated name.
Returns
A dict mapping feature keys to Tensor and SparseTensor values.
Raises
ValueError if any feature is invalid.