class_docstr: The operations and measurements that represent instructions for
  execution on a quantum device.
  
  Args:
      ops (Iterable[Operator]): An iterable of the operations to be performed
      measurements (Iterable[MeasurementProcess]): All the measurements to be performed
  
  Keyword Args:
      shots (None, int, Sequence[int], ~.Shots): Number and/or batches of shots for execution.
          Note that this property is still experimental and under development.
      trainable_params (None, Sequence[int]): the indices for which parameters are trainable
      _update=True (bool): Whether or not to set various properties on initialization. Setting
          ``_update=False`` reduces computations if the script is only an intermediary step.
  
  .. seealso:: :class:`pennylane.tape.QuantumTape`
  
  **Example:**
  
  .. code-block:: python
  
      from pennylane.tape import QuantumScript
  
      ops = [qml.BasisState(np.array([1,1]), wires=(0,"a")),
             qml.RX(0.432, 0),
             qml.RY(0.543, 0),
             qml.CNOT((0,"a")),
             qml.RX(0.133, "a")]
  
      qscript = QuantumScript(ops, [qml.expval(qml.PauliZ(0))])
  
  >>> list(qscript)
  [BasisState(array([1, 1]), wires=[0, "a"]),
  RX(0.432, wires=[0]),
  RY(0.543, wires=[0]),
  CNOT(wires=[0, 'a']),
  RX(0.133, wires=['a']),
  expval(PauliZ(wires=[0]))]
  >>> qscript.operations
  [BasisState(array([1, 1]), wires=[0, "a"]),
  RX(0.432, wires=[0]),
  RY(0.543, wires=[0]),
  CNOT(wires=[0, 'a']),
  RX(0.133, wires=['a'])]
  >>> qscript.measurements
  [expval(PauliZ(wires=[0]))]
  
  Iterating over the quantum script can be done by:
  
  >>> for op in qscript:
  ...     print(op)
  BasisState(array([1, 1]), wires=[0, "a"])
  RX(0.432, wires=[0])
  RY(0.543, wires=[0])
  CNOT(wires=[0, 'a'])
  RX(0.133, wires=['a'])
  expval(PauliZ(wires=[0]))'
  
  Quantum scripts also support indexing and length determination:
  
  >>> qscript[0]
  BasisState(array([1, 1]), wires=[0, "a"])
  >>> len(qscript)
  6
  
  Once constructed, the script can be executed directly on a quantum device
  using the :func:`~.pennylane.execute` function:
  
  >>> dev = qml.device('default.qubit', wires=(0,'a'))
  >>> qml.execute([qscript], dev, gradient_fn=None)
  [array([-0.77750694])]
  
  Quantum scripts can also store information about the number and batches of
  executions by setting the ``shots`` keyword argument. This information is internally
  stored in a :class:`pennylane.measurements.Shots` object:
  
  >>> s_vec = [1, 1, 2, 2, 2]
  >>> qscript = QuantumScript([qml.Hadamard(0)], [qml.expval(qml.PauliZ(0))], shots=s_vec)
  >>> qscript.shots.shot_vector
  (ShotCopies(1 shots x 2), ShotCopies(2 shots x 3))
  
  ``ops`` and ``measurements`` are converted to lists upon initialization,
  so those arguments accept any iterable object:
  
  >>> qscript = QuantumScript((qml.PauliX(i) for i in range(3)))
  >>> qscript.circuit
  [PauliX(wires=[0]), PauliX(wires=[1]), PauliX(wires=[2])]
class_docstr_tok: ["The","operations","and","measurements","that","represent","instructions","for","execution","on","a","quantum","device",".","Args",":","ops","(","Iterable","[","Operator","]",")",":","An","iterable","of","the","operations","to","be","performed","measurements","(","Iterable","[","MeasurementProcess","]",")",":","All","the","measurements","to","be","performed","Keyword","Args",":","shots","(","None",",","int",",","Sequence","[","int","]",",","~.Shots",")",":","Number","and\/or","batches","of","shots","for","execution",".","Note","that","this","property","is","still","experimental","and","under","development",".","trainable_params","(","None",",","Sequence","[","int","]",")",":","the","indices","for","which","parameters","are","trainable","_update=True","(","bool",")",":","Whether","or","not","to","set","various","properties","on","initialization",".","Setting","``","_update=False","``","reduces","computations","if","the","script","is","only","an","intermediary","step",".","..","seealso",":",":",":","class",":","`","pennylane.tape.QuantumTape","`","*","*","Example",":","*","*","..","code-block",":",":","python","from","pennylane.tape","import","QuantumScript","ops","=","[","qml.BasisState","(","np.array","(","[","1,1","]",")",",","wires=","(","0",",","''","a","''",")",")",",","qml.RX","(","0.432",",","0",")",",","qml.RY","(","0.543",",","0",")",",","qml.CNOT","(","(","0",",","''","a","''",")",")",",","qml.RX","(","0.133",",","``","a","''",")","]","qscript","=","QuantumScript","(","ops",",","[","qml.expval","(","qml.PauliZ","(","0",")",")","]",")",">",">",">","list","(","qscript",")","[","BasisState","(","array","(","[","1",",","1","]",")",",","wires=","[","0",",","``","a","''","]",")",",","RX","(","0.432",",","wires=","[","0","]",")",",","RY","(","0.543",",","wires=","[","0","]",")",",","CNOT","(","wires=","[","0",",","'","a","'","]",")",",","RX","(","0.133",",","wires=","[","'","a","'","]",")",",","expval","(","PauliZ","(","wires=","[","0","]",")",")","]",">",">",">","qscript.operations","[","BasisState","(","array","(","[","1",",","1","]",")",",","wires=","[","0",",","``","a","''","]",")",",","RX","(","0.432",",","wires=","[","0","]",")",",","RY","(","0.543",",","wires=","[","0","]",")",",","CNOT","(","wires=","[","0",",","'","a","'","]",")",",","RX","(","0.133",",","wires=","[","'","a","'","]",")","]",">",">",">","qscript.measurements","[","expval","(","PauliZ","(","wires=","[","0","]",")",")","]","Iterating","over","the","quantum","script","can","be","done","by",":",">",">",">","for","op","in","qscript",":","...","print","(","op",")","BasisState","(","array","(","[","1",",","1","]",")",",","wires=","[","0",",","``","a","''","]",")","RX","(","0.432",",","wires=","[","0","]",")","RY","(","0.543",",","wires=","[","0","]",")","CNOT","(","wires=","[","0",",","'","a","'","]",")","RX","(","0.133",",","wires=","[","'","a","'","]",")","expval","(","PauliZ","(","wires=","[","0","]",")",")","'","Quantum","scripts","also","support","indexing","and","length","determination",":",">",">",">","qscript","[","0","]","BasisState","(","array","(","[","1",",","1","]",")",",","wires=","[","0",",","``","a","''","]",")",">",">",">","len","(","qscript",")","6","Once","constructed",",","the","script","can","be","executed","directly","on","a","quantum","device","using","the",":","func",":","`","~.pennylane.execute","`","function",":",">",">",">","dev","=","qml.device","(","'default.qubit","'",",","wires=","(","0",",","'","a","'",")",")",">",">",">","qml.execute","(","[","qscript","]",",","dev",",","gradient_fn=None",")","[","array","(","[","-0.77750694","]",")","]","Quantum","scripts","can","also","store","information","about","the","number","and","batches","of","executions","by","setting","the","``","shots","``","keyword","argument",".","This","information","is","internally","stored","in","a",":","class",":","`","pennylane.measurements.Shots","`","object",":",">",">",">","s_vec","=","[","1",",","1",",","2",",","2",",","2","]",">",">",">","qscript","=","QuantumScript","(","[","qml.Hadamard","(","0",")","]",",","[","qml.expval","(","qml.PauliZ","(","0",")",")","]",",","shots=s_vec",")",">",">",">","qscript.shots.shot_vector","(","ShotCopies","(","1","shots","x","2",")",",","ShotCopies","(","2","shots","x","3",")",")","``","ops","``","and","``","measurements","``","are","converted","to","lists","upon","initialization",",","so","those","arguments","accept","any","iterable","object",":",">",">",">","qscript","=","QuantumScript","(","(","qml.PauliX","(","i",")","for","i","in","range","(","3",")",")",")",">",">",">","qscript.circuit","[","PauliX","(","wires=","[","0","]",")",",","PauliX","(","wires=","[","1","]",")",",","PauliX","(","wires=","[","2","]",")","]"]
code: def __init__(
      self,
      ops=None,
      measurements=None,
      shots: Optional[Union[int, Sequence, Shots]] = None,
      trainable_params: Optional[Sequence[int]] = None,
      _update=True,
  ):
      self._ops = [] if ops is None else list(ops)
      self._measurements = (
          [] if measurements is None else list(measurements)
      )
      self._shots = Shots(shots)
  
      self._par_info = []
      """list[dict[str, Operator or int]]: Parameter information.
          Values are dictionaries containing the corresponding operation and operation parameter index."""
  
      self._trainable_params = trainable_params
      self._graph = None
      self._specs = None
      self._output_dim = None
      self._batch_size = _UNSET_BATCH_SIZE
  
      self.wires = _empty_wires
      self.num_wires = 0
  
      self._obs_sharing_wires = []
      """list[.Observable]: subset of the observables that share wires with another observable,
          i.e., that do not have their own unique set of wires."""
      self._obs_sharing_wires_id = []
  
      if _update:
          self._update()
  
imports: import contextlib
  import copy
  from collections import Counter
  from typing import List, Union, Optional, Sequence
  from warnings import warn
  import pennylane
  from pennylane.measurements import ClassicalShadowMP, CountsMP, MeasurementProcess, ProbabilityMP, SampleMP, ShadowExpvalMP, StateMP, Shots
  from pennylane.typing import TensorLike
  from pennylane.operation import Observable, Operator, Operation, _UNSET_BATCH_SIZE
  from pennylane.pytrees import register_pytree
  from pennylane.queuing import AnnotatedQueue, process_queue
  from pennylane.wires import Wires
label_desc: Use image node_id 3 to create a new QuantumScript object  with example: obj = QuantumScript(ops, measurements, shots, trainable_params, _update)