class_docstr: Tests for the batch VJP function
class_docstr_tok: ["Tests","for","the","batch","VJP","function"]
docstr: Test the 'extend' reduction strategy
docstr_tok: ["Test","the","'extend","'","reduction","strategy"]
code: def test_reduction_extend(self):
      """Test the 'extend' reduction strategy"""
      dev = qml.device("default.qubit", wires=2)
  
      with qml.queuing.AnnotatedQueue() as q1:
          qml.RX(0.4, wires=0)
          qml.CNOT(wires=[0, 1])
          qml.expval(qml.PauliZ(0))
  
      tape1 = qml.tape.QuantumScript.from_queue(q1)
      with qml.queuing.AnnotatedQueue() as q2:
          qml.RX(0.4, wires=0)
          qml.RX(0.6, wires=0)
          qml.CNOT(wires=[0, 1])
          qml.expval(qml.PauliZ(0))
  
      tape2 = qml.tape.QuantumScript.from_queue(q2)
      tape1.trainable_params = {0}
      tape2.trainable_params = {0, 1}
  
      tapes = [tape1, tape2]
      dys = [np.array(1.0), np.array(1.0)]
  
      v_tapes, fn = qml.gradients.batch_vjp(
          tapes, dys, param_shift, reduction="extend"
      )
      res = fn(dev.execute(v_tapes))
  
      # Returned VJPs will be extended into a list. Each element of the returned
      # list will correspond to a single input parameter of the combined
      # tapes.
      assert len(res) == sum(len(t.trainable_params) for t in tapes)
  
imports: from functools import partial
  import pytest
  import pennylane
  from pennylane import numpy
  from pennylane.gradients import param_shift
label_desc: Use image node_id 5 for calling the TestBatchVJP obj's underlying member method code with example usage: obj.test_reduction_extend() without return types