-
Notifications
You must be signed in to change notification settings - Fork 575
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
move draw
and draw_mpl
to drawer
module
#2396
Conversation
@@ -200,6 +200,10 @@ | |||
* Circuit cutting now performs expansion to search for wire cuts in contained operations or tapes. | |||
[(#2340)](https://github.com/PennyLaneAI/pennylane/pull/2340) | |||
|
|||
* The `qml.draw` and `qml.draw_mpl` transforms are now located in the `drawer` module. They can still be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be considered a breaking change? It shouldn't have any user facing ramifications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What comes to mind is that it could be breaking if there were occurrences of qml.transforms.draw
anywhere in our codebase or in user code.
from .drawable_layers import drawable_layers | ||
from .utils import convert_wire_order |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These two methods are only accessed internally by tape_text
and tape_mpl
. I don't see a reason we need to make them accessible from here.
…pennylane into move-draw-trasnform
Codecov Report
@@ Coverage Diff @@
## master #2396 +/- ##
=======================================
Coverage 99.42% 99.42%
=======================================
Files 243 243
Lines 18864 18864
=======================================
Hits 18756 18756
Misses 108 108
Continue to review full report at Codecov.
|
Co-authored-by: antalszava <antalszava@gmail.com>
Developer Methods | ||
----------------- | ||
|
||
.. automodapi:: pennylane.drawer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this was changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
draw
and draw_mpl
are not developer methods. In fact, they're the most important methods of the module, so I thought it would be important to move them to the top.
I think tape_text
and tape_mpl
are on the boundary between user-facing and developer-only. They have quite a bit of use for anyone working primarily with tapes instead of just qnodes.
@@ -14,15 +14,14 @@ | |||
""" | |||
This module provides the circuit drawing functionality used to display circuits visually. | |||
|
|||
.. currentmodule:: pennylane.circuit_drawer | |||
.. currentmodule:: pennylane.drawer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come this name changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This name changed happened a few months ago. Seems like this line just slipped through that PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I argue that the concept of drawing is more important than a common structural pattern.
No strong opinions about this, unless any objections arise, happy to approve once the small questions are answered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
Currently,
qml.draw
andqml.draw_mpl
are located within thetransforms
module, as they do indeed take a qnode and turn it into a function that returns something else.BUT, the two functions only depend on code in the
drawer
module and nothing in thetransforms
module. Nothing else in thetransforms
module depends on these methods.Yes, structurally they look like other things in the
transforms
module, but there is an entire module dedicated to the concept of drawing. I argue that the concept of drawing is more important than a common structural pattern.This is an internal organization change only and has no user-facing implications.