docstr: Test that a ParametrizedEvolution is applied correctly to a batched state.
  Note that the branching logic is different for batched input states, because
  evolving the state vector does not support batching of the state. Instead,
  the evolved matrix is used always.
docstr_tok: ["Test","that","a","ParametrizedEvolution","is","applied","correctly","to","a","batched","state",".","Note","that","the","branching","logic","is","different","for","batched","input","states",",","because","evolving","the","state","vector","does","not","support","batching","of","the","state",".","Instead",",","the","evolved","matrix","is","used","always","."]
code: def test_with_batched_state(self, num_state_wires, mocker):
      """Test that a ParametrizedEvolution is applied correctly to a batched state.
      Note that the branching logic is different for batched input states, because
      evolving the state vector does not support batching of the state. Instead,
      the evolved matrix is used always."""
      spy_einsum = mocker.spy(qml.math, "einsum")
      H = time_independent_hamiltonian()
      params = np.array([1.0, 2.0])
      t = 0.1
  
      op = qml.pulse.ParametrizedEvolution(H=H, params=params, t=t)
  
      initial_state = np.array(
          [
              [
                  [0.81677345 + 0.0j, 0.0 + 0.0j],
                  [0.0 - 0.57695852j, 0.0 + 0.0j],
              ],
              [
                  [0.33894597 + 0.0j, 0.0 + 0.0j],
                  [0.0 - 0.94080584j, 0.0 + 0.0j],
              ],
              [
                  [0.33894597 + 0.0j, 0.0 + 0.0j],
                  [0.0 - 0.94080584j, 0.0 + 0.0j],
              ],
          ]
      )
      if num_state_wires == 4:
          zero_state_two_wires = np.eye(4)[0].reshape((2, 2))
          initial_state = np.tensordot(
              initial_state, zero_state_two_wires, axes=0
          )
  
      true_mat = qml.math.expm(-1j * qml.matrix(H(params, t=t)) * t)
      U = qml.QubitUnitary(U=true_mat, wires=[0, 1])
  
      new_state = apply_operation(
          op, initial_state, is_state_batched=True
      )
      new_state_expected = apply_operation(
          U, initial_state, is_state_batched=True
      )
      assert np.allclose(new_state, new_state_expected, atol=0.002)
  
      if num_state_wires == 4:
          assert spy_einsum.call_count == 2
      else:
          assert spy_einsum.call_count == 1
  
imports: from functools import reduce
  import pytest
  import numpy
  from scipy.stats import unitary_group
  import pennylane
  from pennylane.operation import _UNSET_BATCH_SIZE, Operation
  from pennylane.devices.qubit.apply_operation import apply_operation, apply_operation_einsum, apply_operation_tensordot
label_desc: Use image node_id 7 for calling the TestApplyParametrizedEvolution obj's underlying member method code with example usage: obj.test_with_batched_state(num_state_wires, mocker) without return types