<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/quantum/blob/v0.7.6/tensorflow_quantum/core/ops/tfq_utility_ops.py#L68-L84) |

Utility [`tf.function`](https://www.tensorflow.org/api_docs/python/tf/function) that converts a padded tensor to ragged.

    @tf.function
    tfq.padded_to_ragged(
        masked_state
    )

Convert a state [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) padded with the value -2 to a [`tf.RaggedTensor`](https://www.tensorflow.org/api_docs/python/tf/RaggedTensor)
using efficient boolean masking.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `masked_state` | `tf.State` tensor with -2 padding. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| `state_ragged` | State tensor without padding as a [`tf.RaggedTensor`](https://www.tensorflow.org/api_docs/python/tf/RaggedTensor). |

<br />