# tf.compat.v1.serialize_sparse

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v2.13.1/tensorflow/python/ops/sparse_ops.py#L2165-L2183) |

Serialize a `SparseTensor` into a 3-vector (1-D `Tensor`) object.

#### View aliases


**Compat aliases for migration**

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

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

<br />

    tf.compat.v1.serialize_sparse(
        sp_input,
        name=None,
        out_type=https://www.tensorflow.org/versions/r2.13/api_docs/python/tf/dtypes#string
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `sp_input` | The input `SparseTensor`. |
| `name` | A name prefix for the returned tensors (optional). |
| `out_type` | The `dtype` to use for serialization. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A 3-vector (1-D `Tensor`), with each column representing the serialized `SparseTensor`'s indices, values, and shape (respectively). ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | If `sp_input` is not a `SparseTensor`. |

<br />