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

Replacing map_batch_transform in source code #5212

Merged

Conversation

PietropaoloFrisoni
Copy link
Contributor

@PietropaoloFrisoni PietropaoloFrisoni commented Feb 15, 2024

Context: In the PennyLane source code, the map_batch_transform method is currently used in several locations. However, a new functionality has recently been added to TransformDispatcher so that transforms can be dispatched onto a batch of tapes (see #5163).

Description of the Change: We replace the current usage of map_batch_transform in the source code, taking advantage of the new method _batch_transform implemented in the TransformDispatcher class.

Benefits: Implementing transforms over a batch of tapes without resorting to map_batch_transform is much more straightforward.

Possible Drawbacks: The new method in TransformDispatcher replacing map_batch_transform is called only if the transform is applied on a sequence consisting of qml.tape.QuantumScript instances. Finally, compared to map_batch_transform, the new method returns a tuple as a first variable (instead of a list).

Related GitHub Issues: None

[sc-56689]

@PietropaoloFrisoni PietropaoloFrisoni changed the title Replacing map batch transform in source code Replacing map_batch_transform in source code Feb 15, 2024
@PietropaoloFrisoni PietropaoloFrisoni marked this pull request as draft February 15, 2024 02:44
@PennyLaneAI PennyLaneAI deleted a comment from github-actions bot Feb 15, 2024
Copy link

codecov bot commented Feb 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (3216650) 99.68% compared to head (ffd8089) 99.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5212      +/-   ##
==========================================
- Coverage   99.68%   99.68%   -0.01%     
==========================================
  Files         396      396              
  Lines       36661    36387     -274     
==========================================
- Hits        36547    36272     -275     
- Misses        114      115       +1     

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

@PietropaoloFrisoni PietropaoloFrisoni marked this pull request as ready for review February 15, 2024 15:42
@PietropaoloFrisoni PietropaoloFrisoni requested a review from a team February 15, 2024 18:17
Copy link
Contributor

@timmysilv timmysilv left a comment

Choose a reason for hiding this comment

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

good stuff 👏 pls link the associated story to track this as in progress too:)

pennylane/workflow/execution.py Show resolved Hide resolved
@PietropaoloFrisoni PietropaoloFrisoni requested a review from a team February 16, 2024 13:08
Copy link
Contributor

@albi3ro albi3ro left a comment

Choose a reason for hiding this comment

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

🎉 Thanks!

Co-authored-by: Christina Lee <christina@xanadu.ai>
@PietropaoloFrisoni PietropaoloFrisoni merged commit 376a3a3 into master Feb 16, 2024
36 checks passed
@PietropaoloFrisoni PietropaoloFrisoni deleted the Replacing-map_batch_transform-in-source-code branch February 16, 2024 15:06
PietropaoloFrisoni added a commit that referenced this pull request May 15, 2024
**Context:** ***Part of  deprecations and removals for pennylane-0.37***

**Description of the Change:** Deprecating
``qml.transforms.map_batch_transform``, since a transform can be applied
directly to a batch of tapes. See #5163 and #5212.

[sc-58987]
Shiro-Raven pushed a commit that referenced this pull request May 15, 2024
**Context:** ***Part of  deprecations and removals for pennylane-0.37***

**Description of the Change:** Deprecating
``qml.transforms.map_batch_transform``, since a transform can be applied
directly to a batch of tapes. See #5163 and #5212.

[sc-58987]
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