Tutorials
qcr:2606.05034.1

Introduction to Mid-Circuit Measurements in PennyLane

This PennyLane tutorial introduces mid-circuit measurements (MCMs), the capability to measure qubits partway through a circuit and use the outcomes to influence the rest of the computation, a feature central to dynamic circuits, quantum error correction, and many modern protocols. In a conventional circuit all measurements happen at the end, but MCMs let a circuit branch on intermediate results: measuring a qubit, optionally resetting it, and conditioning later operations on what was observed (feedforward). The tutorial shows PennyLane's syntax for mid-circuit measurements, how to apply gates conditioned on a measurement result, how to reuse measured qubits, and the different ways to collect statistics over MCM outcomes (such as sampling, expectation values, and counts) across the various supported measurement-handling methods. It explains how PennyLane simulates these stochastic, branch-dependent circuits and the subtleties of post-selection versus deferred measurement. By establishing the MCM primitives clearly, the tutorial gives the foundation for dynamic circuits, teleportation, and error-correction demos. It is a practical, beginner-friendly entry point to measurement-driven quantum programming in PennyLane.
Qubit
Circuit-based
Uploaded 4 days ago
55
Views
GitHub667
Citing this entry? Use this QCR ID
Uploaded by
QL
QCR Librarian

Overview

PennyLaneAI/demos
667238
README.md

Introduction to Mid-Circuit Measurements in PennyLane

This PennyLane tutorial introduces mid-circuit measurements (MCMs), the capability to measure qubits partway through a circuit and use the outcomes to influence the rest of the computation, a feature central to dynamic circuits, quantum error correction, and many modern protocols. In a conventional circuit all measurements happen at the end, but MCMs let a circuit branch on intermediate results: measuring a qubit, optionally resetting it, and conditioning later operations on what was observed (feedforward). The tutorial shows PennyLane's syntax for mid-circuit measurements, how to apply gates conditioned on a measurement result, how to reuse measured qubits, and the different ways to collect statistics over MCM outcomes (such as sampling, expectation values, and counts) across the various supported measurement-handling methods. It explains how PennyLane simulates these stochastic, branch-dependent circuits and the subtleties of post-selection versus deferred measurement. By establishing the MCM primitives clearly, the tutorial gives the foundation for dynamic circuits, teleportation, and error-correction demos. It is a practical, beginner-friendly entry point to measurement-driven quantum programming in PennyLane.

Run it

pip install -r requirements.txt
python demo.py

Source and license

Imported from demonstrations_v2/tutorial_mcm_introduction/demo.py in PennyLaneAI/demos at c52c0abeb5122218aa96b38eea848864cce7323f, under the Apache License 2.0. Original authors: Xanadu and the PennyLane community. The upstream LICENSE is included alongside this example.

Join the Discussion

Comments (0)

No comments yet. Be the first to share your thoughts!

Indexed by QCR Librarian

This entry was created automatically from publicly available records. QCR links to public sources and only stores repository content where the license permits redistribution.

Versions

v1 Latest
Jun 15, 2026
qcr:2606.05034.1

Cite all versions? Use the base QCR ID to always reference the latest version of this entry.

Tools used

PennyLane

Keywords

mid-circuit-measurement
dynamic-circuits
pennylane
feedforward
getting-started

You may also like5