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

Fix drawing a QNode with no operations #1354

Merged
merged 4 commits into from
May 22, 2021
Merged

Fix drawing a QNode with no operations #1354

merged 4 commits into from
May 22, 2021

Conversation

antalszava
Copy link
Contributor

@antalszava antalszava commented May 21, 2021

Context
QNodes with no operations raises an error when drawn.

This error boils down to the grid that the CircuitDrawer creates. There is a copying operation that is called on a None type object (due to having no operations).

Changes

Catches the case where the grid is None and no copying of the internal grid happens, instead, an empty grid is used.

Ralated Issues
#1326

.github/CHANGELOG.md Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented May 21, 2021

Codecov Report

Merging #1354 (9c19cab) into master (89b9f64) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1354   +/-   ##
=======================================
  Coverage   98.26%   98.26%           
=======================================
  Files         146      146           
  Lines       11150    11150           
=======================================
  Hits        10956    10956           
  Misses        194      194           
Impacted Files Coverage Δ
pennylane/circuit_drawer/grid.py 88.70% <100.00%> (ø)

Continue to review full report at Codecov.

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

Copy link
Contributor

@agran2018 agran2018 left a comment

Choose a reason for hiding this comment

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

Thanks @antalszava !

Copy link
Member

@josh146 josh146 left a comment

Choose a reason for hiding this comment

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

Thanks @antalszava :) Nice fix!

@antalszava antalszava merged commit b7754de into master May 22, 2021
@antalszava antalszava deleted the draw_bug_2 branch May 22, 2021 15: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.

None yet

3 participants