Skip to content

Investigating and Enabling Autograd Support #31

@Bmete7

Description

@Bmete7

We need to first investigate, if MQSSPennylaneAdapter is able to run in Autograd mode and can use parameter-shift method:

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])

To-Do's:

  • Figuring out whether a scheme similar to described above works in latest stable version of MQSS Pennylane Adapter
  • If it can't, implement the required changes on the device level.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestgood first issueGood for newcomersquestionFurther information is requestedusabilityIncreasing the utility
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions