Repository: PennyLaneAI/pennylane
Pull request #4747 (2023-10-27 17:59:33)

Transformed device fix
The transformed device used `config` instead of `ExecutionConfig`, breaking integration with the qnode.

github-actions[bot]: Hello. You may have forgotten to update the changelog!
Please edit [`doc/releases/changelog-dev.md`](/PennyLaneAI/pennylane/blob/master/doc/releases/changelog-dev.md) with:
* A one-to-two sentence description of the change. You may include a small working example for new features.
* A link back to this PR.
* Your name (or GitHub username) in the contributors section.
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/PennyLaneAI/pennylane/pull/4747?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI) Report
All modified and coverable lines are covered by tests :white_check_mark:
> :exclamation: No coverage uploaded for pull request base (`v0.33.0-rc0@6fe47b5`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI#section-missing-base-commit).

<details><summary>Additional details and impacted files</summary>


```diff
@@              Coverage Diff               @@
##             v0.33.0-rc0    #4747   +/-   ##
==============================================
  Coverage               ?   99.64%           
==============================================
  Files                  ?      380           
  Lines                  ?    33998           
  Branches               ?        0           
==============================================
  Hits                   ?    33876           
  Misses                 ?      122           
  Partials               ?        0           
```




</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/PennyLaneAI/pennylane/pull/4747?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=PennyLaneAI).


Patch:
diff --git a/pennylane/transforms/core/transform_dispatcher.py b/pennylane/transforms/core/transform_dispatcher.py
index 6b95e0770..55383b23c 100644
--- a/pennylane/transforms/core/transform_dispatcher.py
+++ b/pennylane/transforms/core/transform_dispatcher.py
@@ -294,10 +294,11 @@ class TransformDispatcher:
                 return f"Transformed Device({original_device.__repr__()} with additional preprocess transform {self.transform})"
 
             def preprocess(
-                self, config: qml.devices.ExecutionConfig = qml.devices.DefaultExecutionConfig
+                self,
+                execution_config: qml.devices.ExecutionConfig = qml.devices.DefaultExecutionConfig,
             ):
                 """This function updates the original device transform program to be applied."""
-                program, config = self.original_device.preprocess(config)
+                program, config = self.original_device.preprocess(execution_config)
                 program.push_back(TransformContainer(self.transform, targs, tkwargs))
                 return program, config
 


Test patch:
diff --git a/tests/transforms/test_experimental/test_transform_dispatcher.py b/tests/transforms/test_experimental/test_transform_dispatcher.py
index 2ae36088c..cb5d3df81 100644
--- a/tests/transforms/test_experimental/test_transform_dispatcher.py
+++ b/tests/transforms/test_experimental/test_transform_dispatcher.py
@@ -109,7 +109,7 @@ def second_valid_transform(
     """A valid trasnform."""
     tape1 = tape.copy()
     tape2 = tape.copy()
-    tape2 = tape._ops.pop(index)  # pylint:disable=protected-access
+    tape._ops.pop(index)  # pylint:disable=protected-access
 
     def fn(results):
         return qml.math.sum(results)
@@ -557,6 +557,13 @@ class TestTransformDispatcher:  # pylint: disable=too-many-public-methods
 
         assert new_program[-1].transform is valid_transform
 
+        @qml.qnode(new_dev)
+        def circuit():
+            qml.PauliX(0)
+            return qml.state()
+
+        circuit()
+
     @pytest.mark.parametrize("valid_transform", valid_transforms)
     def test_old_device_transform(self, valid_transform):
         """Test a device transform on old device."""