-
Notifications
You must be signed in to change notification settings - Fork 193
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
Gates and channels don't check that their arguments are real numbers (sf 0.9) #47
Comments
Hi @ziofil, this is actually intentional behaviour, but specific to the Since we can make use of Python's duck typing, we tried to support both forms with the following docstring: i.e., |
Oh! Sorry for not spotting that earlier... bad example 😆 |
Early on, we had a discussion internally on how much input validation we wanted to do in Strawberry Fields. We definitely did more input validation in places like the engine (i.e., number of qumodes, etc), but decided to be less stringent for the gates. This was for several reasons:
Although, in this case, since the |
Hello, I noticed there is some type checking on the parameters of, for example, the Decomposition class.
I would be interested in adding validation using a similar pattern for the LossChannel. If I do this, however, I would feel it necessary to be consistent in terms of the amount of validation on the gates in general. Are you open to a changeset including added validation across the board. I would be enthusiastic to write this. |
For now, I have implemented the following for this specific case. I will wait to hear from you before I make changes across the board.
|
Gates and channels don't check that their arguments are real numbers.
Example:
This keeps running without raising an exception.
The text was updated successfully, but these errors were encountered: