From 65df2a6525f4159b02e925da6ec5e2e7a280f729 Mon Sep 17 00:00:00 2001 From: Mudit Pandey Date: Fri, 27 Oct 2023 12:07:04 -0400 Subject: [PATCH] Fix QNSPSA demo (#965) Replace `op.adjoint()` with `qml.adjoint(op)`. Got error about braket job name being taken, so changed name of job. --- demonstrations/qnspsa.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/demonstrations/qnspsa.py b/demonstrations/qnspsa.py index bfcda04148..935b399fda 100644 --- a/demonstrations/qnspsa.py +++ b/demonstrations/qnspsa.py @@ -415,7 +415,6 @@ def get_state_overlap(tape): def get_raw_tensor_metric(params_curr): - dir1 = get_perturbation_direction(params_curr) dir2 = get_perturbation_direction(params_curr) perturb1 = dir1 * finite_diff_step @@ -874,7 +873,7 @@ def __get_overlap_tape(self, cost, params1, params2): for op in op_forward: qml.apply(op) for op in reversed(op_inv): - op.adjoint() + qml.adjoint(copy(op)) qml.probs(wires=cost.tape.wires.labels) return tape @@ -980,7 +979,7 @@ def __apply_blocking(self, cost, params_curr, params_next): "spsa_repeats": 25, } -job_name = f"ref-paper-benchmark-qubit-{n_qubits}" +job_name = f"ref-paper-benchmark-qubit-{n_qubits}-job" instance_config = InstanceConfig(instanceType="ml.m5.large", volumeSizeInGb=30, instanceCount=1) job = AwsQuantumJob.create(