Open
Description
For the following circuit, gradient verification fails:
@qml.qjit
def f(params, x):
@qml.qnode(dev, diff_method="parameter-shift")
def circuit(params, x):
qml.IQPEmbedding(x, wires=range(3), n_repeats=1)
qml.StronglyEntanglingLayers(params["weights"], wires=range(3), imprimitive=qml.CZ)
return qml.expval(qml.PauliZ(0) @ qml.PauliZ(1))
return catalyst.grad(circuit)(params, x)
>>> x = jnp.array([0.1, 0.2, 0.3])
>>> params = {"weights": jnp.ones([3, 3, 3])}
>>> f(params, x)
File catalyst/device/verification.py:238, in validate_observables_parameter_shift.<locals>._obs_checker(obs)
237 def _obs_checker(obs):
--> 238 if obs and obs.grad_method not in {"A", None}:
239 raise DifferentiableCompileError(
240 f"{obs.name} does not support analytic differentiation"
241 )
AttributeError: 'Prod' object has no attribute 'grad_method'