Skip to content

add: unit test for random circuit generation#1056

Open
kenya-sk wants to merge 5 commits intotensorflow:masterfrom
kenya-sk:test-random-circuit-shape
Open

add: unit test for random circuit generation#1056
kenya-sk wants to merge 5 commits intotensorflow:masterfrom
kenya-sk:test-random-circuit-shape

Conversation

@kenya-sk
Copy link
Copy Markdown
Contributor

@kenya-sk kenya-sk commented Apr 27, 2026

I have addressed Issue #1037.
This test case check the output shape and type from random_circuit_resolver_batch and random_symbol_circuit_resolver_batch.

The following are the results of test cases.

$ bazel test //tensorflow_quantum/python:util_test

INFO: Elapsed time: 19.225s, Critical Path: 14.43s
INFO: 204 processes: 3 internal, 201 local.
INFO: Build completed successfully, 204 total actions
//tensorflow_quantum/python:util_test                                    PASSED in 8.0s

Executed 1 out of 1 test: 1 test passes.
There were tests whose specified size is too big. Use the --test_verbose_timeout_warnings command line option to see which ones these are.

Copy link
Copy Markdown

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

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 introduces unit tests for random_circuit_resolver_batch and random_symbol_circuit_resolver_batch to verify their output types and shapes. The review feedback suggests expanding the test coverage to include cases where include_channels=True, as well as adding more rigorous assertions to ensure circuits are correctly parameterized or non-parameterized as expected.

Comment thread tensorflow_quantum/python/util_test.py Outdated
len(serializer.SERIALIZER.supported_gate_types()) -
len(util.get_supported_gates()))

def test_random_circuit_resolver_batch_shapes_and_types(self):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The current tests only verify the default behavior where include_channels=False. It would be beneficial to add test cases or parameterize these tests to also cover include_channels=True to ensure that channel-based random circuits are correctly generated and handled.

Comment thread tensorflow_quantum/python/util_test.py
Comment thread tensorflow_quantum/python/util_test.py
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.

1 participant