torchquantum icon indicating copy to clipboard operation
torchquantum copied to clipboard

Raw probabilities for measurement results

Open JustinS6626 opened this issue 1 year ago • 1 comments

When it comes to using measurement results in learning methods, is there a way to simply get the exact probability for each measurement result (as opposed to the expectation for each register) from the device? Xanadu Pennylane has the qml.probs() function for that.

JustinS6626 avatar Apr 14 '23 21:04 JustinS6626

@JustinS6626 , I also have same question about this, and I found in https://github.com/mit-han-lab/torchquantum/blob/main/torchquantum/measurement/measurements.py#L46 . state_mag = qdev.get_states_1d().abs().detach().cpu().numpy() This can extract the probability like qml.probs().

CYLphysics avatar Dec 24 '23 05:12 CYLphysics