Skip to content

Commit

Permalink
Fix rosalin demo (#949)
Browse files Browse the repository at this point in the history
Still not entirely sure why the problem with the shots was occuring, but
this fixes it.
  • Loading branch information
albi3ro authored Oct 5, 2023
1 parent 7cba984 commit fc2abd9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions demonstrations/tutorial_rosalin.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ def step(self, params):

argmax_gamma = np.unravel_index(np.argmax(gamma), gamma.shape)
smax = s[argmax_gamma]
self.s = np.clip(s, min(2, self.min_shots), smax)
self.s = np.clip(s, min(2, self.min_shots), max(2, smax))

self.k += 1
return params
Expand Down Expand Up @@ -591,9 +591,9 @@ def cost_analytic(weights):
params = init_params
opt = qml.AdamOptimizer(0.07)

non_analytic_dev.shots = adam_shots_per_eval
adam_dev = qml.device('default.qubit', shots=adam_shots_per_eval)

@qml.qnode(non_analytic_dev, diff_method="parameter-shift", interface="autograd")
@qml.qnode(adam_dev, diff_method="parameter-shift", interface="autograd")
def cost(weights):
StronglyEntanglingLayers(weights, wires=non_analytic_dev.wires)
return qml.expval(qml.Hamiltonian(coeffs, obs))
Expand Down

0 comments on commit fc2abd9

Please sign in to comment.