Skip to content

Commit

Permalink
Merge branch 'autograd-use-jpc' of https://github.com/PennyLaneAI/pen…
Browse files Browse the repository at this point in the history
…nylane into autograd-use-jpc
  • Loading branch information
albi3ro committed Oct 17, 2023
2 parents 2ac753b + f565bc3 commit 8d4fc52
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 3 additions & 2 deletions pennylane/devices/execution_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ class ExecutionConfig:
use_device_jacobian_product: Optional[bool] = None
"""Whether or not to use the device provided vjp or jvp to compute gradients.
``None`` indicates to use the device if possible, but to fall back to device jacobian or pennylane behavior if it isn't.
``None`` indicates to use the device if possible, but to fall back to the device Jacobian
or PennyLane behavior if it isn't.
True indicates a request to either use the device jacobian products fail.
``True`` indicates to either use the device Jacobian products or fail.
"""

gradient_method: Optional[str] = None
Expand Down
12 changes: 9 additions & 3 deletions pennylane/interfaces/autograd.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ def autograd_execute(
Args:
tapes (Sequence[.QuantumTape]): batch of tapes to execute
execute_fn (Callable[[Sequence[.QuantumTape]], ResultBatch]): a function that turns a batch of circuits into results
jpc (JacobianProductCalculator): a class that can compute the vector jacobian product for the input tapes.
jpc (JacobianProductCalculator): a class that can compute the vector Jacobian product (VJP)
for the input tapes.
Returns:
TensorLike: A nested tuple of tape results. Each element in
Expand Down Expand Up @@ -117,7 +119,9 @@ def _execute(
This argument should be generated from the provided list of tapes.
tapes (Sequence[.QuantumTape]): batch of tapes to execute
execute_fn (Callable[[Sequence[.QuantumTape]], ResultBatch]): a function that turns a batch of circuits into results
jpc (JacobianProductCalculator): a class that can compute the vector jacobian product for the input tapes.
jpc (JacobianProductCalculator): a class that can compute the vector Jacobian product (VJP)
for the input tapes.
"""
return execute_fn(tapes)

Expand All @@ -138,7 +142,9 @@ def vjp(
This argument should be generated from the provided list of tapes.
tapes (Sequence[.QuantumTape]): batch of tapes to execute
execute_fn (Callable[[Sequence[.QuantumTape]], ResultBatch]): a function that turns a batch of circuits into results
jpc (JacobianProductCalculator): a class that can compute the vector jacobian product for the input tapes.
jpc (JacobianProductCalculator): a class that can compute the vector Jacobian product (VJP)
for the input tapes.
Returns:
function: this function accepts the backpropagation
Expand Down

0 comments on commit 8d4fc52

Please sign in to comment.