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

[TAPE] Adds circuit drawing functionality to the quantum tape #824

Merged
merged 58 commits into from
Oct 13, 2020

Conversation

josh146
Copy link
Member

@josh146 josh146 commented Sep 25, 2020

No description provided.

Base automatically changed from tape-pr-10 to master September 28, 2020 08:16
Copy link
Contributor

@thisac thisac left a comment

Choose a reason for hiding this comment

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

Looks good @josh146. Just a few smaller comments/questions. So, for my own understanding, this simply connects the new quantum tape to the already existing circuit-drawer in circuit_graph.py?

Comment on lines 31 to 32
self._operations = ops
self._observables = obs
Copy link
Contributor

Choose a reason for hiding this comment

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

ops and obs are easily confused. 😆

Copy link
Member Author

Choose a reason for hiding this comment

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

They are, but I didn't want to alter the signature while still inheriting from the old circuit graph! Something to keep in mind when we decide to drop backcompatibility

Comment on lines +34 to +37
for m in self._observables:
if m.return_type is qml.operation.State:
# state measurements are applied to all device wires
m._wires = wires # pylint: disable=protected-access
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this have something to do with allowing state measurements to be applied without declaring on which wires?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep! exactly

pennylane/tape/qnode.py Outdated Show resolved Hide resolved
@@ -467,7 +511,7 @@ def to_tf(self, dtype=None):
output. If not provided, the default is ``tf.float64``.

Raises:
qml.QuantumFunctionError: if TensorFlow >= 2.1 is not installed
.QuantumFunctionError: if TensorFlow >= 2.1 is not installed
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this usually how it's written? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this was originally written by another contributor (and was copied from the old core), but I quite like how it avoids the redundancy of saying "raises a QuantumFunctionError if TensorFlow >= 2.1 is not installed".

pennylane/tape/tapes/tape.py Outdated Show resolved Hide resolved
tests/tape/tapes/test_qnode.py Show resolved Hide resolved
@josh146 josh146 merged commit 74e69be into master Oct 13, 2020
@josh146 josh146 deleted the tape-draw branch October 13, 2020 07:37
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.

None yet

3 participants