class_docstr: Abstract base class for PennyLane qubit devices.
  
  The following abstract method **must** be defined:
  
  * :meth:`~.apply`: append circuit operations, compile the circuit (if applicable),
    and perform the quantum computation.
  
  Devices that generate their own samples (such as hardware) may optionally
  overwrite :meth:`~.probability`. This method otherwise automatically
  computes the probabilities from the generated samples, and **must**
  overwrite the following method:
  
  * :meth:`~.generate_samples`: Generate samples from the device from the
    exact or approximate probability distribution.
  
  Analytic devices **must** overwrite the following method:
  
  * :meth:`~.analytic_probability`: returns the probability or marginal probability from the
    device after circuit execution. :meth:`~.marginal_prob` may be used here.
  
  This device contains common utility methods for qubit-based devices. These
  do not need to be overwritten. Utility methods include:
  
  * :meth:`~.expval`, :meth:`~.var`, :meth:`~.sample`: return expectation values,
    variances, and samples of observables after the circuit has been rotated
    into the observable eigenbasis.
  
  Args:
      wires (int, Iterable[Number, str]]): Number of subsystems represented by the device,
          or iterable that contains unique labels for the subsystems as numbers (i.e., ``[-1, 0, 2]``)
          or strings (``['ancilla', 'q1', 'q2']``). Default 1 if not specified.
      shots (None, int, list[int]): Number of circuit evaluations/random samples used to estimate
          expectation values of observables. If ``None``, the device calculates probability, expectation values,
          and variances analytically. If an integer, it specifies the number of samples to estimate these quantities.
          If a list of integers is passed, the circuit evaluations are batched over the list of shots.
      r_dtype: Real floating point precision type.
      c_dtype: Complex floating point precision type.
docstr: Process measurement results from circuit execution using a device
  with a shot vector and return statistics.
  
  This is an auxiliary method of execute and uses statistics.
  
  When using shot vectors, measurement results for each item of the shot
  vector are contained in a tuple.
  
  Args:
      circuit (~.tape.QuantumTape): circuit to execute on the device
  
  Raises:
      QuantumFunctionError: if the value of :attr:`~.Observable.return_type` is not supported
  
  Returns:
      tuple: stastics for each shot item from the shot vector
docstr_tok: ["Process","measurement","results","from","circuit","execution","using","a","device","with","a","shot","vector","and","return","statistics",".","This","is","an","auxiliary","method","of","execute","and","uses","statistics",".","When","using","shot","vectors",",","measurement","results","for","each","item","of","the","shot","vector","are","contained","in","a","tuple",".","Args",":","circuit","(","~.tape.QuantumTape",")",":","circuit","to","execute","on","the","device","Raises",":","QuantumFunctionError",":","if","the","value","of",":","attr",":","`","~.Observable.return_type","`","is","not","supported","Returns",":","tuple",":","stastics","for","each","shot","item","from","the","shot","vector"]
code: def shot_vec_statistics(self, circuit: QuantumTape):
      """Process measurement results from circuit execution using a device
      with a shot vector and return statistics.
  
      This is an auxiliary method of execute and uses statistics.
  
      When using shot vectors, measurement results for each item of the shot
      vector are contained in a tuple.
  
      Args:
          circuit (~.tape.QuantumTape): circuit to execute on the device
  
      Raises:
          QuantumFunctionError: if the value of :attr:`~.Observable.return_type` is not supported
  
      Returns:
          tuple: stastics for each shot item from the shot vector
      """
      results = []
      s1 = 0
  
      measurements = circuit.measurements
      counts_exist = any(isinstance(m, CountsMP) for m in measurements)
      single_measurement = len(measurements) == 1
  
      for shot_tuple in self._shot_vector:
          s2 = s1 + np.prod(shot_tuple)
          r = self.statistics(
              circuit, shot_range=[s1, s2], bin_size=shot_tuple.shots
          )
  
          # This will likely be required:
          # if qml.math.get_interface(*r) == "jax":  # pylint: disable=protected-access
          #     r = r[0]
  
          if single_measurement:
              r = r[0]
          elif shot_tuple.copies == 1:
              r = tuple(
                  r_[0] if isinstance(r_, list) else r_.T for r_ in r
              )
          elif counts_exist:
              r = self._multi_meas_with_counts_shot_vec(
                  circuit, shot_tuple, r
              )
          else:
              # r is a nested sequence, contains the results for
              # multiple measurements
              #
              # Each item of r has copies length, we need to extract
              # each measurement result from the arrays
  
              # 1. transpose: applied because measurements like probs
              # for multiple copies output results with shape (N,
              # copies) and we'd like to index straight to get rows
              # which requires a shape of (copies, N)
              # 2. asarray: done because indexing into a flat array produces a
              # scalar instead of a scalar shaped array
              r = [
                  tuple(self._asarray(r_.T[idx]) for r_ in r)
                  for idx in range(shot_tuple.copies)
              ]
  
          if isinstance(r, qml.numpy.ndarray):
              if shot_tuple.copies > 1:
                  results.extend(
                      [
                          self._asarray(r_)
                          for r_ in qml.math.unstack(r.T)
                      ]
                  )
              else:
                  results.append(r.T)
  
          elif single_measurement and counts_exist:
              # Results are nested in a sequence
              results.extend(r)
          elif not single_measurement and shot_tuple.copies > 1:
              # Some samples may still be transposed, fix their shapes
              # Leave dictionaries intact
              r = [
                  tuple(
                      elem if isinstance(elem, dict) else elem.T
                      for elem in r_
                  )
                  for r_ in r
              ]
  
              results.extend(r)
          else:
              results.append(r)
  
          s1 = s2
  
      return tuple(results)
  
imports: import abc
  import itertools
  import warnings
  from collections import defaultdict
  from typing import Union, List
  import inspect
  import logging
  import numpy
  import pennylane
  from pennylane import Device, DeviceError
  from pennylane.workflow import set_shots
  from pennylane.math import multiply
  from pennylane.math import sum
  from pennylane.measurements import ClassicalShadowMP, CountsMP, ExpectationMP, MeasurementProcess, MeasurementTransform, MeasurementValue, MutualInfoMP, ProbabilityMP, SampleMeasurement, SampleMP, ShadowExpvalMP, StateMeasurement, StateMP, VarianceMP, VnEntropyMP, Shots
  from pennylane.resource import Resources
  from pennylane.operation import operation_derivative, Operation
  from pennylane.tape import QuantumTape
  from pennylane.wires import Wires
label_desc: Use image node_id 7 for calling the QubitDevice obj's underlying member method code with example usage: obj.shot_vec_statistics(circuit) and returns: tuple