<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/python/util.py#L354-L408) |

Convert a tensor of tfq primitives back to Python objects.

    tfq.from_tensor(
        tensor_to_convert
    )

### Used in the notebooks

| Used in the tutorials |
|---|
| - [Quantum Convolutional Neural Network](https://www.tensorflow.org/quantum/tutorials/qcnn) |

Convert a tensor representing [`cirq.PauliSum`](https://quantumai.google/reference/python/cirq/PauliSum) or [`cirq.Circuit`](https://quantumai.google/reference/python/cirq/Circuit)
objects back to Python objects.

    my_qubits = cirq.GridQubit.rect(1, 2)
    my_circuits = [cirq.Circuit(cirq.X(my_qubits[0])),
                   cirq.Circuit(cirq.Z(my_qubits[0]))
    ]
    tensor_input = tfq.convert_to_tensor(my_circuits)
    # Now tensor_input can be used as model input etc.
    same_circuits = tfq.from_tensor(tensor_input)
    # same_circuits now holds cirq.Circuit objects once more.
    same_circuits
    [cirq.Circuit([
        cirq.Moment(operations=[
            cirq.X.on(cirq.GridQubit(0, 0)),
        ]),
    ])
     cirq.Circuit([
        cirq.Moment(operations=[
            cirq.Z.on(cirq.GridQubit(0, 0)),
        ]),
    ])]

<br />

<br />

<br />

| ## Args ||
|---|---|
| `tensor_to_convert` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) or `np.ndarray` representation to convert back into python objects. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| Python `list` of items converted to their python representation stored in a (potentially nested) `list`. ||

<br />

<br />

<br />

<br />

| ## Raises ||
|---|---|
| `TypeError` | In case of an invalid tensor passed for conversion. |

<br />