qml.tape.get_active_tape

get_active_tape()[source]

Returns the currently recording tape. If no tape is currently recording, None is returned.

Example

>>> with qml.tape.QuantumTape():
...     qml.RX(0.2, wires="a")
...     tape = qml.tape.get_active_tape()
...     qml.RY(0.1, wires="b")
>>> print(tape)
<QuantumTape: wires=['a', 'b'], params=2>
>>> print(qml.tape.get_active_tape())
None