# tf.raw_ops.ParseSingleExample

<br />

Transforms a tf.Example proto (as a string) into typed tensors.

#### View aliases


**Compat aliases for migration**

See
[Migration guide](https://www.tensorflow.org/guide/migrate) for
more details.

[`tf.compat.v1.raw_ops.ParseSingleExample`](https://www.tensorflow.org/api_docs/python/tf/raw_ops/ParseSingleExample)

<br />

    tf.raw_ops.ParseSingleExample(
        serialized,
        dense_defaults,
        num_sparse,
        sparse_keys,
        dense_keys,
        sparse_types,
        dense_shapes,
        name=None
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `serialized` | A `Tensor` of type `string`. A vector containing a batch of binary serialized Example protos. |
| `dense_defaults` | A list of `Tensor` objects with types from: `float32`, `int64`, `string`. A list of Tensors (some may be empty), whose length matches the length of `dense_keys`. dense_defaults\[j\] provides default values when the example's feature_map lacks dense_key\[j\]. If an empty Tensor is provided for dense_defaults\[j\], then the Feature dense_keys\[j\] is required. The input type is inferred from dense_defaults\[j\], even when it's empty. If dense_defaults\[j\] is not empty, and dense_shapes\[j\] is fully defined, then the shape of dense_defaults\[j\] must match that of dense_shapes\[j\]. If dense_shapes\[j\] has an undefined major dimension (variable strides dense feature), dense_defaults\[j\] must contain a single element: the padding element. |
| `num_sparse` | An `int` that is `>= 0`. The number of sparse features to be parsed from the example. This must match the lengths of `sparse_keys` and `sparse_types`. |
| `sparse_keys` | A list of `strings`. A list of `num_sparse` strings. The keys expected in the Examples' features associated with sparse values. |
| `dense_keys` | A list of `strings`. The keys expected in the Examples' features associated with dense values. |
| `sparse_types` | A list of `tf.DTypes` from: `tf.float32, tf.int64, tf.string`. A list of `num_sparse` types; the data types of data in each Feature given in sparse_keys. Currently the ParseSingleExample op supports DT_FLOAT (FloatList), DT_INT64 (Int64List), and DT_STRING (BytesList). |
| `dense_shapes` | A list of shapes (each a [`tf.TensorShape`](https://www.tensorflow.org/api_docs/python/tf/TensorShape) or list of `ints`). The shapes of data in each Feature given in dense_keys. The length of this list must match the length of `dense_keys`. The number of elements in the Feature corresponding to dense_key\[j\] must always equal dense_shapes\[j\].NumEntries(). If dense_shapes\[j\] == (D0, D1, ..., DN) then the shape of output Tensor dense_values\[j\] will be (D0, D1, ..., DN): In the case dense_shapes\[j\] = (-1, D1, ..., DN), the shape of the output Tensor dense_values\[j\] will be (M, D1, .., DN), where M is the number of blocks of elements of length D1 \* .... \* DN, in the input. |
| `name` | A name for the operation (optional). |

<br />

<br />

| ## Returns ||
|---|---|
| A tuple of `Tensor` objects (sparse_indices, sparse_values, sparse_shapes, dense_values). ||
| `sparse_indices` | A list of `num_sparse` `Tensor` objects with type `int64`. |
| `sparse_values` | A list of `Tensor` objects of type `sparse_types`. |
| `sparse_shapes` | A list of `num_sparse` `Tensor` objects with type `int64`. |
| `dense_values` | A list of `Tensor` objects. Has the same type as `dense_defaults`. |

<br />