cirq.merge_moments_batch

Merges as many adjacent moments as possible at once using merge_func(moments_list).

Starting from the first moment, the largest run of mergeable moments is found and then merged at once. The process is repeated starting from the next moment, until the circuit is exhausted. merge_func is not called on single-moment runs.

circuit Input circuit to apply the transformations on. The input circuit is not mutated.
merge_func Callable that takes a sequence of moments and returns both the first moment merged with as many consecutive moments as possible, and a sequence of the remaining unmerged moments.
tags_to_ignore Tagged circuit operations marked with any of tags_to_ignore will be ignored when recursively applying the transformer primitive to sub-circuits, given deep=True.
deep If true, the transformer primitive will be recursively applied to all circuits wrapped inside circuit operations.

Copy of input circuit with merged moments.