XanaduAI / strawberryfields

Strawberry Fields is a full-stack Python library for designing, simulating, and optimizing continuous variable (CV) quantum optical circuits.
https://strawberryfields.ai
Apache License 2.0
754 stars 191 forks source link

Make tensorflow dtype adjustable by user #486

Closed co9olguy closed 3 years ago

co9olguy commented 3 years ago

It would be nice to allow users to set a custom value for the tensorflow dtype if they are really pushing their simulations (and aware of the memory tradeoffs). This would be a very straightforward feature to add, most likely by adjusting backend_options to accept a dtype argument or something similar

See, e.g., the discussion below:

You could change this line https://github.com/XanaduAI/strawberryfields/blob/9800240e014d9b2844444cf92fd1b17b581dfa06/strawberryfields/backends/tfbackend/ops.py#L67

I tested it and you do get the correct result. Not surprisingly you also get a massive spike in memory usage.

Originally posted by @nquesada in https://github.com/XanaduAI/strawberryfields/issues/485#issuecomment-722786561

Aaron-Robertson commented 3 years ago

Hey @co9olguy, I'm looking to learn some more about sf/Xanadu and get involved along the way. Looks like this issue is still up for grabs?

I see the path forward here, so I'm happy to give it a shot!

josh146 commented 3 years ago

Hi @Aaron-Robertson! Yes this issue is still up for grabs if you would like to go for it :) Feel free to make a work-in-progress PR

Aaron-Robertson commented 3 years ago

Awesome, will do asap!