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
change type annotation from float to TParamVal for theta and phi #4266
change type annotation from float to TParamVal for theta and phi #4266
Conversation
@@ -1181,7 +1181,7 @@ def test_run_floquet_characterization_for_moments(): | |||
itertools.product([0.1, 0.7], [-0.3, 0.1, 0.5], [-0.3, 0.2, 0.4], [-0.6, 0.1, 0.6], [0.2, 0.6]), | |||
) | |||
def test_fsim_phase_corrections( | |||
theta: float, zeta: float, chi: float, gamma: float, phi: float | |||
theta: cirq.value.TParamVal, zeta: float, chi: float, gamma: float, phi: cirq.value.TParamVal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is available on the main cirq
namespace, so can just do
theta: cirq.value.TParamVal, zeta: float, chi: float, gamma: float, phi: cirq.value.TParamVal | |
theta: cirq.TParamVal, zeta: float, chi: float, gamma: float, phi: cirq.TParamVal |
Can do this throughout cirq_google, since it's external to cirq_core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with maffoo's comments. Otherwise, LGTM.
Thanks for the feedback! :-) Will make the requested changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I think we should check whether a function whose parameter type is getting changed actually accepts symbols or not. One way of doing this could be to ensure that there's a test with symbols for the function whose parameter type we are changing.
@@ -1181,7 +1181,7 @@ def test_run_floquet_characterization_for_moments(): | |||
itertools.product([0.1, 0.7], [-0.3, 0.1, 0.5], [-0.3, 0.2, 0.4], [-0.6, 0.1, 0.6], [0.2, 0.6]), | |||
) | |||
def test_fsim_phase_corrections( | |||
theta: float, zeta: float, chi: float, gamma: float, phi: float | |||
theta: cirq.value.TParamVal, zeta: float, chi: float, gamma: float, phi: cirq.value.TParamVal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a reason why only theta / phi should accept TParamVal
here. It's not needed for both since we compute the unitary of the expected_gate
in the function and hence not using any parameters. Also, it doesn't look consistent with other parameters (zeta
, chi
, gamma
).
@@ -144,7 +144,7 @@ def _value_equality_values_(self) -> Any: | |||
return tuple(self._diag_angles_radians) | |||
|
|||
def _decompose_for_basis( | |||
self, index: int, bit_flip: int, theta: float, qubits: Sequence['cirq.Qid'] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should make the changes here since below _decompose_
explicitly checks that self
should not be parameterized and hence the parameter will always be a float
here.
@stubbi Gentle reminder. Please let me know once the comments are resolved and the PR is ready for re-review. |
@stubbi Are you still planning to work on this ? |
@stubbi Gentle reminder. |
@tanujkhattar this was done in #5075, so can be closed. |
resolves #4244