PennyLaneAI / PennyLaneAI/catalyst

[BUG] `qml.probs` on Amazon Braket device without shots raises cryptic error

Open
#453 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
234
Forks
84
Avg merge
2d 15h
Merged PRs (30d)
66

Description

dev = qml.device("braket.local.qubit", wires=2)

@qjit
@qml.qnode(dev)
def f(x: float):
    qml.PSWAP(x, wires=[0, 1])
    qml.ISWAP(wires=[1, 0])
    return qml.probs()

f(0.3)

The circuit raises a cryptic error that does not make it clear what the problem is:

RuntimeError: [OpenQasmRunner.hpp][Line:217][Function:Probs] Error in Catalyst Runtime: 'NoneType' object has no attribute 'items'

The same circuit with shots= set in the device works. But I also tested qml.probs without shots with just PennyLane and Braket and it seems to work, so I think there is a bug on our side.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the supplied qjit reproducer with and without device shots, then compare it with the plain PennyLane and Braket case described in the issue. Trace the qml.probs path used by qjit and Braket; done means the no-shots case produces a clear result or diagnostic instead of the NoneType error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.