From 4d4b8798984109dc5a87054e73bb5e4ca41f36ee Mon Sep 17 00:00:00 2001 From: Josh Izaac Date: Tue, 21 May 2019 09:45:08 -0400 Subject: [PATCH 1/2] bug fixes --- doc/tutorials/qubit_rotation.rst | 2 +- pennylane/_device.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/doc/tutorials/qubit_rotation.rst b/doc/tutorials/qubit_rotation.rst index 34eeb891126..5265d6b2fc3 100644 --- a/doc/tutorials/qubit_rotation.rst +++ b/doc/tutorials/qubit_rotation.rst @@ -249,7 +249,7 @@ We can then evaluate this gradient function at any point in the parameter space. >>> dcircuit(0.54, 0.12) (array(-0.510438652516502), array(-0.10267819945693203)) - Keyword arguments may also be used in your custom quantum function. PennyLane does differentiate QNodes with respect to keyword arguments, + Keyword arguments may also be used in your custom quantum function. PennyLane does **not** differentiate QNodes with respect to keyword arguments, so they are useful for passing external data to your QNode. diff --git a/pennylane/_device.py b/pennylane/_device.py index dc8ecd00b60..ec50450903b 100644 --- a/pennylane/_device.py +++ b/pennylane/_device.py @@ -205,7 +205,8 @@ def execute(self, queue, expectation): with self.execution_context(): self.pre_apply() for operation in queue: - self.apply(operation.name, operation.wires, operation.parameters) + w = [int(i) for i in operation.wires] + self.apply(operation.name, w, operation.parameters) self.post_apply() self.pre_expval() From 01476298cecd51e1acfb2c8cf2e3e898eafbaddc Mon Sep 17 00:00:00 2001 From: Josh Izaac Date: Tue, 21 May 2019 09:53:18 -0400 Subject: [PATCH 2/2] move where bug fix is --- pennylane/_device.py | 3 +-- pennylane/operation.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pennylane/_device.py b/pennylane/_device.py index ec50450903b..dc8ecd00b60 100644 --- a/pennylane/_device.py +++ b/pennylane/_device.py @@ -205,8 +205,7 @@ def execute(self, queue, expectation): with self.execution_context(): self.pre_apply() for operation in queue: - w = [int(i) for i in operation.wires] - self.apply(operation.name, w, operation.parameters) + self.apply(operation.name, operation.wires, operation.parameters) self.post_apply() self.pre_expval() diff --git a/pennylane/operation.py b/pennylane/operation.py index 43db7317c28..355c36c4cb9 100644 --- a/pennylane/operation.py +++ b/pennylane/operation.py @@ -373,7 +373,7 @@ def wires(self): """ w = [i.val if isinstance(i, Variable) else i for i in self._wires] self.check_wires(w) - return w + return [int(i) for i in w] @property def parameters(self):