in src/braket/pennylane_plugin/braket_device.py [0:0]
def _braket_to_pl_result(self, braket_result, circuit):
"""Calculates the PennyLane results from a Braket task result. A PennyLane circuit
also determines the output observables."""
# Compute the required statistics
results = self.statistics(braket_result, circuit.observables)
# Ensures that a combination with sample does not put
# single-number results in superfluous arrays
all_sampled = all(obs.return_type is Sample for obs in circuit.observables)
if circuit.is_sampled and not all_sampled:
return np.asarray(results, dtype="object")
return np.asarray(results)