# Tag Info

5

PennyLane supports measurements of tensor products of observable via the @ operator, like so: @qml.qnode(dev) def my_quantum_function(x, y): qml.RZ(x, wires=0) qml.CNOT(wires=[0, 1]) qml.RY(y, wires=1) return qml.expval(qml.PauliZ(0) @ qml.PauliZ(1)) This should return the same result as the solution by KAJ226 above, but will be slightly ...

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 ...

4

I think the following should work: n_qubits = 2 Z = [ [1,0], [0,-1]] ZZ = np.kron(Z,Z) @qml.qnode(dev) def circuit(params): qml.RY(params[0], wires=0) qml.CNOT(wires=[0, 1]) qml.RY(params[1], wires=1) return qml.expval(qml.Hermitian(ZZ, wires=[0, 1]))

3

Yes, $l(z)$ is the true label, and so $l$ is the target function that you want to learn in order for the machine learning model to be correct. The set of functions $l$ that the model is capable of learning describes the expressiveness of the classifier, and they use the construction of $U_l$ to argue that there is a quantum circuit composed of two-qubit ...

3

Typically when you use these kinds of variational circuits to do classification, your goal is to use the circuit to classify some input data $x\in\mathbb{R}^d$ with a decision function of the form $$\tag{1} f(x;\theta) = \langle \psi_x | \mathcal{G}^\dagger (\theta) \hat{M} \mathcal{G}(\theta)|\psi_x\rangle = \langle \hat{M} \rangle$$ where $\hat{M}$ is ...

3

Why are all the states 0 ? Oversimplified, there are three main components to any quantum circuit: the input, the quantum function, and the output. QML research will usually fall into two buckets. In the first, we take a fixed quantum function and feed it different inputs, and see how the output varies. In the second, we take a fixed input and play around ...

3

Why that $|1\rangle^{\otimes N}$? The reason for requiring the final state to be $|1\rangle^{\otimes N}$, is that in this way you can easily propagate the information on an ancilla (i.e. additional) qubit using a multi controlled CNOT, with the target on the ancilla. In this way, measurements on the ancilla yield outcome $|1\rangle$ with probability given by ...

2

Yes, since the dataset does not exist in torchvision, trying to load it through torchvision will produce this error. Instead, save your SWELL-KW dataset as a .csv file, read it in, and convert the train/test data vectors, and labels each as their own PyTorch tensor. For example, let's say I have my own custom dataset that consists of coordinate pairs and ...

2

A non-linear process involves a measurement. The idea of a repeat until success sequence is that when you do the measurement, one of the results will be the one you want. If you get it, great! You've succeeded. If the measurement result is not that answer that you were after, you know that you've not got what you want, and you should know how it's wrong. So, ...

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