diff --git a/pennylane/templates/subroutines/arbitrary_unitary.py b/pennylane/templates/subroutines/arbitrary_unitary.py index e36d212b99d..3527bc0145b 100644 --- a/pennylane/templates/subroutines/arbitrary_unitary.py +++ b/pennylane/templates/subroutines/arbitrary_unitary.py @@ -83,8 +83,8 @@ class ArbitraryUnitary(Operation): .. code-block:: python def arbitrary_nearest_neighbour_interaction(weights, wires): - for w in range(0, len(wires) - 1, 2): - ArbitraryUnitary(weights, wires=[w, w + 1]) + for i, w in enumerate(range(0, len(wires) - 1, 2)): + ArbitraryUnitary(weights[i], wires=[w, w + 1]) Args: weights (tensor_like): The angles of the Pauli word rotations, needs to have length :math:`4^n - 1`