# tf.sparse.slice

<br />

|---|---|
| [![](https://www.tensorflow.org/images/tf_logo_32px.png) TensorFlow 2 version](https://www.tensorflow.org/api_docs/python/tf/sparse/slice) | [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/python/ops/sparse_ops.py#L960-L1007) |

Slice a `SparseTensor` based on the `start` and \`size.

#### View aliases


**Main aliases**

\`tf.sparse_slice\`
**Compat aliases for migration**

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

[`tf.compat.v1.sparse.slice`](https://www.tensorflow.org/api_docs/python/tf/sparse/slice), [`tf.compat.v1.sparse_slice`](https://www.tensorflow.org/api_docs/python/tf/sparse/slice), \`tf.compat.v2.sparse.slice\`

<br />

    tf.sparse.slice(
        sp_input, start, size, name=None
    )

For example, if the input is

    input_tensor = shape = [2, 7]
    [    a   d e  ]
    [b c          ]

Graphically the output tensors are:

    sparse.slice([0, 0], [2, 4]) = shape = [2, 4]
    [    a  ]
    [b c    ]

    sparse.slice([0, 4], [2, 3]) = shape = [2, 3]
    [ d e  ]
    [      ]

<br />

<br />

<br />

| ## Args ||
|---|---|
| `sp_input` | The `SparseTensor` to split. |
| `start` | 1-D. tensor represents the start of the slice. |
| `size` | 1-D. tensor represents the size of the slice. |
| `name` | A name for the operation (optional). |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A `SparseTensor` objects resulting from splicing. ||

<br />

<br />

<br />

<br />

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

<br />