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

Update script and benchmarking plot for adjoint diff demo #1144

Merged
merged 4 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified _static/demonstration_assets/adjoint_diff/scaling.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions demonstrations/adjoint_diff_benchmarking.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
}
],
"dateOfPublication": "2021-11-23T00:00:00+00:00",
"dateOfLastModification": "2024-01-01T00:00:00+00:00",
"dateOfLastModification": "2024-07-04T00:00:00+00:00",
"categories": [],
"tags": [],
"previewImages": [
{
"type": "thumbnail",
"uri": "/_static/demonstration_assets/adjoint_diff/icon.png"
"uri": "/_static/demonstration_assets/regular_demo_thumbnails/thumbnail_adjoint_differentiation.png"
}
],
"seoDescription": "Benchmarking file for adjoint diff demonstration.",
Expand Down
13 changes: 7 additions & 6 deletions demonstrations/adjoint_diff_benchmarking.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
:property="og:image": https://pennylane.ai/qml/_static/thumbs/code.png


*Author: Christina Lee — Posted: 23 November 2021. Last updated: 23 November 2021.*
*Author: Christina Lee — Posted: 23 November 2021. Last updated: 04 July 2024.*

"""

Expand Down Expand Up @@ -98,14 +98,15 @@ def circuit(params):


if __name__ == "__main__":
layers_list = [1, 3, 5, 7, 9]
n_wires = 5
adjoint_layers, backprop_layers, ps_layers = layers_scaling(n_wires, layers_list)

wires_list = [3, 6, 9, 12, 15]
n_layers = 3
n_layers = 6
adjoint_wires, backprop_wires, ps_wires = wires_scaling(wires_list, n_layers)

layers_list = [3, 9, 15, 21, 27]
n_wires = 12
adjoint_layers, backprop_layers, ps_layers = layers_scaling(n_wires, layers_list)

# Generating the graphic
fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(10, 4))

Expand All @@ -132,7 +133,7 @@ def circuit(params):
ax2.set_ylabel("Time")
ax2.set_title("Scaling with Layers")

plt.savefig("adjoint_diff/scaling.png")
plt.savefig("scaling.png")

##############################################################################
#
Expand Down
Loading