class_docstr: A template and quantum function inspector,
  allowing easy introspection of operators that have been
  applied without requiring a QNode.
  
  **Example**:
  
  The OperationRecorder is a context manager. Executing templates
  or quantum functions stores applied operators in the
  recorder, which can then be printed.
  
  >>> shape = qml.templates.StronglyEntanglingLayers.shape(n_layers=1, n_wires=2)
  >>> weights = np.random.random(shape)
  >>>
  >>> with OperationRecorder() as rec:
  >>>    qml.templates.StronglyEntanglingLayers(weights, wires=[0, 1])
  
  
  Alternatively, the :attr:`~.OperationRecorder.queue` attribute can be used
  to directly access the applied :class:`~.Operation` and :class:`~.Observable`
  objects.
class_docstr_tok: ["A","template","and","quantum","function","inspector",",","allowing","easy","introspection","of","operators","that","have","been","applied","without","requiring","a","QNode",".","*","*","Example","*","*",":","The","OperationRecorder","is","a","context","manager",".","Executing","templates","or","quantum","functions","stores","applied","operators","in","the","recorder",",","which","can","then","be","printed",".",">",">",">","shape","=","qml.templates.StronglyEntanglingLayers.shape","(","n_layers=1",",","n_wires=2",")",">",">",">","weights","=","np.random.random","(","shape",")",">",">",">",">",">",">","with","OperationRecorder","(",")","as","rec",":",">",">",">","qml.templates.StronglyEntanglingLayers","(","weights",",","wires=","[","0",",","1","]",")","Alternatively",",","the",":","attr",":","`","~.OperationRecorder.queue","`","attribute","can","be","used","to","directly","access","the","applied",":","class",":","`","~.Operation","`","and",":","class",":","`","~.Observable","`","objects","."]
code: def __str__(self):
      return "\n".join(
          [
              "Operations",
              "==========",
              *[repr(op) for op in self.ops],
              "",
              "Observables",
              "===========",
              *[repr(op) for op in self.obs],
              "",
          ]
      )
  
file_path: pennylane/pennylane/tape/operation_recorder.py
imports: from pennylane.queuing import AnnotatedQueue, QueuingManager, process_queue
  from .tape import QuantumScript
label_desc: Use image node_id 4 for calling the OperationRecorder obj's underlying member method code with example usage: obj.__str__() and returns: str