New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Keyword args are not passed to backend if same backend string is reused #41
Comments
This is definitely confusing and should be fixed to match what the user expects. Perhaps a simple solution would be a logic modification, so that if any passed keyword arguments (in this case, At the moment, this should only affect the Fock and TF backends with the |
Yeah, that's what I was thinking |
from engine.py run function
(added I'm not sure about checking against backend part, I just guessed self.backend.circuit._trunc would return
I took a slightly different approach by adding more stricter condition i.e on what condition backend should not be initialised. I'm not familiar with the codebase so I won't be making a pull request, but hope this might inspire some ideas for better solutions. |
Thanks for the suggestion @0xckylee |
This issue was fixed by #80 |
Putting this here because it is something I uncovered while debugging a user's code in the SF slack channel. I'm not sure what the intended behaviour that we want here is.
I will give example for "fock" backend, but also applies to "tf" backend (actually it's an engine issue).
If a user does, for example,
eng.run("fock", cutoff_dim=N)
, then later does this again, but with a different value for the kwargcutoff_dim
, then thecutoff_dim
used by the backend actually does not change.This is because (currently) the engine checks on the second run whether the desired backend type is the same. If it is, it avoids reinitializing a backend. As a consequence, any
kwargs
are not passed on to the backend itself.Code example:
The text was updated successfully, but these errors were encountered: