View source on GitHub |
Performs an in-order iteration of the operations (leaves) in an OP_TREE.
cirq.flatten_op_tree(
root: cirq.OP_TREE
,
preserve_moments: bool = False
) -> Iterator[Union[Operation, 'cirq.Moment']]
Args | |
---|---|
root
|
The operation or tree of operations to iterate. |
preserve_moments
|
Whether to yield Moments intact instead of flattening them |
Yields | |
---|---|
Operations from the tree. |
Raises | |
---|---|
TypeError
|
root isn't a valid OP_TREE. |