Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion doc/dev/sharp_bits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1317,4 +1317,7 @@ Currently, however, this is not the case for the following functionalities.
return qml.probs(wires=[0])

>>> print(circuit())
NotImplementedError: Dynamically allocated wires cannot be used in quantum adjoints yet.
NotImplementedError: Dynamically allocated wires cannot be used in quantum adjoints yet.

- Usage of ``qml.allocate()`` with Catalyst prohibits returning any terminal measurement
*except for* ``qml.probs``.
14 changes: 14 additions & 0 deletions frontend/catalyst/from_plxpr/qfunc_interpreter.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,20 @@ def interpret_measurement(self, measurement):
"""
)
)
# Only probs measurements are currently supported with dynamic allocation
# due to a bug in Lightning's PartialSample implementation
# TODO: Remove this once the bug is fixed
if not isinstance(measurement, qml.measurements.ProbabilityMP):
raise CompileError(
textwrap.dedent(
"""
Only probability measurements (qml.probs) are currently supported
when dynamic allocations are present in the program. Other measurement
types (qml.sample, qml.expval, qml.var, ...etc) will be supported
in a future release after the underlying bug is fixed.
"""
)
)

if type(measurement) not in measurement_map:
raise NotImplementedError(
Expand Down