import pennylane as qml
from pennylane import numpy as np
from mqss.pennylane_adapter.device import MQSSPennylaneDevice
dev = MQSSPennylaneDevice(wires=2, token=MQSS_TOKEN, backends=MQSS_BACKENDS)
@qml.qnode(dev, interface="autograd", diff_method="parameter-shift", shots = 1024)
def quantum_function_autograd(x, y):
qml.RZ(x, wires=0)
qml.CNOT(wires=[0, 1])
qml.RY(y, wires=1)
qml.CNOT(wires=[1, 0])
qml.RX(x, wires=1)
return qml.expval(qml.PauliX(0) @ qml.PauliZ(1)) # Here, qubits 0 and 1 are being measured, in bases X and Z, respectively.
params = np.array([0.1, 0.2], requires_grad=True)
results = qml.gradients.param_shift(quantum_function_autograd)(params[0], params[1])
We need to first investigate, if
MQSSPennylaneAdapteris able to run in Autograd mode and can use parameter-shift method:To-Do's: