Skip to content

Commit

Permalink
fix: Update code
Browse files Browse the repository at this point in the history
  • Loading branch information
andrijapau committed Jan 23, 2025
1 parent f367e01 commit 1a1e623
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pennylane/workflow/qnode.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ def _convert_to_interface(result, interface: Interface):
def _make_execution_config(
circuit: Optional["QNode"], diff_method=None, mcm_config=None
) -> "qml.devices.ExecutionConfig":
circuit_interface = getattr(circuit, "interface", Interface.NUMPY)
circuit_interface = getattr(circuit, "interface", "numpy")
execute_kwargs = getattr(circuit, "execute_kwargs", {})
gradient_kwargs = getattr(circuit, "gradient_kwargs", {})
grad_on_execution = execute_kwargs.get("grad_on_execution")
if circuit_interface == Interface.JAX:
if circuit_interface == "jax":
grad_on_execution = False
elif grad_on_execution == "best":
grad_on_execution = None
Expand Down Expand Up @@ -288,6 +288,8 @@ class QNode:
gradient_kwargs (dict): A dictionary of keyword arguments that are passed to the differentiation
method. Please refer to the :mod:`qml.gradients <.gradients>` module for details
on supported options for your chosen gradient transform.
autograph (bool): Whether to use AutoGraph to convert Python control flow to native PennyLane
control flow. For more information, refer to :doc:`Autograph </development/autograph>`. Defaults to True.
**Example**
Expand Down Expand Up @@ -505,6 +507,7 @@ def __init__(
postselect_mode: Literal[None, "hw-like", "fill-shots"] = None,
mcm_method: Literal[None, "deferred", "one-shot", "tree-traversal"] = None,
gradient_kwargs: Optional[dict] = None,
autograph: bool = True,
**kwargs,
):
self._init_args = locals()
Expand Down Expand Up @@ -559,6 +562,7 @@ def __init__(
self._qfunc_uses_shots_arg = False

# input arguments
self._autograph = autograph
self.func = func
self.device = device
self._interface = get_canonical_interface_name(interface)
Expand Down

0 comments on commit 1a1e623

Please sign in to comment.