class_docstr: Provides methods for calculating the JVP/VJP between the Jacobians of tapes and tangents/cotangents.
class_docstr_tok: ["Provides","methods","for","calculating","the","JVP\/VJP","between","the","Jacobians","of","tapes","and","tangents\/cotangents","."]
docstr: Calculate both the results for a batch of tapes and the jvp.
  
  This method is required to compute JVPs in the JAX interface.
  
  Args:
      tapes (tuple[.QuantumScript]): The batch of tapes to take the derivatives of
      tangents (Sequence[Sequence[TensorLike]]): the tangents for the parameters of the tape.
          The ``i`` th tangent corresponds to the ``i`` th tape, and the ``j`` th entry into a
          tangent entry corresponds to the ``j`` th trainable parameter of the tape.
  
  Returns:
      ResultBatch, TensorLike: the results of the execution and the jacobian vector product
  
  **Examples:**
  
  For an instance of :class:`~.JacobianProductCalculator` ``jpc``, we have:
  
  >>> tape0 = qml.tape.QuantumScript([qml.RX(0.1, wires=0)], [qml.expval(qml.PauliZ(0))])
  >>> tape1 = qml.tape.QuantumScript([qml.RY(0.2, wires=0)], [qml.expval(qml.PauliZ(0))])
  >>> batch = (tape0, tape1)
  >>> tangents0 = (1.5, )
  >>> tangents1 = (2.0, )
  >>> tangents = (tangents0, tangents1)
  >>> results, jvps = jpc.execute_and_compute_jvp(batch, tangents)
  >>> expected_results = (np.cos(0.1), np.cos(0.2))
  >>> qml.math.allclose(results, expected_results)
  True
  >>> jvps
  (array(-0.14975012), array(-0.39733866))
  >>> expected_jvps = 1.5 * -np.sin(0.1), 2.0 * -np.sin(0.2)
  >>> qml.math.allclose(jvps, expected_jvps)
  True
  
  While this method could support non-scalar parameters in theory, no implementation currently supports
  jacobians with non-scalar parameters.
docstr_tok: ["Calculate","both","the","results","for","a","batch","of","tapes","and","the","jvp",".","This","method","is","required","to","compute","JVPs","in","the","JAX","interface",".","Args",":","tapes","(","tuple","[",".QuantumScript","]",")",":","The","batch","of","tapes","to","take","the","derivatives","of","tangents","(","Sequence","[","Sequence","[","TensorLike","]","]",")",":","the","tangents","for","the","parameters","of","the","tape",".","The","``","i","``","th","tangent","corresponds","to","the","``","i","``","th","tape",",","and","the","``","j","``","th","entry","into","a","tangent","entry","corresponds","to","the","``","j","``","th","trainable","parameter","of","the","tape",".","Returns",":","ResultBatch",",","TensorLike",":","the","results","of","the","execution","and","the","jacobian","vector","product","*","*","Examples",":","*","*","For","an","instance","of",":","class",":","`","~.JacobianProductCalculator","`","``","jpc","``",",","we","have",":",">",">",">","tape0","=","qml.tape.QuantumScript","(","[","qml.RX","(","0.1",",","wires=0",")","]",",","[","qml.expval","(","qml.PauliZ","(","0",")",")","]",")",">",">",">","tape1","=","qml.tape.QuantumScript","(","[","qml.RY","(","0.2",",","wires=0",")","]",",","[","qml.expval","(","qml.PauliZ","(","0",")",")","]",")",">",">",">","batch","=","(","tape0",",","tape1",")",">",">",">","tangents0","=","(","1.5",",",")",">",">",">","tangents1","=","(","2.0",",",")",">",">",">","tangents","=","(","tangents0",",","tangents1",")",">",">",">","results",",","jvps","=","jpc.execute_and_compute_jvp","(","batch",",","tangents",")",">",">",">","expected_results","=","(","np.cos","(","0.1",")",",","np.cos","(","0.2",")",")",">",">",">","qml.math.allclose","(","results",",","expected_results",")","True",">",">",">","jvps","(","array","(","-0.14975012",")",",","array","(","-0.39733866",")",")",">",">",">","expected_jvps","=","1.5","*","-np.sin","(","0.1",")",",","2.0","*","-np.sin","(","0.2",")",">",">",">","qml.math.allclose","(","jvps",",","expected_jvps",")","True","While","this","method","could","support","non-scalar","parameters","in","theory",",","no","implementation","currently","supports","jacobians","with","non-scalar","parameters","."]
code: def execute_and_compute_jvp(
      self, tapes: Batch, tangents: Tuple[Tuple[TensorLike]]
  ) -> Tuple[ResultBatch, Tuple]:
      """Calculate both the results for a batch of tapes and the jvp.
  
      This method is required to compute JVPs in the JAX interface.
  
      Args:
          tapes (tuple[.QuantumScript]): The batch of tapes to take the derivatives of
          tangents (Sequence[Sequence[TensorLike]]): the tangents for the parameters of the tape.
              The ``i`` th tangent corresponds to the ``i`` th tape, and the ``j`` th entry into a
              tangent entry corresponds to the ``j`` th trainable parameter of the tape.
  
      Returns:
          ResultBatch, TensorLike: the results of the execution and the jacobian vector product
  
      **Examples:**
  
      For an instance of :class:`~.JacobianProductCalculator` ``jpc``, we have:
  
      >>> tape0 = qml.tape.QuantumScript([qml.RX(0.1, wires=0)], [qml.expval(qml.PauliZ(0))])
      >>> tape1 = qml.tape.QuantumScript([qml.RY(0.2, wires=0)], [qml.expval(qml.PauliZ(0))])
      >>> batch = (tape0, tape1)
      >>> tangents0 = (1.5, )
      >>> tangents1 = (2.0, )
      >>> tangents = (tangents0, tangents1)
      >>> results, jvps = jpc.execute_and_compute_jvp(batch, tangents)
      >>> expected_results = (np.cos(0.1), np.cos(0.2))
      >>> qml.math.allclose(results, expected_results)
      True
      >>> jvps
      (array(-0.14975012), array(-0.39733866))
      >>> expected_jvps = 1.5 * -np.sin(0.1), 2.0 * -np.sin(0.2)
      >>> qml.math.allclose(jvps, expected_jvps)
      True
  
      While this method could support non-scalar parameters in theory, no implementation currently supports
      jacobians with non-scalar parameters.
  
      """
  
imports: import abc
  from functools import partial
  import inspect
  import logging
  from typing import Tuple, Callable, Optional, Union
  from cachetools import LRUCache
  import numpy
  import pennylane
  from pennylane.tape import QuantumScript
  from pennylane.typing import ResultBatch, TensorLike
label_desc: Use image node_id 1 for calling the JacobianProductCalculator obj's underlying member method code with example usage: obj.execute_and_compute_jvp(tapes, tangents) without return types