Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tfq.datasets.excited_cluster_states

View source on GitHub

Return a tuple of potentially excited cluster states and their labels.

tfq.datasets.excited_cluster_states(
    qubits
)

For every qubit in qubits this method will create a cluster state circuit on qubits, apply a cirq.X on that qubit along with a label of 1 and add it to the return dataset. Finally a cluster state circuit on qubits that doesn't contain any cirq.X gates with a label of -1 will be added to the returned dataset.

circuits, labels = tfq.datasets.excited_cluster_states( 
    cirq.GridQubit.rect(1, 3) 
) 
print(circuits[0]) 
(0, 0): ───H───@───────@───X─── 
               │       │ 
(0, 1): ───H───@───@───┼─────── 
                   │   │ 
(0, 2): ───H───────@───@─────── 
labels[0] 
1 
print(circuits[-1]) 
(0, 0): ───H───@───────@─── 
               │       │ 
(0, 1): ───H───@───@───┼─── 
                   │   │ 
(0, 2): ───H───────@───@─── 
labels[-1] 
-1 

Circuits that feature a cirq.X gate on one of the qubits are labeled 1, while the circuit that doesn't feature a cirq.X anywhere has the label -1.

Args:

  • qubits: Python list of cirq.GridQubits on which the excited cluster state dataset will be created.

Returns:

A tuple of cirq.Circuits and Python int labels.