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

Batch Refactor #521

Draft
wants to merge 20 commits into
base: develop
Choose a base branch
from
Draft

Batch Refactor #521

wants to merge 20 commits into from

Conversation

apchytr
Copy link
Collaborator

@apchytr apchytr commented Nov 8, 2024

Context: Currently in develop, there is no interface explicitly defined for the handling of batch dims. This makes things such as adding new batch dimensions (e.g. for measurement outcomes) difficult. Additionally, we wish to introduce the concept of "batch labels" where ideally some class is responsible for the handling of batch labels. As such, in this PR we introduce the Batch class.

Description of the Change: Introduce the Batch class.

Benefits: Having a concrete interface means a cleaner, safer implementation of batching where we can now define arbitrary batch dims and attribute batch labels to them (for mrm einsum).

TODO:
- ArrayAnsatz
- Everything working w arbitrary batch dims
- Handling of batch labels
- Improve ufunc as much as possible
- Cleanup
- Tests

@apchytr apchytr added WIP work in progress no changelog Pull request does not require a CHANGELOG entry labels Nov 8, 2024
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 83.67347% with 16 lines in your changes missing coverage. Please review.

Project coverage is 89.65%. Comparing base (f3c226d) to head (a389643).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
mrmustard/physics/batches.py 77.14% 16 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #521      +/-   ##
===========================================
- Coverage    89.81%   89.65%   -0.17%     
===========================================
  Files           93       94       +1     
  Lines         6098     6158      +60     
===========================================
+ Hits          5477     5521      +44     
- Misses         621      637      +16     
Files with missing lines Coverage Δ
mrmustard/lab_dev/transformations/base.py 99.42% <100.00%> (ø)
mrmustard/math/backend_manager.py 98.16% <ø> (-0.01%) ⬇️
mrmustard/physics/ansatz/polyexp_ansatz.py 98.55% <100.00%> (-0.05%) ⬇️
mrmustard/physics/batches.py 77.14% <77.14%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f3c226d...a389643. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog Pull request does not require a CHANGELOG entry WIP work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant