<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#L87-L103) |

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

    @tf.function
    tfq.padded_to_ragged2d(
        masked_state
    )

Convert a \[batch, dim, dim\] [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) padded with -2 to a
[`tf.RaggedTensor`](https://www.tensorflow.org/api_docs/python/tf/RaggedTensor) using 2d boolean masking.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `masked_state` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) of rank 3 with -2 padding. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| `state_ragged` | [`tf.RaggedTensor`](https://www.tensorflow.org/api_docs/python/tf/RaggedTensor) of rank 3 with no -2 padding where the outer most dimensions are now ragged instead of padded. |

<br />