Test channel inclusion in random circuit generators.#1091
Conversation
There was a problem hiding this comment.
Code Review
This pull request documents the include_channels argument in several random circuit generation utility functions and adds comprehensive unit tests to verify channel generation, handling, and serialization. The reviewer pointed out that the newly added tests only seed Python's built-in random module, whereas the underlying utility functions rely on NumPy's random generator. This can lead to non-deterministic and flaky tests, so the reviewer suggested seeding np.random as well in all three test cases.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Add behavioral coverage for include_channels=True/False in util_test, including channel presence, non-parameterization, and TFQ serialization round-trips. Document include_channels in random circuit helper docstrings. Fixes tensorflow#1066
aae9428 to
e092837
Compare
mhucka
left a comment
There was a problem hiding this comment.
Thank you for this work!
Please see the comment about the test that may miss some possible cases.
Also, I did not have time to look further down to see if there's a similar situation elsewhere in util_test.py, so please check that.
mhucka
left a comment
There was a problem hiding this comment.
Thanks for the changes. Looks good to me now!
Behavioral coverage for include_channels=True/False in util_test, including channel presence, non-parameterization, and TFQ serialization round-trips. Document include_channels in random circuit helper docstrings.
Fixes #1066