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
I would expect identical behavior for both lists or tuples.
Actual behavior
If we return a measurement process in a list, we add back in a dimension. But if the measurement process is in a tuple, we do not add a tuple dimension back in.
**Context:**
The output of QNode execution was not consistent based on the type of
the qfunc output,
```python
@qml.qnode(qml.device('default.qubit'))
def circuit(t):
return t([qml.expval(qml.Z(0))])
>>> circuit(tuple)
1.0
>>> circuit(list)
[1.0]
```
**Description of the Change:**
Updates how the results of the QNode execution gets "type-converted"
according to the `qfunc_output`.
After this fix we get consistency,
```python
@qml.qnode(qml.device('default.qubit'))
def circuit(t):
return t([qml.expval(qml.Z(0))])
>>> circuit(tuple)
(1.0,)
>>> circuit(list)
[1.0]
```
**Benefits:** Consistency
**Possible Drawbacks:** Output of QNode execution may look different
than people are used to. A direct example is needed to change some tests
to squeeze out the new dimension that has been introduced.
**Related GitHub Issue:** #6540
[sc-77682]
Expected behavior
I would expect identical behavior for both lists or tuples.
Actual behavior
If we return a measurement process in a list, we add back in a dimension. But if the measurement process is in a tuple, we do not add a tuple dimension back in.
Additional information
No response
Source code
Existing GitHub issues
The text was updated successfully, but these errors were encountered: