We changed our privacy policy. Read more.

Hot answers tagged

5

Just to add a little more context to your answer: TensorFlow-Quantum 0.4.0 has an explicit version dependency on sympy==1.5.0 in the setup.py module here, which should have been installed when you first installed TFQ. It's possible that other python pip packages may have overriden or upgraded the sympy version since then. Using something like pip list | grep ...


5

Note 100% sure if this is what you are asking but when you have a circuit like: and you want to write it as a $4 \times 4$ Unitary matrix $U$ then you can do it as: $ U = R_y(a[0]) \otimes R_z(a[1]) $ This can be generalized to any size as well. So if you have then it can be written as an $8 \times 8$ matrix $U$ as $U = R_y(a[0]) \otimes R_z(a[1]) \...


4

I'm the engineer who looks after TensorFlow Quantum. Serializing custom gates is not supported. There is an active issue on the GitHub here: https://github.com/tensorflow/quantum/issues/354 . A quick workaround would be to try and determine the gate decomposition for your custom gate in terms of tfq.util.get_supported_gates gate instances. A good place to ...


3

The easiest way to get the unitary matrix of a couple of operations in Cirq is the unitary method on the Circuit class. In your case: import cirq a, b = cirq.LineQubit.range(2) theta = 0.4 phi = 0.123 u = cirq.Circuit(cirq.rx(phi)(a), cirq.rz(theta)(b)).unitary() print(u) Will give you the 4x4 unitary matrix [[ 0.97821373-0.19829374j 0. +0.j ...


3

I can lend some ideas, but since I don't know exactly what you're after I will have to guess a bit. Looking at the original snippet from the MNIST tutorial: def convert_to_circuit(image): """Encode truncated classical image into quantum datapoint.""" values = np.ndarray.flatten(image) qubits = cirq.GridQubit.rect(4, ...


3

There is no way to disable multiprocessing in TensorFlow Quantum without also affecting TensorFlow. That being said, there are still some workarounds to your problem that might be worth trying. It might help to take a look at changing the inter and intra op parallelism in tensorflow . If you are finding that TFQ isn't making full use of multiprocessing you ...


2

There is no decomposition being done for controlled operations by default. The library expects whatever simulator it is using to have support for the controlled_by operation (by either decomposing it or implementing it directly). In the default C++ simulator TFQ uses qsim, controlled gates are implemented via direct application onto the state vector here -...


2

I think there might be a lot to unpack here. Just making sure my understanding of the problem is correct: I hand you a quantum circuit with some free parameters and then I hand you some samples from that quantum circuit at specific parameter values, but I don't tell you what the parameter values are and then your goal is to try and determine what the ...


Only top voted, non community-wiki answers of a minimum length are eligible