Closed jonasbrami closed 3 years ago
Hi @jonasbrami, the quantum_neural_network.py
tutorial is tailored towards using pure states. Adding loss channels to the circuit might (and in most cases does) result in mixed quantum states. Strawberry Fields keeps track of the purity of the state internally and the state.ket
method returns None
for mixed states. To adjust the tutorial for using loss channels, the code would likely need to be altered to use state.dm
(which returns the state in the density matrix formalism).
I'll remove the bug label, but let us know if you have any related questions. :slightly_smiling_face:
Thanks a lot for the explanation :)
Issue description
I may be missing something, but when trying to add LossChannels to the layer in the quantum_neural_network.py, the output of the layer is None
Expected behavior: Output shouldn't be None
Reproduces how often: 100%
System information:
Python version: 3.8.5 Platform info: Linux-5.8.0-44-generic-x86_64-with-glibc2.10 Installation path: /home/jonas/anaconda3/envs/strawberry/lib/python3.8/site-packages/strawberryfields Strawberry Fields version: 0.17.0 Numpy version: 1.19.2 Scipy version: 1.4.1 SymPy version: 1.7.1 NetworkX version: 2.5 The Walrus version: 0.14.0 Blackbird version: 0.3.1-dev TensorFlow version: 2.2.0
def layer(params, q, loss_channel=None, loss_channel_param=None): """CV quantum neural network layer acting on
N
modes.