TensorFlow vs Fock backends


I have been having some problems with the TensorFlow backend in comparison to the Fock backend. At high cutoff, the TF backend returns just a highly oscillating function in the expectation value of x. Whereas, the Fock returns a distribution which is what I was expecting - not highly oscillatory.

I would like to use the TF backend, as it is seemingly parallelised and runs a lot faster. However, I do not understand why it returns poor results at higher cutoff.

Please could you let me know why this is happening? Please see a rough outline of a circuit example below.


eng  = sf.Engine('tf', backend_options={'cutoff_dim':trunc})
prog = sf.Program(2)

with prog.context as q:
    Ket(array) | q[0]  # Where the array is a Gaussian state
    # Now do some Gaussian multi-qumode operations including...

    CXgate(...) | (q[0], q[1])

    # And Gaussian single qumode operations

Hi @simon.williams ,

Could you please share a self-contained version of your code so that we can try to replicate this behaviour? Ideally please send us a minimal working version of your code, avoiding any gates that don’t contribute to the error but including all imports and data used.

Also please let us know what versions of Strawberry Fields and TF you’re using. Thanks!