Quantum neural network for more than 2 modes

Hi, I am trying this tutorial for CV-QNN: https://strawberryfields.ai/photonics/demos/run_quantum_neural_network.html.

However, when I change the number of modes to 2 modes, the output cost and fidelity become nan.

Hi @namnguyen0510! This was a bug that was recently fixed by the team on the GitHub repo: Fixes the QNN example to use a safe absolute value function for multiple modes by antalszava · Pull Request #589 · XanaduAI/strawberryfields · GitHub

But good catch, it looks like the website still needs to be updated! In the meantime, you can try using the updated example file, strawberryfields/quantum_neural_network.py at master · XanaduAI/strawberryfields · GitHub directly from the GitHub repo :slight_smile:

Let me know if you have any other questions!

Hi, I tried the code but there is another bug:
TypeError: Engine() missing 1 required positional argument: ‘num_subsystems’

Hi @namnguyen0510 :slightly_smiling_face:

Which version of Strawberry Fields did the error arise with? The SF version can be checked for example by looking at the output of sf.about(), after the import strawberryfields as sf import statement.