Questions tagged [pennylane]

PennyLane is a cross-platform Python library for quantum machine learning, automatic differentiation, and optimization of hybrid quantum-classical computations.

Filter by
Sorted by
Tagged with
1 vote
1 answer
34 views

Gradient descent for a quantum-classical hybrid neural network

I am working on implementing a quantum-classical hybrid neural network in qiskit where input data is encoded on a quantum circuit (with say 3 qubits) using a ...
user avatar
0 votes
0 answers
51 views

Converting sigma model Hamiltonian into a quantum circuit

I would like to ask some specific questions about a paper I'm reading. In 1903.06577, authors are playing with the sigma model hamiltonian, and they are showing how they constructed the time evolution ...
user avatar
  • 101
2 votes
2 answers
34 views

Why does VQE with pennylane and scikit-optimize gp_minimize give 'func must be scalar' error?

I am trying to replace the SPSA optimizer in the VQE tutorial of pennylane by the bayesian optimizer of scikit-opimize. When running the code below I get the error "func should return a scalar&...
user avatar
3 votes
1 answer
41 views

Why does the parameter circuit include both the positive and negative shift terms?

In the derivation of the parameter shift rules in the original paper, the Hermitian generator $G$ of any unitary $U(\theta)=\exp[-i\theta G]$ satisfies $$ U(\pm\frac{\pi}{4r})=\frac{1}{\sqrt{2}}(I\mp\...
user avatar
1 vote
1 answer
59 views

Is pennylane free?

I was going through the basics of pennylane. I am able to understand that it is used for quantum neural networks. I am not sure whether it is using paid cloud computer or simulator of xandu or ibmq? ...
user avatar
5 votes
0 answers
78 views

How linear combination of unitaries gradient work (Qiskit, PennyLane)?

I'm trying to implement linear combination of unitaries(LCU) gradient from Qiskit Gradient Framework but on PennyLane. First, i looked through the source code in Qiskit. In Qiskit LCU gradient if we ...
user avatar
1 vote
1 answer
44 views

Implementing Noise in Pennylane (using qiskit.aer)

I want to implement noise in Pennylane using qiskit as a plug-in. I found this tutorial from Pennylane. But, when testing it the bit-flip error seems to have no effect at all. Here, I made some slight ...
user avatar
2 votes
1 answer
66 views

How to convert Pennylane decompose_hamiltonian to Cirq PauliString?

I have a matrix that I would like to decompose into a Pauli String. Pennylane's qml.utils.decompose_hamiltonian does this and returns a list of coefficients and a list of operations representing the ...
user avatar
  • 21
0 votes
0 answers
64 views

Computing custom observables in Pennylane

I wanted to compute the expectation value of the projector $|000\rangle\langle000| + |111\rangle\langle111|$ in Pennylane. So I wrote down the representing matrix and used the ...
user avatar
  • 101
0 votes
1 answer
64 views

Using qml.AmplitudeEmbedding two times in a circuit raises an error

I'm trying to use qml.AmplitudeEmbedding() two times in a circuit but it raises an error saying that the device used does not support this feature.
user avatar
3 votes
0 answers
62 views

What is the most efficient method to update the binary encoded values inside a quantum state?

We're implementing a QML algorithm in which we have to update the value stored inside a quantum state which is strictly unknown to us, by multiplying it with a real number classically stored with us. ...
user avatar
2 votes
2 answers
82 views

Platform for mixed-state quantum machine learning?

I have been using PennyLane to run numerical QML simulations but it now seems to only support backprop on pure state simulations. Does anyone familiar with other packages know if there exists one that ...
user avatar
4 votes
1 answer
154 views

Implementation of Unitary in Shor's Algorithm in PennyLane

I've been working on implementing Shor's Algorithm in PennyLane, but am struggling to understand how the circuit for 'U' has been constructed according to Qiskit. In the Qiskit textbook, they seek to ...
user avatar
3 votes
1 answer
130 views

Quantum Phase Estimation - Should be getting exact answer

Having read the Qiskit demonstration in the Qiskit textbook on how to implement Quantum Phase Estimation, I tried to do so on PennyLane's framework. My code pretty well follows what was done in Qiskit,...
user avatar
2 votes
1 answer
49 views

What is the $K_i$ in Fubini-Study tensor?

Following this paper and tutorial from Pennylane, I'm trying to re-calculate the Fubini-Study tensor: $$ g_{i j}^{(\ell)}=\left\langle\psi_{\ell-1}\left|K_{i} K_{j}\right| \psi_{\ell-1}\right\rangle-\...
user avatar
  • 325
3 votes
1 answer
109 views

VQE from scratch, what have I got wrong?

I've been working on a code to run VQE with a grouped measurement. For some reason, my expectation values are slightly off from those computed by pennylane, the software I decided to use for this ...
user avatar
1 vote
1 answer
154 views

Binary classification using a very simple Neural Net with Qiskit and Pennylane

I implemented a simple Neural Net with Pennylane and Qiskit for classifying two half moons: notebook for two half moons (GitHub). It works somehow (not overwhelmingly by any means): I tried running ...
user avatar
1 vote
1 answer
148 views

QUBO defined in Qiskit/DOcplex: how to solve it using Pennylane?

I have a complex Integer Linear Programming model defined in DOcplex/Qiskit representing a combinatorial optimization problem. Using the Qiskit utils, it is possible to covert it to either an Ising ...
user avatar
3 votes
1 answer
90 views

Why is $\langle \psi| \sigma_z |\psi \rangle=\cos(\phi_1)\cos(\phi_2)$ for $|\psi\rangle=R_y(\phi_2)R_x(\phi_1)|0\rangle$?

I'm trying some example with the rotation gates and stuck here: $$\langle \psi| \sigma_z |\psi \rangle = \langle 0 | R_x(\phi_1)^\dagger R_y(\phi_2)^\dagger \sigma_z R_y(\phi_2) R_x(\phi_1) | 0 \...
user avatar
  • 325
4 votes
1 answer
64 views

How can I write unit tests for a pennylane circuit?

I have several mixing unitary circuits written using Pennylane to be used in the QAOA algorithm. Furthermore, I'd like to write unit tests for these mixing circuits to ensure that the code is doing ...
user avatar
4 votes
1 answer
323 views

Differentiable Programming of Quantum Computers

Recently, I have tried PennyLane and TensorFlow Quantum. These platforms are said to provide differentiable programming of quantum computers but I can't understand it clearly though. I have searched ...
user avatar
4 votes
2 answers
306 views

How to create the equivalent of the Qiskit rxx gate in Pennylane?

How can I create the Pennylane equivalent of: from qiskit import QuantumCircuit circ = QuantumCircuit(2, 2) circ.rxx(theta=0.3, qubit1=0, qubit2=1)
user avatar
5 votes
1 answer
179 views

Pennylane: creating QNodes for large numbers of circuits that only differ by number of wires

Take the following simple quantum function: ...
user avatar
  • 1,833
4 votes
2 answers
386 views

Computing expectation value of product of observables in PennyLane

In PennyLane, the following circuit returns the expectation value of the PauliZ observable on qubit (wire) 1: ...
user avatar
  • 1,833
10 votes
1 answer
303 views

What are the benefits of using quantum machine learning?

I have been investigating uses for quantum machine learning, and have made a few working examples (variations of variational quantum classifiers using PennyLane). However, my issue now is its ...
user avatar
  • 323
8 votes
3 answers
136 views

What are the differences between the IBM machines?

I'm quite new to this field, and have started sending jobs to IBM's quantum computers. I have access to around 11 locations. I can see that these have different numbers of qubits within them, and then ...
user avatar
  • 323
3 votes
1 answer
145 views

PennyLane operations - Kerr, Displacement and Squeeze

I am familiar with the quantum gates of Qiskit, but I become very confused when looking at the continuous variable (CV) operations in the PennyLane documentation. I am especially interested in the ...
user avatar
  • 441
6 votes
3 answers
2k views

Pennylane and Qiskit for quantum machine learning

I'm interested in quantum computing, specifically in “quantum machine learning” (QML). I'm going to start my masters program in computer science and have previous experience in classical machine ...
user avatar
2 votes
1 answer
561 views

Expected value of a product of the Pauli matrices in different bases

I'm trying to reproduce the results of this article https://arxiv.org/abs/1801.03897, using Qiskit and Xanadu PennyLane. Particularly, this part with expected values of the Pauli operators: For ...
user avatar
  • 748