Skip to content

Commit

Permalink
seed fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dwierichs committed May 20, 2023
1 parent 09a24cb commit 7d16bae
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/gradients/core/test_gradient_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ class TestGradientTransformIntegration:
@pytest.mark.parametrize("slicing", [False, True])
def test_acting_on_qnodes_single_param(self, shots, slicing, atol):
"""Test that a gradient transform acts on QNodes with a single parameter correctly"""
np.random.seed(412)
dev = qml.device("default.qubit", wires=2, shots=shots)

@qml.qnode(dev)
Expand All @@ -214,8 +215,6 @@ def circuit(weights):
res = grad_fn(w)
assert circuit.interface == "auto"
expected = np.array([-np.sin(w[0] if slicing else w), 0])
print(expected)
print(res)
if isinstance(shots, list):
assert all(np.allclose(r, expected, atol=atol, rtol=0) for r in res)
else:
Expand All @@ -224,6 +223,7 @@ def circuit(weights):
@pytest.mark.parametrize("shots, atol", [(None, 1e-6), (1000, 1e-1), ([1000, 100], 2e-1)])
def test_acting_on_qnodes_multi_param(self, shots, atol):
"""Test that a gradient transform acts on QNodes with multiple parameters correctly"""
np.random.seed(412)
dev = qml.device("default.qubit", wires=2, shots=shots)

@qml.qnode(dev)
Expand Down

0 comments on commit 7d16bae

Please sign in to comment.