Skip to content

[WIP] Use set_shots in place of device(..., shots=...) #1370

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

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft
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
5 changes: 4 additions & 1 deletion demonstrations/ahs_aquila.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ def gaussian_fn(p, t):
# the gaussian pulse envelope via trial-and-error to find settings that result in a pi-pulse:
#

from functools import partial

max_amplitude = 2.0
displacement = 1.0
sigma = 0.3
Expand All @@ -512,9 +514,10 @@ def gaussian_fn(p, t):
params = [amplitude_params]
ts = [0.0, 1.75]

default_qubit = qml.device("default.qubit", wires=3, shots=1000)
default_qubit = qml.device("default.qubit", wires=3)


@partial(qml.set_shots, shots=1000)
@qml.qnode(default_qubit, interface="jax")
def circuit(parameters):
qml.evolve(global_drive)(parameters, ts)
Expand Down
4 changes: 3 additions & 1 deletion demonstrations/covalent_cloud_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import covalent_cloud as cc
import matplotlib.pyplot as plt
import pennylane as qml
from functools import partial
from matplotlib.colors import ListedColormap
from pennylane import numpy as np
from sklearn.datasets import make_blobs
Expand Down Expand Up @@ -124,7 +125,8 @@

def get_kernel_circuit(n_wires):

@qml.qnode(qml.device(QML_DEVICE, wires=n_wires, shots=None))
@partial(qml.set_shots, shots=None)
@qml.qnode(qml.device(QML_DEVICE, wires=n_wires))
def circuit(x1, x2):
qml.IQPEmbedding(x1, wires=range(n_wires), n_repeats=4)
qml.adjoint(qml.IQPEmbedding)(x2, wires=range(n_wires), n_repeats=4)
Expand Down
Loading