Skip to content

Commit

Permalink
Update deprecated gradient_fn argument to diff_method (#1264)
Browse files Browse the repository at this point in the history
**Summary:**

Updating deprecated code that was introduced from a recent deprecation
PennyLaneAI/pennylane#6549.

[sc-77590]
  • Loading branch information
andrijapau authored Nov 12, 2024
1 parent 3370db1 commit 0d7c3fb
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion demonstrations/tutorial_error_mitigation.metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}
],
"dateOfPublication": "2021-11-29T00:00:00+00:00",
"dateOfLastModification": "2024-11-06T00:00:00+00:00",
"dateOfLastModification": "2024-11-12T00:00:00+00:00",
"categories": [
"Algorithms",
"Quantum Computing"
Expand Down
4 changes: 2 additions & 2 deletions demonstrations/tutorial_error_mitigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def executor(circuits, dev=dev_noisy):
)
circuits_with_meas.append(circuit_with_meas)

return qml.execute(circuits_with_meas, dev, gradient_fn=None)
return qml.execute(circuits_with_meas, dev, diff_method=None)


##############################################################################
Expand Down Expand Up @@ -540,7 +540,7 @@ def executor(circuit):
circuits, postproc = qml.transforms.split_non_commuting(
circuit_with_meas, grouping_strategy=None
)
circuits_executed = qml.execute(circuits, dev_noisy, gradient_fn=None)
circuits_executed = qml.execute(circuits, dev_noisy, diff_method=None)
return postproc(circuits_executed)

mitig_energy = execute_with_zne(circuit, executor, scale_noise=fold_global)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
],
"dateOfPublication": "2022-09-02T00:00:00+00:00",
"dateOfLastModification": "2024-11-06T00:00:00+00:00",
"dateOfLastModification": "2024-11-12T00:00:00+00:00",
"categories": [
"Algorithms", "Quantum Computing"
],
Expand Down
4 changes: 2 additions & 2 deletions demonstrations/tutorial_quantum_circuit_cutting.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,10 +741,10 @@ def make_kraus_ops(num_wires: int):
tape0 = QuantumTape(ops=ops_0, measurements=tape.measurements, shots=channel_shots[0].item())
tape1 = QuantumTape(ops=ops_1, measurements=tape.measurements, shots=channel_shots[1].item())

(shots0,) = qml.execute([tape0], device=device, cache=False, gradient_fn=None)
(shots0,) = qml.execute([tape0], device=device, cache=False, diff_method=None)
samples[choices == 0] = shots0

(shots1,) = qml.execute([tape1], device=device, cache=False, gradient_fn=None)
(shots1,) = qml.execute([tape1], device=device, cache=False, diff_method=None)
samples[choices == 1] = shots1

######################################################################
Expand Down

0 comments on commit 0d7c3fb

Please sign in to comment.