Hi,
I continue to try different aspects of PennyLane. In this tutorial
you are using amplitude embedding: qml.AmplitudeEmbedding() to input 8x8 images on 6 qubits.
Is an implementation available for this method of state initialization on gate-based real hardware? If not, are there any alternatives for O(100) pixel image embedding for real HW execution when using PennyLane?
I made a simple example which runs on ‘default.qubit’ but crashes in transpiler if I change device to ‘ibmq_qasm_simulator’. The error is:
TranspilerError: "HighLevelSynthesis was unable to synthesize Instruction(name='reset', num_qubits=1, num_clbits=0, params=[ ])."
This is the reproducer:
num_wires = 4
X=np.random.rand(2 ** num_wires)
X/=np.linalg.norm(X)
if 1:
backN='ibmq_qasm_simulator'
from qiskit_ibm_provider import IBMProvider
provider = IBMProvider()
backend = provider.get_backend(backN)
dev = qml.device('qiskit.ibmq', wires=num_wires, backend=backend, shots=2000)
else:
dev = qml.device('default.qubit', wires=num_wires)
def encoder( features):
wires = list(range(num_wires))
qml.AmplitudeEmbedding(features=features, wires=wires, pad_with=0.5)
return qml.probs(wires=wires)
qnode = qml.QNode(encoder, dev)
print(qml.draw(qnode)(X))
# run circuit on IBM HW
probTens = qnode(X)
This is my software stack:
Name: PennyLane
Version: 0.34.0
Summary: PennyLane is a Python quantum machine learning library by Xanadu Inc.
Home-page: https://github.com/PennyLaneAI/pennylane
Author:
Author-email:
License: Apache License 2.0
Location: /usr/local/lib/python3.10/dist-packages
Requires: appdirs, autograd, autoray, cachetools, networkx, numpy, pennylane-lightning, requests, rustworkx, scipy, semantic-version, toml, typing-extensions
Required-by: PennyLane-Cirq, PennyLane-Lightning, PennyLane-Lightning-GPU, PennyLane-qiskit, PennyLane-SF
Platform info: Linux-6.6.9-200.fc39.x86_64-x86_64-with-glibc2.35
Python version: 3.10.12
Numpy version: 1.23.5
Scipy version: 1.11.4
Installed devices:
- default.gaussian (PennyLane-0.34.0)
- default.mixed (PennyLane-0.34.0)
- default.qubit (PennyLane-0.34.0)
- default.qubit.autograd (PennyLane-0.34.0)
- default.qubit.jax (PennyLane-0.34.0)
- default.qubit.legacy (PennyLane-0.34.0)
- default.qubit.tf (PennyLane-0.34.0)
- default.qubit.torch (PennyLane-0.34.0)
- default.qutrit (PennyLane-0.34.0)
- null.qubit (PennyLane-0.34.0)
- cirq.mixedsimulator (PennyLane-Cirq-0.34.0)
- cirq.pasqal (PennyLane-Cirq-0.34.0)
- cirq.qsim (PennyLane-Cirq-0.34.0)
- cirq.qsimh (PennyLane-Cirq-0.34.0)
- cirq.simulator (PennyLane-Cirq-0.34.0)
- lightning.qubit (PennyLane-Lightning-0.34.0)
- lightning.gpu (PennyLane-Lightning-GPU-0.34.0)
- strawberryfields.fock (PennyLane-SF-0.29.0)
- strawberryfields.gaussian (PennyLane-SF-0.29.0)
- strawberryfields.gbs (PennyLane-SF-0.29.0)
- strawberryfields.remote (PennyLane-SF-0.29.0)
- strawberryfields.tf (PennyLane-SF-0.29.0)
- qiskit.aer (PennyLane-qiskit-0.34.0)
- qiskit.basicaer (PennyLane-qiskit-0.34.0)
- qiskit.ibmq (PennyLane-qiskit-0.34.0)
- qiskit.ibmq.circuit_runner (PennyLane-qiskit-0.34.0)
- qiskit.ibmq.sampler (PennyLane-qiskit-0.34.0)
- qiskit.remote (PennyLane-qiskit-0.34.0)