Skip to content
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

Rewrite tests for split_non_commuting #6687

Merged
merged 11 commits into from
Dec 13, 2024
Merged

Rewrite tests for split_non_commuting #6687

merged 11 commits into from
Dec 13, 2024

Conversation

astralcai
Copy link
Contributor

@astralcai astralcai commented Dec 9, 2024

This is an attempt to refactor the tests for one of the transforms, hoping to set a standard for future transform tests. For each transform, we should have:

  • Unit tests for basic functionalities of the transform:
    • Does the transform produce the correct tapes?
    • Does the processing function return the correct results (numerical correctness tested here)?
  • Tests for integration of the transform with a QNode:
    • Tests different combinations of parameter broadcasting and shots/shot-vectors
    • Mainly tests that the circuit executes without error and returns results with the correct shapes.
  • Tests for the differentiability of QNodes with this transform applied:
    • Tests different interfaces
    • Tests numerical correctness of the gradients

[sc-72000]
[sc-72519]

Copy link
Contributor

github-actions bot commented Dec 9, 2024

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@astralcai astralcai requested review from mlxd and albi3ro December 9, 2024 16:09
Copy link

codecov bot commented Dec 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.62%. Comparing base (0aa4738) to head (fd157b9).
Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff            @@
##           master    #6687    +/-   ##
========================================
  Coverage   99.61%   99.62%            
========================================
  Files         473      474     +1     
  Lines       44355    44617   +262     
========================================
+ Hits        44186    44448   +262     
  Misses        169      169            

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@mlxd mlxd left a comment

Choose a reason for hiding this comment

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

Thanks @astralcai

A few questions from my side:

tests/transforms/test_split_non_commuting.py Show resolved Hide resolved
tests/transforms/test_split_non_commuting.py Outdated Show resolved Hide resolved
tests/transforms/test_split_non_commuting.py Outdated Show resolved Hide resolved
tests/transforms/test_split_non_commuting.py Outdated Show resolved Hide resolved
tests/transforms/test_split_non_commuting.py Outdated Show resolved Hide resolved
tests/transforms/test_split_non_commuting.py Outdated Show resolved Hide resolved
tests/transforms/test_split_non_commuting.py Show resolved Hide resolved
tests/transforms/test_split_non_commuting.py Show resolved Hide resolved
tests/transforms/test_split_non_commuting.py Show resolved Hide resolved
tests/transforms/test_split_non_commuting.py Show resolved Hide resolved
@astralcai astralcai requested a review from mlxd December 10, 2024 17:07
Copy link
Member

@mlxd mlxd left a comment

Choose a reason for hiding this comment

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

Many previous questions resolved without comment. Same questions/prompts apply.

tests/transforms/test_split_non_commuting.py Outdated Show resolved Hide resolved
tests/transforms/test_split_non_commuting.py Outdated Show resolved Hide resolved
tests/transforms/test_split_non_commuting.py Outdated Show resolved Hide resolved
@astralcai astralcai requested review from mlxd and albi3ro December 11, 2024 14:25
@astralcai astralcai enabled auto-merge (squash) December 13, 2024 19:58
@astralcai astralcai merged commit 7ba76d6 into master Dec 13, 2024
45 checks passed
@astralcai astralcai deleted the transform-test branch December 13, 2024 21:07
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.

3 participants