torchquantum
torchquantum copied to clipboard
Raw probabilities for measurement results
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 , 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().