You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
File ~/Xanadu/pennylane/pennylane/measurements/expval.py:74, in expval(op)
68 if isinstance(op, qml.Identity) and len(op.wires) == 0:
69 # temporary solution to merge https://github.com/PennyLaneAI/pennylane/pull/5106
70 raise NotImplementedError(
71 "Expectation values of qml.Identity() without wires are currently not allowed."
72 )
---> 74 if not op.is_hermitian:
75 warnings.warn(f"{op.name} might not be hermitian.")
77 return ExpectationMP(obs=op)
File ~/Xanadu/pennylane/pennylane/ops/op_math/sprod.py:201, in SProd.is_hermitian(self)
197 @property
198 def is_hermitian(self):
199 """If the base operator is hermitian and the scalar is real,
200 then the scalar product operator is hermitian."""
--> 201 return self.base.is_hermitian and not qml.math.iscomplex(self.scalar)
[... skipping hidden 1 frame]
File ~/anaconda3/envs/pennylane311/lib/python3.11/site-packages/jax/_src/core.py:1510, in concretization_function_error.<locals>.error(self, arg)
1509 def error(self, arg):
-> 1510 raise TracerBoolConversionError(arg)
TracerBoolConversionError: Attempted boolean conversion of traced array with shape bool[1]..
The error occurred while tracing the function qnode at /var/folders/yv/h7q98p6d2td8vzzbdszwc5l40000gq/T/ipykernel_49113/2688043293.py:3 for jit. This concrete value was not available in Python because it depends on the value of the argument x.
See https://jax.readthedocs.io/en/latest/errors.html#jax.errors.TracerBoolConversionError
The text was updated successfully, but these errors were encountered:
The problem is we are hitting the
is_hermitian
check inpennylane/measurements/expval.py
which does not work for abstract tracers.Same problem for
qml.sum(qml.s_prod(x, X(0)))
orqml.prod(qml.s_prod(x, X(0)))
The text was updated successfully, but these errors were encountered: