Skip to content

Test channel inclusion in random circuit generators.#1091

Merged
mhucka merged 4 commits into
tensorflow:masterfrom
rosspeili:test-random-circuit-channels
Jun 9, 2026
Merged

Test channel inclusion in random circuit generators.#1091
mhucka merged 4 commits into
tensorflow:masterfrom
rosspeili:test-random-circuit-channels

Conversation

@rosspeili

Copy link
Copy Markdown
Contributor

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tensorflow_quantum/python/util_test.py
Comment thread tensorflow_quantum/python/util_test.py
Comment thread tensorflow_quantum/python/util_test.py
rosspeili added 2 commits June 6, 2026 22:42
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
@tensorflow tensorflow deleted a comment from google-cla Bot Jun 7, 2026

@mhucka mhucka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread tensorflow_quantum/python/util_test.py Outdated
@rosspeili rosspeili requested a review from mhucka June 7, 2026 07:43

@mhucka mhucka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes. Looks good to me now!

@mhucka mhucka added this pull request to the merge queue Jun 9, 2026
Merged via the queue into tensorflow:master with commit c22028e Jun 9, 2026
9 checks passed
@rosspeili rosspeili deleted the test-random-circuit-channels branch June 10, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test that channel-based random circuits are correctly generated and handled

2 participants